11module PrescribedAtmospheres
22
33using Oceananigans
4- using Oceananigans. Grids: grid_name
5- using Oceananigans. Utils: prettysummary, Time
64using Oceananigans. Fields: Center
5+ using Oceananigans. Grids: grid_name
76using Oceananigans. OutputReaders: FieldTimeSeries, update_field_time_series!, extract_field_time_series
87using Oceananigans. TimeSteppers: Clock, tick!
8+ using Oceananigans. Utils: prettysummary, Time
99
1010using Adapt
1111using Thermodynamics. Parameters: AbstractThermodynamicsParameters
@@ -16,22 +16,22 @@ import Thermodynamics.Parameters:
1616 gas_constant, #
1717 molmass_dryair, # Molar mass of dry air (without moisture)
1818 molmass_water, # Molar mass of gaseous water vapor
19- molmass_ratio , # Ratio of the molar masses of dry air to water vapor
19+ Rv_over_Rd , # Ratio of the specific gas constants of water vapor over dry air
2020 R_v, # Specific gas constant for water vapor
2121 R_d, # Specific gas constant for dry air
2222 kappa_d, # Ideal gas adiabatic exponent for dry air
2323 T_0, # Enthalpy reference temperature
2424 LH_v0, # Vaporization enthalpy at the reference temperature
2525 LH_s0, # Sublimation enthalpy at the reference temperature
26- LH_f0, # Fusionn enthalpy at the reference temperature
26+ LH_f0, # Fusion enthalpy at the reference temperature
2727 cp_d, # Heat capacity of dry air at constant pressure
2828 cp_v, # Isobaric specific heat capacity of gaseous water vapor
2929 cp_l, # Isobaric specific heat capacity of liquid water
3030 cp_i, # Isobaric specific heat capacity of water ice
3131 cv_v, # Heat capacity of dry air at constant volume
3232 cv_l, # Isobaric specific heat capacity of liquid water
3333 cv_i, # Isobaric specific heat capacity of liquid water
34- e_int_v0, # what? someting about reference internal energy of water vapor
34+ e_int_v0, # what? something about reference internal energy of water vapor
3535 T_freeze, # Freezing temperature of _pure_ water
3636 T_triple, # Triple point temperature of _pure_ water
3737 press_triple, # Triple point pressure of pure water
6464Base. show (io:: IO , p:: ConstitutiveParameters ) = print (io, summary (p))
6565
6666"""
67- ConstitutiveParameters(FT = Float64 ;
67+ ConstitutiveParameters(FT = Oceananigans.defaults.FloatType ;
6868 gas_constant = 8.3144598,
6969 dry_air_molar_mass = 0.02897,
7070 water_molar_mass = 0.018015)
@@ -76,7 +76,7 @@ Construct a set of parameters that define the density of moist air,
7676```
7777
7878where ``p`` is pressure, ``T`` is temperature, ``q`` defines the partition
79- of total mass into vapor, liqiud , and ice mass fractions, and
79+ of total mass into vapor, liquid , and ice mass fractions, and
8080``Rᵐ`` is the effective specific gas constant for the mixture,
8181
8282```math
@@ -102,7 +102,7 @@ const CP{FT} = ConstitutiveParameters{FT} where FT
102102@inline gas_constant (p:: CP ) = p. gas_constant
103103@inline molmass_dryair (p:: CP ) = p. dry_air_molar_mass
104104@inline molmass_water (p:: CP ) = p. water_molar_mass
105- @inline molmass_ratio (p:: CP ) = molmass_dryair (p) / molmass_water (p)
105+ @inline Rv_over_Rd (p:: CP ) = molmass_dryair (p) / molmass_water (p)
106106@inline R_v (p:: CP ) = gas_constant (p) / molmass_water (p)
107107@inline R_d (p:: CP ) = gas_constant (p) / molmass_dryair (p)
108108
124124Base. show (io:: IO , p:: HeatCapacityParameters ) = print (io, summary (p))
125125
126126"""
127- HeatCapacityParameters(FT = Float64,
127+ HeatCapacityParameters(FT = Oceananigans.defaults.FloatType;
128128 dry_air_adiabatic_exponent = 2/7,
129129 water_vapor_heat_capacity = 1859,
130130 liquid_water_heat_capacity = 4181,
213213const ATP{FT} = AtmosphereThermodynamicsParameters{FT} where FT
214214
215215Base. eltype (:: ATP{FT} ) where FT = FT
216- Base. eltype (:: CP{FT} ) where FT = FT
217- Base. eltype (:: HCP{FT} ) where FT = FT
218- Base. eltype (:: PTP{FT} ) where FT = FT
216+ Base. eltype (:: CP{FT} ) where FT = FT
217+ Base. eltype (:: HCP{FT} ) where FT = FT
218+ Base. eltype (:: PTP{FT} ) where FT = FT
219219
220220Base. summary (:: ATP{FT} ) where FT = " AtmosphereThermodynamicsParameters{$FT }"
221221
@@ -247,9 +247,9 @@ function Base.show(io::IO, p::AtmosphereThermodynamicsParameters)
247247end
248248
249249function AtmosphereThermodynamicsParameters (FT = Oceananigans. defaults. FloatType;
250- constitutive = ConstitutiveParameters (FT),
251- phase_transitions = PhaseTransitionParameters (FT),
252- heat_capacity = HeatCapacityParameters (FT))
250+ constitutive = ConstitutiveParameters (FT),
251+ phase_transitions = PhaseTransitionParameters (FT),
252+ heat_capacity = HeatCapacityParameters (FT))
253253
254254 return AtmosphereThermodynamicsParameters (constitutive, heat_capacity, phase_transitions)
255255end
@@ -261,7 +261,7 @@ const ATP = AtmosphereThermodynamicsParameters
261261@inline gas_constant (p:: ATP ) = gas_constant (p. constitutive)
262262@inline molmass_dryair (p:: ATP ) = molmass_dryair (p. constitutive)
263263@inline molmass_water (p:: ATP ) = molmass_water (p. constitutive)
264- @inline molmass_ratio (p:: ATP ) = molmass_ratio (p. constitutive)
264+ @inline Rv_over_Rd (p:: ATP ) = Rv_over_Rd (p. constitutive)
265265@inline LH_v0 (p:: ATP ) = LH_v0 (p. phase_transitions)
266266@inline LH_s0 (p:: ATP ) = LH_s0 (p. phase_transitions)
267267@inline LH_f0 (p:: ATP ) = LH_f0 (p. phase_transitions)
@@ -344,8 +344,8 @@ function default_freshwater_flux(grid, times)
344344 return (; rain, snow)
345345end
346346
347- """ The standard unit of atmospheric pressure; 1 standard atmosphere (atm) = 101,325 Pascals (Pa) in SI units.
348- This is approximately equal to the mean sea-level atmospheric pressure on Earth. """
347+ """ The standard unit of atmospheric pressure; 1 standard atmosphere (atm) = 101,325 Pascals (Pa)
348+ in SI units. This is approximately equal to the mean sea-level atmospheric pressure on Earth. """
349349function default_atmosphere_pressure (grid, times)
350350 pa = FieldTimeSeries {Center, Center, Nothing} (grid, times)
351351 parent (pa) .= 101325
@@ -377,11 +377,11 @@ end
377377@inline boundary_layer_height (atmos:: PrescribedAtmosphere ) = atmos. boundary_layer_height
378378
379379"""
380- PrescribedAtmosphere(grid, times;
380+ PrescribedAtmosphere(grid, times=[zero(grid)] ;
381381 clock = Clock{Float64}(time = 0),
382382 surface_layer_height = 10, # meters
383383 boundary_layer_height = 512 # meters,
384- thermodynamics_parameters = AtmosphereThermodynamicsParameters(FT) ,
384+ thermodynamics_parameters = nothing ,
385385 auxiliary_freshwater_flux = nothing,
386386 velocities = default_atmosphere_velocities(grid, times),
387387 tracers = default_atmosphere_tracers(grid, times),
0 commit comments