Skip to content

Commit 24791cd

Browse files
authored
Merge pull request #291 from FourierFlows/ncc/docstrings
Update/fix docstrings
2 parents 00b8ab3 + b697178 commit 24791cd

File tree

4 files changed

+128
-118
lines changed

4 files changed

+128
-118
lines changed

src/multilayerqg.jl

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ function Problem(nlayers::Int, # number of fluid layers
133133
end
134134

135135
"""
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
137137
138-
A struct containing the parameters for the MultiLayerQG problem. Included are:
138+
The parameters for the MultiLayerQG problem.
139139
140140
$(TYPEDFIELDS)
141141
"""
@@ -182,9 +182,9 @@ struct Params{T, Aphys3D, Aphys2D, Aphys1D, Atrans4D, Trfft} <: AbstractParams
182182
end
183183

184184
"""
185-
SingleLayerParams{T, Aphys3D, Aphys2D, Trfft}(β, U, eta, μ, ν, nν, calcFq!, Qx, Qy, rfftplan)
185+
struct SingleLayerParams{T, Aphys3D, Aphys2D, Trfft} <: AbstractParams
186186
187-
A struct containing the parameters for the SingleLayerQG problem. Included are:
187+
The parameters for the SingleLayerQG problem.
188188
189189
$(TYPEDFIELDS)
190190
"""
@@ -215,9 +215,9 @@ struct SingleLayerParams{T, Aphys3D, Aphys2D, Trfft} <: AbstractParams
215215
end
216216

217217
"""
218-
TwoLayerParams{T, Aphys3D, Aphys2D, Trfft}(g, f₀, β, ρ, H, U, eta, μ, ν, nν, calcFq!, g′, Qx, Qy, rfftplan)
218+
TwoLayerParams{T, Aphys3D, Aphys2D, Trfft} <: AbstractParams
219219
220-
A struct containing the parameters for the TwoLayerQG problem. Included are:
220+
The parameters for the TwoLayerQG problem.
221221
222222
$(TYPEDFIELDS)
223223
"""
@@ -378,7 +378,7 @@ end
378378
"""
379379
LinearEquation(dev, params, grid)
380380
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`.
382382
The linear opeartor ``L`` includes only (hyper)-viscosity and is computed via
383383
`hyperviscosity(dev, params, grid)`.
384384
@@ -393,7 +393,7 @@ end
393393
"""
394394
Equation(dev, params, grid)
395395
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`.
397397
The linear opeartor ``L`` includes only (hyper)-viscosity and is computed via
398398
`hyperviscosity(dev, params, grid)`.
399399
@@ -411,9 +411,9 @@ end
411411
# ----
412412

413413
"""
414-
Vars{Aphys, Atrans, F, P}(q, ψ, u, v, qh, , ψh, uh, vh, Fh, prevsol)
414+
struct Vars{Aphys, Atrans, F, P} <: AbstractVars
415415
416-
The variables for MultiLayer QG:
416+
The variables for MultiLayer QG.
417417
418418
$(FIELDS)
419419
"""
@@ -447,7 +447,7 @@ const StochasticForcedVars = Vars{<:AbstractArray, <:AbstractArray, <:AbstractAr
447447
"""
448448
DecayingVars(dev, grid, params)
449449
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`.
451451
"""
452452
function DecayingVars(dev::Dev, grid, params) where Dev
453453
T = eltype(grid)
@@ -462,7 +462,7 @@ end
462462
"""
463463
ForcedVars(dev, grid, params)
464464
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`.
466466
"""
467467
function ForcedVars(dev::Dev, grid, params) where Dev
468468
T = eltype(grid)
@@ -477,7 +477,7 @@ end
477477
"""
478478
StochasticForcedVars(dev, rid, params)
479479
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`.
481481
"""
482482
function StochasticForcedVars(dev::Dev, grid, params) where Dev
483483
T = eltype(grid)
@@ -620,7 +620,7 @@ end
620620
"""
621621
calcS!(S, Fp, Fm, nlayers, grid)
622622
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
624624
relate the ``q̂_j``'s and ``ψ̂_j``'s for every wavenumber: ``q̂_𝐤 = 𝕊_𝐤 ψ̂_𝐤``.
625625
"""
626626
function calcS!(S, Fp, Fm, nlayers, grid)
@@ -638,7 +638,7 @@ end
638638
"""
639639
calcS⁻¹!(S, Fp, Fm, nlayers, grid)
640640
641-
Constructs the array ``𝕊⁻¹``, which consists of `nlayer` x `nlayer` static arrays ``(𝕊_𝐤)⁻¹``
641+
Construct the array ``𝕊⁻¹``, which consists of `nlayer` x `nlayer` static arrays ``(𝕊_𝐤)⁻¹``
642642
that relate the ``q̂_j``'s and ``ψ̂_j``'s for every wavenumber: ``ψ̂_𝐤 = (𝕊_𝐤)⁻¹ q̂_𝐤``.
643643
"""
644644
function calcS⁻¹!(S⁻¹, Fp, Fm, nlayers, grid)
@@ -665,6 +665,7 @@ end
665665
calcN!(N, sol, t, clock, vars, params, grid)
666666
667667
Compute the nonlinear term, that is the advection term, the bottom drag, and the forcing:
668+
668669
```math
669670
N_j = - \\widehat{𝖩(ψ_j, q_j)} - \\widehat{U_j ∂_x Q_j} - \\widehat{U_j ∂_x q_j}
670671
+ \\widehat{(∂_y ψ_j)(∂_x Q_j)} - \\widehat{(∂_x ψ_j)(∂_y Q_j)} + δ_{j, n} μ |𝐤|^2 ψ̂_n + F̂_j .
@@ -688,6 +689,7 @@ end
688689
calcNlinear!(N, sol, t, clock, vars, params, grid)
689690
690691
Compute the nonlinear term of the linearized equations:
692+
691693
```math
692694
N_j = - \\widehat{U_j ∂_x Q_j} - \\widehat{U_j ∂_x q_j} + \\widehat{(∂_y ψ_j)(∂_x Q_j)}
693695
- \\widehat{(∂_x ψ_j)(∂_y Q_j)} + δ_{j, n} μ |𝐤|^2 ψ̂_n + F̂_j .
@@ -707,6 +709,7 @@ end
707709
calcN_advection!(N, sol, vars, params, grid)
708710
709711
Compute the advection term and stores it in `N`:
712+
710713
```math
711714
N_j = - \\widehat{𝖩(ψ_j, q_j)} - \\widehat{U_j ∂_x Q_j} - \\widehat{U_j ∂_x q_j}
712715
+ \\widehat{(∂_y ψ_j)(∂_x Q_j)} - \\widehat{(∂_x ψ_j)(∂_y Q_j)} .
@@ -755,6 +758,7 @@ end
755758
calcN_linearadvection!(N, sol, vars, params, grid)
756759
757760
Compute the advection term of the linearized equations and stores it in `N`:
761+
758762
```math
759763
N_j = - \\widehat{U_j ∂_x Q_j} - \\widehat{U_j ∂_x q_j}
760764
+ \\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
909913
potential energy of each fluid interface PE``_{3/2}, ...,`` PE``_{n-1/2}``, where ``n``
910914
is the number of layers in the fluid. (When ``n=1``, only the kinetic energy is returned.)
911915
912-
The kinetic energy at the ``j``-th fluid layer is
916+
The kinetic energy at the ``j``-th fluid layer is
917+
913918
```math
914919
𝖪𝖤_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 ,
915920
```
921+
916922
while the potential energy that corresponds to the interface ``j+1/2`` (i.e., the interface
917923
between the ``j``-th and ``(j+1)``-th fluid layer) is
924+
918925
```math
919926
𝖯𝖤_{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 .
920927
```
@@ -983,12 +990,15 @@ verticalfluxes``_{3/2},...,``verticalfluxes``_{n-1/2}``, where ``n`` is the tota
983990
(When ``n=1``, only the lateral fluxes are returned.)
984991
985992
The lateral eddy fluxes within the ``j``-th fluid layer are
993+
986994
```math
987995
\\textrm{lateralfluxes}_j = \\frac{H_j}{H} \\int U_j v_j ∂_y u_j
988996
\\frac{𝖽x 𝖽y}{L_x L_y} , \\ j = 1, ..., n ,
989997
```
998+
990999
while the vertical eddy fluxes at the ``j+1/2``-th fluid interface (i.e., interface between
9911000
the ``j``-th and ``(j+1)``-th fluid layer) are
1001+
9921002
```math
9931003
\\textrm{verticalfluxes}_{j+1/2} = \\int \\frac{f₀²}{g'_{j+1/2} H} (U_j - U_{j+1}) \\,
9941004
v_{j+1} ψ_{j} \\frac{𝖽x 𝖽y}{L_x L_y} , \\ j = 1, ..., n-1.

0 commit comments

Comments
 (0)