### Unformatted Attachment Preview

Individual Report 2
Guidelines:
•
•
•
•
This is an individual report (one submission per student).
Use 12 pt Times New Roman, double-spaced.
Recommended length: 3-6 pages.
When completing the peer reviews, use the rubric below to assign a score to each of the five (5) subsection categories in the first
column of the rubric. Sum the scores for each subsection to determine the total score for this assignment out of 5 points. For example,
if you rate each subsection Proficient (0.75 pts per subsection), then the total score is 0.75 x 5 = 3.75 out of 5 possible points.
Rubric:
Subsection
1. Description of
Physical System
and
Experimental
Methods
2. Mathematical
Model
3. Simulation
Method
Exemplary (1)
Student’s descriptions of the
testing system and
experimental methods are
concise yet thorough. The
description of methods is
detailed enough that one
could replicate it, yet at the
same time is not excessively
wordy. Any photos or figures
include captions.
All equations describing the
system dynamics are
reported accurately and all
variables are defined.
Description of the simulation
method reflects
understanding of the physical
meaning of the dH/dt ODE as
well as the rationale behind
using numerical solution
methods (“ode solvers”).
Proficient (0.75)
Student’s descriptions of the
testing system and
experimental methods are
adequate; minor steps may
be missing, but overall the
documentation of methods is
adequate. Any photos or
figures include captions.
Apprentice (0.5)
Student’s descriptions of the
testing system and
experimental methods lack
sufficient detail.
Documentation of how data
were collected is incomplete
or sloppy. Any photos or
figures do not always include
captions.
Novice (0.25)
Student’s descriptions of the
testing system and
experimental methods are
missing or barely mentioned.
Any photos or figures do not
include captions.
Most equations describing
the system dynamics are
reported correctly and all
variables are defined.
Description of the simulation
method reflects
understanding of the physical
meaning of the dH/dt ODE.
Some equations describing
the system dynamics are
reported and most of the
variables are defined.
Description of the simulation
method indicates the
simulation code has been
written correctly, but does
not reflect much
understanding of the physical
meaning of the dH/dt ODE.
Incomplete reporting of the
equations and variables used
to describe system dynamics.
Description of the simulation
method indicates the
simulation code has not been
written correctly or provides
too few details.
1
4. Calibration
Method
5. Validation
Method
Exemplary (1)
Description of the calibration
method reflects
understanding of how model
calibration achieves a better
fit between simulation and
observed measurements.
The methods used to analyze
the experimental data and
calculate the model error are
described clearly and
concisely.
Description of the validation
method reflects
understanding of how the
application of the calibrated
model to another testing
system allows an evaluation
of model performance.
Provides a clear and concise
explanation of how the
calibrated model was used to
produce a simulation for a
new testing system, and how
this was compared to
measurements from the
second testing system (error
analysis).
Proficient (0.75)
Description of the calibration
method reflects
understanding of how model
calibration achieves a better
fit between simulation and
observed measurements.
The methods used to analyze
the experimental data and
calculate the model error are
described, but not always
clearly and concisely.
Description of validation
method includes all
information necessary to
understand how the results
were produced but is not
always clear or concise.
Apprentice (0.5)
Description of the calibration
method indicates that the
model was calibrated
correctly, but does not reflect
much understanding of how
the calibration algorithm
works. The methods used to
analyze the experimental
data and calculate the model
error are described, but
some steps are missing.
Description of validation
method is missing some key
points about how the
calibrated model was applied
to a new testing system and
how model error was
determined.
Novice (0.25)
Description of the calibration
method indicates the
optimization code has not
been written correctly or
provides too few details. The
methods used to analyze the
experimental data and
calculate the model error are
not described or are not
covered in enough detail.
Description of validation
method provides too little
explanation of the way that
the calibrated model was
applied to a new testing
system.
2
Trial_No
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
H_cm
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
18
17
16
15
14
13
12
11
10
9
Time_s
10.2
15.9
21.3
27
32.7
38.3
43.7
51.1
56.9
60.5
72.3
79.3
88.4
97.5
106.8
118.9
131.6
150
10.4
15.8
21.4
27.3
32.6
38.9
44.8
51.3
57.7
64.8
72.2
80.3
87.2
97.6
107.6
118.1
131.8
150
12.2
17.4
23.5
28.8
34.4
40.9
47.8
54.1
60.1
67.6
Delta_t_s
0
5.7
5.4
5.7
5.7
5.6
5.4
7.4
5.8
3.6
11.8
7
9.1
9.1
9.3
12.1
12.7
18.4
0
5.4
5.6
5.9
5.3
6.3
5.9
6.5
6.4
7.1
7.4
8.1
6.9
10.4
10
10.5
13.7
18.2
0
5.2
6.1
5.3
5.6
6.5
6.9
6.3
6
7.5
Time_since_start_s
0
5.7
11.1
16.8
22.5
28.1
33.5
40.9
46.7
50.3
62.1
69.1
78.2
87.3
96.6
108.7
121.4
139.8
0
5.4
11
16.9
22.2
28.5
34.4
40.9
47.3
54.4
61.8
69.9
76.8
87.2
97.2
107.7
121.4
139.6
0
5.2
11.3
16.6
22.2
28.7
35.6
41.9
47.9
55.4
3
3
3
3
3
3
3
3
8
7
6
5
4
3
2
1
74.3
82.6
90.9
100.4
109.8
121.3
136.8
153.3
6.7
8.3
8.3
9.5
9.4
11.5
15.5
16.5
62.1
70.4
78.7
88.2
97.6
109.1
124.6
141.1
Area_Water_Surface_cm2
90.47786842
90.16370916
89.84954989
89.53539063
89.22123136
88.9070721
88.59291283
88.27875357
87.9645943
87.65043504
87.33627577
87.0221165
86.70795724
86.39379797
86.07963871
85.76547944
85.45132018
85.13716091
90.47786842
90.16370916
89.84954989
89.53539063
89.22123136
88.9070721
88.59291283
88.27875357
87.9645943
87.65043504
87.33627577
87.0221165
86.70795724
86.39379797
86.07963871
85.76547944
85.45132018
85.13716091
90.47786842
90.16370916
89.84954989
89.53539063
89.22123136
88.9070721
88.59291283
88.27875357
87.9645943
87.65043504
87.33627577
87.0221165
86.70795724
86.39379797
86.07963871
85.76547944
85.45132018
85.13716091
Water System Modeling Project: Merging Theory and Data
ENGRCEE 170 - Introduction to Fluid Mechanics
October 25, 2021
1
Introduction
1.1
Project Rationale
There is a major trend in civil and environmental engineering involving a transition from theory-driven
analysis and design to data-driven analysis and design. For engineering students to be prepared for
successful careers over the next 4-5 decades, an ability to synthesize theory and data using models
(including custom-made models) will be paramount. This project gives students an introduction to
this process. It covers a set of essential topics:
1. Collection of data using physical systems useful for developing and testing theories and analysis
of measurement error.
2. Formulation of mathematical models based on engineering mechanics fundamentals.
3. Development of software that uses numerical methods to solve the mathematical equations and
arrive at quantitative solutions.
4. Development of software that synthesizes theory and measurements and yields information about
the uncertainty in quantitative solutions.
5. Making a prediction from a model that is grounded in both theory and data.
1.2
Pre-Requisites
Students should have the ability to use programming tools (e.g., Matlab, Python, C, Fortran) for this
project, and should also be familiar with solving ordinary differential equations. The pre-requisites of
this course are designed to check for these qualifications. If you haven’t previously taken a programming
course but are enrolled in one now, I am willing to sign a pre-requisite waiver.
1.3
Project Overview
The project will be completed over the first eight weeks of the quarter, with the aim of leaving the
final two weeks to focus on preparation for the final exam. Class projects invariably push students to
work very hard and invest large amounts of time, which is good, but not when it takes away from time
that students can and should be using to solve lots of problems and understand all important concepts
in a course.
This project will involve the collection of data using a very simple water tank system, the synthesis
of theory and data through modeling (and programming), and the testing of theory through making
a prediction. Importantly, the project will provide students a hands-on introduction to modeling and
simulation, which is relied upon extensively today by engineers for analysis and design purposes.
1
The main stages of the project are as follows:
1. Experiments yielding water level and discharge data.
2. Writing a code that simulates system dynamics.
3. Writing a code that calibrates parameters to synthesize theory and data.
4. Making a prediction, testing it against measurements, and analyzing errors and uncertainties.
5. Report preparation.
Each step of the project is described in detail in Section 3.
2
Theory
2.1
Mathematical Modeling
The integral statement of mass conservation is given by
Z
Z
∂
ρ d−
V +
ρ u · n dA = 0
∂t CV
CS
(1)
and if we define S to be the volume of water stored in the tank, Q to be the volumetric flow rate of
water leaving the tank, and ρ to be a constant, then Eq. 1 can be re-written as follows,
dS
+Q=0
dt
(2)
Furthermore, if the tank has a cross sectional area, AT (z), where z is the vertical coordinate relative
to a fixed datum, and we assume that the water height above a fixed datum is given by H, then Eq. 2
can be written as follows,
AT (H)
dH
+Q=0
dt
(3)
Application of Torricelli’s law leads to an analytical expression for the velocity of water leaving a hole
in the side of the tank located at a height zo above the fixed datum. This function appears as a
function of the height of the water H as follows,
p
V (H) = 2g(H − zo )
(4)
and we note that Torricelli’s Law is simply an application of Bernoulli’s equation between the surface
of the tank and the outlet hole of the tank. The volumetric flow rate Q is related to the V through
the area of the hole, Ao , and a discharge coefficient cD , as follows,
Q = cD Ao V
(5)
The discharge coefficient is unity for an ideal fluid, but working with real fluids introduces viscous
effects that lead to non-uniformity in the distribution of velocity out of the hole as well as friction
losses. Hence, the discharge coefficient accounts for differences between ideal flow theory and real fluid
behavior. Moreover, we generally expect that the discharge coefficient will be close to unity, and most
2
likely between a value of zero and unity. Now, by combining Eqs. 3, 4, and 5, and rearranging, we
arrive at a mathematical model of the water level change in the tank over time,
p
dH
Ao
= −cD
2g(H − zo )
(6)
dt
AT (H)
with the initial condition H = H0 at t = t0 .
Note that the mathematical model given by Eq. 6 and its initial condition represents an ordinary
differential equation (ode), where t represents the independent variable and H is the dependent variable.
Further, the parameters of the equation are cD , g, zo , Ao and there is one parametric function, AT (H).
This ode can be solved analytically in some cases, such as when AT is a constant, cD is constant, and
zo = 0. On the other hand, numerical solutions are almost always possible irrespective of the values
and/or functional dependence of parameters.
2.2
Numerical Solution Methods
There are a class of methods for integrating ode’s that are described as ode solvers. These methods
assume that any system of ordinary differential equations (i.e., a set of n equations describing the
time-wise change of n different dependent variables) can be written as follows,
dy
= f(t, y; p)
dt
(7)
where y is a vector of dependent variables of dimension n, f a vector-valued function of dimension n
describing the time rate of change in y, and p is a vector of parameters of dimension m needed to
express f in based on values of t and y. Moreover, this system requires an initial condition given by
y = y0 at t = t0 . When we apply this general formulation of ode’s to our specific problem, we see that
Eq. 6 involves one dependent variable (n=1) and at minimum five parameters (m=5): g, Ao , AT , zo
and cD .
Computers integrate ode’s by repeating a very simple cycle over and over: estimating y a short distance
into the future, time t + ∆t, based on the value of solution at time t and the value of dy/dt at time t.
Mathematically, this can be written as follows,
y(t + ∆t) = y(t) +
dy(t)
∆t
dt
(8)
which corresponds to an algorithm named Euler’s Method. Now it is helpful to switch notation into
something that is more compact and easier to write. Instead of writing out y(t), we’ll just use a
subscript i to refer to time t, and i + 1 to time t + ∆t. Hence, Eq. 8 becomes
yi+1 = yi +
dy
dt
∆t
(9)
yi+1 = yi + f(ti , yi ; p) ∆t
(10)
i
Moreover, if we combine Eqs. and we can write
and we can now create a simple Matlab algorithm that repeats this calculation over and over again to
solve a very simple ode: dy/dt = −e−at from t=0 to 10 s for a=0.5 s−1 subject to y = 10 at t = 0
3
clear; close all
a=0.5; T=10; dt=0.1;
N=floor(T/dt);
y(1)=10;
t(1)=0;
for i=1:N
f=-exp(-a*t(i));
y(i+1)=y(i)+f*dt;
t(i+1)=t(i)+dt;
end
plot(t,y)
The advantage of using Euler’s method is that it is very simple, which makes it easy to code. However,
it isn’t very accurate. Its accuracy is characterized as “first order”, which means that every time ∆t is
cut in half, the truncation error is cut by a factor of two. Hence, there is a one-to-one proportionality
between ∆t and errors. To get much smaller truncation errors, we will use a routine built into Matlab
that achieves “fourth order” accuracy, which means that every time ∆t is cut in half, the error is cut
by a factor of two to the fourth power!, i.e., 24 = 16.
To use the built-in Matlab function, it is useful to first create a function that evaluates the right-handside of the ode. For the simple problem considered here, this can be written as:
function f = odefcn(t,y,a)
%Note that y is not used, but it is a requirement and it
%will be needed for the class project
%Input variables: t=ind var, y=dep var; a=parameter
%Output variable: f=dydt
f=-exp(-a*t);
end
Once this function file is created, we create a script file (Matlab program) that calls the built-in ode
solver as follows:
clear; close all
T=10; a=0.5; y0=10;
tspan=[0 T];
[t,y] = ode45(@(t,y) odefcn(t,y,a), tspan, y0);
plot(t,y)
For this project, each student will need to create a function file to evaluate the right-hand side of
Eq. 6 and then a script file (Matlab program) that computes H versus t. Moreover, once H is
computed, students can compute V using Eq. 4 and Q using Eq. 5. Hence, students can create a
program that computes H, V and Q versus t and supports comparisons between model predictions
and measurements.
3
Project Steps
3.1
Experiments Yielding Water Level and Discharge Data
3.1.1
Experiment 1
In this first experiment, you will be collecting water level data to develop and calibrate a model of
the discharge from your testing system over time. The testing system consists of a simple reservoir
that drains through a single outlet. Before you begin this experiment, think about how the height
4
of water in the testing system might change over time based on your current understanding of fluid
mechanics. Will the trend be linear? Non-linear? How does the change in flow rate over time relate to
the change in water height over time? You will fill the testing system with water and allow it to empty
via gravity for at least five trials during this experiment. Video recordings will allow you to conduct
the experiment and transcribe water level observations over time from the video playback later.
The experimental procedure for Experiment 1 will be described in detail during your in-person lab
session. Don’t forget to take photos of the experimental materials and methods to include in your
reports!
3.1.2
Data collection for Experiment 1
Once you have obtained the video recordings for at least three (3) experimental trials, you will need to
record time and water level measurements from the videos. We recommend using the “Data Collection
Template.xlsx” spreadsheet uploaded to the Canvas website to organize the measurements needed to
calibrate your model of water level, velocity, and discharge over time.
1. Upload each video to cloud storage (such as Google Drive) or to a computer so that you can
delete it from your recording device’s memory.
2. You will be reading time observations from the elapsed time of each video, so the measurements
will be more precise if you play the video in a media player that displays time in fractions of
seconds. One example is VLC Media Player, which is available for free for Windows, Mac, and
Linux. VLC Media Player does not display the video time in milliseconds by default, but you
can install a free extension called Time that allows you to display the time in milliseconds. If
the default media player on your computer displays time in whole seconds you can still record
the time measurements, they will just not be as precise.
3. Open one of the experimental trial videos in a media player on your computer. Open the “Data
Collection Template.xlsx” spreadsheet and select the “TS1 H vs t” tab.
4. Fast forward the video until the water level in the testing system is at the greatest height reading
on your water level scale (e.g. 18 cm). You are aiming for the point when the bottom of the
meniscus (the curve of surface of the water) is at the desired marking on the height scale. The
nice thing about having a video recording of the experiment is that you can move forward or
backward in the video until you feel the water level is exactly where you want it to be on the
scale, so feel free to adjust until you feel the water level reading is right.
5. Record the trial number (1, 2, 3, etc.) in the “Trial No” column and the water level in the “H cm”
column of the “Data Collection Template.xlsx” spreadsheet. Now record the corresponding time
elapsed since the start of the video in column “Time s”. This time represents the t=0 or the
start time of the experiment.
6. Continue recording the video time and water level that corresponds to each centimeter on the
height scale, up to and including the lowest line on the scale.
7. Once you are done entering the water level and time data into the spreadsheet, calculate the
column “delta t” as the difference between consecutive time measurements (e.g. cell C3-C2,
C4-C3, etc.). Note that the first value in the “delta t” column should be set to zero, since there
are no time measurements preceding the first one.
8. Calculate the column “Time Since Start s” as the delta t value for a given row plus the Time Since Start s
value for the previous row (e.g. D3+E2, D4+E3, etc.). The first value in the “Time Since Start s”
column should be set to zero, indicating the start time of the experiment.
5
9. Once you are done entering the water level data into the “TS1 H vs t” tab, enter the geometry
data for Testing System 1 that you recorded during lab into the “TS1 Geometry” tab of the
spreadsheet, if you have not already.
3.1.3
Experiment 2
The experimental procedure for Experiment 2 is essentially the same as that for Experiment 1 (see
Section 3.1.1), except you will be using a second testing system with a different shape than the first. If
your second testing system has an irregular shape such that the cross-sectional area varies non-linearly
with height, during this experiment you will need to pour multiple known volumes of water into the
container and record the height that the water level rises to so that you can develop an equation that
expresses the cross-sectional area as a function of height. This procedure will be described in more
detail during your in-person lab session.
The data collection procedure is the same as that of Experiment 1 (see Section 3.1.2), but make sure
to populate the spreadsheet tabs labeled “TS2”.
3.2
Simulation Code
To Be Determined.
3.3
Fitting Code
To Be Determined.
3.4
Prediction, Testing, and Analysis of Errors
To Be Determined.
6
4
Project Report
Project grades will be based on a combination of a team-based final report grade and peer-assessed
interim reports prepared individually by students. The project report grade will be weighed most
heavily - preparation of written reports is a critically important task in both scientific research and
professional engineering.
Over the duration of the quarter, students will be tasked with preparing three individual interim
reports that can be re-used and re-purposed by students to prepare the final report. The final report
will be structured as follows
1. Executive Summary
2. Rationale and Objective (Individual Report 1)
3. Theory and Methods for Measurements, Modeling, Parameter Estimation and Prediction (Individual Report 2)
4. Calibration and Uncertainty (Individual Report 3)
5. Prediction and Error Analysis
6. References
7. Appendices (Codes and Data)
4.1
Executive Summary
This is similar to an extended abstract of a paper, and is very popular today for reports prepared for
broad audiences. A reader should be able to read an executive summary, not read any other part of a
report, and get the most important information that you have to share.
This section should quickly summarize the rationale and methods used for this project, and then
transition into what was learned. Here, what you want to do is report findings and/or conclusions that
are supported by the work contained within your report. This is not a place where you report findings
unrelated to your work, and it is not a place to share opinions. For this assignment, I think it would
be nice to include two graphics in your executive summary: a plot showing a calibrated simulation,
and a plot showing a prediction by the calibrated model (against measurements).
Recommended Length: 2 pages.
4.2
Rationale and Objective
This project is an exercise in modeling and simulation, which is used widely in many fields of science
and engineering today. First, students should introduce “modeling and simulation” to the reader in
the context of engineering analysis and design. This will require that students do literature research on
this topic, collecting some good sources of information and reviewing it, and then introducing this topic
to the reader (in your own words, with citations). Secondly, students should explain how this project
is designed to support hands-on learning about modeling and simulation (i.e., by taking measurements
from a system, formulating and calibrating a simulation code, applying the code to make a prediction,
and then taking additional measurements to see how well the simulation code performs). Third, this
section should conclude with an objective or a set of objectives that are nicely framed by the preceding
narrative.
Organizing these ideas into a narrative that is informative, interesting to read, easy to follow, and
specific about the final objective is the challenge here.
7
Recommended Length: 2-3 pages. This will largely depend on how much background information
about modeling and simulation you wish to share with the reader.
4.3
Theory and Methods for Measurements, Modeling, Parameter Estimation and Prediction
Unlike the previous section which is meant to intrigue the reader and get them excited about learning
more, this section should be factual and straight to the point. There is no need to further engage the
reader’s interest here. Rather, you want to explain as concisely as possible how you will carry out this
project - the theory you will use, the data you will collect, and the steps of modeling that you will
carry out. I suggest the following structure:
1. Physical System: Water Tank with Outlet
2. Experiments and Measurements (water level, volume, times, etc.)
3. Mathematical Model (equations describing system dynamics; no need to derive, just report and
define all variables and parameters)
4. Simulation Method (integration of ode in Matlab)
5. Calibration Method (manual calibration, or an automated method if you choose)
6. Validation Method (explain that the calibrated model will be tested on a different physical system, and that you will evaluate the prediction by taking measurements that can be used in error
analysis; explain the sources of uncertainty in the model including uncertainty in measurements,
uncertainty in the calibrated parameters, uncertainty in the mathematical model; finally summarize the idea that this step is what allows us to test whether a model developed for one system
can be successfully transferred to a second system, and if not, why).
Recommended Length: as short as possible, but this may need to be 3-6 pages long to cover everything.
4.4
Calibrated Model and Uncertainty
This is the first section where you will show results. Here, you will show graphics and tables that
reveal the level of agreement between the calibrated simulation and the measurements. Here, you will
also want to show measurement uncertainties and the sensitivity of the calibrated simulation to
various inputs, most importantly the parameters that you calibrated.
Recommended Length: 2-3 pages including plots and tables.
4.5
Prediction and Error Analysis
This the second results section. Here, you will show how well the calibrated model simulated system
dynamics in a second physical system for which the model was not calibrated. It will be important
to once again show uncertainties. We don’t expect models to exactly pass through data, but we do
expect that a good simulation will fall within uncertainties that are predictable based on measurement
errors, model sensitivities, and uncertainties in model inputs and parameters.
Recommended Length: 1-2 pages including plots and tables
8
es
_2022_10_27_001815.PNG
feic
-arn
arn.
inst
-qui
TACI
St
3
Submit your Individual Report 2 here as a PDE (one submission per student). This report
represents the Theory and Methods for Measurements, Modeling, Parameter Estimation and
Prediction section of your final report, which is described in Section 4.3 in the Project
Description and Guide linked below:
CEE 170 Project Description and Guide F2021.pdf+
Click the link below to download additional assignment guidelines and a rubric for Individual
Report 2:
Individual Report 2 Guidelines and Rubric F2021.pdf
Peer Assessment Assignment:
Your report will be peer-assessed by other students in the class (your comments are
anonymous), and you will automatically be assigned the reports of three (3) other students to
peer assess on October 28th at 11:59 pm PST. Use the Rubric above to rate your peers' reports
out of 5 possible points and provide 1-2 sentences of constructive feedback explaining your
rating
**The peer assessment is due Friday. November 28th at 11:59 pm PST for full credit.
How to access the reports you are assigned to peer review:
On the right side of the screen, under your submission information, you should see "Assigned
Peer Reviews." Click on one of the links that say "Anonymous User."
• Write your peer assessment in the "Add a Comment" box. Make sure to assign a total rating
out of 5 based on the above rubric and provide 1-2 sentences explaining the reason for your
rating
. Repeat for the other two students.
• For more info on how to submit peer assessments, click here >
Grading:
.5 points for submitting Individual Report on time
⚫ 5 Points for completing peer assessments on time
• 10% deducted for each day assignment is late from the appropriate score
Note that this assignment will be reviewed for plagiarism using Tumitin.
8
x