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
Add Documentation for Hydrostatic Balance and Ekman Layer 1D Column Examples
Hello,
following up on the idea I previously shared in the issue, I've added documentation [docs/src/examples.md](https://github.com/CliMA/ClimaCore.jl/blob/main/docs/src/examples.md) for the two 1D column examples: the hydrostatic balance and the Ekman layer.
Please let me know if this contribution aligns with your goals for the documentation or if any revisions are needed. I'd be happy to make changes!
Copy file name to clipboardExpand all lines: docs/src/examples.md
+183Lines changed: 183 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -99,6 +99,189 @@ This test case is set up in a 1D column domain ``z \in [0, 4\pi]``, discretized
99
99
* For tendencies 1 and 2 where the upwind biased operator ``UB`` is used, the left boundary is defined as ``sin(a - t)``. The right boundary is ``sin(b - t)``. Here ``a`` and ``b`` are the left and right bounds of the domain.
100
100
* For tendencies 3 and 4, where the advection operator ``A`` is used, the left boundary is defined as ``sin(-t)``. The right boundary is extrapolated, meaning its value is set to the closest interior point.
101
101
102
+
### Ekman Layer
103
+
104
+
The 1D vertical Ekman layer simulation in [`examples/column/ekman.jl`](https://github.com/CliMA/ClimaCore.jl/blob/main/examples/column/ekman.jl) demonstrates the simulation of atmospheric boundary layer dynamics, specifically the Ekman spiral phenomenon resulting from the balance between Coriolis force and vertical diffusion.
105
+
106
+
#### Equations and discretizations
107
+
108
+
#### Momentum
109
+
110
+
Follows the momentum equations with vertical diffusion and Coriolis force:
*`u`: _horizontal velocity (zonal or east-west component)_ measured in m/s.
129
+
*`v`: _horizontal velocity (meridional or north-south component)_ measured in m/s.
130
+
*`w`: _vertical velocity_ measured in m/s (manually set to zero in this example to disable vertical advection effects).
131
+
132
+
#### Differentiation operators
133
+
134
+
Because this is a 1D vertical problem, we utilize the staggered vertical grid with:
135
+
136
+
-``D`` is the [face-to-center divergence](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.DivergenceF2C) operator, called `divf2c` in the example code
137
+
-``G`` is the [center-to-face gradient](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.GradientC2F) operator, called `gradc2f` in the example code
138
+
-``A`` is the [center-to-center vertical advection](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.AdvectionC2C) operator, called `A` in the example code.
139
+
140
+
#### Problem flow and set-up
141
+
142
+
This test case is set up in a vertical column domain $[0, L]$ with height $L = 200\,\mathrm{m}$. The Coriolis parameter is set to $f = 5 \times 10^{-5}\,\mathrm{s}^{-1}$, the viscosity coefficient to $\nu = 0.01\,\mathrm{m}^2/\mathrm{s}$, and the geostrophic wind to $(u_g, v_g) = (1.0, 0.0)\,\mathrm{m/s}$.
143
+
144
+
The Ekman depth parameter is calculated as
145
+
$d = \sqrt{\dfrac{2\nu}{f}}$,
146
+
which determines the characteristic depth of the boundary layer.
147
+
148
+
The initial condition is set to a uniform wind profile equal to the geostrophic wind throughout the vertical column. The simulation is run for 50 hours to allow the boundary layer to develop fully.
149
+
150
+
Boundary conditions are applied as follows:
151
+
- At the top boundary: wind velocity equals the geostrophic wind $(u_g, v_g)$
152
+
- At the bottom boundary: drag condition proportional to the wind speed, where the surface stress is
The results demonstrate accurate capture of the characteristic Ekman spiral, where wind speed increases with height and wind direction rotates with increasing height until it aligns with the geostrophic wind.
176
+
177
+
178
+
### Hydrostatic Balance
179
+
180
+
The 1D Column hydrostatic balance example in [`examples/column/hydrostatic.jl`](https://github.com/CliMA/ClimaCore.jl/blob/main/examples/column/hydrostatic.jl) demonstrates the setup and maintenance of hydrostatic balance in a single vertical column using a finite difference discretization.
181
+
182
+
#### Equations and discretizations
183
+
184
+
##### Mass and Potential Temperature
185
+
186
+
The system maintains hydrostatic balance while solving the continuity equations for density and potential temperature density:
Where $B$ applies boundary conditions to enforce $\boldsymbol{w} = 0$ at the domain boundaries.
243
+
244
+
#### Prognostic variables
245
+
246
+
**$\rho$**: *Density*, measured in kg/m³, discretized at cell centers.
247
+
248
+
**$\rho\theta$**: *Potential temperature density*, measured in K·kg/m³, discretized at cell centers.
249
+
250
+
**$\boldsymbol{w}$**: *Vertical velocity*, measured in m/s, discretized at cell faces.
251
+
252
+
#### Operators
253
+
254
+
##### Reconstructions
255
+
256
+
**$I^f$** is the [center-to-face reconstruction](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.InterpolateC2F) operator, called `If` in the example code.
257
+
Currently this is implemented as the arithmetic mean.
258
+
259
+
##### Differentiation operators
260
+
261
+
**$D^c_v$** is the [face-to-center vertical divergence](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.DivergenceF2C), called `∂` in the example code.
262
+
This example uses zero vertical velocity at the top and bottom boundaries.
263
+
264
+
**$\nabla^f_v$** is the [center-to-face vertical gradient](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.GradientC2F), called `∂f` in the example code.
265
+
266
+
**$B$** is the [boundary operator](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.SetBoundaryOperator), called `B` in the example code.
267
+
This enforces zero vertical velocity at domain boundaries.
268
+
269
+
270
+
#### Problem flow and set-up
271
+
272
+
This test case is set up in a vertical column domain from $z=0$ m to $z=30$ km with 30 vertical elements. The column is initialized with a decaying temperature profile, where:
273
+
274
+
- The virtual temperature starts at $T_{\textrm{virt}\_\textrm{surf}} = 280$ K at the surface
275
+
- It asymptotically approaches $T_{\textrm{min}\_\textrm{ref}} = 230$ K with height
276
+
- The profile follows a hyperbolic tangent function with height
277
+
- The pressure follows a hydrostatic balance equation
278
+
- Density is calculated from the equation of state using virtual temperature and pressure
279
+
280
+
The initial vertical velocity is set to zero everywhere. To maintain hydrostatic balance, the discrete form computes iteratively the values of density that ensure the vertical pressure gradient balances gravity.
281
+
282
+
The simulation is run for 10 days to verify that the hydrostatic balance is maintained over time. Results are plotted showing density ($\rho$), vertical velocity ($\boldsymbol{w}$), and potential temperature density ($\rho\theta$) profiles.
0 commit comments