##### Term Project Due 11/29/07

*CE 5143 Civil Engineering Numerical Analysis, Dr. Chowdhury*

#### Behavior of a Simple Structure with a Nonlinear Element

— *by David Wagner 2007/11/17 12:23*

#### Table of Contents

- Introduction
- Background
- Objective
- Scope

- Theory
- Numerical Method
- Computer Code

- Numerical Analysis
- Results and Discussion
- Reference
- Appendix: Selected Computer Output

# Introduction

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.

## Background

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.

## Objective

The objective is to model the dynamic behavior a simple hydraulic system with a nonlinear component.

## Scope

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.

# Theory

Coordinate System

- x :: Parallel to Fluid Flow
- y :: Vertical
- z :: Horizontal and Perpendicular to Fluid Flow

A periodic flow may be characterized by the sum of individual sine-wave flows.

^{1)}

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

- Conservation of Mass:
- Conservation of Momentum:
- Fluid Inertia (mv) = ρA
_{pf}L_{pf}q_{pf}

- Conservation of Energy:
- :

Fluid in a full horizontal pipe

- Momentum
- Energy

Fluid in a vertical standpipe

- Momentum
- Energy

Resonant Frequency of a full pipe.

- 1.00 rad/s
- 0.1 rad/s

Mechanical Impedance: Z=F/v

Statics

## Numerical Method

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 Q_{ov} by considering the head losses in the overflow line and using a Taylor's series backward-difference approximation.

- Let and

Organize this a bit.

- 0=
- +
- +
- -

Expand it out.

- 0=
- +
- +
- -

Expand it further.

- 0=
- -
- +
- -
- +
- +
- -
- +
- +
- +
- -
- +
- -
- +
- -
- +

Put this is in terms of Q_{ov,i}, the variable of interest.

0= + .

The outflow at each time step can be found by solving for Q_{ov,i}.

## Computer Code

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"));

# Numerical Analysis

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).

- g = 9.8 (m/s²) :: Acceleration due to Gravity
- ρ = 1000 (kg/m³) :: Density of wastewater (assumed incompressible)
- Q (m³/sec) :: Fluid Flow Through the System

- Influent Standpipe
- A
_{sp}= 10 (m²) :: Average Cross-sectional Area - R
_{sp}= 0 :: Negligible Flow Resistance - h
_{sp}(m) :: Standpipe Fluid Level

- Plug-flow Reactor
- L
_{pf}= 9.8 (m) :: Hydraulic Path Length - A
_{pf}= 10 (m²) :: Average Cross-sectional Area - R
_{pf}= 0 :: Negligible Flow Resistance

- Overflow Check Valve
- h
_{T}= 2.5 (m) :: Minimum Pressure Threshold - n = 1.0 :: Emission Coefficient or Ideality Factor
- Q
_{s}= 0.01 :: Leakage Flow - h
_{cv}(m) :: Pressure Head across the Check Valve

- Overflow Pipe
- L
_{op}= 9.8√10 (m) :: Hydraulic Path Length - A
_{op}= 1 (m²) :: Average Cross-sectional Area - h
_{op}(m) :: Fluid Level

- Outflow Valve
- R
_{ov}= 0.01 (m/unit flow) :: Valve Friction

Free water surfaces are at the datum level.

- h
_{sp,in}= h_{pf,out}= h_{ov,out}= 0 (m)

Continuity leaves only three unknowns.

- h
_{sp,out}= h_{pf,in}= h_{cv,in} - h
_{cv,out}= h_{op,in} - h
_{op,out}= h_{ov,in}

The desired value Q_{ov} = h_{ov,in}/R_{ov}

For this exercise, two flows of nearly the same frequency are considered.

- I
_{1}= I_{2}= 1.0 m³/sec - ω
_{1}= 1.0 rad/sec; ω_{2}= 1.1 ω_{1}= 1.1 rad/sec - φ
_{1}= φ_{2}= 0.0

# Results and Discussion

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.

# Reference

* *Applied Nomerical Methods for Engineers and Scientists*, 2002, Singiresu S. Rao, Prentice Hall

*Fundamentals of Engineering Supplied-reference Handbook*, Seventh Edition, 2006, National Council of Examiners for Engineering and Surveying*Non-linear DC Analysis*, 2007-06-17, Stefan Jahn, Qucs Technical Papers, http://qucs.sourceforge.net/tech/node16.html, accessed 2007-11-29

In addition, *Wikipedia*, http://wikipedia.org, was of great use for checking basic concepts.

# Appendix: Selected Computer Output

^{1)}

*And, similarly for the next equation.*

^{2)}Non-linear DC Analysis, Stefan Jahn, 2007

## Discussion