Upload
others
View
5
Download
0
Embed Size (px)
Citation preview
SCHISM Theory Manual
Joseph Zhang
December 18, 2014
1 Notation on symbols used in this manual
We typically use bold characters to denote vectors and matrices, and unbold charac-
ters to denote scalars. In many cases, we like to use capital letters to denote depth
integrated quantities.
2 Discretization
The horizontal grid used in SCHISM is triangular (Fig. N1, where the local number-
ing is also shown), and vertical grid is hybrid S-Z (Fig. N2). A basic computational
unit in SCHISM is thus a triangular prism, with uneven top and bottom faces (Fig.
N3).
1
A few notations used in this document:
Np : # of nodes
Ns : # of sides
Ne : # of elements
Nz : # of vertical levels
kbp : bottom index as seen by a node (due to Z layers)
kbs : bottom index as seen by a side (due to Z layers)
kbe : bottom index as seen by an elem. (due to Z layers)
A : area of an elem.
∆z : layer thickness (at a node, side or elem.)
δij : Dirac’s Delta function (=1 when i=j; 0 otherwise)
(1)
3 Coupled continuity and momentum equations
This section deals with the core part of the SCHISM formulation, i.e. how to solve
the coupled continuity and momentum equations semi-implicitly. This is adpated
and updated from the original SELFE paper.
The eqs. are:
ηt + ∇ ·
∫ η
−h
u = 0, (2)
∇ · (u) = 0 (3)
Du
Dt= f − g∇η +
∂
∂z(ν∂u
∂z) (4)
ν∂u
∂z= τw at z = η (5)
ν∂u
∂z= χub at z = −h (6)
2
where f combines all explicit terms (more details later), χ = Cd|ub|, with ub being
the near bottom velocity at the top of the computational cell. The viscosity and
diffusivity are calculated from turbulence closure (Section 9).
Galerkin F.E. formulation of Eq. (2) is:
∫
Ω
(φiηt −∇φi ·
∫ η
−h
udz)dΩ +
∫
Γ
φi
∫ η
−h
undzdΓ = 0, (i = 1, ..., Np) (7)
where Γ = ∂Ω, and the shape function is:
φi =
Ni∑
j=1
φi′ (8)
with i′ being the local index of the node i inside its own ball (Fig. N1c). We use
linear shape function for φi′ and so a hat function for φi. The boundary is further
divided into essential (Γv) and natural (Γv) parts:
Γ = Γv
⋃
Γv (9)
Semi-implicit discretization in time leads to:
∫
Ω
φiηn+1 − ηn
∆tdΩ + θ[−
∫
Ω
∇φi ·Un+1dΩ +
∫
Γv
φiUn+1n dΓv +
∫
Γv
φiUn+1n dΓv] +
+(1− θ)[−
∫
Ω
∇φi ·UndΩ +
∫
Γ
φiUnndΓ] = 0 (10)
where 0.5 ≤ θ ≤ 1 is the implicitness factor, and subscript n denotes normal direc-
tion (not to be confused with time step n in superscripts), and U =∫ ηn
−hudz is the
integrated velocity, and the hat symbol denotes imposed values.
The discretized momentum eq. is:
un+1 − u∗
∆t= fn − gθ∇ηn+1 − g(1− θ)∇ηn +
∂
∂z(νn
∂un+1
∂z)), (11)
where u∗ is the back-tracked value of velocity at the foot of characteristic line.
Integrating this eq. leads to:
Un+1 = G− gθ∆tHn∇ηn+1 − χnun+1b ∆t (12)
3
where Hn = h+ ηn is the total depth, and G contains explicit terms. Applying the
momentum eq. (11) at the bottom computational cell for ub and substituting this
to (12) gives:
Un+1 = G− gθ∆tH∇ηn+1 (13)
where H = H −χ∆t is the depth reduced by friction (note that we sometimes drop
supercript n for brevity), G again is an explicit term. Subt. eq. (13) back to (10)
gives rise to the most important eq. in SCHISM:
︷ ︸︸ ︷∫
Ω
[φiηn+1 + gθ2∆t2H∇φi · ∇η
n+1]dΩ =
︷ ︸︸ ︷∫
Ω
[φiηn + θ∆t∇φi · G+ (1− θ)∆t∇φi ·U
n]dΩ
−θ∆t
︷ ︸︸ ︷∫
Γv
φiUn+1n dΓv −(1− θ)∆t
︷ ︸︸ ︷∫
Γ
φiUnndΓ−θ∆t
︷ ︸︸ ︷∫
Γv
φiUn+1n dΓv
(i = 1, ..., Np) (14)
or in shorthand form for the unknown ηn+1:
I1 = I4 − θ∆tI3 − (1− θ)∆tI5 − θ∆tI6 (15)
Note that I6 needs not be evaluated because η is prescribed on this part of the
boundary.
We’ll go thru each integral in detail in the following.
3.1 I1
Referring to Fig. N1c and taking into account the shape function, we have:
I1 =
Ni∑
j=1
∫
Ωj
[φi′ηn+1 + gθ2∆t2H∇φi′ · ∇η
n+1]dΩj
=
Ni∑
j=1
3∑
l=1
ηn+1j,l [
1 + δi′,l12
Aj +gθ2∆t2
4Aj
¯Hji
′ · l] (16)
where the overbar denotes averaging¯Hj =
Hj,1+Hj,2+Hj,3
3, and i′ is the vector for
side i′ (counter-clockwise direction; similarly for l). The dot product i′ · l is max.
4
when i′ = l, and therefore the diagonal is guarenteed to be dominant (note that∑
i′ i′ = 0) if
¯Hj ≥ 0. Experience indicates that even if the latter condition is not
met the maxtrix conditioning is still good enough for JCG solver. In the code, ihhat
is a flag used to impose this positivity condition for¯Hj.
3.2 I3
This is a boundary only term, i.e. it’s non-zero only when node i is on the boundary.
Since the normal vel. is 0 at land boundary sides, I3 is non-0 only at open boundary
sides.
I3 ≡
∫
Γv
φiUn+1n dΓv =
2∑
j=1
Lij
2
Nz−1∑
k=kbs
∆zij,k+1(un)ij,k+1 + (un)ij,k
2≡ I∗3 , when i ∈ Γv
(17)
where the sum is over the 2 adjacent sides of node i, kbs is the bottom as seen by
the side, and L is the side length.
Sometimes Flather’s b.c. is applied at a boundary segment,
un+1n − un =
√
g/Hn(ηn+1 − η) (18)
where overbars denote prescribed mean vel. and elevation. Then I3 contains implicit
terms as follows:
I3 = I∗3 +2∑
j=1
Lij
√gHij
6[2(ηn+1
i − ηi) + ηn+1j − ηj] (19)
Note that the implicit part enhances the diagonal also.
3.3 I5
This term is similar to I3:
I5 ≡
∫
Γ
φiUnndΓ =
2∑
j=1
Lij
2
Nz−1∑
k=kbs
∆zij,k+1(unn)ij,k+1 + (unn)ij,k
2, when i ∈ Γ (20)
5
3.4 I4
This term is the most involved of all. It contains almost all of the explicit terms.
I4 ≡
∫
Ω
[φiηn + θ∆t∇φi · G+ (1− θ)∆t∇φi ·U
n]dΩ
=
Ni∑
j=1
[Aj
12
3∑
l=1
ηnj,l(1 + δi′,l) + (1− θ)∆tAj∇φi′ · Unj + θ∆t∇φi′ · G
j
1] (21)
whereNi is the # of elements in the ball of node i, U is the elem. averaged integrated
vel., and i′ is the local index. Most of the explicit terms are wrapped into
Gj
1 =
∫
Ωj
GdΩj (22)
Now recall that:
G = U ∗ +∆t[F + τ n+1w − χ(u∗
b +∆tf b)− g(1− θ)H∇ηn] (23)
F =
∫ η
−h
fdz (24)
f = −fk × u−1
ρ0∇pA + αg∇ψ + f c + fhd + other terms (25)
where the subscript b denotes the value at the top of the bottom computational cell,
f is the Coriolis parameter, pA is air pressure, ψ is the earth tidal potential, and the
last 3 terms in (25) represent baroclinic pressure gradient and horizontal viscosity,
and other terms from other modules (e.g., wave radiation stress, source/sinks etc).
Due to its special importance, we separate out the baroclinic term as:
f = f r + f c (26)
F = F r + F c (27)
f b = (f r)b + (f c)b (28)
f r = −fk × u−1
ρ0∇pA + αg∇ψ + fhd + other terms (29)
Eq. (22) can be written as:
Gj
1 =
∫
Ωj
∫ η
−h
u∗dzdΩj +∆t
∫
Ωj
F cdΩ +
+Aj∆t[F r + τw − χ(u∗
b +∆tf b)− χ∆t(f c)b − g(1− θ)¯H∇ηn] (30)
6
where the overbars denote elem. average. We’ll only focus on the baroclinic gradient
term as the rest are straightforward.
3.5 Baroclinic gradient
A method to reduce pressure gradient error is to use the Z-method where the den-
sities are first interpolated onto a horizontal plane before the derivatives are taken.
We use cubic spline for the vertical interpolation, with 2 options near the bottom:
constant extrapolation of the density, or the baroclinic head itself, below bottom.
The 1st approach may generate spurious flow in deeper depths (imagine a shelf
break), and is thus more appropriate in shallow depths. The 2nd approach is more
appropriate in deeper depths. The users can set a transition depth (depth zsimga
in param.in) for the two approaches.
Since the densities are defined at different locations depending on the transport
algorithms used, we discuss two cases separately.
3.5.1 upwind/TVD transport
In this algorithm, the T,S, and densities are defined at half levels and element centers
(i.e. prism centers). Referring to Fig. N4b, up to 3 eqs. can be formed from an
element (0) and its 3 neighbors (1-3). For example, for the stencil (0,1,2), we have:
r1(xc1 − xc0) + r2(y
c1 − yc0) = ρ′1 − ρ′0, (31)
r1(xc2 − xc0) + r2(y
c2 − yc0) = ρ′2 − ρ′0, (32)
where (xc, yc) are coordinates of the centroid, and (r1, r2) ≡ (∇ρ′)0 is the density
gradient defined the prism center ’0’. In SCHISM, the density may be de-meaned
using a reference density profile: ρ′ = ρ − ρ(z). If some neighbors (1 or 2 or 3) do
not exist (i.e. boundary) or they are dry, then we impose the no-flux condition; e.g.,
7
if ’1’ is such an element then:
(r1, r2) · ~AB = 0 (33)
Eqs. (31-32) does not have a unique soln when e.g. the centroids 0,1,2 align
along a straightline, and in this case the associated eqs. are discarded. The final
soln is the average of (up to) 3 solns obtained from (0,1,2), (0,2,3) and (0,1,3) - note
that at least one set will have a unique soln.
For continuity eq, the calculated gradient can be directly used. The relevant
part is:
Gj
c = ∆t
∫
Ωj
F cdΩj − χ∆t2∫
Ωj
(f c)bdΩj (34)
F c = −g
ρ0
∫ η
−h
dz
∫ η
z
∇ρ′dζ (35)
∫
Ωj
F cdΩj = −g
ρ0Aj
Nz∑
m=kbe+1
∆zej,m[Nz∑
l=m+1
(∇ρ′)j,l∆zej,l + (∇ρ′)j,m∆z
ej,m/2](36)
∫
Ωj
(f c)bdΩj = −g
ρ0Aj
∫ η
zkbe+1
∇ρ′dζ = −g
ρ0Aj
Nz∑
l=kbe+2
(∇ρ′)j,l∆zej,l (37)
For momomentum eq, we need to calculate the b-clinic force at side cnters and
a whole level (cf. (52)). The density gradients at prism centers are therefore first
averaged to give density derivatives at side centers and half levels. At a side center,
the gradients at its 2 adjacent prisms are first interpolated vertically (using simple
linear interpolaton) to the same level as the side center, before a simple averaging
is used to calculate the gradient at the side. The integration in eq. (52) is then
calculated with ∇ρ′ being constant inside each vertical interval (zl−1, zl).
3.5.2 ELM transport
In this algorithm, the T,S, and densities are defined at whole levels and nodes
(and also sides, which are not used to compute the baroclinic head). Referring to
8
Fig. N4a, the density gradient can be reconstructed using 2 directional derivatives
supported by the stencil:
r1(x2 − x1) + r2(y2 − y1) = ρ′2 − ρ′1, (38)
r1(x4 − x3) + r2(y4 − y3) = ρ′4 − ρ′3, (39)
where (r1, r2) ≡ (∇ρ′)j is the density gradient at side j (at a particular whole level).
The eqs. above alsways have a unique solution since the determinant is ~l12 ×~l34.
Similar treatments are applied at the wet/dry interface or boundary sides as in
Upwind/TVD. After the gradient is found at a side, the integration in eq. (52) is
done using trapzoidal rule. The integrals (34) in the continuity eq. are evaluated
using trapzoidal rule and averaging over the element.
4 Momentum equation
After the surface elevation is solved, the momentum eq. is solved at each side center
and whole levels along the vertical:
Du
Dt= f − g∇η +
∂
∂z(ν∂u
∂z) (40)
ν∂u
∂z= τw at z = η (41)
ν∂u
∂z= χub at z = −h (42)
where f combines all explicit terms; other terms in eq. (40) are treated implicitly.
Note that since the Reynolds stress is constant in the bottom computational cell,
the last eq. (42) is applied at the top of the bottom cell:
ν∂u
∂z= χub at z = −h+ δb (43)
where δb is the thickness of the bottom cell.
9
Applying FEM to these equations leads to:∫ η
δb−h
ψl[un+1 −∆t
∂
∂z(ν∂un+1
∂z)]dz =
∫ η
δb−h
gψldz (44)
(l = kb + 1, ..., Nz) (45)
where ψ is the linear shape function (in the vertical), kb ≡ kbs is the bottom index
at a side, and Nz is the surface index (Fig. N3), and
g = u∗ +∆t[f − gθ∇ηn+1 − g(1− θ)∇ηn] (46)
where ∗ denote backtracked values.
The final FEM eqs. are:
∆zl+1
6(2un+1
l + un+1l+1 ) +
∆zl6
(2un+1l + un+1
l−1 ) + νl+1/2∆tun+1
l+1 − un+1l
∆zl+1
+
+νl−1/2∆tun+1
l − un+1l−1
∆zl=
∆zl+1
6(2gl + gl+1) +
∆zl6
(2gl + gl−1),
(l = kb + 2, ..., Nz − 1) (47)
∆zl+1
6(2un+1
l + un+1l+1 ) + νl+1/2∆t
un+1l+1 − un+1
l
∆zl+1
+∆tχun+1kb+1 =
=∆zl+1
6(2gl + gl+1), (l = kb + 1)
∆zl6
(2un+1l + un+1
l−1 ) + +νl−1/2∆tun+1
l − un+1l−1
∆zl= ∆tτ n+1
w +
+∆zl6
(2gl + gl−1), (l = Nz) (48)
where ∆zl = zl − zl−1.
Note that νl+1/2, evaluated at half levels, is not an aproximation but comes out
naturally thru integration (due to linear shape function). Since the viscosities are
defined at nodes, the side values are calculated using simple averaging.
After un+1 are solved from levels kb + 1 to Nz, the bottom velocity is:
un+1kb
= 0, if χ 6= 0, (49)
un+1kb
= un+1kb+1, if χ = 0, (50)
(51)
10
which is consistent with the bottom BL formulation we used.
The explicit term has serval components: Coriolis, atmospheric pressure gradi-
ent, tidal potential, horizontal viscosity, baroclinic head and wave radiation stress,
and possibly more from other modules:
f = −fk × u−1
ρ0∇pA + αg∇ψ +∇ · (µ∇u)−
g
ρ0
∫ η
z
∇ρdz +Rs (52)
Horizontal gradients are first calculated within each element, and the final side values
are averaged between its 2 adjacent elements. The horizontal gradients for atmo-
spheric pressure and tidal potential are 2D and therefore no vertical interpolation
is needed. For the horizontal viscosity and baroclinic head, some forms of vertical
interpolation are needed. The method used to calculate the baroclinic head has
been explained in Section (3.5); the viscosity term is mostly omitted in the model.
5 3D continuity equation to solve the vertical ve-
locity
We use Finite Volume method to solve the 3D continuity eq. (3), not only to
enforce volume conservation, but also serves as a foundation for mass conservation
(transport eqs).
The continuity eq. is solved prism-wise from bottom to surface; note that the
top and bottom faces of the prism are not necessarily horizontal, and so the normal
velocity there has horizontal components in it (cf. Fig. N3):
3∑
m=1
Pjs(i,m),lsi,mqjs(i,m),l + qjs(i,m),l+1
2+ Si,l+1(ui,l+1n
xl+1 + vi,l+1n
yl+1 + wi,l+1n
zl+1)−
Si,l(ui,lnxl + vi,ln
yl + wi,ln
zl ) = 0
(l = keb , ..., Nz − 1) (53)
where P and S are areas of vertical and ’horizontal’ faces of the prism, i is the element
11
number, js(i,m) is the side number, si,m is a sign related to the outer normal, keb
is the bottom index of the element, (nxl , n
yl , n
zl ) is the unit upward normal on the 2
’horizontal’ faces, q is the normal velocity at side (with positive direction following
internal convention of SCHISM, and thus the sign si,m), and (u, v) is the horizontal
velocity, averaged from 3 sidecenter velocities (which are the ’original’ velocities
defined in SCHISM), on 2 vertical faces. The vertical velocity is then solved from
bottom to surface starting from the bottom no-flux b.c.
Eq. (53) can be written in the following compact statement for volume conser-
vation:∑
j∈S+
|Qj| =∑
j∈S−
|Qj| (54)
where Q = unA is the flux (un being the outward normal vel.), A is the area of the
face, and S± are the out/inflow faces. This eq. simply states that the incoming and
outging fluxes must balance out against each other; this will be used in upwind/TVD
transport schemes.
6 SCHISM 2D
In this section, all 3D variables become depth-averaged, e.g., u is the depth-averaged
velocity. Also many terms drop out because there is no transport module in 2D; we’ll
only deal with barotropic mode. One new addition to SCHISM2D is the implicit
treatment of Coriolis force.
Let’s rewrite the eqs. in 2DH form:
∂η
∂t+ ∇ · (uH) = 0, (55)
Du
Dt= f − g∇η + f(v,−u) +
τw − χu
H(56)
f = −1
ρ0∇pA + αg∇ψ + fhd +Rs (57)
where we’ll neglect the horizontal viscosity fhd first, and Rs is the radiation stress
12
induced by waves. Note that χ is different from 3D case as it depends on the depth-
averaged vel., not the bottom vel, and the drag coefficient Cd is calculated using
e.g. Manning formulation (bfric=-1 in param.in). This is a fundamental difference
between SCHISM2D and SCHISM3D.
Semi-implicit discretization in time of (55) leads to:∫
Ω
φiηn+1 − ηn
∆tdΩ + θ[−
∫
Ω
∇φi · un+1HndΩ +
∫
Γv
φiHnun+1
n dΓv +
∫
Γv
φiHnun+1
n dΓv] +
+(1− θ)[−
∫
Ω
∇φi · unHndΩ +
∫
Γ
φiHnunndΓ] = 0 (58)
Semi-implicit discretization of (56) is:
un+1 − u∗
∆t= f
n+θ2f(v
n+1,−un+1)+(1−θ2)f(vn,−un)−gθ∇ηn+1−g(1−θ)∇ηn+
τ n+1w − χnun+1
Hn
(59)
where 0 ≤ θ2 ≤ 1 is the implicitness factor for Coriolis. We can solve for un+1:
un+1 =HHn(γx−gθ∆tηn+1
x )+θ2f(Hn)2∆t(γy−gθ∆tηn+1y )
∆
vn+1 =HHn(γy−gθ∆tηn+1
y )+θ2f(Hn)2∆t(γx−gθ∆tηn+1x )
∆
(60)
where
∆ = H2 + (θ2f∆tHn)2 (61)
H = Hn + χ∆t (62)
γ ≡ (γx, γy) = u∗ +∆tfn+
(1− θ2)f∆t(vn,−un)− g(1− θ)∆t∇ηn +
τ n+1w ∆t
Hn(63)
(64)
Note that H is the friction-enhanced depth (as opposed to friction-reduced depth in
3D). Eq. (60) can be written in a more compact form to isolate the implicit pressure
gradient term:
un+1 = γ −HHn
∆gθ∆t∇ηn+1 −
gθθ2f(Hn∆t)2
∆(ηn+1
y ,−ηn+1x ) (65)
γ =HHnγ + θ2f(H
n)2∆t(γy,−γx)
∆(66)
13
Substituting (65) into (58) gives:
︷ ︸︸ ︷∫
Ω
[φiηn+1 + gθ2∆t2
H(Hn)2
∆∇φi · ∇η
n+1 +(Hn∆t)3
∆gθ2θ
2f∇φi · (ηn+1y ,−ηn+1
x )]dΩ
=
︷ ︸︸ ︷∫
Ω
[φiηn + θHn∆t∇φi · γ + (1− θ)Hn∆t∇φi · u
n]dΩ
−θ∆t
︷ ︸︸ ︷∫
Γv
φiHnun+1
n dΓv −(1− θ)∆t
︷ ︸︸ ︷∫
Γ
φiHnunndΓ−θ∆t
︷ ︸︸ ︷∫
Γv
φiHnun+1
n dΓv
(i = 1, ..., Np) (67)
Comparing (67) to (14), the main difference is in the additional implicit part from
the Coriolis. Each integral can be evaluated in a similar way as in 3D.
7 Eulerian-Lagrangian method
So far we have said little about the backtracked values like u∗. These are calculated
in SCHISM via Eulerian-Lagrangian method (ELM).
8 Transport equation
The advection-diffusion-reaction eq. for a generic tracer T is:
DT
Dt=
∂
∂z(κ∂T
∂z) + Q, (68)
κ∂T
∂z= T , at z = η, (69)
κ∂T
∂z= Tb, at z = −h, (70)
where the total derivative is written in a conservative form:
D
Dt=
∂
∂t+∇ · (uT ) (71)
and the 3D velocity u is divergence free:
∇ · (u) = 0 (72)
14
Eq. (72) gives rise to the constancy condition for the transport equation i.e.
T = const initially will remain so in the absence of sinks/sources.
8.1 Upwind scheme
A F.V. discretization of eq. (68) for a prism shown in Fig. N3 is:
Tm+1i = Tm
i −∆t′
Vi
∑
j∈S
QjTj∗ + Qn+1i,k ∆t′ +
Ai∆t′
Vi[κi,k
Tm+1i,k+1 − Tm+1
i,k
∆zi,k+1/2
− κi,k−1
Tm+1i,k − Tm+1
i,k−1
∆zi,k−1/2
]
(k = keb + 1, ..., Nz) (73)
where ∆t′ 6= ∆t is the trasnport step (subject to Courant condition below), Vi is the
volume of the prism, Ti is a shorthand for Ti,k (i.e., concentration at prism (i, k)).
Note that we have treated the diffusion term implicitly. For the sake of brevity we’ll
drop the source and diffusion terms from now on and focus on the advection term,
where different methods diverge.
The upwind concentration is defined as:
Tj∗ ≡ Tj∗ =
Ti, j ∈ S+
Tj, j ∈ S−
(74)
where again we have used shorthand Tj for concentration at prism j (i.e. the prism
adjacent to (i, k) from face j).
Eq. (73) then becomes (only retaining the advective term):
Tm+1i = Tm
i −∆t′
Vi[∑
j∈S+
|Qj|Ti −∑
j∈S−
|Qj|Tj]
=
1−∆t′
Vi
∑
j∈S+
|Qj|
Ti +∆t′
Vi
∑
j∈S+
|Qj|Tj (75)
(T without superscript are evaluated at step m, i.e. explicitly). We have used the
15
volume conservation statement (54) here. Therefore the Courant condition is:
1−∆t′
Vi
∑
j∈S+
|Qj| ≥ 0 (76)
SCHISM uses this eq. to dynamically adjust time step for transport for each step.
Moreover, to improve efficiency, the vertical flux terms in (75) are treated implicitly,
and the corresponding terms are then removed in the Courant condition (76). This
is allowable because upwind is a linear method.
8.2 TVD scheme
The only difference between TVD and upwind schemes lies in the evaluation of the
interfacial concentation:
Tj∗ = Tj∗ +ϕj
2(TjD − Tj∗) (77)
where TjD is the downstream concentration, and 0 ≤ ϕj ≤ 2 is a limiter function.
TVD scheme nominally approaches 2nd order accuracy due to the anti-diffusion
term in (77).
The final eq. for TVD is:
Tm+1i = Tm
i +∆t′
Vi
∑
j∈S−
|Qj|(Tj − Ti) +
∆t′
Vi
∑
j∈S
|Qj|ϕj
2(Ti − Tj) + souce + diffusion (78)
and the Courant condition is (option ’AA’ in param.in):
∆t′ ≤Vi
∑
j∈S− |Qj|(1−ϕj
2+ δi)
(79)
where
δi =∑
p∈S+
ϕ(rp)
2rp, upwind ratio (80)
rp =
∑
m∈S− |Qm|(Tm − Ti)
|Qp|(Ti − Tp), p ∈ S+
i (81)
16
The 2nd eq. involves upwind of upwind neighboring prism.
In eqs. (78) and (79), the faces S, S+, and S− need to exclude the locations where
upwind is applied: all horizontal and vertical boundaries, and interfaces between
wetting and drying. In those places, ϕj = δi = 0.
Again SCHISM automatically calculates the time step according to the Courant
condition (79); the sub-time step used is the min. of all prisms. The choices for the
limiter function include: MINMOD, OSHER, van Leer, Super Bee etc.
Since TVD is a nonlinear method, we cannot treat the vertical fluxes implicitly,
and so all fluxes have to be treated explicitly. TVD method is therefore more
expensive than upwind. A hybrid upwind/TVD, with TVD being used in the deeper
depths and upwind in the shallow depths, has been implemented in SCHISM to
improve efficiency. The user can also manually specify upwind/TVD zones in the
domain via tvd.gr3.
8.3 Boundary conditions
In either upwiund or TVD schemes, the concentration at the neighboring prism Tj
at the open boundary is known. For outflow, Tj = Ti and the signal is advected out
of the domain without hindrance. For incoming flow, Tj is specified by the b.c., and
SCHISM nudges to this value with a relaxation constant, in order to prevent sharp
gradient there.
8.4 Interface for the generic tracer transport module
In SCHISM v4, it’s easy to use SCHISM’s generic tracer transport module by using
flag model=-1 in param.in. The 3 arrays in schism step.F90, bdy frc, f lx sf, flx bt
correspond to the source, surface/bottom b.c. in Eqs. (68-70). You may use
SCHISM’s conventional way of specifying i.c. (flag ic in param.in) or choose to
specify your own by modifying sections in schism init.F90.
17
9 Turbulence closure
We use Umlauf and Burchard’s generic length-scale model (itur=3 in param.in):
∆k
∆t=
∂
∂z
(
νΨk∂k
∂z
)
+ νtM2 + νθtN
2 − ǫ (82)
∆Ψ
∆t=
∂
∂z
(
νΨ∂Ψ
∂z
)
+Ψ
k(cΨ1νtM
2 + cΨ3νθtN
2 − cΨ2ǫFwall) (83)
with natural b.c.:
νΨk∂k∂z
= 0, at z = −h, or η
νΨ∂Ψ∂z
= κ0nνΨΨl, at z = −h
νΨ∂Ψ∂z
= −κ0nνΨΨl, at z = η
(84)
and essential b.c.:
k = (c0µ)−2ν|∂u
∂z|, at z = −h, or η
l = κ0∆
Ψ = (c0µ)pkm(κ0∆)n
(85)
where k is the TKE, l is the mixing length, cΨ∗ are some constants and Ψ = (c0µ)pkmln
is a generic length-scale variable. The turbulence production and dissipation terms
are:
M2 =
(∂u
∂z
)2
+
(∂v
∂z
)2
(86)
N2 =g
ρ0
∂ρ
∂z(87)
ǫ = (c0µ)3k1.5l−1 (88)
In the code, the natural b.c. is applied first (see the FEM formulation below), and
the essential b.c. is then used to overwrite the boundary values of the unknown, as
suggested by GOTM.
In the FEM formulation, k,Ψ are defined at nodes and whole levels. Furthermore,
the sums ofM2 and N2 are treated explicitly/implicitly depending on the sign. The
final eqs. look similar to those for the momentum eq.
18
h(Nz − l)
[∆zl+1
6(2kn+1
l + kn+1l+1 − 2knl − knl+1)−∆t(νΨk )
nl+1/2
kn+1l+1 − kn+1
l
∆zl+1
)
]
+
h(l − kb)
[∆zl6
(2kn+1l + kn+1
l−1 − 2knl − knl−1) + ∆t(νΨk )nl−1/2
kn+1l − kn+1
l−1
∆zl)
]
=
h(Nz − l)∆t
∆zl+1
2(νtM
2 + νθtN2)nl+1/2
∆zl+1
6(νtM
2 + νθtN2)nl+1/2
2kn+1
l +kn+1
l+1
knl+1/2
− (c0µ)
3(k0.5l−1)nl+1/2
∆zl+1
6(2kn+1
l + kn+1l+1 )
h(l − kb)∆t
∆zl2(νtM
2 + νθtN2)nl−1/2
∆zl6(νtM
2 + νθtN2)nl−1/2
2kn+1
l +kn+1
l−1
knl−1/2
− (c0µ)
3(k0.5l−1)nl−1/2
∆zl+1
6(2kn+1
l + kn+1l−1 )
(89)
h(Nz − l)
[∆zl+1
6(2Ψn+1
l +Ψn+1l+1 − 2Ψn
l −Ψnl+1)−∆t(νΨ)
nl+1/2
Ψn+1l+1 −Ψn+1
l
∆zl+1
)
]
+
h(l − kb)
[∆zl6
(2Ψn+1l +Ψn+1
l−1 − 2Ψnl −Ψn
l−1) + ∆t(νΨ)nl−1/2
Ψn+1l −Ψn+1
l−1
∆zl)
]
+
κ0n∆t[δl,Nz(νΨ/l)nNzΨn+1
Nz+ δl,kb(νΨ/l)
nkbΨ
n+1kb ] =
h(Nz − l)∆t
∆zl+1
2(cΨ1νtM
2 + cΨ3νθtN
2)nl+1/2(Ψ/k)nl+1/2
∆zl+1
6(cΨ1νtM
2 + cΨ3νθtN
2)nl+1/2
2Ψn+1
l +Ψn+1
l+1
knl+1/2
−(cΨ2(c0µ)
3k0.5l−1Fwall)nl+1/2
∆zl+1
6(2Ψn+1
l +Ψn+1l+1 )
]
+
h(l − kb)∆t
∆zl2(cΨ1νtM
2 + cΨ3νθtN
2)nl−1/2
∆zl6(νtM
2 + νθtN2)nl−1/2
2Ψn+1
l +Ψn+1
l−1
+knl−1/2
−(c0µ)3(k0.5l−1)nl−1/2
∆zl+1
6(2Ψn+1
l +Ψn+1l−1 )
]
(l = kb, ..., Nz) (90)
where ’’ indicates the alternative explicit/implicit schemes mentioned above, and
h(x) =
1, if x > 0
0, if x ≤ 0(91)
19
10 SCHISM on spherical coordinates
We used the approach of Comblen et al. (2009) and transform the coordinates
instead of the eqs. Since the unstructured grids work naturally on a sphere, the
polar simgularity is avoided. Most of the work is done inside local frames. There
are 5 frames used (cf. Fig. N5); note that all frames rotate with the earth.
(1) Global frame (Fig. N5a). The origin is located at center of the earth (assumed
to be a sphere) of radius R0, xg axis pointing to prime meridian, zg to the
north pole. The coordinates are related to the longitude and latitude of a
point on the spherical surface:
xg = R0 cosφ cosλ
yg = R0 cosφ sinλ
zg = R0 sinφ
(92)
with |φ| ≤ π/2,−π < λ ≤ π).
(2) Side frame (Fig. N1e). The origin is located at a side center and undisturbed
water surface (geoid), with zs axis verticall up (assumed to be radial direction
from earth center). The xs axis points from element (1) to (2) (in the code
is(i,1) to is(i,2)), and ys axis along the side. The transformation tensor between
global and this frame is sframe() in the code.
(3) Lon/lat frame (Fig. N5a). This frame is useful at any point on surface. The 3
axes of this frame are: λ0 (zonal), φ0 (meridional North), and r0 = λ0 × φ0
(radial). The relationship between this frame and global frame is:
λ0 = − sinλi+ cosλj (93)
φ0 = = − cosλ sinφi− sinλ sinφj + cosφk (94)
20
where ijk are unit vectors of the global frame. Strictly speaking this frame is
undefined at the 2 poles, but we can still use it there as long as the axes are
unique.
(4) Element and node frames. These are the particular instances of lon/lat frame,
with the origin located at a centroid or node. We also use planar instead of
spherical triangle for simplicity.
Further assumption is made that when the origins are close to each other, the z-axes
also coincide with each other, e.g. in the back-tracking part etc. This is reasonable
as the relevant distances are much smaller than R0.
With the aid from all these frames, the eqs. can be solved in a very similar way
to Section 3. The main difference is in the evaluation of the vectors; e.g., I4 should
be calculated within the elem. frame. The changes to the code is therefore minimal.
Below are some important info about arrays used in the code that are affected by
lon/lat frames.
(1) (xnd, ynd, znd), (xcj, ycj, zcj),(xctr, yctr, zctr) are global coordinates of node,
side and elem for ics=1 or 2. If ics=1 (Cartesian), znd = zcj = zctr = 0.
(2) znl, zs, ze are local z-coordinates measured vertically upward from the undis-
turbed surface (i.e. local frame when ics=2).
(3) eframe(1 : 3, 1 : 3, 1 : nea) is the tensor for the elem. frame (w.r.t. global
frame). The 2nd index indicates axid id (1=x; 2=y; 3=z) and the 1st index
indicates tensor components. sframe and pframe are similar.
The following arrays are defined in different frames if ics=2:
(1) In lat/lon frame: wind(), tau();
21
(2) In eframe: ufg, vfg, we, we fv, we. xel, yel: x, y coordinates of each node of an
elem. inside eframe; for ics=1, xel = xnd, yel = ynd; dl(1 : nea, 1 : 3, 1 : 2):
derivatives of shape function inside an element.
(3) In sframe: su2, sv2, sdbt;
(4) In pframe: uu2, vv2, ww2, dav.
10.1 Domain decomposition in lat/lon
Right now we use a stereographic projection to aid domain decomp. process. This
places a restriction that the south pole must not be included in the domain; this
restriction can be easily removed with other methods in the future if necessary.
The stereographic projection of a point on the sphere (P in Fig. N5b) is given
by the intersection between a line connecting the south pole and this point, and the
plane tangential to the sphere at the north pole (Fig. N5b). Therefore the global
coordinates of the projection are:
xP = 2R0 cosλ tan(π
4−φ
2) (95)
yP = 2R0 sinλ tan(π
4−φ
2) (96)
It’s easy to see that (1) the parallels are mapped to concentric circles around the
north pole, and (2) meridians are mapped to lines that pass thru the north pole.
The projection also preserves elem. orientation, i.e. counter-clockwise before and
after.
22
23