CE 5143 Civil Engineering Numerical Analysis, Dr. Chowdhury
— by David Wagner 2007/11/17 12:23
This paper presents a mathematical model of a simple hydraulic system with nonlinear behavior. A backward-difference approximation gives expected results only over a limited time period.
Some hydraulic systems can be modeled piecewise by mathematically combining the behavior of individual elements. This method is fairly straightforward for linear systems, but becomes more complex for nonlinear systems. Furthermore, a model created in this manner may be limited in accuracy to predictive periods too short to be of use. The simple hydraulic system analysed here demonstrates these limitations.
The objective is to model the dynamic behavior a simple hydraulic system with a nonlinear component.
This paper illustrates the analysis with one example.
Consider a simple industrial waste treatment unit, presented here with parameters chosen to illustrate the nature of the hydraulic model developed to describe it. The process unit is a plug-flow reactor designed to treat the average flow of the effluent expected from two similar industrial processes. Each of these processes is cyclic with a period near 6.28 seconds (1.00 rad/s), during which the process alternately draws some, then empties more water than it drew into the reactor. Together the two processes discharge into the reactor the average net flow rate it was designed to treat. The reactor entrance is oriented vertically and continues above the datum like a standpipe to form a chamber intended to buffer the influent flow. Also at the entrance into the process unit is a check valve to divert the wastewater through a pipe and into the sanitary sewer if influent backs up too high into the standpipe. A valve at the end of this pipe is intended to limit the flow into the sewer when this happens.
The check valve exhibits nonlinear behavior of interest. Because the function is well-behaved and applied extensively in engineering to model similar behavior, the Shockley equation is used here to model the behavior of the check valve.
Coordinate System
A periodic flow may be characterized by the sum of individual sine-wave flows.


The pressure drop (h) across each component of a hydraulic network is related to the flow through it (Q).
| Component | Pressure Drop h(Q) | dh/dt | Flow Q(h) | dQ/dt |
|---|---|---|---|---|
| Open Standpipe | ![]() | ![]() | ![]() | ![]() |
| Valve | ![]() | ![]() | ![]() | ![]() |
| Closed Pipe | ![]() | ![]() | ![]() | ![]() |
| Check Valve | ![]() | ![]() | ![]() | 2) |
Conservative Quantities



: 
Fluid in a full horizontal pipe

Fluid in a vertical standpipe

Resonant Frequency of a full pipe.
1.00 rad/s
0.1 rad/sMechanical Impedance: Z=F/v
Statics

Since the objective is to show how this system behaves in general, a finite-backward-difference approximation should be sufficient to visualize the nature of its behavior.
As both outflows discharge to free surfaces at the datum, conservation of energy requires the net headloss through each pathway to be zero.




The sum of their derivatives must also be zero.




Although H(t) is not known (the pressure is whatever is necessary to maintain the given flow rate Q(t)), the following relations hold regardless of H(t).


Since the fluid is considered incompressible, the flow into any enclosed point must equal the flow out of it, thus the net flow at each connecting node is zero.


Differentiate these.


These equations can be solved in terms of head or flow. Solving for head is conventional, so put everything in terms of h.


