9191liquid_water (FT) = CondensedPhase (FT; latent_heat= 2500800 , heat_capacity= 4181 )
9292water_ice (FT) = CondensedPhase (FT; latent_heat= 2834000 , heat_capacity= 2108 )
9393
94- struct AtmosphereThermodynamics {FT, C, S}
94+ struct ThermodynamicConstants {FT, C, S}
9595 molar_gas_constant :: FT
9696 gravitational_acceleration :: FT
9797 energy_reference_temperature :: FT
@@ -103,9 +103,9 @@ struct AtmosphereThermodynamics{FT, C, S}
103103 solid :: S
104104end
105105
106- Base. summary (at:: AtmosphereThermodynamics {FT} ) where FT = " AtmosphereThermodynamics {$FT }"
106+ Base. summary (at:: ThermodynamicConstants {FT} ) where FT = " ThermodynamicConstants {$FT }"
107107
108- function Base. show (io:: IO , at:: AtmosphereThermodynamics )
108+ function Base. show (io:: IO , at:: ThermodynamicConstants )
109109 print (io, summary (at), " :" , ' \n ' ,
110110 " ├── molar_gas_constant: " , at. molar_gas_constant, " \n " ,
111111 " ├── gravitational_acceleration: " , at. gravitational_acceleration, " \n " ,
@@ -118,9 +118,9 @@ function Base.show(io::IO, at::AtmosphereThermodynamics)
118118 " └── solid: " , at. solid)
119119end
120120
121- Base. eltype (:: AtmosphereThermodynamics {FT} ) where FT = FT
121+ Base. eltype (:: ThermodynamicConstants {FT} ) where FT = FT
122122
123- function Adapt. adapt_structure (to, thermo:: AtmosphereThermodynamics )
123+ function Adapt. adapt_structure (to, thermo:: ThermodynamicConstants )
124124 molar_gas_constant = adapt (to, thermo. molar_gas_constant)
125125 gravitational_acceleration = adapt (to, thermo. gravitational_acceleration)
126126 dry_air = adapt (to, thermo. dry_air)
@@ -133,38 +133,37 @@ function Adapt.adapt_structure(to, thermo::AtmosphereThermodynamics)
133133 FT = typeof (molar_gas_constant)
134134 C = typeof (liquid)
135135 S = typeof (solid)
136- return AtmosphereThermodynamics {FT, C, S} (molar_gas_constant,
137- gravitational_acceleration,
138- energy_reference_temperature,
139- triple_point_temperature,
140- triple_point_pressure,
141- dry_air,
142- vapor,
143- liquid,
144- solid)
136+ return ThermodynamicConstants {FT, C, S} (molar_gas_constant,
137+ gravitational_acceleration,
138+ energy_reference_temperature,
139+ triple_point_temperature,
140+ triple_point_pressure,
141+ dry_air,
142+ vapor,
143+ liquid,
144+ solid)
145145end
146146
147147"""
148- AtmosphereThermodynamics(FT = Oceananigans.defaults.FloatType;
149- gravitational_acceleration = 9.81,
150- molar_gas_constant = 8.314462618,
151- energy_reference_temperature = 273.16,
152- triple_point_temperature = 273.16,
153- triple_point_pressure = 611.657,
154- dry_air_molar_mass = 0.02897,
155- dry_air_heat_capacity = 1005,
156- vapor_molar_mass = 0.018015,
157- vapor_heat_capacity = 1850,
158- liquid = liquid_water(FT),
159- solid = water_ice(FT),
160- condensed_phases = nothing)
161-
162- Create `AtmosphereThermodynamics` with parameters that represent gaseous mixture of dry "air"
148+ ThermodynamicConstants(FT = Oceananigans.defaults.FloatType;
149+ molar_gas_constant = 8.314462618,
150+ gravitational_acceleration = 9.81,
151+ energy_reference_temperature = 273.16,
152+ triple_point_temperature = 273.16,
153+ triple_point_pressure = 611.657,
154+ dry_air_molar_mass = 0.02897,
155+ dry_air_heat_capacity = 1005,
156+ vapor_molar_mass = 0.018015,
157+ vapor_heat_capacity = 1850,
158+ liquid = liquid_water(FT),
159+ solid = water_ice(FT))
160+
161+ Create `ThermodynamicConstants` with parameters that represent gaseous mixture of dry "air"
163162and vapor, as well as condensed liquid and solid phases.
164163The `triple_point_temperature` and `triple_point_pressure` may be combined with
165164internal energy parameters for condensed phases to compute the vapor pressure
166165at the boundary between vapor and a homogeneous sample of the condensed phase.
167- The `gravitational_acceleration` parameter is included to compute reference_state
166+ The `gravitational_acceleration` parameter is included to compute ` reference_state`
168167quantities associated with hydrostatic balance.
169168
170169The Clausius-Clapeyron relation describes the pressure-temperature relationship during phase
@@ -198,43 +197,43 @@ Note: any reference values for pressure and temperature can be used in principle
198197The advantage of using reference values at the triple point is that the same values
199198can then be used for both condensation (vapor → liquid) and deposition (vapor → ice).
200199"""
201- function AtmosphereThermodynamics (FT = Oceananigans. defaults. FloatType;
202- molar_gas_constant = 8.314462618 ,
203- gravitational_acceleration = 9.81 ,
204- energy_reference_temperature = 273.16 ,
205- triple_point_temperature = 273.16 ,
206- triple_point_pressure = 611.657 ,
207- dry_air_molar_mass = 0.02897 ,
208- dry_air_heat_capacity = 1005 ,
209- vapor_molar_mass = 0.018015 ,
210- vapor_heat_capacity = 1850 ,
211- liquid = liquid_water (FT),
212- solid = water_ice (FT))
200+ function ThermodynamicConstants (FT = Oceananigans. defaults. FloatType;
201+ molar_gas_constant = 8.314462618 ,
202+ gravitational_acceleration = 9.81 ,
203+ energy_reference_temperature = 273.16 ,
204+ triple_point_temperature = 273.16 ,
205+ triple_point_pressure = 611.657 ,
206+ dry_air_molar_mass = 0.02897 ,
207+ dry_air_heat_capacity = 1005 ,
208+ vapor_molar_mass = 0.018015 ,
209+ vapor_heat_capacity = 1850 ,
210+ liquid = liquid_water (FT),
211+ solid = water_ice (FT))
213212
214213 dry_air = IdealGas (FT; molar_mass = dry_air_molar_mass,
215214 heat_capacity = dry_air_heat_capacity)
216215
217216 vapor = IdealGas (FT; molar_mass = vapor_molar_mass,
218217 heat_capacity = vapor_heat_capacity)
219218
220- return AtmosphereThermodynamics (convert (FT, molar_gas_constant),
221- convert (FT, gravitational_acceleration),
222- convert (FT, energy_reference_temperature),
223- convert (FT, triple_point_temperature),
224- convert (FT, triple_point_pressure),
225- dry_air,
226- vapor,
227- liquid,
228- solid)
219+ return ThermodynamicConstants (convert (FT, molar_gas_constant),
220+ convert (FT, gravitational_acceleration),
221+ convert (FT, energy_reference_temperature),
222+ convert (FT, triple_point_temperature),
223+ convert (FT, triple_point_pressure),
224+ dry_air,
225+ vapor,
226+ liquid,
227+ solid)
229228end
230229
231- const AT = AtmosphereThermodynamics
230+ const TC = ThermodynamicConstants
232231const IG = IdealGas
233232
234- @inline vapor_gas_constant (thermo:: AT ) = thermo. molar_gas_constant / thermo. vapor. molar_mass
235- @inline dry_air_gas_constant (thermo:: AT ) = thermo. molar_gas_constant / thermo. dry_air. molar_mass
233+ @inline vapor_gas_constant (thermo:: TC ) = thermo. molar_gas_constant / thermo. vapor. molar_mass
234+ @inline dry_air_gas_constant (thermo:: TC ) = thermo. molar_gas_constant / thermo. dry_air. molar_mass
236235
237- const NonCondensingAtmosphereThermodynamics {FT} = AtmosphereThermodynamics {FT, Nothing, Nothing}
236+ const NonCondensingThermodynamicConstants {FT} = ThermodynamicConstants {FT, Nothing, Nothing}
238237
239238"""
240239 mixture_gas_constant(q, thermo)
@@ -256,12 +255,12 @@ where:
256255
257256# Arguments
258257- `q`: Specific humidity (dimensionless)
259- - `thermo`: `AtmosphereThermodynamics ` instance containing gas constants
258+ - `thermo`: `ThermodynamicConstants ` instance containing gas constants
260259
261260# Returns
262261- Gas constant of the moist air mixture in J/(kg·K)
263262"""
264- @inline function mixture_gas_constant (q, thermo:: AT )
263+ @inline function mixture_gas_constant (q, thermo:: TC )
265264 Rᵈ = dry_air_gas_constant (thermo)
266265 Rᵛ = vapor_gas_constant (thermo)
267266 return Rᵈ * (1 - q) + Rᵛ * q
@@ -274,7 +273,7 @@ Compute the heat capacity of state air given the total specific humidity q
274273and assuming that condensate mass ratio qᶜ ≪ q, where qℓ is the mass ratio of
275274liquid condensate.
276275"""
277- @inline function mixture_heat_capacity (q, thermo:: AT )
276+ @inline function mixture_heat_capacity (q, thermo:: TC )
278277 cᵖᵈ = thermo. dry_air. heat_capacity
279278 cᵖᵛ = thermo. vapor. heat_capacity
280279 return cᵖᵈ * (1 - q) + cᵖᵛ * q
0 commit comments