Skip to content

Commit

Permalink
Lest see if we can also run with Float32
Browse files Browse the repository at this point in the history
  • Loading branch information
trontrytel committed Jun 27, 2023
1 parent 6c6382e commit 6b017f6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 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
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
28 changes: 16 additions & 12 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 @@ -46,55 +50,55 @@ function parse_commandline()
"--z_min"
help = "Bottom of the computational domain [m]"
arg_type = Float64
default = 0.0
default = Float64(0)
"--z_max"
help = "Top of the computational domain [m]"
arg_type = Float64
default = 2000.0
default = Float64(2000)
"--n_elem"
help = "Number of computational elements"
arg_type = Int
default = 256
"--dt"
help = "Simulation time step [s]"
arg_type = Float64
default = 1.0
default = Float64(1)
"--dt_output"
help = "Output time step [s]"
arg_type = Float64
default = 30.0
default = Float64(30)
"--t_ini"
help = "Time at the beginning of the simulation [s]"
arg_type = Float64
default = 0.0
default = Float64(0)
"--t_end"
help = "Time at the end of the simulation [s]"
arg_type = Float64
default = 3600.0
default = Float64(3600)
"--w1"
help = "Maximum prescribed updraft momentum flux [m/s * kg/m3]"
arg_type = Float64
default = 2.0
default = Float64(2)
"--t1"
help = "Oscillation time of the prescribed momentum flux [s]"
arg_type = Float64
default = 600.0
default = Float64(600)
"--p0"
help = "Pressure at the surface [pa]"
arg_type = Float64
default = 100000.0
default = Float64(100000)
"--r_dry"
help = "aerosol distribution mean radius for aerosol activation calculations in 2M schemes [m]"
arg_type = Float64
default = 0.04 * 1e-6
default = Float64(0.04 * 1e-6)
"--std_dry"
help = "aerosol distribution standard deviation for aerosol activation calucaulations in 2M schemes"
arg_type = Float64
default = 1.4
default = Float64(1.4)
"--kappa"
help = "hygroscopicity of aerosols for aerosol activation calucaulations in 2M schemes"
arg_type = Float64
default = 0.9
default = Float64(0.9)
end

return AP.parse_args(s)
Expand Down

0 comments on commit 6b017f6

Please sign in to comment.