Skip to content

Commit 16d70f5

Browse files
authored
Add bib entry for Pauluis (2008) + few other fixes/code alignment (#51)
* add Pauluis2008 bib entry * alignment * lowercase * use bib citation * code alignment; order imports * [ after ( * fix rendering * code -> math * fix typo in p(T) * fix latex rendering and add definitions
1 parent 3016b85 commit 16d70f5

12 files changed

+81
-51
lines changed

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[deps]
2+
Breeze = "660aa2fb-d4c8-4359-a52c-9c057bc511da"
23
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
34
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
45
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"

docs/src/breeze.bib

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@ @article{Chammas2023
99
year = {2023}
1010
}
1111

12+
@article{Pauluis2008,
13+
author = {Olivier Pauluis},
14+
title = {Thermodynamic consistency of the anelastic approximation for a moist atmosphere},
15+
journal = {Journal of the Atmospheric Sciences},
16+
year = {2008},
17+
volume = {65},
18+
number = {8},
19+
doi = {10.1175/2007JAS2475.1},
20+
pages = {2719-2729},
21+
}
22+
1223
@book{Straka2009,
13-
place={Cambridge},
14-
title={Cloud and precipitation microphysics: Principles and parameterizations},
15-
publisher={Cambridge University Press},
16-
author={Straka, Jerry M.},
17-
year={2009},
18-
doi={10.1017/CBO9780511581168}
24+
place = {Cambridge},
25+
title = {Cloud and precipitation microphysics: Principles and parameterizations},
26+
publisher = {Cambridge University Press},
27+
author = {Straka, Jerry M.},
28+
year = {2009},
29+
doi = {10.1017/CBO9780511581168}
1930
}

docs/src/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Breeze provides two ways to simulate moist atmospheres:
1111

1212
* A [`MoistAirBuoyancy`](@ref) that can be used with [Oceananigans](https://clima.github.io/OceananigansDocumentation/stable/)' [`NonhydrostaticModel`](https://clima.github.io/OceananigansDocumentation/stable/appendix/library/#Oceananigans.Models.NonhydrostaticModels.NonhydrostaticModel-Tuple{}) to simulate atmospheric flows with the Boussinesq approximation.
1313

14-
* A prototype [`AtmosphereModel`](@ref Breeze.AtmosphereModels.AtmosphereModel) that uses the anelastic approximation following [Pauluis (2008)](https://journals.ametsoc.org/view/journals/atsc/65/8/200s7jas2475.1.xml).
14+
* A prototype [`AtmosphereModel`](@ref Breeze.AtmosphereModels.AtmosphereModel) that uses the anelastic approximation following [Pauluis2008](@citet).
1515

1616
## Installation
1717

@@ -26,7 +26,7 @@ Pkg.add("https://github.com/NumericalEarth/Breeze.jl.git")
2626

2727
A basic free convection simulation:
2828

29-
```@example intro
29+
```julia intro
3030
using Oceananigans
3131
using Oceananigans.Units
3232
using CairoMakie

src/AtmosphereModels/anelastic_formulation.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
using Oceananigans.Architectures: architecture
2-
using Oceananigans.Grids: inactive_cell
3-
using Oceananigans.Utils: prettysummary
4-
using Oceananigans.Operators: Δzᵃᵃᶜ, Δzᵃᵃᶠ, divᶜᶜᶜ
5-
using Oceananigans.Solvers: solve!
6-
71
using ..Thermodynamics:
82
AtmosphereThermodynamics,
93
ReferenceStateConstants,
@@ -13,6 +7,12 @@ using ..Thermodynamics:
137
mixture_heat_capacity,
148
dry_air_gas_constant
159

10+
using Oceananigans.Architectures: architecture
11+
using Oceananigans.Grids: inactive_cell
12+
using Oceananigans.Operators: Δzᵃᵃᶜ, Δzᵃᵃᶠ, divᶜᶜᶜ
13+
using Oceananigans.Solvers: solve!
14+
using Oceananigans.Utils: prettysummary
15+
1616
using KernelAbstractions: @kernel, @index
1717

1818
import Oceananigans.Solvers: tridiagonal_direction, compute_main_diagonal!, compute_lower_diagonal!

src/AtmosphereModels/atmosphere_model.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ using ..Thermodynamics:
99

1010
using Oceananigans
1111
using Oceananigans.Advection: Centered, adapt_advection_order
12-
using Oceananigans.Grids: ZDirection
13-
using Oceananigans.Models: AbstractModel
1412
using Oceananigans.Architectures: AbstractArchitecture
15-
using Oceananigans.TimeSteppers: TimeStepper
1613
using Oceananigans.BoundaryConditions: FieldBoundaryConditions, regularize_field_boundary_conditions
14+
using Oceananigans.Grids: ZDirection
15+
using Oceananigans.Models: AbstractModel
1716
using Oceananigans.Solvers: FourierTridiagonalPoissonSolver, HomogeneousNeumannFormulation
17+
using Oceananigans.TimeSteppers: TimeStepper
1818
using Oceananigans.Utils: launch!
1919

2020
using KernelAbstractions: @kernel, @index
@@ -81,10 +81,11 @@ end
8181
timestepper = :RungeKutta3)
8282
8383
Return an AtmosphereModel that uses the anelastic approximation following
84-
[Pauluis (2008)](https://journals.ametsoc.org/view/journals/atsc/65/8/200s7jas2475.1.xml).
84+
[Pauluis2008](@citet).
8585
8686
Example
8787
=======
88+
8889
```jldoctest
8990
julia> using Breeze, Breeze.AtmosphereModels, Oceananigans
9091
@@ -100,6 +101,11 @@ AtmosphereModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
100101
├── coriolis: Nothing
101102
└── microphysics: WarmPhaseSaturationAdjustment
102103
```
104+
105+
References
106+
==========
107+
Pauluis, O. (2008). Thermodynamic consistency of the anelastic approximation for a moist atmosphere.
108+
Journal of the Atmospheric Sciences 65, 2719–2729.
103109
"""
104110
function AtmosphereModel(grid;
105111
clock = Clock(grid),

src/AtmosphereModels/set_atmosphere_model.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import Oceananigans.Fields: set!
2-
using Oceananigans.TimeSteppers: update_state!
31
using Oceananigans.BoundaryConditions: fill_halo_regions!
42
using Oceananigans.Models.NonhydrostaticModels: compute_pressure_correction!, make_pressure_correction!
3+
using Oceananigans.TimeSteppers: update_state!
4+
5+
import Oceananigans.Fields: set!
56

67
function set!(model::AtmosphereModel; enforce_mass_conservation=true, kw...)
78
for (name, value) in kw
@@ -43,14 +44,14 @@ function set!(model::AtmosphereModel; enforce_mass_conservation=true, kw...)
4344
value = ρʳ * u
4445
end
4546

46-
set!(ϕ, value)
47+
set!(ϕ, value)
4748
fill_halo_regions!(ϕ, model.clock, fields(model))
4849
end
4950

5051
# Apply a mask
5152
# foreach(mask_immersed_field!, prognostic_fields(model))
5253
update_state!(model, compute_tendencies=false)
53-
54+
5455
if enforce_mass_conservation
5556
FT = eltype(model.grid)
5657
Δt = one(FT)

src/AtmosphereModels/update_atmosphere_model_state.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ using ..Thermodynamics:
33
mixture_heat_capacity,
44
mixture_gas_constant
55

6+
using Oceananigans.Architectures: architecture
67
using Oceananigans.BoundaryConditions: fill_halo_regions!, compute_x_bcs!, compute_y_bcs!, compute_z_bcs!
78
using Oceananigans.ImmersedBoundaries: mask_immersed_field!
8-
using Oceananigans.Architectures: architecture
99

10-
import Oceananigans.TimeSteppers: update_state!, compute_flux_bc_tendencies!
1110
import Oceananigans: fields, prognostic_fields
11+
import Oceananigans.TimeSteppers: update_state!, compute_flux_bc_tendencies!
1212

1313
const AnelasticModel = AtmosphereModel{<:AnelasticFormulation}
1414

@@ -113,7 +113,7 @@ function compute_tendencies!(model::AnelasticModel)
113113
model.momentum,
114114
model.coriolis,
115115
model.clock,
116-
fields(model))
116+
fields(model))
117117

118118
pₕ′ = model.hydrostatic_pressure_anomaly
119119
ρᵣ = model.formulation.reference_density
@@ -178,7 +178,7 @@ end
178178
hydrostatic_pressure_anomaly)
179179

180180
# Note: independent of x
181-
ρᵣ = @inbounds reference_density[i, j, k]
181+
ρᵣ = @inbounds reference_density[i, j, k]
182182

183183
return ( - div_𝐯u(i, j, k, grid, advection, velocities, momentum.ρu)
184184
- x_f_cross_U(i, j, k, grid, coriolis, momentum)
@@ -198,7 +198,7 @@ end
198198
hydrostatic_pressure_anomaly)
199199

200200
# Note: independent of y
201-
ρᵣ = @inbounds reference_density[i, j, k]
201+
ρᵣ = @inbounds reference_density[i, j, k]
202202

203203
return ( - div_𝐯v(i, j, k, grid, advection, velocities, momentum.ρv)
204204
- y_f_cross_U(i, j, k, grid, coriolis, momentum)
@@ -222,7 +222,7 @@ end
222222

223223
ρᵣᶜᶜᶠ = ℑzᵃᵃᶠ(i, j, k, grid, reference_density)
224224
bᶜᶜᶠ = ℑzᵃᵃᶠ(i, j, k, grid, buoyancy,
225-
formulation, temperature, specific_humidity, thermo)
225+
formulation, temperature, specific_humidity, thermo)
226226

227227
return ( - div_𝐯w(i, j, k, grid, advection, velocities, momentum.ρw)
228228
- z_f_cross_U(i, j, k, grid, coriolis, momentum)
@@ -259,10 +259,10 @@ end
259259
+ forcing(i, j, k, grid, clock, model_fields))
260260
end
261261
=#
262-
262+
263263
""" Apply boundary conditions by adding flux divergences to the right-hand-side. """
264264
function compute_flux_bc_tendencies!(model::AtmosphereModel)
265-
265+
266266
Gⁿ = model.timestepper.Gⁿ
267267
arch = model.architecture
268268
clock = model.clock

src/AtmosphereModels/update_hydrostatic_pressure.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
##### update pressure
33
#####
44

5-
using Oceananigans.Operators: Δzᶜᶜᶜ, Δzᶜᶜᶠ, ℑzᵃᵃᶠ
5+
using Oceananigans.Grids: topology, XFlatGrid, YFlatGrid
66
using Oceananigans.ImmersedBoundaries: PartialCellBottom, ImmersedBoundaryGrid
7-
using Oceananigans.Grids: topology
8-
using Oceananigans.Grids: XFlatGrid, YFlatGrid
7+
using Oceananigans.Operators: Δzᶜᶜᶜ, Δzᶜᶜᶠ, ℑzᵃᵃᶠ
98
using Oceananigans.Utils: KernelParameters
109

1110
const c = Center()

src/Thermodynamics/Thermodynamics.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module Thermodynamics
22

3-
export AtmosphereThermodynamics, ReferenceStateConstants, IdealGas, PhaseTransitionConstants, CondensedPhase, mixture_gas_constant, mixture_heat_capacity
3+
export AtmosphereThermodynamics, ReferenceStateConstants, IdealGas,
4+
PhaseTransitionConstants, CondensedPhase,
5+
mixture_gas_constant, mixture_heat_capacity
46

57
include("atmosphere_thermodynamics.jl")
68
include("vapor_saturation.jl")

src/Thermodynamics/atmosphere_thermodynamics.jl

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,27 +160,30 @@ end
160160
161161
Create `AtmosphereThermodynamics` with parameters that represent gaseous mixture of dry "air"
162162
and vapor, as well as condensed liquid and solid phases.
163-
The `triple_point_temperature` and `triple_point_pressure` may be combined with
163+
The `triple_point_temperature` and `triple_point_pressure` may be combined with
164164
internal energy parameters for condensed phases to compute the vapor pressure
165165
at the boundary between vapor and a homogeneous sample of the condensed phase.
166166
The `gravitational_acceleration` parameter is included to compute reference_state
167167
quantities associated with hydrostatic balance.
168168
169-
The Clausius-Clapeyron relation describes the pressure-temperature relationship during phase transitions:
169+
The Clausius-Clapeyron relation describes the pressure-temperature relationship during phase
170+
transitions:
170171
171-
d/dT log(pⁱ⁺) = ℒⁱ / (Rⁱ * T²)
172+
```math
173+
d[\\log(pⁱ⁺)] / dT = ℒⁱ / (Rⁱ T²)
174+
```
172175
173176
where:
174177
175-
- `pⁱ⁺` is the saturation vapor pressure for a transition between vapor and the `ⁱ`th phase
176-
- `T` is temperature
177-
- `ℒⁱ` is the latent heat of vaporization
178-
- `Rⁱ` is the specific gas constant for the `ⁱ`th phase
178+
- ``pⁱ⁺`` is the saturation vapor pressure for a transition between vapor and the ``i``-th phase
179+
- ``T`` is temperature
180+
- ``ℒⁱ`` is the latent heat of vaporization
181+
- ``Rⁱ`` is the specific gas constant for the ``i``-th phase
179182
180183
For water vapor, this integrates to:
181184
182185
```math
183-
pⁱ⁺ = pᵗʳ * exp( ℒⁱ (1/Tᵗʳ - 1/T) / Rⁱ )
186+
pⁱ⁺ = pᵗʳ \\exp[ ℒⁱ (1/Tᵗʳ - 1/T) / Rⁱ ]
184187
```
185188
186189
where
@@ -191,7 +194,6 @@ where
191194
Note: any reference values for pressure and temperature can be used in principle.
192195
The advantage of using reference values at the triple point is that the same values
193196
can then be used for both condensation (vapor → liquid) and deposition (vapor → ice).
194-
195197
"""
196198
function AtmosphereThermodynamics(FT = Oceananigans.defaults.FloatType;
197199
molar_gas_constant = 8.314462618,
@@ -234,7 +236,7 @@ const NonCondensingAtmosphereThermodynamics{FT} = AtmosphereThermodynamics{FT, N
234236
"""
235237
mixture_gas_constant(q, thermo)
236238
237-
Compute the gas constant of moist air given the specific humidity `q` and
239+
Compute the gas constant of moist air given the specific humidity `q` and
238240
thermodynamic parameters `thermo`.
239241
240242
The mixture gas constant is calculated as a weighted average of the dry air
@@ -246,7 +248,7 @@ R_m = R_d (1 - q) + R_v q
246248
247249
where:
248250
- `R_d` is the dry air gas constant
249-
- `R_v` is the water vapor gas constant
251+
- `R_v` is the water vapor gas constant
250252
- `q` is the specific humidity (mass fraction of water vapor)
251253
252254
# Arguments

0 commit comments

Comments
 (0)