Skip to content

Commit

Permalink
Move "run_name" and "base_directory" into [output] section
Browse files Browse the repository at this point in the history
  • Loading branch information
johnomotani committed Sep 9, 2024
1 parent 554dc7e commit dfc1934
Show file tree
Hide file tree
Showing 36 changed files with 287 additions and 275 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function run_test(test_input; args...)
# update the default inputs

# Convert keyword arguments to a unique name
name = test_input["run_name"]
name = test_input["output"]["run_name"]
if length(args) > 0
name = string(name, "_", (string(k, "-", v, "_") for (k, v) in args)...)

Expand All @@ -25,7 +25,7 @@ function run_test(test_input; args...)
# Update default inputs with values to be changed
input = merge(test_input, modified_inputs)

input["run_name"] = name
input["output"]["run_name"] = name

# run simulation
run_moment_kinetics(input)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ test_type = "Fokker-Planck collisions"

# default input for test
test_input_full_f = OptionsDict(
"run_name" => "full_f",
"output" => OptionsDict("run_name" => "full_f"),
"timestepping" => OptionsDict("dt" => 0.0,
"nstep" => 3,
"nwrite" => 2,
Expand Down
2 changes: 1 addition & 1 deletion moment_kinetics/debug_test/gyroaverage_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ test_type = "gyroaverage"

# default inputs for tests
test_input = OptionsDict(
"run_name" => "gyroaverage",
"output" => OptionsDict("run_name" => "gyroaverage"),
"composition" => OptionsDict("n_ion_species" => 1,
"n_neutral_species" => 0,
"gyrokinetic_ions" => true,
Expand Down
4 changes: 2 additions & 2 deletions moment_kinetics/debug_test/kinetic_electron_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ test_input = OptionsDict("composition" => OptionsDict("n_ion_species" => 1,
"recycling_fraction" => 0.5,
"T_e" => 0.2,
"T_wall" => 0.1),
"run_name" => "kinetic_electron",
"base_directory" => test_output_directory,
"output" => OptionsDict("run_name" => "kinetic_electron",
"base_directory" => test_output_directory),
"evolve_moments" => OptionsDict("density" => true,
"parallel_flow" => true,
"parallel_pressure" => true,
Expand Down
2 changes: 1 addition & 1 deletion moment_kinetics/debug_test/mms_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test_input = OptionsDict(
"electron_physics" => "boltzmann_electron_response",
"T_e" => 1.0,
"T_wall" => 1.0),
"run_name" => "MMS-2D-wall_cheb-with-neutrals",
"output" => OptionsDict("run_name" => "MMS-2D-wall_cheb-with-neutrals"),
"recations" => OptionsDict("charge_exchange_frequency" => 0.0,
"ionization_frequency" => 0.0),
"timestepping" => OptionsDict("nstep" => 3,
Expand Down
10 changes: 5 additions & 5 deletions moment_kinetics/debug_test/recycling_fraction_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ test_input = OptionsDict("composition" => OptionsDict("n_ion_species" => 1,
"T_wall" => 2.0),
"ion_species_1" => OptionsDict("initial_density" => 1.0,
"initial_temperature" => 1.0),
"run_name" => "full-f",
"base_directory" => test_output_directory,
"output" => OptionsDict("run_name" => "full-f",
"base_directory" => test_output_directory),
"evolve_moments" => OptionsDict("density" => false,
"parallel_flow" => false,
"parallel_pressure" => false,
Expand Down Expand Up @@ -82,16 +82,16 @@ test_input = OptionsDict("composition" => OptionsDict("n_ion_species" => 1,


test_input_split1 = recursive_merge(test_input,
OptionsDict("run_name" => "split1",
OptionsDict("output" => OptionsDict("run_name" => "split1"),
"evolve_moments" => OptionsDict("density" => true,
"moments_conservation" => true)))
test_input_split2 = recursive_merge(test_input_split1,
OptionsDict("run_name" => "split2",
OptionsDict("output" => OptionsDict("run_name" => "split2"),
"evolve_moments" => OptionsDict("parallel_flow" => true)))
test_input_split2["timestepping"] = recursive_merge(test_input_split2["timestepping"],
OptionsDict("step_update_prefactor" => 0.4))
test_input_split3 = recursive_merge(test_input_split2,
OptionsDict("run_name" => "split3",
OptionsDict("output" => OptionsDict("run_name" => "split3"),
"evolve_moments" => OptionsDict("parallel_pressure" => true),
"vpa" => OptionsDict("nelement" => 8),
"vz" => OptionsDict("nelement" => 8),
Expand Down
12 changes: 6 additions & 6 deletions moment_kinetics/debug_test/restart_interpolation_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ using moment_kinetics.utils: recursive_merge

# default inputs for tests
base_input = OptionsDict(
"run_name" => "base",
"output" => OptionsDict("run_name" => "base",
"base_directory" => test_output_directory),
"composition" => OptionsDict("n_ion_species" => 2,
"n_neutral_species" => 2,
"electron_physics" => "boltzmann_electron_response",
"T_e" => 1.0),
"base_directory" => test_output_directory,
"evolve_moments" => OptionsDict("density" => false,
"parallel_flow" => false,
"parallel_pressure" => false,
Expand Down Expand Up @@ -48,24 +48,24 @@ base_input = OptionsDict(

test_input =
recursive_merge(base_input,
OptionsDict("run_name" => "full-f",
OptionsDict("output" => OptionsDict("run_name" => "full-f"),
"z" => OptionsDict("nelement" => 3),
"vpa" => OptionsDict("nelement" => 3),
"vz" => OptionsDict("nelement" => 3)))

test_input_split1 =
recursive_merge(test_input,
OptionsDict("run_name" => "split1",
OptionsDict("output" => OptionsDict("run_name" => "split1"),
"evolve_moments" => OptionsDict("density" => true)))

test_input_split2 =
recursive_merge(test_input_split1 ,
OptionsDict("run_name" => "split2",
OptionsDict("output" => OptionsDict("run_name" => "split2"),
"evolve_moments" => OptionsDict("parallel_flow" => true)))

test_input_split3 =
recursive_merge(test_input_split2,
OptionsDict("run_name" => "split3",
OptionsDict("output" => OptionsDict("run_name" => "split3"),
"evolve_moments" => OptionsDict("parallel_pressure" => true)))

test_input_list = [
Expand Down
4 changes: 2 additions & 2 deletions moment_kinetics/debug_test/restart_interpolation_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ include("restart_interpolation_inputs.jl")
run_moment_kinetics(base_input)

if moment_kinetics.file_io.io_has_parallel(Val(moment_kinetics.file_io.hdf5))
base_output_file = realpath(joinpath(base_input["base_directory"], base_input["run_name"], string(base_input["run_name"], ".dfns.h5")))
base_output_file = realpath(joinpath(base_input["output"]["base_directory"], base_input["output"]["run_name"], string(base_input["output"]["run_name"], ".dfns.h5")))
else
base_output_file = realpath(joinpath(base_input["base_directory"], base_input["run_name"], string(base_input["run_name"], ".dfns.0.h5")))
base_output_file = realpath(joinpath(base_input["output"]["base_directory"], base_input["output"]["run_name"], string(base_input["output"]["run_name"], ".dfns.0.h5")))
end

# Defines the test functions, using variables defined in the *_inputs.jl file
Expand Down
2 changes: 1 addition & 1 deletion moment_kinetics/debug_test/runtest_template.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Run a test for a single set of parameters
# Note 'name' should not be shared by any two tests in this file
function run_test(test_input, debug_loop_type, debug_loop_parallel_dims; restart=false)

name = test_input["run_name"]
name = test_input["output"]["run_name"]

@testset "$name" begin
# Provide some progress info
Expand Down
Loading

0 comments on commit dfc1934

Please sign in to comment.