Introduction to
2D Hydraulics Equations
Alex Sánchez, Ph.D.
Senior Hydraulic Engineer
USACE, Institute for Water Resources, Hydrologic Engineering Center
1
Hydraulic Modeling
Formal Framework: Computational Concepts:
• Mass Conservation • Computational Mesh
• Momentum Conservation • Numerical Methods
• Empirical Equations • Subgrid Bathymetry
HEC-RAS
Data: Engineering Problems:
• Topography, Maps, LIDAR • Project Planning & Design
• Historical Information • Dam and Levee Breaks
• Modeler Experience • Overland Flows, Floods
2
Outline
• Mass Conservation (Continuity)
• Momentum Conservation (Depth-Averaged)
• Acceleration
• Coriolis term
• Hydrostatic pressure
• Turbulent mixing
• Friction
• Diffusion Wave Equation
• Numerical Methods
3
Mass Conservation
• Assuming a constant water density
∂h h : Water depth
+ ∇ ⋅ (hV ) = q
∂t q : Water souce/sink
• Integrating over a computational cell Ωi : Cell water volume
∂ Ak : Face area
∂t ∫∫∫ d Ω + ∫∫ (V ⋅ n)dS =Q
Ω S
Vk : Face velocity
nik : Outward face-normal unit vector
• Finite-Volume Discretization
∆t : Time step
Ω n +1
−Ω n
i
∆t
+ i
∑
k ∈K ( i )
(Vk ⋅ nik )Ak =
Qi
Change in volume in a
system balances with
Ω=volume flow through
boundaries 4
Momentum Conservation
• Momentum Equation (non-conservative form) V : Velocity
∂V 1 τb τs zs : Water level
+ (V ⋅ ∇ )V + f c k × V = − g ∇zs + ∇ ⋅ ( νt h∇V ) − + g : Gravity
∂t h ρ R ρh
νt : Turbulent eddy
viscosity
h : Water depth
• From Newton’s 2nd Law of motion R : Hydraulic Radius
• Assumes constant water density, small vertical f c : Coriolis Parameter
velocities, hydrostatic pressure, etc. τ b : Bed shear stress
• Non-linear and a function of both velocity and water τ s : Surface stress
levels
• Continuity and Momentum Equations are the
Shallow Water Equations or sometimes referred to
5
as the “Full Momentum” equations in HEC-RAS
Acceleration and Total Derivative
• Eulerian: Frame of reference fixed in space and time https://commons.wikimedia.org/wiki/File:Lag
rangian_vs_Eulerian_frame_of_reference.svg
∂V
+ (V ⋅ ∇ )V
∂t
• Easier to compute
• Time-step restricted by Courant condition
• Lagrangian: Frame of reference moves with
total derivative along flow path
∂V DV V n +1 − VXn
+ (V ⋅ ∇=
)V =
∂t Dt ∆t
flow
• More expensive to compute path Velocity (V n+1)
Velocity (V )
n
• Allows larger time-steps X
at time t+Δt
at time t
6
Coriolis Acceleration
• Effect of rotating frame of reference (earth’s rotation)
• Constant for the each 2D domain (f-plane approx.)
𝑓𝑓𝑐𝑐 = 2 ωsin 𝜑𝜑
• ω: sidereal angular velocity of the Earth
• 𝜑𝜑: latitude. Positive for northern hemisphere.
Negative for southern hemisphere
• Coriolis acceleration disabled by default
to save computational time
• Negligible for most river and flood simulations
• When to enable Coriolis term?
• Large domains
• Higher latitudes
7
Hydrostatic Pressure
• Assumes vertical water accelerations are small compared to gravity
• Total pressure is
𝑃𝑃 = 𝑃𝑃𝑃𝑃𝑃𝑃𝑃𝑃 + 𝜌𝜌𝜌𝜌(𝑧𝑧𝑧𝑧 − 𝑧𝑧)
• 𝑃𝑃𝑎𝑎𝑎𝑎𝑎𝑎: atmospheric pressure (assumed to be constant)
• 𝜌𝜌 : constant water density
• 𝑔𝑔: gravity acceleration constant
• 𝑧𝑧𝑠𝑠: water surface elevation
• z: vertical coordinate
• Pressure gradient
𝜕𝜕𝑃𝑃 𝜕𝜕𝑧𝑧𝑠𝑠
= 𝜌𝜌𝑔𝑔
𝜕𝜕𝜕𝜕 𝜕𝜕𝑥𝑥
8
Diffusion of Momentum
• Non-conservative Formulation
• Only option in Version 5.0.7 and earlier,
• Optional in Version 6.0
∆ = ∇ 2 : Laplacian
DV τb
=− g ∇zs + ν t ∆V − u N : Face-normal velocity
Dt ρR ν t : Turbulent eddy viscosity
• Conservative Formulation h : Water depth
• Default in Version 6.0
• Only option for Eulerian SWE solver
c f : Non-linear friction coefficient
DV 1 τb
= − g ∇zs + ∇ ⋅ ( νt h∇V ) −
Dt h ρR
9
Mixing Term Formulation Comparison
Bathymetry and
water level
Produces a net
dissipation
Non-conservative
Decreases velocities in
middle of channel but
Conservative increases velocities
near banks
10
Eddy Viscosity: Turbulence Model
• Old: Parabolic ν t = Du* h u* : Shear velocity
• Versions 5.0.7 and earlier h : Water depth
• Isotropic (same in all directions) D : Mixing coefficient
• 1 parameter: mixing coefficient D DL : Longitudinal mixing coefficient
• New: Parabolic-Smagorisnky DT : Transverse mixing coefficient
νt= Du* h + ( Cs ∆ ) S
2
Cs : Smagorinsky coefficient
2
∂u
2
∂v ∂u ∂v
2
Dxx 0 = Dxx
DL
cos 2
θ + D,T
sin 2
θ
S
= 2 + 2 + + D=
∂x ∂y ∂y ∂x 0 Dyy =Dyy DL sin 2 θ + DT cos 2 θ
• Default method in Version 6.0
• Non-Isotropic (not the same in all directions)
• 3 parameters: DL , DT , and Cs
11
Bottom Friction
• Resisting force due to relative motion of fluid against the bed
• Bed Shear Stress
τ b = ρ CD V V
𝑛𝑛 :Manning coefficient
• Drag Coefficient 𝜌𝜌: water density
𝑔𝑔: gravity acceleration constant
gn 2
CD = 1/3 𝑽𝑽 : velocity magnitude
R 𝑅𝑅: hydraulic radius
• Friction coefficient
CD gn 2
=cf = V V
12
R R 4/3
Wind Stress
• Surface Stress is given by
τ s = ρ a CD W10 W10 5
10
-3 Drag Coefficient
4
• Wind Reference Frame
3
Drag Coefficient
W10E − V for Lagrangian
W10 = E 2
W10 for Eulerian Hsu (1988)
Garratt (1977)
1 Large and Pond (1981)
Andreas et al. (2012)
Charnock (1955) + smooth flow
0
0 10 20 30 40 50 60
Wind Speed (m/s)
13
Diffusive-Wave Approximation
• Ignoring the following terms
∂V 1 τb τs
+ (V ⋅ ∇ )V + f c k × V = − g ∇zs + ∇ ⋅ ( νt h∇V ) − +
∂t h ρ R ρh
• Expanding and dividing both sides by the square of its norm leads to
β R 2/3 h
V=− ∇z s β= 1/ 2
h n ∇z s
• Inserting the above equation into the Continuity Equation leads to the
Diffusion-Wave Equation (DWE)
∂h
= ∇ ⋅ ( β ∇z s ) + q
∂t
14
SWE vs. DWE
• Use SWE for:
• Flows with dynamic changes in acceleration
• Studies with important wave effects, tidal flows
• Detail solution of flows around obstacles, bridges or bends
• Simulations influenced by Coriolis, mixing, or wind
• To obtain high-resolution and detailed flows
• Use DWE for:
• Flow is mainly driven by gravity and friction
• Fluid acceleration is monotonic and smooth, no waves
• To compute approximate global estimates such as flood extent
• To assess approximate effects of dam breaks
• To assess interior areas due to levee breeches
• For quick estimations or preliminary runs
15
Computational Mesh
• Mesh/grid can be unstructured
• Polygonal cells of up to 8 sides
• Cells must be concave
• Multiple 2D mesh can be run together
or independently
• Grid Notation
• Cells, Faces, Face Points (i.e. nodes or
vertices), Computational Points, etc.
• State Variables
• Cell Water levels
• Face-normal Velocities
16
Numerical Methods
• Both DWE and SWE solvers are Semi-implicit
• Terms treated as:
• Explicit: acceleration and diffusion terms
• Semi-implicit: friction, flow divergence terms, and water level gradient
• Fully-Implicit: pressure gradient term (for θ = 1)
• By treating the “fast” pressure gradient term implicitly, the time step
limitation based on the wave celerity can be removed
• Both DWE and SWE use Finite-Difference and Finite-Volume
Methods
• Time integration: Finite-Difference
• Continuity Equation: Finite-Volume
• Momentum Equation: Finite-Difference (no control volume)
17
Face Water Surface Gradient
• Face-Normal Gradient
∂zs zs , R − zs , L
∇zs ⋅ nk= ≈
∂N ∆xN
• Uses Cell Centroids and
NOT the Computation Points
• Future versions may include non-orthogonal
• Compact two-point stencil is computationally
efficient and robust
• Important to have a good quality mesh
to reduce errors
18
Momentum Conservation
• Momentum conservation is directionally invariant
• Only “face-normal” component is needed at faces so
∂u N ∂zs 1 τ b, N τ s, N
+ (V ⋅ ∇ ) u N − f c uT = − g + ∇ ⋅ ( νt h∇u N ) − +
∂t ∂N h ρ R ρh
where u N is the velocity in the N direction
19
Face-Tangential Velocity
Double-C Stencil
• Tangential velocities are computed on left and
right of face with a Least-squares Formulation
3 3
∑ (V ⋅ nk − (u N ) k ) ∑ (V ⋅ nk − (u N ) k )
2 2
S=
R R S=
L L
k ∈R k ∈L
• Of the left and right reconstructed velocities,
only the tangential component is used, because
the normal component is known
(uT )=
R VR ⋅ t f (uT )=
L VL ⋅ t f
• Average face-tangential velocity computed as
(uT ) R + (uT ) L
( uT ) f =
2
20
Discretization
• Cell Velocity Gradient (x-direction)
• Gauss’ Divergence Theorem
1 1 1
∇ui=
Ai A∫∇udA=
Ai ∫ undL=
Ai
∑u n
k ∈i
k ik Lk
L
• Needed tor turbulence modeling nik = sik nk
• Cell Velocity
• Perot’s Method
1
Vi
=
Ai
∑ ∆x
k ∈i
ik Lk nk (u N ) k
• Needed for the conservative form of the
mixing term and for Eulerian advection
21
Discretization: Laplacian
• Node Laplacian
j
(∇ V )
2
j
= ∇ ⋅ ( ∇V ) j ≈ ∑
i
d i ( ∇V )i
i : Cells
∑ ckVk
( ∇V )i = j : Nodes i
k
k : Faces
• Used only by non-conservative turbulence
22
Backtracking
∂u N Du N u Nn +1 − u Xn
+ (V ⋅ ∇=
) uN ≈
1. Interpolate node velocities from faces ∂t Dt ∆t
2. Set starting location and remaining time as f and TR = ∆t dx P
= V ( x, t )
3. From starting location and velocity, find location B dt
4. Compute time to location B: = TB ( x A − x B )VA−1
=
5. Interpolate velocity at location B: VB wn1Vn1 + wn 2Vn 2
if TB > TR
6. Set A = B, T= R TR − TB , and go to step 3
else
7. Find location X as x= X x f − TRVA
8. Interpolate velocity vector at X
VX TB−1 TRVB + (TB − TR )VA
=
9. Compute advective velocity
u=
X n f ⋅V X 23
Fractional Step Method (ELM only)
• Coriolis Term approximated as
f [ (1 − θ ) fv Xn + θ v n +1 ]
f c k ×V ≈ n +1
− f [ (1 − θ ) fu n
X
+ θ u ]
where k : Unit vector in the vertical direction
f : Coriolis Parameter V = ( u , v ) : Velocity at face
T
θ : Implicit weighting factor VX = ( u X , vX ) : Velocity at face at location X
T
• First (Coriolis) Step
1 θ∆tf u * u Xn + (1 − θ )∆tfv Xn u *
* = n n
V = *
*
θ∆tf 1 v vX + (1 − θ )∆tfu X v
• Second Step includes all other terms
24
Eulerian-Lagrangian Momentum Equation
• Semi-discrete form (2nd Fractional Step)
τ s,N
n
u n +1
−u *
∂z 1
n +θ
N
= −g
N
+ ∇ ⋅ (ν t h ∇u N ) − c f u N + n
s n n +1
∆t ∂N h X ρ hf
where
zan +θ =−
(1 θ ) zsn + θ zsn +1
u=
*
N
V *
⋅ nf
• Velocity V* includes Coriolis
• Mixing term is interpolated at backtracking location X and
based on previous time step velocity field
• Friction term is semi-implicit
25
Eulerian Momentum Equation
• Semi-discrete form
τ s,N
n
u n +1
−u n
∂z 1 n +θ
N
+ (V ⋅∇ ) u N − fuT = − g
N n n n
+ ∇ ⋅ (ν t h∇u N ) − c f u N + n
s n +1
∆t ∂N h f ρ hf
where
zsn +θ =−
(1 θ ) zsn + θ zsn +1 h f α Lf hL + α Rf hR
=
• Coriolis term computed at face f and is explicit
• No fractional step method like ELM solver
• Mixing term is computed at face f and is explicit
• Friction and pressure gradient terms are semi-implicit
26
Discretization: Eulerian Advection
• Approach from Kramer and Stelling (2008)
α Lf
(V ⋅ ∇ ) u N ≈
h f AL
∑
k ∈L
sLk Qk Vku ⋅ n f − ( u N ) f
α Rf
+
h f AR
∑
k ∈R
sRk Qk Vku ⋅ n f − ( u N ) f
∆x Lf
α Lf = h f α Lf hL + α Rf hR
=
∆x Lf + ∆x Rf
α Rf = 1 − α Lf
• Courant-Freidrichs-Lewy (CFL) Condition
U ∆t
C
= ≤1
∆x 27
Discretization: Mixing Term
• Non-Conservative Form
(∇ V )
n
νt ∇ u N
2
f
≈ν n
t, f
2
X
⋅ nf
• Conservative Form
1 α L
n f ⋅ (V j − VL )+ α Rf n f ⋅ (V j − VR )
h
∇ ⋅ ( νt h∇u N ) ≈ f
h f AL
∑ Aν
k ∈L
k t ,k
∆xL , j h f AR
∑ Aν
k ∈R
k t ,k
∆xR , j
f
• Discretization same for both ELM and EM solvers
• Approximate Stability Criteria for EM solver ν ∆t 1
t
≤
∆x 2
2
• ELM interpolates term to location X
n
1
h ∇ ⋅ ( νt h∇u N ) 28
X
Why is the Temporal Term Important?
• Assuming deep water, no friction or other forces
∂zs ∂u ∂u ∂zs
+h 0
= +g 0
=
∂t ∂x ∂t ∂x
• Eliminating the velocity leads to the classical wave equation
∂ 2 zs ∂ 2
zs
=c 2
c = gh 𝑐𝑐 : Celerity
∂t 2
∂x 2
• Temporal term is necessary for wave propagation
29
Eulerian-Lagrangian vs. Eulerian SWE Solvers
• SWE-ELM Strength/Feature/Capability SWE-ELM SWE-EM
• Only solver available in V5.0.7 and earlier Larger Time Step X
• Default in V6.0 Best Stability X
• Not limited by Courant condition Courant Stability Criteria X
• Excellent stability Diffusion Stability Criteria X
• Can have momentum conservation Computational Speed X
problems around shocks or Wet/dry > 1 cell per time step X
where the flow changes rapidly Best Momentum Conservation X
• SWE-EM Non-Conservative Mixing X
Conservative Mixing X X
• New to V6.0 as an option
Wind X X
• Limited to Courant less than 1.0
• Good Stability
• Improved momentum conservation
for all flow conditions 30
SWE-ELM and SWE-EM vs SWE-LIA
• SWE-ELM and SWE-EM
• Include momentum advection term
Strength/Feature/Capability SWE-ELM SWE-LIA
• Differ in their approach to computing SWE-EM
momentum advection term Temporal Term X X
• Slower Advection Term X
• Less stable Larger Time Step X
• Include temporal term Best Stability X
• SWE-LIA Wave propagation X X
Diffusion Term X
• Ignores the advection term
Wind X X
• Faster (momentum term can be
20-30% of run time) Atmospheric pressure X X
• More stable
• Also includes the temporal term
31
Solution Procedure
• System of equations
Ω + ΨZ =
b Z : Water level
Ω : Water volume
• Algorithm
1. Compute Right-Hand-Side b ψ : Coefficient matrix
• Contains explicit terms: b : Right-hand-side
advection, diffusion, wind, etc.
2. Outer Loop (Assembly and Updates) m : Iteration index
• Update linearized terms and variables A : Diagonal matrix of
including coefficient matrix Ψ
3. Inner Loop (Newton Iterations) cell wet surface areas
Z m +1
= Z − [Ψ + A
m
] (Ω
m −1 m
+ ΨZ m − b )
32
Boundary Conditions
• Stage Hydrograph. Upstream or downstream
• Flow Hydrograph. Upstream or downstream. Local conveyance
and velocities computed automatically.
• Normal Depth BC. At downstream boundaries.
• Rating Curve BC.
• Wind. Only for shallow-water equations.
• Precipitation, evapotranspiration, and infiltration. Included as
sources and sinks in the continuity equation.
• 1D reaches and 2D areas can be connected
• Multiple 2D areas can be connected to each other
• 2D areas can be connected to 1D lateral structures
such as levees to simulate levee breaches
33
Computational Implementation
• Multiple 2D areas can be computed independently and
simultaneously
• All solvers are can be run on multiple cores
• 2D solvers and parameters can be selected independently for
each 2D area
• A partial grid solution keeps track of active portion of
mesh and only computes the solution for active portion
significantly reducing computational times.
34
Thank You!
HEC-RAS Website:
https://www.hec.usace.army.mil/software/hec-ras/
Online Documentation:
https://www.hec.usace.army.mil/confluence/rasdocs
35