Skip to content
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

Clean up parameter changes #327

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/parameters/IceNucleation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ struct IceNucleationParameters{FT, DEP, HOM} <: ParametersType{FT}
homogeneous::HOM
end

function IceNucleationParameters(
::Type{FT},
toml_dict::CP.AbstractTOMLDict = CP.create_toml_dict(FT),
) where {FT}
IceNucleationParameters(::Type{FT}) where {FT <: AbstractFloat} =
IceNucleationParameters(CP.create_toml_dict(FT))

function IceNucleationParameters(toml_dict::CP.AbstractTOMLDict)
deposition = Mohler2006(toml_dict)
homogeneous = Koop2000(toml_dict)
DEP = typeof(deposition)
HOM = typeof(homogeneous)
FT = CP.float_type(toml_dict)
return IceNucleationParameters{FT, DEP, HOM}(deposition, homogeneous)
end

Expand Down
9 changes: 5 additions & 4 deletions src/parameters/Microphysics2M.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ struct KK2000{FT, AV, AR} <: Precipitation2MType{FT}
accr::AR
end

function KK2000(
::Type{FT},
toml_dict::CP.AbstractTOMLDict = CP.create_toml_dict(FT),
) where {FT}
KK2000(::Type{FT}) where {FT <: AbstractFloat} = KK2000(CP.create_toml_dict(FT))


function KK2000(toml_dict::CP.AbstractTOMLDict)
acnv = AcnvKK2000(toml_dict)
accr = AccrKK2000(toml_dict)
FT = CP.float_type(toml_dict)
return KK2000{FT, typeof(acnv), typeof(accr)}(acnv, accr)
end

Expand Down
18 changes: 10 additions & 8 deletions src/parameters/TerminalVelocity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ struct Blk1MVelType{FT, R, S} <: TerminalVelocityType{FT}
snow::S
end

function Blk1MVelType(
::Type{FT},
toml_dict::CP.AbstractTOMLDict = CP.create_toml_dict(FT),
) where {FT}
Blk1MVelType(::Type{FT}) where {FT <: AbstractFloat} =
Blk1MVelType(CP.create_toml_dict(FT))

function Blk1MVelType(toml_dict::CP.AbstractTOMLDict)
rain = Blk1MVelTypeRain(toml_dict)
snow = Blk1MVelTypeSnow(toml_dict)
FT = CP.float_type(toml_dict)
return Blk1MVelType{FT, typeof(rain), typeof(snow)}(rain, snow)
end

Expand Down Expand Up @@ -230,11 +231,12 @@ struct Chen2022VelType{FT, R, SI} <: TerminalVelocityType{FT}
snow_ice::SI
end

function Chen2022VelType(
::Type{FT},
toml_dict::CP.AbstractTOMLDict = CP.create_toml_dict(FT),
) where {FT}
Chen2022VelType(::Type{FT}) where {FT <: AbstractFloat} =
Chen2022VelType(CP.create_toml_dict(FT))

function Chen2022VelType(toml_dict::CP.AbstractTOMLDict)
rain = Chen2022VelTypeRain(toml_dict)
snow_ice = Chen2022VelTypeSnowIce(toml_dict)
FT = CP.float_type(toml_dict)
return Chen2022VelType{FT, typeof(rain), typeof(snow_ice)}(rain, snow_ice)
end
Loading