You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`examples/barotropicqg/ACConelayer.jl`: A script that simulates barotropic quasi-geostrophic flow above topography reproducing the results of the paper by
47
47
48
-
> Constantinou, N. C. (2018). A barotropic model of eddy saturation. *J. Phys. Oceanogr.*, **48 (2)**, 397-411
48
+
> Constantinou, N. C. (2018). A barotropic model of eddy saturation. *J. Phys. Oceanogr.*, **48 (2)**, 397-411.
For the unforced case ($f=0$) parameters AbstractType is build with `Params` and it includes:
45
+
-`nu`: Float; viscosity or hyperviscosity coefficient.
46
+
-`nnu`: Integer$>0$; the order of viscosity $n_\nu$. Case $n_\nu=1$ give normal viscosity.
47
+
-`mu`: Float; bottom drag or hypoviscosity coefficient.
48
+
-`nmu`: Integer$\ge 0$; the order of hypodrag $n_\mu$. Case $n_\mu=0$ give plain linear drag $\mu$.
49
+
50
+
For the forced case ($f\ne 0$) parameters AbstractType is build with `ForcedParams`. It includes all parameters in `Params` and additionally:
51
+
-`calcF!`: Function that calculates the forcing $\widehat{f}$
52
+
53
+
54
+
**Vars**
55
+
56
+
For the unforced case ($f=0$) variables AbstractType is build with `Vars` and it includes:
57
+
-`q`: Array of Floats; relative vorticity.
58
+
-`U`: Array of Floats; $x$-velocity, $u$.
59
+
-`V`: Array of Floats; $y$-velocity, $v$.
60
+
-`sol`: Array of Complex; the solution, $\widehat{q}$.
61
+
-`qh`: Array of Complex; the Fourier transform $\widehat{q}$.
62
+
-`Uh`: Array of Complex; the Fourier transform $\widehat{u}$.
63
+
-`Vh`: Array of Complex; the Fourier transform $\widehat{v}$.
64
+
65
+
For the forced case ($f\ne 0$) variables AbstractType is build with `ForcedVars`. It includes all variables in `Vars` and additionally:
66
+
-`Fh`: Array of Complex; the Fourier transform $\widehat{f}$.
67
+
-`prevsol`: Array of Complex; the values of the solution `sol` at the previous time-step (useful for calculating the work done by the forcing).
68
+
69
+
70
+
71
+
**`calcN!` function**
72
+
73
+
The nonlinear term $\mathcal{N}(\widehat{q})$ is computed via functions:
74
+
75
+
-`calcN_advection!`: computes $- \widehat{J(\psi, q)}$ and stores it in array `N`.
76
+
77
+
```julia
78
+
functioncalcN_advection!(N, sol, t, s, v, p, g)
79
+
@. v.Uh = im * g.l * g.invKKrsq * sol
80
+
@. v.Vh =-im * g.kr * g.invKKrsq * sol
81
+
@. v.qh = sol
82
+
83
+
A_mul_B!(v.U, g.irfftplan, v.Uh)
84
+
A_mul_B!s(v.V, g.irfftplan, v.Vh)
85
+
A_mul_B!(v.q, g.irfftplan, v.qh)
86
+
87
+
@. v.U *= v.q # U*q
88
+
@. v.V *= v.q # V*q
89
+
90
+
A_mul_B!(v.Uh, g.rfftplan, v.U) # \hat{U*q}
91
+
A_mul_B!(v.Vh, g.rfftplan, v.V) # \hat{U*q}
92
+
93
+
@. N =-im*g.kr*v.Uh - im*g.l*v.Vh
94
+
nothing
95
+
end
96
+
```
97
+
98
+
-`calcN_forced!`: computes $- \widehat{J(\psi, q)}$ via `calcN_advection!` and then adds to it the forcing $\widehat{f}$ computed via `calcF!` function. Also saves the solution $\widehat{q}$ of the previous time-step in array `prevsol`.
99
+
100
+
```julia
101
+
functioncalcN_forced!(N, sol, t, s, v, p, g)
102
+
calcN_advection!(N, sol, t, s, v, p, g)
103
+
if t == s.t # not a substep
104
+
v.prevsol .= s.sol # used to compute budgets when forcing is stochastic
105
+
p.calcF!(v.Fh, sol, t, s, v, p, g)
106
+
end
107
+
@. N += v.Fh
108
+
nothing
109
+
end
110
+
```
111
+
-`updatevars!`: uses `sol` to compute $q$, $u$, $v$, $\widehat{u}$, and $\widehat{v}$ and stores them into corresponding arrays of `Vars`/`ForcedVars`.
112
+
113
+
-`updatevars!`: uses `sol` to compute $q$, $u$, $v$, $\widehat{u}$, and $\widehat{v}$ and stores them into corresponding arrays of `Vars`/`ForcedVars`.
38
114
39
115
40
116
## Examples
41
117
42
118
-`examples/twodturb/McWilliams.jl`: A script that simulates decaying two-dimensional turbulence reproducing the results of the paper by
43
119
44
-
> McWilliams, J. C. (1984). The emergence of isolated coherent vortices in turbulent flow. *J. Fluid Mech.*, **146**, 21-43
120
+
> McWilliams, J. C. (1984). The emergence of isolated coherent vortices in turbulent flow. *J. Fluid Mech.*, **146**, 21-43.
45
121
46
-
-`examples/twodturb/IsotropicRingForcing.jl`: A script that simulates stochastically forced two-dimensional turbulence. The forcing is temporally delta-corraleted and its spatial structure is isotropic with power in a narrow annulus of total radius `kf` in wavenumber space.
122
+
-`examples/twodturb/IsotropicRingForcing.jl`: A script that simulates stochastically forced two-dimensional turbulence. The forcing is temporally delta-corraleted and its spatial structure is isotropic with power in a narrow annulus of total radius $k_f$ in wavenumber space.
0 commit comments