Skip to content

Add documentation for 1D Column Hydrostatic Balance and Ekman Layer examplesExpdoc #2325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Snowdog85123
Copy link

They complement the existing 1D column examples and provide more atmospheric physics use cases.

This new PR replaces the previous one and includes only the intended changes.

  • Code follows the style guidelines OR N/A.
  • Unit tests are included OR N/A.
  • Code is exercised in an integration test OR N/A.
  • Documentation has been added/updated OR N/A.

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!
Add 1D Column Examples for Hydrostatic Balance and Ekman Layer
@Snowdog85123
Copy link
Author

@valeriabarra I've reordered the examples and removed the root-level file as requested. Please let me know if anything else needs adjustment.

The application of boundary conditions is implemented through the operators:

1. For the u-momentum equation:
- Top boundary: `Operators.SetValue(FT(ug))` sets u to the geostrophic value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Top boundary: `Operators.SetValue(FT(ug))` sets u to the geostrophic value
- Top boundary: `Operators.SetValue(FT(ug))` sets $u$ to the geostrophic value

- Bottom boundary: `Operators.SetValue(Geometry.WVector(Cd * u_wind * u_1))` applies the drag condition

2. For the v-momentum equation:
- Top boundary: `Operators.SetValue(FT(vg))` sets v to the geostrophic value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Top boundary: `Operators.SetValue(FT(vg))` sets v to the geostrophic value
- Top boundary: `Operators.SetValue(FT(vg))` sets $v$ to the geostrophic value

- Top boundary: `Operators.SetValue(FT(vg))` sets v to the geostrophic value
- Bottom boundary: `Operators.SetValue(Geometry.WVector(Cd * u_wind * v_1))` applies the drag condition

3. DSS (Direct Stiffness Summation) is applied implicitly through the operators to ensure continuity of the solution at element boundaries and reduction of unnecessary multiplicity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. DSS (Direct Stiffness Summation) is applied implicitly through the operators to ensure continuity of the solution at element boundaries and reduction of unnecessary multiplicity


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:

- The virtual temperature starts at $T_{virt\_surf} = 280$ K at the surface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- The virtual temperature starts at $T_{virt\_surf} = 280$ K at the surface
- The virtual temperature starts at $T_{\textrm{virt}\_\textrm{surf}} = 280$ K at the surface

Please double check that the suggested \textrm syntax works as intended in the subscript mode.
Also, please post screenshot of the rendered built docs to ease reviews. Thank you

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:

- The virtual temperature starts at $T_{virt\_surf} = 280$ K at the surface
- It asymptotically approaches $T_{min\_ref} = 230$ K with height
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- It asymptotically approaches $T_{min\_ref} = 230$ K with height
- It asymptotically approaches $T_{\textrm{min}\_\textrm{ref}} = 230$ K with height

Same as above. Thank yoy

@Snowdog85123
Copy link
Author

screenshot of the rendered built docs:
截屏2025-05-15 21 26 47
截屏2025-05-15 21 27 32
截屏2025-05-15 21 27 22
截屏2025-05-15 21 27 10
截屏2025-05-15 21 26 59

Comment on lines 121 to 122
\frac{\partial u}{\partial t} &\approx D_{f2c}\left(\nu G_{c2f}(u)\right) + f(v - v_g) - A(w, u) \\
\frac{\partial v}{\partial t} &\approx D_{f2c}\left(\nu G_{c2f}(v)\right) - f(u - u_g) - A(w, v)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Snowdog85123 , it is best to keep consistent notation with the rest of the document (see examples above and below yours already present in the file) . Hence, here it is best to not use the subscripts specifications for c2f and f2c, as they are explained below anyways.

Suggested change
\frac{\partial u}{\partial t} &\approx D_{f2c}\left(\nu G_{c2f}(u)\right) + f(v - v_g) - A(w, u) \\
\frac{\partial v}{\partial t} &\approx D_{f2c}\left(\nu G_{c2f}(v)\right) - f(u - u_g) - A(w, v)
\frac{\partial u}{\partial t} &\approx D\left(\nu G(u)\right) + f(v - v_g) - A(w, u) \\
\frac{\partial v}{\partial t} &\approx D\left(\nu G(v)\right) - f(u - u_g) - A(w, v)

Comment on lines 136 to 137
- `G_{c2f}` is the [gradient operator from cell centers to faces](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.GradientC2F), called `gradc2f` in the example code.
- `D_{f2c}` is the [divergence operator from faces to centers](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.DivergenceF2C), called `divf2c` in the example code.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to my above comment.

Suggested change
- `G_{c2f}` is the [gradient operator from cell centers to faces](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.GradientC2F), called `gradc2f` in the example code.
- `D_{f2c}` is the [divergence operator from faces to centers](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.DivergenceF2C), called `divf2c` in the example code.
- ``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
- ``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


- `G_{c2f}` is the [gradient operator from cell centers to faces](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.GradientC2F), called `gradc2f` in the example code.
- `D_{f2c}` is the [divergence operator from faces to centers](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.DivergenceF2C), called `divf2c` in the example code.
- `A` is the [advection operator](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.AdvectionC2C), called `A` in the example code.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `A` is the [advection operator](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.AdvectionC2C), called `A` in the example code.
- ``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.


##### Reconstructions

**$I^f$** is the [center-to-face reconstruction operator](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.InterpolateC2F), called `If` in the example code.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**$I^f$** is the [center-to-face reconstruction operator](https://clima.github.io/ClimaCore.jl/stable/operators/#ClimaCore.Operators.InterpolateC2F), called `If` in the example code.
**$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.

@Snowdog85123
Copy link
Author

Hi @valeriabarra , I just modified as you suggested.
截屏2025-05-17 15 21 26
截屏2025-05-17 15 21 59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants