Skip to content

Commit

Permalink
Changed the arg_type of command-line arguments for KiD_driver from Re…
Browse files Browse the repository at this point in the history
…al to Float64, added option to specify float type.
  • Loading branch information
Mikhail Mints authored and mikhailmints committed Jun 30, 2023
1 parent c9a0675 commit 524cef1
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ steps:
command: "julia --color=yes --project=test test/experiments/KiD_driver/KiD_driver.jl --moisture_choice=NonEquilibriumMoisture --prognostic_vars=RhodTQ --precipitation_choice=Precipitation1M"
artifact_paths: "test/experiments/KiD_driver/Output_NonEquilibriumMoisture_RhodTQ_Precipitation1M_CliMA_1M/figures/*"

- label: ":crystal_ball: Experiments: equil (fixed rhod and T) + KK2000 "
command: "julia --color=yes --project=test test/experiments/KiD_driver/KiD_driver.jl --moisture_choice=EquilibriumMoisture --prognostic_vars=RhodTQ --precipitation_choice=Precipitation1M --rain_formation_scheme_choice KK2000 --prescribed_Nd 1e8"
- label: ":crystal_ball: Experiments: equil (fixed rhod and T) + KK2000 + Float32 "
command: "julia --color=yes --project=test test/experiments/KiD_driver/KiD_driver.jl --FLOAT_TYPE=Float32 --moisture_choice=EquilibriumMoisture --prognostic_vars=RhodTQ --precipitation_choice=Precipitation1M --rain_formation_scheme_choice KK2000 --prescribed_Nd 1e8"
artifact_paths: "test/experiments/KiD_driver/Output_EquilibriumMoisture_RhodTQ_Precipitation1M_KK2000/figures/*"

- label: ":crystal_ball: Experiments: equil (fixed rhod and T) + B1994 "
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.8.1'
- '1.8.5'
os:
- ubuntu-latest
- macOS-latest
Expand Down
14 changes: 7 additions & 7 deletions test/experiments/KiD_driver/KiD_driver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ const KID = Kinematic1D
const AP = ArgParse
const CMT = CloudMicrophysics.CommonTypes

const FT = Float64

# Get the parameter values for the simulation
include("parse_commandline.jl")
opts = parse_commandline()

const FT = opts["FLOAT_TYPE"] == "Float64" ? Float64 : Float32

# Equations to solve for mositure and precipitation variables
moisture_choice = opts["moisture_choice"]
prognostics_choice = opts["prognostic_vars"]
Expand Down Expand Up @@ -83,7 +83,7 @@ end
TS = KID.TimeStepping(FT(opts["dt"]), FT(opts["dt_output"]), FT(opts["t_end"]))

# Create the coordinates
space, face_space = KID.make_function_space(FT, opts["z_min"], opts["z_max"], opts["n_elem"])
space, face_space = KID.make_function_space(FT, FT(opts["z_min"]), FT(opts["z_max"]), opts["n_elem"])
coord = CC.Fields.coordinate_field(space)
face_coord = CC.Fields.coordinate_field(face_space)

Expand All @@ -106,9 +106,9 @@ params = create_parameter_set(
path,
toml_dict,
FT,
opts["w1"],
opts["t1"],
opts["p0"],
FT(opts["w1"]),
FT(opts["t1"]),
FT(opts["p0"]),
Int(opts["precip_sources"]),
Int(opts["precip_sinks"]),
Int(opts["qtot_flux_correction"]),
Expand Down Expand Up @@ -141,7 +141,7 @@ callbacks = ODE.CallbackSet(callback_io)
ode_rhs! = KID.make_rhs_function(moisture, precip)

# Solve the ODE operator
problem = ODE.ODEProblem(ode_rhs!, Y, (opts["t_ini"], opts["t_end"]), aux)
problem = ODE.ODEProblem(ode_rhs!, Y, (FT(opts["t_ini"]), FT(opts["t_end"])), aux)
solver = ODE.solve(
problem,
ODE.SSPRK33(),
Expand Down
52 changes: 28 additions & 24 deletions test/experiments/KiD_driver/parse_commandline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ function parse_commandline()
s = AP.ArgParseSettings()

AP.@add_arg_table! s begin
"--FLOAT_TYPE"
help = "Float type. Can be set to Float64 or Float32"
arg_type = String
default = "Float64"
"--moisture_choice"
help = "Mositure model choice: EquilibriumMoisture, NonEquilibriumMoisture"
arg_type = String
Expand Down Expand Up @@ -45,56 +49,56 @@ function parse_commandline()
default = false
"--z_min"
help = "Bottom of the computational domain [m]"
arg_type = Real
default = 0.0
arg_type = Float64
default = Float64(0)
"--z_max"
help = "Top of the computational domain [m]"
arg_type = Real
default = 2000.0
arg_type = Float64
default = Float64(2000)
"--n_elem"
help = "Number of computational elements"
arg_type = Int
default = 256
"--dt"
help = "Simulation time step [s]"
arg_type = Real
default = 1.0
arg_type = Float64
default = Float64(1)
"--dt_output"
help = "Output time step [s]"
arg_type = Real
default = 30.0
arg_type = Float64
default = Float64(30)
"--t_ini"
help = "Time at the beginning of the simulation [s]"
arg_type = Real
default = 0.0
arg_type = Float64
default = Float64(0)
"--t_end"
help = "Time at the end of the simulation [s]"
arg_type = Real
default = 3600.0
arg_type = Float64
default = Float64(3600)
"--w1"
help = "Maximum prescribed updraft momentum flux [m/s * kg/m3]"
arg_type = Real
default = 2.0
arg_type = Float64
default = Float64(2)
"--t1"
help = "Oscillation time of the prescribed momentum flux [s]"
arg_type = Real
default = 600.0
arg_type = Float64
default = Float64(600)
"--p0"
help = "Pressure at the surface [pa]"
arg_type = Real
default = 100000.0
arg_type = Float64
default = Float64(100000)
"--r_dry"
help = "aerosol distribution mean radius for aerosol activation calculations in 2M schemes [m]"
arg_type = Real
default = 0.04 * 1e-6
arg_type = Float64
default = Float64(0.04 * 1e-6)
"--std_dry"
help = "aerosol distribution standard deviation for aerosol activation calucaulations in 2M schemes"
arg_type = Real
default = 1.4
arg_type = Float64
default = Float64(1.4)
"--kappa"
help = "hygroscopicity of aerosols for aerosol activation calucaulations in 2M schemes"
arg_type = Real
default = 0.9
arg_type = Float64
default = Float64(0.9)
end

return AP.parse_args(s)
Expand Down

0 comments on commit 524cef1

Please sign in to comment.