@@ -133,9 +133,9 @@ function Problem(nlayers::Int, # number of fluid layers
133
133
end
134
134
135
135
"""
136
- Params{T, Aphys3D, Aphys2D, Aphys1D, Atrans4D, Trfft}(nlayers, g, f₀, β, ρ, H, U, eta, μ, ν, nν, calcFq!, g′, Qx, Qy, S, S⁻¹, rfftplan)
136
+ struct Params{T, Aphys3D, Aphys2D, Aphys1D, Atrans4D, Trfft} <: AbstractParams
137
137
138
- A struct containing the parameters for the MultiLayerQG problem. Included are:
138
+ The parameters for the MultiLayerQG problem.
139
139
140
140
$(TYPEDFIELDS)
141
141
"""
@@ -182,9 +182,9 @@ struct Params{T, Aphys3D, Aphys2D, Aphys1D, Atrans4D, Trfft} <: AbstractParams
182
182
end
183
183
184
184
"""
185
- SingleLayerParams{T, Aphys3D, Aphys2D, Trfft}(β, U, eta, μ, ν, nν, calcFq!, Qx, Qy, rfftplan)
185
+ struct SingleLayerParams{T, Aphys3D, Aphys2D, Trfft} <: AbstractParams
186
186
187
- A struct containing the parameters for the SingleLayerQG problem. Included are:
187
+ The parameters for the SingleLayerQG problem.
188
188
189
189
$(TYPEDFIELDS)
190
190
"""
@@ -215,9 +215,9 @@ struct SingleLayerParams{T, Aphys3D, Aphys2D, Trfft} <: AbstractParams
215
215
end
216
216
217
217
"""
218
- TwoLayerParams{T, Aphys3D, Aphys2D, Trfft}(g, f₀, β, ρ, H, U, eta, μ, ν, nν, calcFq!, g′, Qx, Qy, rfftplan)
218
+ TwoLayerParams{T, Aphys3D, Aphys2D, Trfft} <: AbstractParams
219
219
220
- A struct containing the parameters for the TwoLayerQG problem. Included are:
220
+ The parameters for the TwoLayerQG problem.
221
221
222
222
$(TYPEDFIELDS)
223
223
"""
378
378
"""
379
379
LinearEquation(dev, params, grid)
380
380
381
- Return the ` equation` for a multi-layer quasi-geostrophic problem with `params` and `grid`.
381
+ Return the equation for a multi-layer quasi-geostrophic problem with `params` and `grid`.
382
382
The linear opeartor ``L`` includes only (hyper)-viscosity and is computed via
383
383
`hyperviscosity(dev, params, grid)`.
384
384
393
393
"""
394
394
Equation(dev, params, grid)
395
395
396
- Return the ` equation` for a multi-layer quasi-geostrophic problem with `params` and `grid`.
396
+ Return the equation for a multi-layer quasi-geostrophic problem with `params` and `grid`.
397
397
The linear opeartor ``L`` includes only (hyper)-viscosity and is computed via
398
398
`hyperviscosity(dev, params, grid)`.
399
399
411
411
# ----
412
412
413
413
"""
414
- Vars{Aphys, Atrans, F, P}(q, ψ, u, v, qh, , ψh, uh, vh, Fh, prevsol)
414
+ struct Vars{Aphys, Atrans, F, P} <: AbstractVars
415
415
416
- The variables for MultiLayer QG:
416
+ The variables for MultiLayer QG.
417
417
418
418
$(FIELDS)
419
419
"""
@@ -447,7 +447,7 @@ const StochasticForcedVars = Vars{<:AbstractArray, <:AbstractArray, <:AbstractAr
447
447
"""
448
448
DecayingVars(dev, grid, params)
449
449
450
- Return the vars for unforced multi-layer QG problem with `grid` and `params`.
450
+ Return the variables for an unforced multi-layer QG problem with `grid` and `params`.
451
451
"""
452
452
function DecayingVars (dev:: Dev , grid, params) where Dev
453
453
T = eltype (grid)
462
462
"""
463
463
ForcedVars(dev, grid, params)
464
464
465
- Return the vars for forced multi-layer QG problem with `grid` and `params`.
465
+ Return the variables for a forced multi-layer QG problem with `grid` and `params`.
466
466
"""
467
467
function ForcedVars (dev:: Dev , grid, params) where Dev
468
468
T = eltype (grid)
477
477
"""
478
478
StochasticForcedVars(dev, rid, params)
479
479
480
- Return the vars for forced multi-layer QG problem with `grid` and `params`.
480
+ Return the variables for a forced multi-layer QG problem with `grid` and `params`.
481
481
"""
482
482
function StochasticForcedVars (dev:: Dev , grid, params) where Dev
483
483
T = eltype (grid)
620
620
"""
621
621
calcS!(S, Fp, Fm, nlayers, grid)
622
622
623
- Constructs the array ``𝕊``, which consists of `nlayer` x `nlayer` static arrays ``𝕊_𝐤`` that
623
+ Construct the array ``𝕊``, which consists of `nlayer` x `nlayer` static arrays ``𝕊_𝐤`` that
624
624
relate the ``q̂_j``'s and ``ψ̂_j``'s for every wavenumber: ``q̂_𝐤 = 𝕊_𝐤 ψ̂_𝐤``.
625
625
"""
626
626
function calcS! (S, Fp, Fm, nlayers, grid)
638
638
"""
639
639
calcS⁻¹!(S, Fp, Fm, nlayers, grid)
640
640
641
- Constructs the array ``𝕊⁻¹``, which consists of `nlayer` x `nlayer` static arrays ``(𝕊_𝐤)⁻¹``
641
+ Construct the array ``𝕊⁻¹``, which consists of `nlayer` x `nlayer` static arrays ``(𝕊_𝐤)⁻¹``
642
642
that relate the ``q̂_j``'s and ``ψ̂_j``'s for every wavenumber: ``ψ̂_𝐤 = (𝕊_𝐤)⁻¹ q̂_𝐤``.
643
643
"""
644
644
function calcS⁻¹! (S⁻¹, Fp, Fm, nlayers, grid)
665
665
calcN!(N, sol, t, clock, vars, params, grid)
666
666
667
667
Compute the nonlinear term, that is the advection term, the bottom drag, and the forcing:
668
+
668
669
```math
669
670
N_j = - \\ widehat{𝖩(ψ_j, q_j)} - \\ widehat{U_j ∂_x Q_j} - \\ widehat{U_j ∂_x q_j}
670
671
+ \\ widehat{(∂_y ψ_j)(∂_x Q_j)} - \\ widehat{(∂_x ψ_j)(∂_y Q_j)} + δ_{j, n} μ |𝐤|^2 ψ̂_n + F̂_j .
688
689
calcNlinear!(N, sol, t, clock, vars, params, grid)
689
690
690
691
Compute the nonlinear term of the linearized equations:
692
+
691
693
```math
692
694
N_j = - \\ widehat{U_j ∂_x Q_j} - \\ widehat{U_j ∂_x q_j} + \\ widehat{(∂_y ψ_j)(∂_x Q_j)}
693
695
- \\ widehat{(∂_x ψ_j)(∂_y Q_j)} + δ_{j, n} μ |𝐤|^2 ψ̂_n + F̂_j .
707
709
calcN_advection!(N, sol, vars, params, grid)
708
710
709
711
Compute the advection term and stores it in `N`:
712
+
710
713
```math
711
714
N_j = - \\ widehat{𝖩(ψ_j, q_j)} - \\ widehat{U_j ∂_x Q_j} - \\ widehat{U_j ∂_x q_j}
712
715
+ \\ widehat{(∂_y ψ_j)(∂_x Q_j)} - \\ widehat{(∂_x ψ_j)(∂_y Q_j)} .
755
758
calcN_linearadvection!(N, sol, vars, params, grid)
756
759
757
760
Compute the advection term of the linearized equations and stores it in `N`:
761
+
758
762
```math
759
763
N_j = - \\ widehat{U_j ∂_x Q_j} - \\ widehat{U_j ∂_x q_j}
760
764
+ \\ widehat{(∂_y ψ_j)(∂_x Q_j)} - \\ widehat{(∂_x ψ_j)(∂_y Q_j)} .
@@ -909,12 +913,15 @@ Return the kinetic energy of each fluid layer KE``_1, ...,`` KE``_{n}``, and the
909
913
potential energy of each fluid interface PE``_{3/2}, ...,`` PE``_{n-1/2}``, where ``n``
910
914
is the number of layers in the fluid. (When ``n=1``, only the kinetic energy is returned.)
911
915
912
- The kinetic energy at the ``j``-th fluid layer is
916
+ The kinetic energy at the ``j``-th fluid layer is
917
+
913
918
```math
914
919
𝖪𝖤_j = \\ frac{H_j}{H} \\ int \\ frac1{2} |{\\ bf ∇} ψ_j|^2 \\ frac{𝖽x 𝖽y}{L_x L_y} = \\ frac1{2} \\ frac{H_j}{H} \\ sum_{𝐤} |𝐤|² |ψ̂_j|², \\ j = 1, ..., n ,
915
920
```
921
+
916
922
while the potential energy that corresponds to the interface ``j+1/2`` (i.e., the interface
917
923
between the ``j``-th and ``(j+1)``-th fluid layer) is
924
+
918
925
```math
919
926
𝖯𝖤_{j+1/2} = \\ int \\ frac1{2} \\ frac{f₀^2}{g'_{j+1/2} H} (ψ_j - ψ_{j+1})^2 \\ frac{𝖽x 𝖽y}{L_x L_y} = \\ frac1{2} \\ frac{f₀^2}{g'_{j+1/2} H} \\ sum_{𝐤} |ψ̂_j - ψ̂_{j+1}|², \\ j = 1, ..., n-1 .
920
927
```
@@ -983,12 +990,15 @@ verticalfluxes``_{3/2},...,``verticalfluxes``_{n-1/2}``, where ``n`` is the tota
983
990
(When ``n=1``, only the lateral fluxes are returned.)
984
991
985
992
The lateral eddy fluxes within the ``j``-th fluid layer are
993
+
986
994
```math
987
995
\\ textrm{lateralfluxes}_j = \\ frac{H_j}{H} \\ int U_j v_j ∂_y u_j
988
996
\\ frac{𝖽x 𝖽y}{L_x L_y} , \\ j = 1, ..., n ,
989
997
```
998
+
990
999
while the vertical eddy fluxes at the ``j+1/2``-th fluid interface (i.e., interface between
991
1000
the ``j``-th and ``(j+1)``-th fluid layer) are
1001
+
992
1002
```math
993
1003
\\ textrm{verticalfluxes}_{j+1/2} = \\ int \\ frac{f₀²}{g'_{j+1/2} H} (U_j - U_{j+1}) \\ ,
994
1004
v_{j+1} ψ_{j} \\ frac{𝖽x 𝖽y}{L_x L_y} , \\ j = 1, ..., n-1.
0 commit comments