Skip to content

Commit

Permalink
Remove water_params from params, format
Browse files Browse the repository at this point in the history
  • Loading branch information
nefrathenrici committed Dec 13, 2024
1 parent c03694a commit 9ffa61c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
7 changes: 1 addition & 6 deletions src/parameters/Parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ Base.@kwdef struct ClimaAtmosParameters{
insolation_params::IP
microphysics_cloud_params::MPC
microphysics_0m_params::MP0M
microphysics_1m_params:: MP1M
water_params::WP
microphysics_1m_params::MP1M
surface_fluxes_params::SFP
turbconv_params::TCP
surface_temp_params::STP
Expand Down Expand Up @@ -130,10 +129,6 @@ for var in [:molmass_ratio, :R_d, :R_v, :e_int_v0, :cp_d, :cv_v, :cv_l, :cv_d]
@eval $var(ps::ACAP) = TD.Parameters.$var(thermodynamics_params(ps))
end

# Forwarding CloudMicrophysics parameters
ρ_cloud_liq(ps::ACAP) = ps.water_params.ρw
ρ_cloud_ice(ps::ACAP) = ps.water_params.ρi

# Forwarding SurfaceFluxes parameters
von_karman_const(ps::ACAP) =
SF.Parameters.von_karman_const(surface_fluxes_params(ps))
Expand Down
33 changes: 24 additions & 9 deletions src/parameters/create_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ import CloudMicrophysics as CM
import StaticArrays as SA

function ClimaAtmosParameters(config::AtmosConfig)
(;toml_dict, parsed_args ) = config
(; toml_dict, parsed_args) = config
FT = CP.float_type(toml_dict)
return ClimaAtmosParameters(toml_dict, FT(CA.time_to_seconds(parsed_args["dt"])))
return ClimaAtmosParameters(
toml_dict,
FT(CA.time_to_seconds(parsed_args["dt"])),
)
end

ClimaAtmosParameters(::Type{FT}, dt = nothing) where {FT} =
ClimaAtmosParameters(::Type{FT}, dt = nothing) where {FT} =
ClimaAtmosParameters(CP.create_toml_dict(FT), dt)

function ClimaAtmosParameters(toml_dict::TD, dt = nothing) where {TD<:CP.AbstractTOMLDict}
function ClimaAtmosParameters(
toml_dict::TD,
dt = nothing,
) where {TD <: CP.AbstractTOMLDict}
if !isnothing(dt)
toml_dict["precipitation_timescale"]["value"] = dt
end
Expand All @@ -34,9 +40,6 @@ function ClimaAtmosParameters(toml_dict::TD, dt = nothing) where {TD<:CP.Abstrac
insolation_params = InsolationParameters(toml_dict)
IP = typeof(insolation_params)

water_params = CM.Parameters.WaterProperties(toml_dict)
WP = typeof(water_params)

surface_fluxes_params =
SF.Parameters.SurfaceFluxesParameters(toml_dict, UF.BusingerParams)
SFP = typeof(surface_fluxes_params)
Expand All @@ -57,15 +60,27 @@ function ClimaAtmosParameters(toml_dict::TD, dt = nothing) where {TD<:CP.Abstrac

parameters =
CP.get_parameter_values(toml_dict, atmos_name_map, "ClimaAtmos")
return CAP.ClimaAtmosParameters{FT, TP, RP, IP, MPC, MP0M, MP1M, WP, SFP, TCP, STP, VDP}(;
return CAP.ClimaAtmosParameters{
FT,
TP,
RP,
IP,
MPC,
MP0M,
MP1M,
WP,
SFP,
TCP,
STP,
VDP,
}(;
parameters...,
thermodynamics_params,
rrtmgp_params,
insolation_params,
microphysics_cloud_params,
microphysics_0m_params,
microphysics_1m_params,
water_params,
surface_fluxes_params,
turbconv_params,
surface_temp_params,
Expand Down

0 comments on commit 9ffa61c

Please sign in to comment.