Following the flow, first consider the head in the standpipe using this last equation and substituting backward-difference formulas (Taylor's series expansions) for the unknown terms. Note the rate of change of the total influent flow (dQ/dt) is known or can be approximated.




Now solve for Qov by considering the head losses in the overflow line and using a Taylor's series backward-difference approximation.


and 


Organize this a bit.




Expand it out.




Expand it further.
















Put this is in terms of Qov,i, the variable of interest.
0=
+
.
The outflow at each time step can be found by solving for Qov,i.
This model is written as a script file for Octave, an open-source mathematical analysis program similar to MatLab.
# CE 5143 Civil Engineering Numerical Analysis, Dr. Chowdhury
# Fall 2007 Term Project
# By David Wagner
clear;
imax = 1000;
i = 1:imax ;# Index counter
Delta_t = 1 ;# (s) :: Time slice
t = Delta_t*i ;
g = 9.8 ;# (m/s²) :: Acceleration due to Gravity
rho = 1000 ;# (kg/m³) :: Density of wastewater (assumed incompressible)
#Influent Standpipe
A_sp = 10 ;# (m²) :: Average Cross-sectional Area
#Plug-flow Reactor
L_pf = 9.8 ;# (m) :: Hydraulic Path Length
A_pf = 10 ;# (m²) :: Average Cross-sectional Area
#Overflow Check Valve
h_T = 2.0 ;# (m) :: Minimum Pressure Threshold
n = 1.0 ;# :: Emission Coefficient or Ideality Factor
Q_s = 0.01 ;# :: Leakage Flow
#Overflow Pipe
L_op = 9.8*sqrt(10) ;# (m) :: Hydraulic Path Length
A_op = 1.0 ;# (m²) :: Average Cross-sectional Area
#Overflow Valve
R_ov = 0.01 ;# (m/unit flow) :: Valve Headloss (Resistance)
#Influent Flow
I_1 = 1 ;omega_1 = 1 ;phi_1 = 0 ;
I_2 = 1 ;omega_2 = 1.1 ;phi_2 = 0 ;
dQ_dt(i) = I_1*omega_1*cos(omega_1*t(i) + phi_1) \
+ I_2*omega_2*cos(omega_2*t(i) + phi_2) ;
h_sp(1:2) = 0 ;# (m) :: Standpipe Fluid Level, initial values
Q_ov(i) = 0 ;
i = 3:imax;
h_cv(i-1)=0;
for i = 3:imax
h_sp(i) = ( dQ_dt(i) \
+ (A_sp/(Delta_t^2)) .* (2*h_sp(i-1)-h_sp(i-2)) \
- (Q_s/(n*h_T)) * exp(h_cv(i-1)/(n*h_T)) ) \
/ ( (A_sp/(Delta_t^2)) + ((g*A_pf)/L_pf) );
a= (L_op/(g*A_op) + R_ov*Delta_t) ; # {Q_{ov,i}}^2
b=(0
+ n*h_T*Delta_t
- (2*L_op/(g*A_op)) * Q_ov(i-1)
+ ( L_op/(g*A_op)) * Q_ov(i-2)
+ ( L_op/(g*A_op)) * Q_s
+ R_ov * Delta_t * Q_s
- R_ov * Delta_t * Q_ov(i-1)
- h_sp(i) * Delta_t
+ h_sp(i-1)* Delta_t ); # Q_ov(i);
c= (0
- n * h_T * Delta_t * Q_ov(i-1)
- (2*L_op/(g*A_op)) * Q_ov(i-1) * Q_s
+ ( L_op/(g*A_op)) * Q_s * Q_ov(i-2)
+ R_ov * Delta_t * Q_s^2
- h_sp(i) * Delta_t * Q_s
+ h_sp(i-1) * Delta_t * Q_s );
Q_ov(i)=max(real(roots([a,b,c])));
h_cv(i)=n * h_T * log( (Q_ov(i) / Q_s) +1 );
endfor
plot(t,Q_ov, t,h_sp)
print(strcat("project_1_",num2str(imax),".png"));
The system is assumed to be flowing full at all times, and both discharge into water bodies with free surfaces at the same elevation (0 m).
Free water surfaces are at the datum level.
Continuity leaves only three unknowns.
The desired value Qov = hov,in/Rov
For this exercise, two flows of nearly the same frequency are considered.



The results were unexpected and appear to show the limitations of the model more clearly than the behavior of this system. The continually increasing flow rate past a few thousand iterations of the model should violate the continuity equations, but it is there nonetheless, likely a result of cumulative arithmetic error. The exponential term often exacerbates such errors.
It is also entirely possible there is a mistake in this model, perhaps more than one. A more systematic modeling method would reduce this kind of error. Unfortunately I am not aware of a published system or open-source software package available to guide physical system modeling efforts. Most modeling software is either very specific to an application (SewerCAD, Dr. Frame, HEC-RAS, and such) or overly general (Mathematica, MatLab, and others). These are useful for practicing in an engineering specialty, or for detailed research, respectively. But there appears to be little available for one-off projects or exploring nonstandard modeling techniques.
* Applied Nomerical Methods for Engineers and Scientists, 2002, Singiresu S. Rao, Prentice Hall
In addition, Wikipedia, http://wikipedia.org, was of great use for checking basic concepts.

