From de707a30ea1efd052445953705c80012ce4a047b Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Thu, 1 Aug 2024 12:25:40 +0100 Subject: [PATCH 01/46] Test script to explore refactoring of species inputs. --- test_scripts/species_input_test.jl | 95 ++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 test_scripts/species_input_test.jl diff --git a/test_scripts/species_input_test.jl b/test_scripts/species_input_test.jl new file mode 100644 index 000000000..eb580eac7 --- /dev/null +++ b/test_scripts/species_input_test.jl @@ -0,0 +1,95 @@ +export species_input_test + +import moment_kinetics +using moment_kinetics.input_structs: set_defaults_and_check_section! +using moment_kinetics.type_definitions: mk_float, mk_int + +Base.@kwdef struct ion_spec_params + # mass + mass::mk_float + # charge number + zeds::mk_float +end + +Base.@kwdef struct neutral_spec_params + # mass + mass::mk_float +end + +""" +""" +Base.@kwdef struct spec_composition + # n_ion_species is the number of evolved ion species + n_ion_species::mk_int + # n_neutral_species is the number of evolved neutral species + n_neutral_species::mk_int + ion_species::Vector{ion_spec_params} + neutral_species::Vector{neutral_spec_params} +end + +const test_toml_base = Dict( "composition" => Dict("n_ion_species" => 2,"n_neutral_species" => 2), + "ion_species_1" => Dict("mass" => 2.0, "zeds" => 4.0), + "ion_species_2" => Dict("mass" => 3.0, "zeds" => 5.0), + "neutral_species_1" => Dict("mass" => 2.5), + "neutral_species_2" => Dict("mass" => 3.5)) + + +function species_input_test(toml_input=test_toml_base) + comp_input_section = set_defaults_and_check_section!(toml_input, "composition", + n_ion_species = 1, + n_neutral_species = 1) + nspec_ion = comp_input_section["n_ion_species"] + nspec_neutral = comp_input_section["n_neutral_species"] + # read species parameters + ion_spec_params_list = Array{ion_spec_params,1}(undef,nspec_ion) + neutral_spec_params_list = Array{neutral_spec_params,1}(undef,nspec_neutral) + for is in 1:nspec_ion + spec_input_section = set_defaults_and_check_section!(toml_input, "ion_species_"*string(is), + mass = 1.0, + zeds = 1.0) + spec_input = Dict(Symbol(k)=>v for (k,v) in spec_input_section) + println(spec_input) + ion_spec_params_list[is] = ion_spec_params(; spec_input...) + end + for isn in 1:nspec_neutral + spec_input_section = set_defaults_and_check_section!(toml_input, "neutral_species_"*string(isn), + mass = 1.0) + spec_input = Dict(Symbol(k)=>v for (k,v) in spec_input_section) + println(spec_input) + neutral_spec_params_list[isn] = neutral_spec_params(; spec_input...) + end + # construct composition dict + println(comp_input_section) + println(ion_spec_params_list) + println(neutral_spec_params_list) + println(comp_input_section["n_ion_species"]) + newdict = Dict("ion_species" => ion_spec_params_list, "neutral_species" => neutral_spec_params_list) + println(newdict) + comp_input_section = merge(comp_input_section,newdict) + println(comp_input_section) + input = Dict(Symbol(k)=>v for (k,v) in comp_input_section) + println(input) + # construct composition struct + composition = spec_composition(; input...) + println(composition) + println("") + for is in 1:composition.n_ion_species + println("ion_species_"*string(is)) + println("mass: ",composition.ion_species[1].mass) + println("Zs: ",composition.ion_species[1].zeds) + println("") + end + + for isn in 1:composition.n_neutral_species + println("neutral_species_"*string(isn)) + println("mass: ",composition.neutral_species[1].mass) + println("") + end +end + +if abspath(PROGRAM_FILE) == @__FILE__ + using Pkg + Pkg.activate(".") + + species_input_test() +end \ No newline at end of file From acf4f7ad5ebfe7921e0206b784366de1201be799 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:01:26 +0100 Subject: [PATCH 02/46] Refactor composition and species input. N.B. file i/o fails due to electron_physics option. --- moment_kinetics/src/input_structs.jl | 67 ++++- moment_kinetics/src/moment_kinetics.jl | 1 + moment_kinetics/src/moment_kinetics_input.jl | 297 ++----------------- moment_kinetics/src/species_input.jl | 225 ++++++++++++++ 4 files changed, 300 insertions(+), 290 deletions(-) create mode 100644 moment_kinetics/src/species_input.jl diff --git a/moment_kinetics/src/input_structs.jl b/moment_kinetics/src/input_structs.jl index b740615c9..4d68b06ca 100644 --- a/moment_kinetics/src/input_structs.jl +++ b/moment_kinetics/src/input_structs.jl @@ -8,7 +8,8 @@ export time_info export advection_input, advection_input_mutable export grid_input, grid_input_mutable export initial_condition_input, initial_condition_input_mutable -export species_parameters, species_parameters_mutable +export spatial_initial_condition_input, velocity_initial_condition_input +export ion_species_parameters, neutral_species_parameters, species_parameters_mutable export species_composition export drive_input, drive_input_mutable export collisions_input, krook_collisions_input, fkpl_collisions_input @@ -237,7 +238,26 @@ end """ """ -struct initial_condition_input +Base.@kwdef struct spatial_initial_condition_input + # initialization inputs for one coordinate of a separable distribution function + initialization_option::String + # inputs for "gaussian" initial condition + width::mk_float + # inputs for "sinusoid" initial condition + wavenumber::mk_int + density_amplitude::mk_float + density_phase::mk_float + upar_amplitude::mk_float + upar_phase::mk_float + temperature_amplitude::mk_float + temperature_phase::mk_float + # inputs for "monomial" initial condition + monomial_degree::mk_int +end + +""" +""" +Base.@kwdef struct velocity_initial_condition_input # initialization inputs for one coordinate of a separable distribution function initialization_option::String # inputs for "gaussian" initial condition @@ -278,25 +298,49 @@ end """ """ -struct species_parameters - # type is the type of species; options are 'ion' or 'neutral' +Base.@kwdef struct ion_species_parameters + # type is the type of species + type::String + # mass/reference mass + mass::mk_float + # charge number, absolute w.r.t. proton charge + zeds::mk_float + # array containing the initial line-averaged temperature for this species + initial_temperature::mk_float + # array containing the initial line-averaged density for this species + initial_density::mk_float + # struct containing the initial condition info in z for this species + z_IC::spatial_initial_condition_input + # struct containing the initial condition info in r for this species + r_IC::spatial_initial_condition_input + # struct containing the initial condition info in vpa for this species + vpa_IC::velocity_initial_condition_input +end + +""" +""" +Base.@kwdef struct neutral_species_parameters + # type is the type of species type::String + # mass/reference mass + mass::mk_float # array containing the initial line-averaged temperature for this species initial_temperature::mk_float # array containing the initial line-averaged density for this species initial_density::mk_float # struct containing the initial condition info in z for this species - z_IC::initial_condition_input + z_IC::spatial_initial_condition_input # struct containing the initial condition info in r for this species - r_IC::initial_condition_input + r_IC::spatial_initial_condition_input # struct containing the initial condition info in vpa for this species - vpa_IC::initial_condition_input + vpa_IC::velocity_initial_condition_input end """ """ -mutable struct species_composition +Base.@kwdef struct species_composition # n_species = total number of evolved species (including ions, neutrals and electrons) + # a diagnostic, not an input parameter n_species::mk_int # n_ion_species is the number of evolved ion species n_ion_species::mk_int @@ -317,7 +361,6 @@ mutable struct species_composition T_wall::mk_float # wall potential used if electron_physics=boltzmann_electron_response_with_simple_sheath phi_wall::mk_float - # constant for testing nonzero Er # ratio of the neutral particle mass to the ion mass mn_over_mi::mk_float # ratio of the electron particle mass to the ion mass @@ -329,8 +372,10 @@ mutable struct species_composition # gyrokinetic_ions = true -> use gyroaveraged fields at fixed guiding centre and moments of the pdf computed at fixed r # gyrokinetic_ions = false -> use drift kinetic approximation gyrokinetic_ions::Bool - # scratch buffer whose size is n_species - scratch::Vector{mk_float} + # array of structs of parameters for each ion species + ion::Vector{ion_species_parameters} + # array of structs of parameters for each neutral species + neutral::Vector{neutral_species_parameters} end """ diff --git a/moment_kinetics/src/moment_kinetics.jl b/moment_kinetics/src/moment_kinetics.jl index 90fd7f1bd..409d6c990 100644 --- a/moment_kinetics/src/moment_kinetics.jl +++ b/moment_kinetics/src/moment_kinetics.jl @@ -64,6 +64,7 @@ include("energy_equation.jl") include("force_balance.jl") include("source_terms.jl") include("numerical_dissipation.jl") +include("species_input.jl") include("moment_kinetics_input.jl") include("utils.jl") include("load_data.jl") diff --git a/moment_kinetics/src/moment_kinetics_input.jl b/moment_kinetics/src/moment_kinetics_input.jl index 3bdba79f8..41c38b528 100644 --- a/moment_kinetics/src/moment_kinetics_input.jl +++ b/moment_kinetics/src/moment_kinetics_input.jl @@ -21,7 +21,7 @@ using ..input_structs using ..numerical_dissipation: setup_numerical_dissipation using ..reference_parameters using ..geo: init_magnetic_geometry, setup_geometry_input - +using ..species_input: get_species_input using MPI using Quadmath using TOML @@ -62,22 +62,14 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) * "removed ones.") end end - - # n_ion_species is the number of evolved ion species - # currently only n_ion_species = 1 is supported - n_ion_species = get(scan_input, "n_ion_species", 1) - # n_neutral_species is the number of evolved neutral species - # currently only n_neutral_species = 0,1 is supported - n_neutral_species = get(scan_input, "n_neutral_species", 1) - # * if electron_physics=boltzmann_electron_response, then the electron density is - # fixed to be N_e*(eϕ/T_e) - # * if electron_physics=boltzmann_electron_response_with_simple_sheath, then the - # electron density is fixed to be N_e*(eϕ/T_e) and N_e is calculated w.r.t a - # reference value using J_||e + J_||i = 0 at z = 0 - electron_physics = get(scan_input, "electron_physics", boltzmann_electron_response) - z, r, vpa, vperp, gyrophase, vz, vr, vzeta, species, composition, drive, evolve_moments = - load_defaults(n_ion_species, n_neutral_species, electron_physics) + # read composition and species data + composition = get_species_input(scan_input) + n_ion_species = composition.n_ion_species + n_neutral_species = composition.n_neutral_species + + z, r, vpa, vperp, gyrophase, vz, vr, vzeta, drive, evolve_moments = + load_defaults() # this is the prefix for all output files associated with this run run_name = get(scan_input, "run_name", "wallBC") @@ -91,29 +83,6 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) evolve_moments.parallel_pressure = get(scan_input, "evolve_moments_parallel_pressure", false) evolve_moments.conservation = get(scan_input, "evolve_moments_conservation", false) - ####### specify any deviations from default inputs for evolved species ####### - # set initial Tₑ = 1 - composition.T_e = get(scan_input, "T_e", 1.0) - # set wall temperature T_wall = Tw/Te - composition.T_wall = get(scan_input, "T_wall", 1.0) - # set initial neutral temperature Tn/Tₑ = 1 - # set initial nᵢ/Nₑ = 1.0 - # set phi_wall at z = 0 - composition.phi_wall = get(scan_input, "phi_wall", 0.0) - # if false use true Knudsen cosine for neutral wall bc - composition.use_test_neutral_wall_pdf = get(scan_input, "use_test_neutral_wall_pdf", false) - # constant to be used to test nonzero Er in wall boundary condition - #composition.Er_constant = get(scan_input, "Er_constant", 0.0) - # The ion flux reaching the wall that is recycled as neutrals is reduced by - # `recycling_fraction` to account for ions absorbed by the wall. - composition.recycling_fraction = get(scan_input, "recycling_fraction", 1.0) - if !(0.0 <= composition.recycling_fraction <= 1.0) - error("recycling_fraction must be between 0 and 1. Got $recycling_fraction.") - end - # gyrokinetic_ions = True -> use gyroaveraged fields at fixed guiding centre and moments of the pdf computed at fixed r - # gyrokinetic_ions = False -> use drift kinetic approximation - composition.gyrokinetic_ions = get(scan_input, "gyrokinetic_ions", false) - # Reference parameters that define the conversion between physical quantities and # normalised values used in the code. reference_params = setup_reference_parameters(scan_input) @@ -121,66 +90,7 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) ## set geometry_input geometry_in = setup_geometry_input(scan_input, get_default_rhostar(reference_params)) - ispecies = 1 - species.ion[1].z_IC.initialization_option = get(scan_input, "z_IC_option$ispecies", "gaussian") - species.ion[1].initial_density = get(scan_input, "initial_density$ispecies", 1.0) - species.ion[1].initial_temperature = get(scan_input, "initial_temperature$ispecies", 1.0) - species.ion[1].z_IC.width = get(scan_input, "z_IC_width$ispecies", 0.125) - species.ion[1].z_IC.wavenumber = get(scan_input, "z_IC_wavenumber$ispecies", 1) - species.ion[1].z_IC.density_amplitude = get(scan_input, "z_IC_density_amplitude$ispecies", 0.001) - species.ion[1].z_IC.density_phase = get(scan_input, "z_IC_density_phase$ispecies", 0.0) - species.ion[1].z_IC.upar_amplitude = get(scan_input, "z_IC_upar_amplitude$ispecies", 0.0) - species.ion[1].z_IC.upar_phase = get(scan_input, "z_IC_upar_phase$ispecies", 0.0) - species.ion[1].z_IC.temperature_amplitude = get(scan_input, "z_IC_temperature_amplitude$ispecies", 0.0) - species.ion[1].z_IC.temperature_phase = get(scan_input, "z_IC_temperature_phase$ispecies", 0.0) - species.ion[1].r_IC.initialization_option = get(scan_input, "r_IC_option$ispecies", "gaussian") - species.ion[1].r_IC.wavenumber = get(scan_input, "r_IC_wavenumber$ispecies", 1) - species.ion[1].r_IC.density_amplitude = get(scan_input, "r_IC_density_amplitude$ispecies", 0.0) - species.ion[1].r_IC.density_phase = get(scan_input, "r_IC_density_phase$ispecies", 0.0) - species.ion[1].r_IC.upar_amplitude = get(scan_input, "r_IC_upar_amplitude$ispecies", 0.0) - species.ion[1].r_IC.upar_phase = get(scan_input, "r_IC_upar_phase$ispecies", 0.0) - species.ion[1].r_IC.temperature_amplitude = get(scan_input, "r_IC_temperature_amplitude$ispecies", 0.0) - species.ion[1].r_IC.temperature_phase = get(scan_input, "r_IC_temperature_phase$ispecies", 0.0) - species.ion[1].vpa_IC.initialization_option = get(scan_input, "vpa_IC_option$ispecies", "gaussian") - species.ion[1].vpa_IC.density_amplitude = get(scan_input, "vpa_IC_density_amplitude$ispecies", 1.000) - species.ion[1].vpa_IC.width = get(scan_input, "vpa_IC_width$ispecies", 1.0) - species.ion[1].vpa_IC.density_phase = get(scan_input, "vpa_IC_density_phase$ispecies", 0.0) - species.ion[1].vpa_IC.upar_amplitude = get(scan_input, "vpa_IC_upar_amplitude$ispecies", 0.0) - species.ion[1].vpa_IC.upar_phase = get(scan_input, "vpa_IC_upar_phase$ispecies", 0.0) - species.ion[1].vpa_IC.temperature_amplitude = get(scan_input, "vpa_IC_temperature_amplitude$ispecies", 0.0) - species.ion[1].vpa_IC.temperature_phase = get(scan_input, "vpa_IC_temperature_phase$ispecies", 0.0) - ispecies += 1 - if n_neutral_species > 0 - species.neutral[1].z_IC.initialization_option = get(scan_input, "z_IC_option$ispecies", "gaussian") - species.neutral[1].initial_density = get(scan_input, "initial_density$ispecies", 1.0) - species.neutral[1].initial_temperature = get(scan_input, "initial_temperature$ispecies", 1.0) - species.neutral[1].z_IC.width = get(scan_input, "z_IC_width$ispecies", species.ion[1].z_IC.width) - species.neutral[1].z_IC.density_amplitude = get(scan_input, "z_IC_density_amplitude$ispecies", 0.001) - species.neutral[1].z_IC.density_phase = get(scan_input, "z_IC_density_phase$ispecies", 0.0) - species.neutral[1].z_IC.upar_amplitude = get(scan_input, "z_IC_upar_amplitude$ispecies", 0.0) - species.neutral[1].z_IC.upar_phase = get(scan_input, "z_IC_upar_phase$ispecies", 0.0) - species.neutral[1].z_IC.temperature_amplitude = get(scan_input, "z_IC_temperature_amplitude$ispecies", 0.0) - species.neutral[1].z_IC.temperature_phase = get(scan_input, "z_IC_temperature_phase$ispecies", 0.0) - species.neutral[1].r_IC.initialization_option = get(scan_input, "r_IC_option$ispecies", "gaussian") - species.neutral[1].r_IC.density_amplitude = get(scan_input, "r_IC_density_amplitude$ispecies", 0.001) - species.neutral[1].r_IC.density_phase = get(scan_input, "r_IC_density_phase$ispecies", 0.0) - species.neutral[1].r_IC.upar_amplitude = get(scan_input, "r_IC_upar_amplitude$ispecies", 0.0) - species.neutral[1].r_IC.upar_phase = get(scan_input, "r_IC_upar_phase$ispecies", 0.0) - species.neutral[1].r_IC.temperature_amplitude = get(scan_input, "r_IC_temperature_amplitude$ispecies", 0.0) - species.neutral[1].r_IC.temperature_phase = get(scan_input, "r_IC_temperature_phase$ispecies", 0.0) - species.neutral[1].vpa_IC.initialization_option = get(scan_input, "vpa_IC_option$ispecies", "gaussian") - species.neutral[1].vpa_IC.density_amplitude = get(scan_input, "vpa_IC_density_amplitude$ispecies", 1.000) - species.neutral[1].vpa_IC.width = get(scan_input, "vpa_IC_width$ispecies", species.ion[1].vpa_IC.width) - species.neutral[1].vpa_IC.density_phase = get(scan_input, "vpa_IC_density_phase$ispecies", 0.0) - species.neutral[1].vpa_IC.upar_amplitude = get(scan_input, "vpa_IC_upar_amplitude$ispecies", 0.0) - species.neutral[1].vpa_IC.upar_phase = get(scan_input, "vpa_IC_upar_phase$ispecies", 0.0) - species.neutral[1].vpa_IC.temperature_amplitude = get(scan_input, "vpa_IC_temperature_amplitude$ispecies", 0.0) - species.neutral[1].vpa_IC.temperature_phase = get(scan_input, "vpa_IC_temperature_phase$ispecies", 0.0) - ispecies += 1 - end - #################### end specification of species inputs ##################### - - charge_exchange = get(scan_input, "charge_exchange_frequency", 2.0*sqrt(species.ion[1].initial_temperature)) + charge_exchange = get(scan_input, "charge_exchange_frequency", 2.0*sqrt(composition.ion[1].initial_temperature)) ionization = get(scan_input, "ionization_frequency", charge_exchange) constant_ionization_rate = get(scan_input, "constant_ionization_rate", false) # set up krook collision inputs @@ -193,7 +103,7 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) timestepping_section = set_defaults_and_check_section!( scan_input, "timestepping"; nstep=5, - dt=0.00025/sqrt(species.ion[1].initial_temperature), + dt=0.00025/sqrt(composition.ion[1].initial_temperature), CFL_prefactor=-1.0, nwrite=1, nwrite_dfns=nothing, @@ -339,7 +249,7 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) # do not parallelise vpa with distributed-memory MPI vpa.nelement_local = vpa.nelement_global # L is the box length in units of vthermal_species - vpa.L = get(scan_input, "vpa_L", 8.0*sqrt(species.ion[1].initial_temperature)) + vpa.L = get(scan_input, "vpa_L", 8.0*sqrt(composition.ion[1].initial_temperature)) # determine the boundary condition # only supported option at present is "zero" and "periodic" vpa.bc = get(scan_input, "vpa_bc", "periodic") @@ -357,7 +267,7 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) # do not parallelise vperp with distributed-memory MPI vperp.nelement_local = vperp.nelement_global # L is the box length in units of vthermal_species - vperp.L = get(scan_input, "vperp_L", 8.0*sqrt(species.ion[1].initial_temperature)) + vperp.L = get(scan_input, "vperp_L", 8.0*sqrt(composition.ion[1].initial_temperature)) # Note vperp.bc is set below, after numerical dissipation is initialized, so that it # can use the numerical dissipation settings to set its default value. # @@ -401,7 +311,7 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) # do not parallelise vz with distributed-memory MPI vr.nelement_local = vr.nelement_global # L is the box length in units of vthermal_species - vr.L = get(scan_input, "vr_L", 8.0*sqrt(species.ion[1].initial_temperature)) + vr.L = get(scan_input, "vr_L", 8.0*sqrt(composition.ion[1].initial_temperature)) # determine the boundary condition # only supported option at present is "zero" and "periodic" vr.bc = get(scan_input, "vr_bc", "none") @@ -418,7 +328,7 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) # do not parallelise vz with distributed-memory MPI vzeta.nelement_local = vzeta.nelement_global # L is the box length in units of vthermal_species - vzeta.L = get(scan_input, "vzeta_L", 8.0*sqrt(species.ion[1].initial_temperature)) + vzeta.L = get(scan_input, "vzeta_L", 8.0*sqrt(composition.ion[1].initial_temperature)) # determine the boundary condition # only supported option at present is "zero" and "periodic" vzeta.bc = get(scan_input, "vzeta_bc", "none") @@ -526,68 +436,6 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) vzeta_immutable = grid_input("vzeta", vzeta.ngrid, vzeta.nelement_global, vzeta.nelement_local, 1, 0, vzeta.L, vzeta.discretization, vzeta.fd_option, vzeta.cheb_option, vzeta.bc, vzeta_advection_immutable, MPI.COMM_NULL, vzeta.element_spacing_option) - species_ion_immutable = Array{species_parameters,1}(undef,n_ion_species) - species_neutral_immutable = Array{species_parameters,1}(undef,n_neutral_species) - - for is ∈ 1:n_ion_species - species_type = "ion" - # species_type = "electron" - z_IC = initial_condition_input(species.ion[is].z_IC.initialization_option, - species.ion[is].z_IC.width, species.ion[is].z_IC.wavenumber, - species.ion[is].z_IC.density_amplitude, species.ion[is].z_IC.density_phase, - species.ion[is].z_IC.upar_amplitude, species.ion[is].z_IC.upar_phase, - species.ion[is].z_IC.temperature_amplitude, species.ion[is].z_IC.temperature_phase, - species.ion[is].z_IC.monomial_degree, 0.0, 0.0, 0.0, 0.0) - r_IC = initial_condition_input(species.ion[is].r_IC.initialization_option, - species.ion[is].r_IC.width, species.ion[is].r_IC.wavenumber, - species.ion[is].r_IC.density_amplitude, species.ion[is].r_IC.density_phase, - species.ion[is].r_IC.upar_amplitude, species.ion[is].r_IC.upar_phase, - species.ion[is].r_IC.temperature_amplitude, species.ion[is].r_IC.temperature_phase, - species.ion[is].r_IC.monomial_degree, 0.0, 0.0, 0.0, 0.0) - vpa_IC = initial_condition_input(species.ion[is].vpa_IC.initialization_option, - species.ion[is].vpa_IC.width, species.ion[is].vpa_IC.wavenumber, - species.ion[is].vpa_IC.density_amplitude, species.ion[is].vpa_IC.density_phase, - species.ion[is].vpa_IC.upar_amplitude, species.ion[is].vpa_IC.upar_phase, - species.ion[is].vpa_IC.temperature_amplitude, - species.ion[is].vpa_IC.temperature_phase, species.ion[is].vpa_IC.monomial_degree, - get(scan_input, "vpa_IC_v0$is", 0.5*sqrt(vperp.L^2 + (0.5*vpa.L)^2)), - get(scan_input, "vpa_IC_vth0$is", 0.1*sqrt(vperp.L^2 + (0.5*vpa.L)^2)), - get(scan_input, "vpa_IC_vpa0$is", 0.25*0.5*abs(vpa.L)), - get(scan_input, "vpa_IC_vperp0$is", 0.5*abs(vperp.L))) - species_ion_immutable[is] = species_parameters(species_type, species.ion[is].initial_temperature, - species.ion[is].initial_density, z_IC, r_IC, vpa_IC) - end - if n_neutral_species > 0 - for is ∈ 1:n_neutral_species - species_type = "neutral" - z_IC = initial_condition_input(species.neutral[is].z_IC.initialization_option, - species.neutral[is].z_IC.width, species.neutral[is].z_IC.wavenumber, - species.neutral[is].z_IC.density_amplitude, species.neutral[is].z_IC.density_phase, - species.neutral[is].z_IC.upar_amplitude, species.neutral[is].z_IC.upar_phase, - species.neutral[is].z_IC.temperature_amplitude, species.neutral[is].z_IC.temperature_phase, - species.neutral[is].z_IC.monomial_degree, 0.0, 0.0, 0.0, 0.0) - r_IC = initial_condition_input(species.neutral[is].r_IC.initialization_option, - species.neutral[is].r_IC.width, species.neutral[is].r_IC.wavenumber, - species.neutral[is].r_IC.density_amplitude, species.neutral[is].r_IC.density_phase, - species.neutral[is].r_IC.upar_amplitude, species.neutral[is].r_IC.upar_phase, - species.neutral[is].r_IC.temperature_amplitude, species.neutral[is].r_IC.temperature_phase, - species.neutral[is].r_IC.monomial_degree, 0.0, 0.0, 0.0, 0.0) - vpa_IC = initial_condition_input(species.neutral[is].vpa_IC.initialization_option, - species.neutral[is].vpa_IC.width, species.neutral[is].vpa_IC.wavenumber, - species.neutral[is].vpa_IC.density_amplitude, species.neutral[is].vpa_IC.density_phase, - species.neutral[is].vpa_IC.upar_amplitude, species.neutral[is].vpa_IC.upar_phase, - species.neutral[is].vpa_IC.temperature_amplitude, - species.neutral[is].vpa_IC.temperature_phase, species.neutral[is].vpa_IC.monomial_degree, - get(scan_input, "vpa_IC_v0$is", 0.5*sqrt(vperp.L^2 + (0.5*vpa.L)^2)), - get(scan_input, "vpa_IC_vth0$is", 0.1*sqrt(vperp.L^2 + (0.5*vpa.L)^2)), - get(scan_input, "vpa_IC_vpa0$is", 0.25*0.5*abs(vpa.L)), - get(scan_input, "vpa_IC_vperp0$is", 0.5*abs(vperp.L))) - species_neutral_immutable[is] = species_parameters(species_type, species.neutral[is].initial_temperature, - species.neutral[is].initial_density, z_IC, r_IC, vpa_IC) - end - end - species_immutable = (ion = species_ion_immutable, neutral = species_neutral_immutable) - force_Er_zero = get(scan_input, "force_Er_zero_at_wall", false) drive_immutable = drive_input(drive.force_phi, drive.amplitude, drive.frequency, force_Er_zero) @@ -663,6 +511,8 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) error("Mirror terms not yet implemented for moment-kinetic modes") end + species_immutable = (ion = composition.ion, neutral = composition.neutral) + # check input (and initialized coordinate structs) to catch errors/unsupported options check_input(io, output_dir, timestepping_section["nstep"], timestepping_section["dt"], r, z, vpa, vperp, composition, species_immutable, evolve_moments, @@ -684,7 +534,7 @@ end """ """ -function load_defaults(n_ion_species, n_neutral_species, electron_physics) +function load_defaults() ############## options related to the equations being solved ############### evolve_density = false evolve_parallel_flow = false @@ -1001,117 +851,6 @@ function load_defaults(n_ion_species, n_neutral_species, electron_physics) vzeta = grid_input_mutable("vzeta", ngrid_vzeta, nelement_vzeta, nelement_vzeta, L_vzeta, discretization_option_vzeta, finite_difference_option_vzeta, cheb_option_vzeta, boundary_option_vzeta, advection_vzeta, element_spacing_option_vzeta) - ############################################################################# - # define default values and create corresponding mutable structs holding - # information about the composition of the species and their initial conditions - if electron_physics ∈ (boltzmann_electron_response, boltzmann_electron_response_with_simple_sheath) - n_species = n_ion_species + n_neutral_species - else - n_species = n_ion_speces + n_neutral_species + 1 - end - use_test_neutral_wall_pdf = false - # electron temperature over reference temperature - T_e = 1.0 - # temperature at the entrance to the wall in terms of the electron temperature - T_wall = 1.0 - # wall potential at z = 0 - phi_wall = 0.0 - # ratio of the neutral particle mass to the ion particle mass - mn_over_mi = 1.0 - # ratio of the electron particle mass to the ion particle mass - me_over_mi = 1.0/1836.0 - # The ion flux reaching the wall that is recycled as neutrals is reduced by - # `recycling_fraction` to account for ions absorbed by the wall. - recycling_fraction = 1.0 - gyrokinetic_ions = false - composition = species_composition(n_species, n_ion_species, n_neutral_species, - electron_physics, use_test_neutral_wall_pdf, T_e, T_wall, phi_wall, - mn_over_mi, me_over_mi, recycling_fraction, gyrokinetic_ions, allocate_float(n_species)) - - species_ion = Array{species_parameters_mutable,1}(undef,n_ion_species) - species_neutral = Array{species_parameters_mutable,1}(undef,n_neutral_species) - - # initial temperature for each species defaults to Tₑ - initial_temperature = 1.0 - # initial density for each species defaults to Nₑ - initial_density = 1.0 - # initialization inputs for z part of distribution function - # supported options are "gaussian", "sinusoid" and "monomial" - z_initialization_option = "sinusoid" - # inputs for "gaussian" initial condition - # width of the Gaussian in z - z_width = 0.125 - # inputs for "sinusoid" initial condition - # z_wavenumber should be an integer - z_wavenumber = 1 - z_density_amplitude = 0.1 - z_density_phase = 0.0 - z_upar_amplitude = 0.0 - z_upar_phase = 0.0 - z_temperature_amplitude = 0.0 - z_temperature_phase = 0.0 - # inputs for "monomial" initial condition - z_monomial_degree = 2 - z_initial_conditions = initial_condition_input_mutable(z_initialization_option, - z_width, z_wavenumber, z_density_amplitude, z_density_phase, z_upar_amplitude, - z_upar_phase, z_temperature_amplitude, z_temperature_phase, z_monomial_degree) - # initialization inputs for r part of distribution function - # supported options are "gaussian", "sinusoid" and "monomial" - r_initialization_option = "sinusoid" - # inputs for "gaussian" initial condition - # width of the Gaussian in r - r_width = 0.125 - # inputs for "sinusoid" initial condition - # r_wavenumber should be an integer - r_wavenumber = 1 - r_density_amplitude = 0.0 - r_density_phase = 0.0 - r_upar_amplitude = 0.0 - r_upar_phase = 0.0 - r_temperature_amplitude = 0.0 - r_temperature_phase = 0.0 - # inputs for "monomial" initial condition - r_monomial_degree = 2 - r_initial_conditions = initial_condition_input_mutable(r_initialization_option, - r_width, r_wavenumber, r_density_amplitude, r_density_phase, r_upar_amplitude, - r_upar_phase, r_temperature_amplitude, r_temperature_phase, r_monomial_degree) - # initialization inputs for vpa part of distribution function - # supported options are "gaussian", "sinusoid" and "monomial" - # inputs for 'gaussian' initial condition - vpa_initialization_option = "gaussian" - # if initializing a Maxwellian, vpa_width = 1.0 for each species - # any temperature-dependence will be self-consistently treated using initial_temperature - vpa_width = 1.0 - # inputs for "sinusoid" initial condition - vpa_wavenumber = 1 - vpa_density_amplitude = 1.0 - vpa_density_phase = 0.0 - vpa_upar_amplitude = 0.0 - vpa_upar_phase = 0.0 - vpa_temperature_amplitude = 0.0 - vpa_temperature_phase = 0.0 - # inputs for "monomial" initial condition - vpa_monomial_degree = 2 - vpa_initial_conditions = initial_condition_input_mutable(vpa_initialization_option, - vpa_width, vpa_wavenumber, vpa_density_amplitude, vpa_density_phase, - vpa_upar_amplitude, vpa_upar_phase, vpa_temperature_amplitude, - vpa_temperature_phase, vpa_monomial_degree) - - # fill in entries in species struct corresponding to ion species - for is ∈ 1:n_ion_species - species_ion[is] = species_parameters_mutable("ion", initial_temperature, initial_density, - deepcopy(z_initial_conditions), deepcopy(r_initial_conditions), - deepcopy(vpa_initial_conditions)) - end - # if there are neutrals, fill in corresponding entries in species struct - if n_neutral_species > 0 - for is ∈ 1:n_neutral_species - species_neutral[is] = species_parameters_mutable("neutral", initial_temperature, - initial_density, deepcopy(z_initial_conditions), - deepcopy(r_initial_conditions), deepcopy(vpa_initial_conditions)) - end - end - species = (ion = species_ion, neutral = species_neutral) # if drive_phi = true, include external electrostatic potential of form # phi(z,t=0)*drive_amplitude*sinpi(time*drive_frequency) @@ -1120,7 +859,7 @@ function load_defaults(n_ion_species, n_neutral_species, electron_physics) drive_frequency = 1.0 drive = drive_input_mutable(drive_phi, drive_amplitude, drive_frequency) - return z, r, vpa, vperp, gyrophase, vz, vr, vzeta, species, composition, drive, evolve_moments + return z, r, vpa, vperp, gyrophase, vz, vr, vzeta, drive, evolve_moments end """ diff --git a/moment_kinetics/src/species_input.jl b/moment_kinetics/src/species_input.jl new file mode 100644 index 000000000..d239f4156 --- /dev/null +++ b/moment_kinetics/src/species_input.jl @@ -0,0 +1,225 @@ +""" +Module for handling i/o for species specific input parameters +which are hosted in the composition and species structs for passing to functions +""" +module species_input + +export get_species_input + +using ..type_definitions: mk_float, mk_int +using ..input_structs: set_defaults_and_check_section! +using ..input_structs: species_composition, ion_species_parameters, neutral_species_parameters +using ..input_structs: spatial_initial_condition_input, velocity_initial_condition_input +using ..input_structs: boltzmann_electron_response, boltzmann_electron_response_with_simple_sheath + +function get_species_input(toml_input) + + # read general composition parameters + composition_section = set_defaults_and_check_section!(toml_input, "composition", + # n_ion_species is the number of evolved ion species + n_ion_species = 1, + # n_neutral_species is the number of evolved neutral species + n_neutral_species = 1, + # * if electron_physics=boltzmann_electron_response, then the electron density is + # fixed to be N_e*(eϕ/T_e) + # * if electron_physics=boltzmann_electron_response_with_simple_sheath, then the + # electron density is fixed to be N_e*(eϕ/T_e) and N_e is calculated w.r.t a + # reference value using J_||e + J_||i = 0 at z = 0 + electron_physics = boltzmann_electron_response, + # initial Tₑ = 1 + T_e = 1.0, + # wall temperature T_wall = Tw/Te + T_wall = 1.0, + # phi_wall at z = -L/2 + phi_wall = 0.0, + # ratio of the neutral particle mass to the ion mass + mn_over_mi = 1.0, + # ratio of the electron particle mass to the ion mass + me_over_mi = 1.0/1836.0, + # if false use true Knudsen cosine for neutral wall bc + use_test_neutral_wall_pdf = false, + # The ion flux reaching the wall that is recycled as neutrals is reduced by + # `recycling_fraction` to account for ions absorbed by the wall. + recycling_fraction = 1.0, + # gyrokinetic_ions = True -> use gyroaveraged fields at fixed guiding centre and moments of the pdf computed at fixed r + # gyrokinetic_ions = False -> use drift kinetic approximation + gyrokinetic_ions = false) + + nspec_ion = composition_section["n_ion_species"] + nspec_neutral = composition_section["n_neutral_species"] + nspec_tot = nspec_ion + nspec_neutral + + # read individual species parameters + ion_spec_params_list = Array{ion_species_parameters,1}(undef,nspec_ion) + neutral_spec_params_list = Array{neutral_species_parameters,1}(undef,nspec_neutral) + for is in 1:nspec_ion + spec_section = set_defaults_and_check_section!(toml_input, "ion_species_"*string(is), + # [ion_species_1], [ion_species_2], etc + # mass of ion species + mass = 1.0, + # charge number + zeds = 1.0, + # initial density + initial_density = 1.0, + # initial temperature + initial_temperature = 1.0) + + z_IC_section = set_defaults_and_check_section!(toml_input, "ion_z_IC_species_"*string(is), + # [ion_z_IC_species_1], [ion_z_IC_species_2], etc + initialization_option = "gaussian", + width = 0.125, + wavenumber = 1, + density_amplitude = 0.001, + density_phase = 0.0, + upar_amplitude = 0.0, + upar_phase = 0.0, + temperature_amplitude = 0.0, + temperature_phase = 0.0, + monomial_degree = 2) + z_IC_input = Dict(Symbol(k)=>v for (k,v) in z_IC_section) + z_IC = spatial_initial_condition_input(; z_IC_input...) + + r_IC_section = set_defaults_and_check_section!(toml_input, "ion_r_IC_species_"*string(is), + # [ion_r_IC_species_1], [ion_r_IC_species_2], etc + initialization_option = "gaussian", + width = 0.125, + wavenumber = 1, + density_amplitude = 0.001, + density_phase = 0.0, + upar_amplitude = 0.0, + upar_phase = 0.0, + temperature_amplitude = 0.0, + temperature_phase = 0.0, + monomial_degree = 2) + r_IC_input= Dict(Symbol(k)=>v for (k,v) in r_IC_section) + r_IC = spatial_initial_condition_input(; r_IC_input...) + + vpa_IC_section = set_defaults_and_check_section!(toml_input, "ion_vpa_IC_species_"*string(is), + # [ion_vpa_IC_species_1], [ion_vpa_IC_species_2], etc + initialization_option = "gaussian", + width = 1.0, + wavenumber = 1, + density_amplitude = 1.0, + density_phase = 0.0, + upar_amplitude = 0.0, + upar_phase = 0.0, + temperature_amplitude = 0.0, + temperature_phase = 0.0, + monomial_degree = 2, + # need to read resolutions before setting defaults here + v0 = 1.0, + vth0 = 1.0, + vpa0 = 1.0, + vperp0 = 1.0) + vpa_IC_input= Dict(Symbol(k)=>v for (k,v) in vpa_IC_section) + vpa_IC = velocity_initial_condition_input(; vpa_IC_input...) + + IC_input = Dict("z_IC" => z_IC, "r_IC" => r_IC, "vpa_IC" => vpa_IC) + type_input = Dict("type" => "ion") + spec_section = merge(spec_section, IC_input, type_input) + spec_input = Dict(Symbol(k)=>v for (k,v) in spec_section) + ion_spec_params_list[is] = ion_species_parameters(; spec_input...) + end + for isn in 1:nspec_neutral + spec_section = set_defaults_and_check_section!(toml_input, "neutral_species_"*string(isn), + # [neutral_species_1], [neutral_species_2], etc + # mass of neutral species + mass = 1.0, + # initial density + initial_density = 1.0, + # initial temperature + initial_temperature = 1.0) + + z_IC_section = set_defaults_and_check_section!(toml_input, "neutral_z_IC_species_"*string(isn), + # [neutral_z_IC_species_1], [neutral_z_IC_species_2], etc + initialization_option = "gaussian", + width = 0.125, + wavenumber = 1, + density_amplitude = 0.001, + density_phase = 0.0, + upar_amplitude = 0.0, + upar_phase = 0.0, + temperature_amplitude = 0.0, + temperature_phase = 0.0, + monomial_degree = 2) + z_IC_input = Dict(Symbol(k)=>v for (k,v) in z_IC_section) + z_IC = spatial_initial_condition_input(; z_IC_input...) + + r_IC_section = set_defaults_and_check_section!(toml_input, "neutral_r_IC_species_"*string(isn), + # [neutral_r_IC_species_1], [neutral_r_IC_species_2], etc + initialization_option = "gaussian", + width = 0.125, + wavenumber = 1, + density_amplitude = 0.001, + density_phase = 0.0, + upar_amplitude = 0.0, + upar_phase = 0.0, + temperature_amplitude = 0.0, + temperature_phase = 0.0, + monomial_degree = 2) + r_IC_input= Dict(Symbol(k)=>v for (k,v) in r_IC_section) + r_IC = spatial_initial_condition_input(; r_IC_input...) + + vpa_IC_section = set_defaults_and_check_section!(toml_input, "neutral_vpa_IC_species_"*string(isn), + # [neutral_vpa_IC_species_1], [neutral_vpa_IC_species_2], etc + initialization_option = "gaussian", + width = 1.0, + wavenumber = 1, + density_amplitude = 1.0, + density_phase = 0.0, + upar_amplitude = 0.0, + upar_phase = 0.0, + temperature_amplitude = 0.0, + temperature_phase = 0.0, + monomial_degree = 2, + # need to read resolutions before setting defaults here + v0 = 1.0, + vth0 = 1.0, + vpa0 = 1.0, + vperp0 = 1.0) + vpa_IC_input= Dict(Symbol(k)=>v for (k,v) in vpa_IC_section) + vpa_IC = velocity_initial_condition_input(; vpa_IC_input...) + + IC_input = Dict("z_IC" => z_IC, "r_IC" => r_IC, "vpa_IC" => vpa_IC) + type_input = Dict("type" => "neutral") + spec_section = merge(spec_section, IC_input, type_input) + spec_input = Dict(Symbol(k)=>v for (k,v) in spec_section) + neutral_spec_params_list[isn] = neutral_species_parameters(; spec_input...) + end + # construct composition dict + println(composition_section) + println(ion_spec_params_list) + println(neutral_spec_params_list) + println(composition_section["n_ion_species"]) + species_dict = Dict("n_species" => nspec_tot, "ion" => ion_spec_params_list, "neutral" => neutral_spec_params_list) + println(species_dict) + composition_section = merge(composition_section,species_dict) + println(composition_section) + input = Dict(Symbol(k)=>v for (k,v) in composition_section) + println(input) + # construct composition struct + composition = species_composition(; input...) + println(composition) + println("") + for is in 1:composition.n_ion_species + println("ion_species_"*string(is)) + println("mass: ",composition.ion[1].mass) + println("Zs: ",composition.ion[1].zeds) + println("") + end + + for isn in 1:composition.n_neutral_species + println("neutral_species_"*string(isn)) + println("mass: ",composition.neutral[1].mass) + println("") + end + + ## checks and errors + if !(0.0 <= composition.recycling_fraction <= 1.0) + error("recycling_fraction must be between 0 and 1. Got $recycling_fraction.") + end + + return composition +end + +end From 546c68ae415acd41f1e3b7c7788160709edad336 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:09:05 +0100 Subject: [PATCH 03/46] Workaround for file i/o error, make electron physics determined by String const variables which match allowed TOML input variables. --- moment_kinetics/src/input_structs.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/moment_kinetics/src/input_structs.jl b/moment_kinetics/src/input_structs.jl index 4d68b06ca..0845a849e 100644 --- a/moment_kinetics/src/input_structs.jl +++ b/moment_kinetics/src/input_structs.jl @@ -154,8 +154,9 @@ end """ """ -@enum electron_physics_type boltzmann_electron_response boltzmann_electron_response_with_simple_sheath -export electron_physics_type, boltzmann_electron_response, boltzmann_electron_response_with_simple_sheath +const boltzmann_electron_response = "boltzmann_electron_response" +const boltzmann_electron_response_with_simple_sheath = "boltzmann_electron_response_with_simple_sheath" +export boltzmann_electron_response, boltzmann_electron_response_with_simple_sheath """ """ @@ -351,7 +352,7 @@ Base.@kwdef struct species_composition # * if electron_physics=boltzmann_electron_response_with_simple_sheath, the electron # density is fixed to be Nₑ*(eϕ/T_e) and N_e is calculated using a current # condition at the wall - electron_physics::electron_physics_type + electron_physics::String # if false -- wall bc uses true Knudsen cosine to specify neutral pdf leaving the wall # if true -- use a simpler pdf that is easier to integrate use_test_neutral_wall_pdf::Bool From 8340491308acab2b1f83dc66f11fae1a9828b606 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:10:49 +0100 Subject: [PATCH 04/46] Comment out print statements. --- moment_kinetics/src/species_input.jl | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/moment_kinetics/src/species_input.jl b/moment_kinetics/src/species_input.jl index d239f4156..73a724c0e 100644 --- a/moment_kinetics/src/species_input.jl +++ b/moment_kinetics/src/species_input.jl @@ -187,32 +187,32 @@ function get_species_input(toml_input) neutral_spec_params_list[isn] = neutral_species_parameters(; spec_input...) end # construct composition dict - println(composition_section) - println(ion_spec_params_list) - println(neutral_spec_params_list) - println(composition_section["n_ion_species"]) + #println(composition_section) + #println(ion_spec_params_list) + #println(neutral_spec_params_list) + #println(composition_section["n_ion_species"]) species_dict = Dict("n_species" => nspec_tot, "ion" => ion_spec_params_list, "neutral" => neutral_spec_params_list) - println(species_dict) + #println(species_dict) composition_section = merge(composition_section,species_dict) - println(composition_section) + #println(composition_section) input = Dict(Symbol(k)=>v for (k,v) in composition_section) - println(input) + #println(input) # construct composition struct composition = species_composition(; input...) - println(composition) - println("") - for is in 1:composition.n_ion_species - println("ion_species_"*string(is)) - println("mass: ",composition.ion[1].mass) - println("Zs: ",composition.ion[1].zeds) - println("") - end + #println(composition) + #println("") + #for is in 1:composition.n_ion_species + #println("ion_species_"*string(is)) + #println("mass: ",composition.ion[1].mass) + #println("Zs: ",composition.ion[1].zeds) + #println("") + #end - for isn in 1:composition.n_neutral_species - println("neutral_species_"*string(isn)) - println("mass: ",composition.neutral[1].mass) - println("") - end + #for isn in 1:composition.n_neutral_species + # println("neutral_species_"*string(isn)) + # println("mass: ",composition.neutral[1].mass) + # println("") + #end ## checks and errors if !(0.0 <= composition.recycling_fraction <= 1.0) From 1c70e113a8e7c851365802f81933097c98d75229 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:16:04 +0100 Subject: [PATCH 05/46] Update post processing functions. --- .../makie_post_processing/src/shared_utils.jl | 43 +------------------ 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/makie_post_processing/makie_post_processing/src/shared_utils.jl b/makie_post_processing/makie_post_processing/src/shared_utils.jl index 32acaf1ec..9f5289ae7 100644 --- a/makie_post_processing/makie_post_processing/src/shared_utils.jl +++ b/makie_post_processing/makie_post_processing/src/shared_utils.jl @@ -13,6 +13,7 @@ using moment_kinetics.type_definitions: mk_float, mk_int using moment_kinetics.reference_parameters: setup_reference_parameters using moment_kinetics.moment_kinetics_input: get_default_rhostar using moment_kinetics.geo: init_magnetic_geometry, setup_geometry_input +using moment_kinetics.species_input: get_species_input using MPI """ @@ -65,47 +66,7 @@ end """ """ function get_composition(scan_input) - reference_params = setup_reference_parameters(scan_input) - # set composition input - # MRH need to get this in way that does not duplicate code - # MRH from moment_kinetics_input.jl - electron_physics = get(scan_input, "electron_physics", boltzmann_electron_response) - - n_ion_species = get(scan_input, "n_ion_species", 1) - n_neutral_species = get(scan_input, "n_neutral_species", 1) - if electron_physics ∈ (boltzmann_electron_response, boltzmann_electron_response_with_simple_sheath) - n_species = n_ion_species + n_neutral_species - else - n_species = n_ion_species + n_neutral_species + 1 - end - T_e = get(scan_input, "T_e", 1.0) - # set wall temperature T_wall = Tw/Te - T_wall = get(scan_input, "T_wall", 1.0) - # set initial neutral temperature Tn/Tₑ = 1 - # set initial nᵢ/Nₑ = 1.0 - # set phi_wall at z = 0 - phi_wall = get(scan_input, "phi_wall", 0.0) - # if false use true Knudsen cosine for neutral wall bc - use_test_neutral_wall_pdf = get(scan_input, "use_test_neutral_wall_pdf", false) - gyrokinetic_ions = get(scan_input, "gyrokinetic_ions", false) - # constant to be used to test nonzero Er in wall boundary condition - recycling_fraction = get(scan_input, "recycling_fraction", 1.0) - # constant to be used to control Ez divergences - epsilon_offset = get(scan_input, "epsilon_offset", 0.001) - # bool to control if dfni is a function of vpa or vpabar in MMS test - use_vpabar_in_mms_dfni = get(scan_input, "use_vpabar_in_mms_dfni", true) - if use_vpabar_in_mms_dfni - alpha_switch = 1.0 - else - alpha_switch = 0.0 - end - # ratio of the neutral particle mass to the ion particle mass - mn_over_mi = 1.0 - # ratio of the electron particle mass to the ion particle mass - me_over_mi = 1.0/1836.0 - composition = species_composition(n_species, n_ion_species, n_neutral_species, - electron_physics, use_test_neutral_wall_pdf, T_e, T_wall, phi_wall, - mn_over_mi, me_over_mi, recycling_fraction, gyrokinetic_ions, allocate_float(n_species)) + composition = get_species_input(scan_input) return composition end From c4afb3c4ee5b996023737dbf41033db344e8a9b5 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:24:23 +0100 Subject: [PATCH 06/46] Script showing how to define function to merge arbitrary Dicts of Dicts. Another level of Dict nesting would require further effort. --- test_scripts/dict_merge.jl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test_scripts/dict_merge.jl diff --git a/test_scripts/dict_merge.jl b/test_scripts/dict_merge.jl new file mode 100644 index 000000000..3cca83f03 --- /dev/null +++ b/test_scripts/dict_merge.jl @@ -0,0 +1,28 @@ +export dict_merge_test + +dict_base = Dict("a" => 1, + "bdict" => Dict("a" => 2, "f" =>3), + "cdict" => Dict("a" => 2, "f" =>3)) + +function dict_merge_test(dict_base=dict_base; args...) + println("before merge: ",dict_base) + for (k,v) in args + println(k, " ", v) + if String(k) in keys(dict_base) + if isa(v,AbstractDict) + v = merge(dict_base[String(k)],v) + end + end + dict_mod = Dict(String(k) => v) + dict_base = merge(dict_base, dict_mod) + end + println("after merge: ",dict_base) +end + + +if abspath(PROGRAM_FILE) == @__FILE__ + using Pkg + Pkg.activate(".") + + dict_merge_test(a=4,bdict=Dict("g"=>6.0,"h" => 8),zed=74,xx=Dict("sz" => 5)) +end \ No newline at end of file From 3dd6d9c0d79cea09fcc08328f39a7c2f766d4477 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Sun, 4 Aug 2024 16:58:06 +0100 Subject: [PATCH 07/46] Refactor tests to match new input structure. Gyroaverage tests failing because of some strange typing error, to be fixed. --- moment_kinetics/src/input_structs.jl | 24 ++ moment_kinetics/src/species_input.jl | 14 +- .../test/Krook_collisions_tests.jl | 49 ++-- .../fokker_planck_time_evolution_tests.jl | 42 ++-- moment_kinetics/test/gyroaverage_tests.jl | 28 +-- moment_kinetics/test/harrisonthompson.jl | 45 ++-- ...ear_sound_wave_inputs_and_expected_data.jl | 44 ++-- .../test/nonlinear_sound_wave_tests.jl | 4 +- .../test/recycling_fraction_tests.jl | 80 +++--- moment_kinetics/test/sound_wave_tests.jl | 229 +++++++++++------- moment_kinetics/test/wall_bc_tests.jl | 78 +++--- 11 files changed, 344 insertions(+), 293 deletions(-) diff --git a/moment_kinetics/src/input_structs.jl b/moment_kinetics/src/input_structs.jl index 0845a849e..23ff4fade 100644 --- a/moment_kinetics/src/input_structs.jl +++ b/moment_kinetics/src/input_structs.jl @@ -18,6 +18,7 @@ export pp_input export geometry_input export set_defaults_and_check_top_level!, set_defaults_and_check_section!, Dict_to_NamedTuple +export merge_dict_with_kwargs! using ..communication using ..type_definitions: mk_float, mk_int @@ -779,4 +780,27 @@ function Dict_to_NamedTuple(d) return NamedTuple(Symbol(k)=>v for (k,v) ∈ d) end +""" +Dict merge function for named keyword arguments +for case when input Dict is a mixed Dict of Dicts +and non-Dict float/int/string entries, and the +keyword arguments are also a mix of Dicts and non-Dicts +""" + +function merge_dict_with_kwargs!(dict_base; args...) + #println("before merge: ",dict_base) + for (k,v) in args + println(k, " ", v) + if String(k) in keys(dict_base) + if isa(v,AbstractDict) + v = merge(dict_base[String(k)],v) + end + end + dict_mod = Dict(String(k) => v) + dict_base = merge(dict_base, dict_mod) + end + #println("after merge: ",dict_base) + return nothing +end + end diff --git a/moment_kinetics/src/species_input.jl b/moment_kinetics/src/species_input.jl index 73a724c0e..7ac468987 100644 --- a/moment_kinetics/src/species_input.jl +++ b/moment_kinetics/src/species_input.jl @@ -44,7 +44,7 @@ function get_species_input(toml_input) # gyrokinetic_ions = True -> use gyroaveraged fields at fixed guiding centre and moments of the pdf computed at fixed r # gyrokinetic_ions = False -> use drift kinetic approximation gyrokinetic_ions = false) - + nspec_ion = composition_section["n_ion_species"] nspec_neutral = composition_section["n_neutral_species"] nspec_tot = nspec_ion + nspec_neutral @@ -64,7 +64,7 @@ function get_species_input(toml_input) # initial temperature initial_temperature = 1.0) - z_IC_section = set_defaults_and_check_section!(toml_input, "ion_z_IC_species_"*string(is), + z_IC_section = set_defaults_and_check_section!(toml_input, "z_IC_ion_species_"*string(is), # [ion_z_IC_species_1], [ion_z_IC_species_2], etc initialization_option = "gaussian", width = 0.125, @@ -79,7 +79,7 @@ function get_species_input(toml_input) z_IC_input = Dict(Symbol(k)=>v for (k,v) in z_IC_section) z_IC = spatial_initial_condition_input(; z_IC_input...) - r_IC_section = set_defaults_and_check_section!(toml_input, "ion_r_IC_species_"*string(is), + r_IC_section = set_defaults_and_check_section!(toml_input, "r_IC_ion_species_"*string(is), # [ion_r_IC_species_1], [ion_r_IC_species_2], etc initialization_option = "gaussian", width = 0.125, @@ -94,7 +94,7 @@ function get_species_input(toml_input) r_IC_input= Dict(Symbol(k)=>v for (k,v) in r_IC_section) r_IC = spatial_initial_condition_input(; r_IC_input...) - vpa_IC_section = set_defaults_and_check_section!(toml_input, "ion_vpa_IC_species_"*string(is), + vpa_IC_section = set_defaults_and_check_section!(toml_input, "vpa_IC_ion_species_"*string(is), # [ion_vpa_IC_species_1], [ion_vpa_IC_species_2], etc initialization_option = "gaussian", width = 1.0, @@ -130,7 +130,7 @@ function get_species_input(toml_input) # initial temperature initial_temperature = 1.0) - z_IC_section = set_defaults_and_check_section!(toml_input, "neutral_z_IC_species_"*string(isn), + z_IC_section = set_defaults_and_check_section!(toml_input, "z_IC_neutral_species_"*string(isn), # [neutral_z_IC_species_1], [neutral_z_IC_species_2], etc initialization_option = "gaussian", width = 0.125, @@ -145,7 +145,7 @@ function get_species_input(toml_input) z_IC_input = Dict(Symbol(k)=>v for (k,v) in z_IC_section) z_IC = spatial_initial_condition_input(; z_IC_input...) - r_IC_section = set_defaults_and_check_section!(toml_input, "neutral_r_IC_species_"*string(isn), + r_IC_section = set_defaults_and_check_section!(toml_input, "r_IC_neutral_species_"*string(isn), # [neutral_r_IC_species_1], [neutral_r_IC_species_2], etc initialization_option = "gaussian", width = 0.125, @@ -160,7 +160,7 @@ function get_species_input(toml_input) r_IC_input= Dict(Symbol(k)=>v for (k,v) in r_IC_section) r_IC = spatial_initial_condition_input(; r_IC_input...) - vpa_IC_section = set_defaults_and_check_section!(toml_input, "neutral_vpa_IC_species_"*string(isn), + vpa_IC_section = set_defaults_and_check_section!(toml_input, "vz_IC_neutral_species_"*string(isn), # [neutral_vpa_IC_species_1], [neutral_vpa_IC_species_2], etc initialization_option = "gaussian", width = 1.0, diff --git a/moment_kinetics/test/Krook_collisions_tests.jl b/moment_kinetics/test/Krook_collisions_tests.jl index 91e6bb7de..2f4b1946e 100644 --- a/moment_kinetics/test/Krook_collisions_tests.jl +++ b/moment_kinetics/test/Krook_collisions_tests.jl @@ -7,7 +7,7 @@ include("setup.jl") using Base.Filesystem: tempname using moment_kinetics.coordinates: define_coordinate -using moment_kinetics.input_structs: grid_input, advection_input +using moment_kinetics.input_structs: grid_input, advection_input, merge_dict_with_kwargs! using moment_kinetics.load_data: open_readonly_output_file, load_coordinate_data, load_species_data, load_fields_data, load_ion_moments_data, load_pdf_data, @@ -85,34 +85,35 @@ const expected = 0.024284888662941113 0.010011392733734206 0.008423252360063494 0.019281192435730943 0.036719507768509525 0.041644492169994836 0.03692283098105331 0.03638215764882269 0.04191389118981368 0.04071460358290303 0.024284888662941134]) # default inputs for tests -test_input_full_f = Dict("n_ion_species" => 1, - "n_neutral_species" => 1, - "boltzmann_electron_response" => true, +test_input_full_f = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, + "n_neutral_species" => 1, + "electron_physics" => "boltzmann_electron_response", + "T_e" => 1.0, + "T_wall" => 1.0), + "ion_species_1" => Dict{String,Any}("initial_density" => 0.5, + "initial_temperature" => 1.0), + "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "density_amplitude" => 0.5, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.5, + "temperature_phase" => mk_float(π)), + "neutral_species_1" => Dict{String,Any}("initial_density" => 0.5, + "initial_temperature" => 1.0), + "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "density_amplitude" => 0.5, + "density_phase" => mk_float(π), + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.5, + "temperature_phase" => 0.0), "run_name" => "full_f", "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => true, "krook_collisions" => Dict{String,Any}("use_krook" => true,"frequency_option" => "reference_parameters"), - "T_e" => 1.0, - "initial_density1" => 0.5, - "initial_temperature1" => 1.0, - "initial_density2" => 0.5, - "initial_temperature2" => 1.0, - "z_IC_option1" => "sinusoid", - "z_IC_density_amplitude1" => 0.5, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 0.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.5, - "z_IC_temperature_phase1" => mk_float(π), - "z_IC_option2" => "sinusoid", - "z_IC_density_amplitude2" => 0.5, - "z_IC_density_phase2" => mk_float(π), - "z_IC_upar_amplitude2" => 0.0, - "z_IC_upar_phase2" => 0.0, - "z_IC_temperature_amplitude2" => 0.5, - "z_IC_temperature_phase2" => 0.0, "charge_exchange_frequency" => 2*π*0.1, "ionization_frequency" => 0.0, "timestepping" => Dict{String,Any}("nstep" => 100, @@ -185,7 +186,7 @@ function run_test(test_input, rtol, atol; args...) # Update default inputs with values to be changed input = merge(test_input, modified_inputs) - + merge_dict_with_kwargs!(input; args...) input["run_name"] = name # Suppress console output while running diff --git a/moment_kinetics/test/fokker_planck_time_evolution_tests.jl b/moment_kinetics/test/fokker_planck_time_evolution_tests.jl index a02fddf70..0a44262ab 100644 --- a/moment_kinetics/test/fokker_planck_time_evolution_tests.jl +++ b/moment_kinetics/test/fokker_planck_time_evolution_tests.jl @@ -5,7 +5,7 @@ using Base.Filesystem: tempname using MPI using moment_kinetics.coordinates: define_coordinate -using moment_kinetics.input_structs: grid_input, advection_input +using moment_kinetics.input_structs: grid_input, advection_input, merge_dict_with_kwargs! using moment_kinetics.load_data: open_readonly_output_file, load_coordinate_data, load_species_data, load_fields_data, load_ion_moments_data, load_pdf_data, @@ -225,11 +225,19 @@ end # default inputs for tests test_input_gauss_legendre = Dict("run_name" => "gausslegendre_pseudospectral", "base_directory" => test_output_directory, - "n_ion_species" => 1, - "n_neutral_species" => 0, - "T_wall" => 1.0, - "T_e" => 1.0, - "initial_temperature2" => 1.0, + "composition" => Dict{String,Any}("n_ion_species" => 1, + "n_neutral_species" => 0, + "electron_physics" => "boltzmann_electron_response", + "T_e" => 1.0), + "ion_species_1" => Dict{String,Any}("initial_density" => 0.5, + "initial_temperature" => 1.0), + "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "density_amplitude" => 0.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), "vpa_ngrid" => 3, "vpa_L" => 6.0, "vpa_nelement" => 6, @@ -239,34 +247,16 @@ test_input_gauss_legendre = Dict("run_name" => "gausslegendre_pseudospectral", "vperp_nelement" => 3, "vperp_L" => 3.0, "vperp_discretization" => "gausslegendre_pseudospectral", - #"split_operators" => false, "ionization_frequency" => 0.0, "charge_exchange_frequency" => 0.0, "constant_ionization_rate" => false, "electron_physics" => "boltzmann_electron_response", "fokker_planck_collisions" => Dict{String,Any}("use_fokker_planck" => true, "nuii" => 1.0, "frequency_option" => "manual"), - "z_IC_upar_amplitude1" => 0.0, - "z_IC_density_amplitude1" => 0.0, - "z_IC_upar_amplitude2" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.0, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, - "z_IC_option1" => "sinusoid", "evolve_moments_parallel_flow" => false, - "z_IC_density_phase2" => 0.0, "z_discretization" => "chebyshev_pseudospectral", - "z_IC_upar_phase2" => 0.0, "evolve_moments_density" => false, - "z_IC_temperature_amplitude2" => 0.0, - "initial_density1" => 0.5, - "z_IC_upar_phase1" => 0.0, - "initial_density2" => 0.5, - "z_IC_density_phase1" => 0.0, - "z_IC_option2" => "sinusoid", - "z_IC_density_amplitude2" => 0.001, - "initial_temperature1" => 1.0, - "z_IC_temperature_phase2" => 0.0, "z_ngrid" => 1, "z_nelement_local" => 1, "z_nelement" => 1, @@ -283,7 +273,7 @@ test_input_gauss_legendre = Dict("run_name" => "gausslegendre_pseudospectral", """ -Run a sound-wave test for a single set of parameters +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, expected, rtol, atol, upar_rtol=nothing; args...) @@ -315,7 +305,7 @@ function run_test(test_input, expected, rtol, atol, upar_rtol=nothing; args...) # Update default inputs with values to be changed input = merge(test_input, modified_inputs) - + merge_dict_with_kwargs!(input; args...) input["run_name"] = name # Suppress console output while running quietoutput() do diff --git a/moment_kinetics/test/gyroaverage_tests.jl b/moment_kinetics/test/gyroaverage_tests.jl index 21c43f0b7..ff842ec17 100644 --- a/moment_kinetics/test/gyroaverage_tests.jl +++ b/moment_kinetics/test/gyroaverage_tests.jl @@ -17,6 +17,7 @@ using moment_kinetics.array_allocation: allocate_float, allocate_shared_float using moment_kinetics.gyroaverages: gyroaverage_pdf! using moment_kinetics.gyroaverages: gyroaverage_field!, init_gyro_operators using moment_kinetics.type_definitions: mk_float, mk_int +using moment_kinetics.species_input: get_species_input print_test_results = false @@ -229,30 +230,9 @@ function gyroaverage_test(absolute_error; rhostar=0.1, pitch=0.5, ngrid=5, kr=2, end function create_test_composition() - electron_physics = boltzmann_electron_response - n_ion_species = 1 - n_neutral_species = 0 - n_species = n_ion_species + n_neutral_species - use_test_neutral_wall_pdf = false - # electron temperature over reference temperature - T_e = 1.0 - # temperature at the entrance to the wall in terms of the electron temperature - T_wall = 1.0 - # wall potential at z = 0 - phi_wall = 0.0 - # constant to test nonzero Er - #Er_constant = 0.0 - # ratio of the neutral particle mass to the ion particle mass - mn_over_mi = 1.0 - # ratio of the electron particle mass to the ion particle mass - me_over_mi = 1.0/1836.0 - # The ion flux reaching the wall that is recycled as neutrals is reduced by - # `recycling_fraction` to account for ions absorbed by the wall. - recycling_fraction = 1.0 - gyrokinetic_ions = true - return composition = species_composition(n_species, n_ion_species, n_neutral_species, - electron_physics, use_test_neutral_wall_pdf, T_e, T_wall, phi_wall, #Er_constant, - mn_over_mi, me_over_mi, recycling_fraction, gyrokinetic_ions, allocate_float(n_species)) + input_dict = Dict{String,Any}("composition" => Dict("gyrokinetic_ions" => true ) ) + println(input_dict) + return get_species_input(input_dict) end function fill_test_arrays!(phi,gphi,vperp,z,r,geometry,composition,kz,kr,phasez,phaser) diff --git a/moment_kinetics/test/harrisonthompson.jl b/moment_kinetics/test/harrisonthompson.jl index 4e4cada7d..3fbe78f36 100644 --- a/moment_kinetics/test/harrisonthompson.jl +++ b/moment_kinetics/test/harrisonthompson.jl @@ -11,6 +11,7 @@ using SpecialFunctions: dawson using moment_kinetics.load_data: open_readonly_output_file using moment_kinetics.load_data: load_fields_data, load_time_data using moment_kinetics.load_data: load_species_data, load_coordinate_data +using moment_kinetics.input_structs: merge_dict_with_kwargs! ionization_frequency = 0.688 @@ -61,32 +62,32 @@ function findphi(z, R_ion) end # default inputs for tests -test_input_finite_difference = Dict("n_ion_species" => 1, - "n_neutral_species" => 0, - "boltzmann_electron_response" => true, +test_input_finite_difference = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, + "n_neutral_species" => 0, + "electron_physics" => "boltzmann_electron_response", + "T_e" => 1.0, + "T_wall" => 1.0), + "ion_species_1" => Dict{String,Any}("initial_density" => 1.0, + "initial_temperature" => 1.0), + "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 0.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "vpa_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 1.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), "run_name" => "finite_difference", "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, - "T_e" => 1.0, - "T_wall" => 1.0, - "initial_density1" => 1.0, - "initial_temperature1" => 1.0, - "z_IC_option1" => "gaussian", - "z_IC_density_amplitude1" => 0.0, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 0.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "vpa_IC_option1" => "gaussian", - "vpa_IC_density_amplitude1" => 1.0, - "vpa_IC_density_phase1" => 0.0, - "vpa_IC_upar_amplitude1" => 0.0, - "vpa_IC_upar_phase1" => 0.0, - "vpa_IC_temperature_amplitude1" => 0.0, - "vpa_IC_temperature_phase1" => 0.0, "charge_exchange_frequency" => 0.0, "ionization_frequency" => 0.0, "constant_ionization_rate" => true, @@ -175,7 +176,7 @@ function run_test(test_input, analytic_rtol, analytic_atol, expected_phi, # Update default inputs with values to be changed input = merge(test_input, modified_inputs) - + merge_dict_with_kwargs!(input; args...) input["run_name"] = name # Suppress console output while running diff --git a/moment_kinetics/test/nonlinear_sound_wave_inputs_and_expected_data.jl b/moment_kinetics/test/nonlinear_sound_wave_inputs_and_expected_data.jl index d76a644f9..8e5ab4988 100644 --- a/moment_kinetics/test/nonlinear_sound_wave_inputs_and_expected_data.jl +++ b/moment_kinetics/test/nonlinear_sound_wave_inputs_and_expected_data.jl @@ -82,33 +82,33 @@ const expected = 0.024285034070612672 0.01001177872485688 0.00842420216637052 0.019283695804388705 0.03672486160719087 0.04165072188572364 0.0369234055803037 0.036374533667106045 0.041904838760501203 0.040712367539469434 0.02428503407061266]) # default inputs for tests -test_input_finite_difference = Dict("n_ion_species" => 1, - "n_neutral_species" => 1, - "boltzmann_electron_response" => true, +test_input_finite_difference = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, + "n_neutral_species" => 1, + "electron_physics" => "boltzmann_electron_response", + "T_e" => 1.0), + "ion_species_1" => Dict{String,Any}("initial_density" => 0.5, + "initial_temperature" => 1.0), + "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "density_amplitude" => 0.5, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.5, + "temperature_phase" => mk_float(π)), + "neutral_species_1" => Dict{String,Any}("initial_density" => 0.5, + "initial_temperature" => 1.0), + "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "density_amplitude" => 0.5, + "density_phase" => mk_float(π), + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.5, + "temperature_phase" => 0.0), "run_name" => "finite_difference", "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => true, - "T_e" => 1.0, - "initial_density1" => 0.5, - "initial_temperature1" => 1.0, - "initial_density2" => 0.5, - "initial_temperature2" => 1.0, - "z_IC_option1" => "sinusoid", - "z_IC_density_amplitude1" => 0.5, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 0.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.5, - "z_IC_temperature_phase1" => mk_float(π), - "z_IC_option2" => "sinusoid", - "z_IC_density_amplitude2" => 0.5, - "z_IC_density_phase2" => mk_float(π), - "z_IC_upar_amplitude2" => 0.0, - "z_IC_upar_phase2" => 0.0, - "z_IC_temperature_amplitude2" => 0.5, - "z_IC_temperature_phase2" => 0.0, "charge_exchange_frequency" => 2*π*0.1, "ionization_frequency" => 0.0, "timestepping" => Dict{String,Any}("nstep" => 100, diff --git a/moment_kinetics/test/nonlinear_sound_wave_tests.jl b/moment_kinetics/test/nonlinear_sound_wave_tests.jl index 590047000..cd773b5e2 100644 --- a/moment_kinetics/test/nonlinear_sound_wave_tests.jl +++ b/moment_kinetics/test/nonlinear_sound_wave_tests.jl @@ -5,7 +5,7 @@ include("setup.jl") using Base.Filesystem: tempname using moment_kinetics.coordinates: define_coordinate -using moment_kinetics.input_structs: grid_input, advection_input +using moment_kinetics.input_structs: grid_input, advection_input, merge_dict_with_kwargs! using moment_kinetics.interpolation: interpolate_to_grid_z, interpolate_to_grid_vpa using moment_kinetics.load_data: get_run_info_no_setup, close_run_info, postproc_load_variable @@ -49,7 +49,7 @@ function run_test(test_input, rtol, atol, upar_rtol=nothing; args...) # Update default inputs with values to be changed input = merge(test_input, modified_inputs) - + merge_dict_with_kwargs!(input; args...) input["run_name"] = name # Suppress console output while running diff --git a/moment_kinetics/test/recycling_fraction_tests.jl b/moment_kinetics/test/recycling_fraction_tests.jl index 28a22c84f..af087dd02 100644 --- a/moment_kinetics/test/recycling_fraction_tests.jl +++ b/moment_kinetics/test/recycling_fraction_tests.jl @@ -10,55 +10,55 @@ using Base.Filesystem: tempname using MPI using moment_kinetics.coordinates: define_coordinate -using moment_kinetics.input_structs: grid_input, advection_input +using moment_kinetics.input_structs: grid_input, advection_input, merge_dict_with_kwargs! using moment_kinetics.interpolation: interpolate_to_grid_z using moment_kinetics.load_data: get_run_info_no_setup, close_run_info, postproc_load_variable # default inputs for tests -test_input = Dict("n_ion_species" => 1, - "n_neutral_species" => 1, - "boltzmann_electron_response" => true, +test_input = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, + "n_neutral_species" => 1, + "electron_physics" => "boltzmann_electron_response", + "T_e" => 0.2, + "T_wall" => 0.1, + "recycling_fraction" => 0.5), + "ion_species_1" => Dict{String,Any}("initial_density" => 1.0, + "initial_temperature" => 1.0), + "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 0.0, + "density_phase" => 0.0, + "upar_amplitude" => 1.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "vpa_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 1.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "neutral_species_1" => Dict{String,Any}("initial_density" => 1.0, + "initial_temperature" => 1.0), + "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 0.001, + "density_phase" => 0.0, + "upar_amplitude" => -1.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "vpa_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 1.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), "run_name" => "full-f", "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, - "recycling_fraction" => 0.5, - "T_e" => 0.2, - "T_wall" => 0.1, - "initial_density1" => 1.0, - "initial_temperature1" => 1.0, - "z_IC_option1" => "gaussian", - "z_IC_density_amplitude1" => 0.0, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 1.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "vpa_IC_option1" => "gaussian", - "vpa_IC_density_amplitude1" => 1.0, - "vpa_IC_density_phase1" => 0.0, - "vpa_IC_upar_amplitude1" => 0.0, - "vpa_IC_upar_phase1" => 0.0, - "vpa_IC_temperature_amplitude1" => 0.0, - "vpa_IC_temperature_phase1" => 0.0, - "initial_density2" => 1.0, - "initial_temperature2" => 1.0, - "z_IC_option2" => "gaussian", - "z_IC_density_amplitude2" => 0.001, - "z_IC_density_phase2" => 0.0, - "z_IC_upar_amplitude2" => -1.0, - "z_IC_upar_phase2" => 0.0, - "z_IC_temperature_amplitude2" => 0.0, - "z_IC_temperature_phase2" => 0.0, - "vpa_IC_option2" => "gaussian", - "vpa_IC_density_amplitude2" => 1.0, - "vpa_IC_density_phase2" => 0.0, - "vpa_IC_upar_amplitude2" => 0.0, - "vpa_IC_upar_phase2" => 0.0, - "vpa_IC_temperature_amplitude2" => 0.0, - "vpa_IC_temperature_phase2" => 0.0, "charge_exchange_frequency" => 0.75, "ionization_frequency" => 0.5, "constant_ionization_rate" => false, @@ -190,7 +190,7 @@ function run_test(test_input, expected_phi; rtol=4.e-14, atol=1.e-15, args...) # Update default inputs with values to be changed input = merge(test_input, modified_inputs) - + merge_dict_with_kwargs!(input; args...) input["run_name"] = name # Suppress console output while running diff --git a/moment_kinetics/test/sound_wave_tests.jl b/moment_kinetics/test/sound_wave_tests.jl index 813ed5a99..533e1ef2f 100644 --- a/moment_kinetics/test/sound_wave_tests.jl +++ b/moment_kinetics/test/sound_wave_tests.jl @@ -6,7 +6,7 @@ using Base.Filesystem: tempname #using Plots: plot, plot!, gui using moment_kinetics.array_allocation: allocate_float -using moment_kinetics.input_structs: netcdf +using moment_kinetics.input_structs: netcdf, merge_dict_with_kwargs! using moment_kinetics.file_io: io_has_implementation using moment_kinetics.load_data: open_readonly_output_file using moment_kinetics.load_data: load_fields_data, load_time_data @@ -24,33 +24,33 @@ const binary_format = (force_optional_dependencies || io_has_implementation(netc "netcdf" : "hdf5" # default inputs for tests -test_input_finite_difference = Dict("n_ion_species" => 1, - "n_neutral_species" => 1, - "boltzmann_electron_response" => true, +test_input_finite_difference = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, + "n_neutral_species" => 1, + "electron_physics" => "boltzmann_electron_response", + "T_e" => 1.0), + "ion_species_1" => Dict{String,Any}("initial_density" => 0.5, + "initial_temperature" => 1.0), + "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "density_amplitude" => 0.001, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "neutral_species_1" => Dict{String,Any}("initial_density" => 0.5, + "initial_temperature" => 1.0), + "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "density_amplitude" => 0.001, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), "run_name" => "finite_difference", "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => true, - "T_e" => 1.0, - "initial_density1" => 0.5, - "initial_temperature1" => 1.0, - "initial_density2" => 0.5, - "initial_temperature2" => 1.0, - "z_IC_option1" => "sinusoid", - "z_IC_density_amplitude1" => 0.001, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 0.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "z_IC_option2" => "sinusoid", - "z_IC_density_amplitude2" => 0.001, - "z_IC_density_phase2" => 0.0, - "z_IC_upar_amplitude2" => 0.0, - "z_IC_upar_phase2" => 0.0, - "z_IC_temperature_amplitude2" => 0.0, - "z_IC_temperature_phase2" => 0.0, "charge_exchange_frequency" => 2*π*0.1, "ionization_frequency" => 0.0, "timestepping" => Dict{String,Any}("nstep" => 1500, @@ -164,7 +164,7 @@ function run_test(test_input, analytic_frequency, analytic_growth_rate, input = merge(test_input, modified_inputs) input["timestepping"] = merge(test_input["timestepping"], modified_timestepping_inputs) - + merge_dict_with_kwargs!(input; args...) input["run_name"] = shortname # Suppress console output while running @@ -269,39 +269,46 @@ function run_test_set_finite_difference() [-0.001068422466592656, -0.001050527721698838, -0.0010288041337549816, -0.0010033394223323698, -0.0009742364063442995, -0.000941612585497573]; - initial_density1=0.9999, initial_density2=0.0001) + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) @long run_test(test_input_finite_difference, 2*π*1.4467, -2*π*0.6020, [-0.001068422466592656, -0.001050527721698838, -0.0010288041337549816, -0.0010033394223323698, -0.0009742364063442995, - -0.000941612585497573]; initial_density1=0.9999, - initial_density2=0.0001, charge_exchange_frequency=2*π*2.0) + -0.000941612585497573]; + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), + charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) @long run_test(test_input_finite_difference, 2*π*0.0, -2*π*0.5112, [-9.211308789442441, -9.211290894697548, -9.211269171109604, -9.21124370639818, -9.211214603382192, -9.211181979561346]; - initial_density1=0.0001, initial_density2=0.9999, + ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 @long run_test(test_input_finite_difference, 2*π*1.2671, -2*π*0.8033, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544], 30; - T_e=0.5, nstep=1300, charge_exchange_frequency=2*π*0.0) + composition = Dict{String,Any}("T_e" => 0.5), + nstep=1300, charge_exchange_frequency=2*π*0.0) @long run_test(test_input_finite_difference, 2*π*0.0, -2*π*0.2727, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; - T_e=0.5, charge_exchange_frequency=2*π*2.0) + composition = Dict{String,Any}("T_e" => 0.5), + charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 @long run_test(test_input_finite_difference, 2*π*1.9919, -2*π*0.2491, [-2.7764623921048157, -2.776390813125241, -2.7763039187734666, -2.7762020599277726, -2.7760856478638214, -2.775955152580435]; - T_e=4.0) + composition = Dict{String,Any}("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -327,38 +334,45 @@ function run_test_set_finite_difference_split_1_moment() run_test(test_input_finite_difference_split_1_moment, 2*π*1.4467, -2*π*0.6020, [-0.0010684224665919893, -0.0010505277216983934, -0.0010288041337547594, -0.0010033394223312585, -0.0009742364063434105, -0.0009416125854969064]; - initial_density1=0.9999, initial_density2=0.0001) + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) run_test(test_input_finite_difference_split_1_moment, 2*π*1.4467, -2*π*0.6020, [-0.0010684224665919893, -0.0010505277216983934, -0.0010288041337547594, -0.0010033394223312585, -0.0009742364063434105, -0.0009416125854969064]; - initial_density1=0.9999, initial_density2=0.0001, + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) run_test(test_input_finite_difference_split_1_moment, 2*π*0.0, -2*π*0.5112, [-9.211308789442441, -9.211290894697548, -9.211269171109604, -9.21124370639818, -9.211214603382192, -9.211181979561346]; - initial_density1=0.0001, initial_density2=0.9999, + ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 run_test(test_input_finite_difference_split_1_moment, 2*π*1.2671, -2*π*0.8033, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544], 30; - T_e=0.5, nstep=1300, charge_exchange_frequency=2*π*0.0) + composition = Dict{String,Any}("T_e" => 0.5), + nstep=1300, charge_exchange_frequency=2*π*0.0) run_test(test_input_finite_difference_split_1_moment, 2*π*0.0, -2*π*0.2727, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, - -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; T_e=0.5, + -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; + composition = Dict{String,Any}("T_e" => 0.5), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 run_test(test_input_finite_difference_split_1_moment, 2*π*1.9919, -2*π*0.2491, [-2.7764623921048157, -2.776390813125241, -2.7763039187734666, - -2.7762020599277726, -2.7760856478638214, -2.775955152580435]; T_e=4.0) + -2.7762020599277726, -2.7760856478638214, -2.775955152580435]; + composition = Dict{String,Any}("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -384,38 +398,45 @@ function run_test_set_finite_difference_split_2_moments() run_test(test_input_finite_difference_split_2_moments, 2*π*1.4467, -2*π*0.6020, [-0.0010684224665919893, -0.0010505277216983934, -0.0010288041337547594, -0.0010033394223312585, -0.0009742364063434105, -0.0009416125854969064]; - initial_density1=0.9999, initial_density2=0.0001) + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) run_test(test_input_finite_difference_split_2_moments, 2*π*1.4467, -2*π*0.6020, [-0.0010684224665919893, -0.0010505277216983934, -0.0010288041337547594, -0.0010033394223312585, -0.0009742364063434105, -0.0009416125854969064]; - initial_density1=0.9999, initial_density2=0.0001, + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) run_test(test_input_finite_difference_split_2_moments, 2*π*0.0, -2*π*0.5112, [-9.211308789442441, -9.211290894697548, -9.211269171109604, -9.21124370639818, -9.211214603382192, -9.211181979561346]; - initial_density1=0.0001, initial_density2=0.9999, + ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 run_test(test_input_finite_difference_split_2_moments, 2*π*1.2671, -2*π*0.8033, [-0.34706673733456106, -0.3470627566790802, -0.3470579059173919, -0.347052193699157, -0.34704563020982493, -0.3470382271523149], 30; - T_e=0.5, nstep=1300, z_ngrid=150, charge_exchange_frequency=2*π*0.0) + composition = Dict{String,Any}("T_e" => 0.5), + nstep=1300, z_ngrid=150, charge_exchange_frequency=2*π*0.0) run_test(test_input_finite_difference_split_2_moments, 2*π*0.0, -2*π*0.2727, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, - -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; T_e=0.5, + -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; + composition = Dict{String,Any}("T_e" => 0.5), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 run_test(test_input_finite_difference_split_2_moments, 2*π*1.9919, -2*π*0.2491, [-2.7764623921048157, -2.776390813125241, -2.7763039187734666, - -2.7762020599277726, -2.7760856478638214, -2.775955152580435]; T_e=4.0) + -2.7762020599277726, -2.7760856478638214, -2.775955152580435]; + composition = Dict{String,Any}("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -443,12 +464,14 @@ function run_test_set_finite_difference_split_3_moments() -2*π*0.6020, [-0.0010684224665919893, -0.0010505277216983934, -0.0010288041337547594, -0.0010033394223312585, -0.0009742364063434105, -0.0009416125854969064]; - initial_density1=0.9999, initial_density2=0.0001) + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) @long run_test(test_input_finite_difference_split_3_moments, 2*π*1.4467, -2*π*0.6020, [-0.0010684224665919893, -0.0010505277216983934, -0.0010288041337547594, -0.0010033394223312585, -0.0009742364063434105, -0.0009416125854969064]; - initial_density1=0.9999, initial_density2=0.0001, + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) @long run_test(test_input_finite_difference_split_3_moments, 2*π*0.0, -2*π*0.5112, [-9.211308789442441, -9.211290894697548, -9.211269171109604, -9.21124370639818, -9.211214603382192, -9.211181979561346]; - initial_density1=0.0001, initial_density2=0.9999, + ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 @@ -468,17 +493,20 @@ function run_test_set_finite_difference_split_3_moments() -2*π*0.8033, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544], 30; - T_e=0.5, nstep=1300, charge_exchange_frequency=2*π*0.0) + composition = Dict{String,Any}("T_e" => 0.5), + nstep=1300, charge_exchange_frequency=2*π*0.0) @long run_test(test_input_finite_difference_split_3_moments, 2*π*0.0, -2*π*0.2727, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; - T_e=0.5, charge_exchange_frequency=2*π*2.0) + composition = Dict{String,Any}("T_e" => 0.5), + charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 @long run_test(test_input_finite_difference_split_3_moments, 2*π*1.9919, -2*π*0.2491, [-2.7764623921048157, -2.776390813125241, -2.7763039187734666, -2.7762020599277726, - -2.7760856478638214, -2.775955152580435]; T_e=4.0) + -2.7760856478638214, -2.775955152580435]; + composition = Dict{String,Any}("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -504,39 +532,45 @@ function run_test_set_chebyshev() @long run_test(test_input_chebyshev, 2*π*1.4467, -2*π*0.6020, [-0.00010000500033334732, 0.0004653997510461739, 0.0007956127502558478, 0.0008923624901804128, 0.0008994953327500175, 0.0008923624901804128]; - initial_density1=0.9999, initial_density2=0.0001) + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) @long run_test(test_input_chebyshev, 2*π*1.4467, -2*π*0.6020, [-0.00010000500033334732, 0.0004653997510461739, 0.0007956127502558478, 0.0008923624901804128, 0.0008994953327500175, 0.0008923624901804128]; - initial_density1=0.9999, initial_density2=0.0001, + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) @long run_test(test_input_chebyshev, 2*π*0.0, -2*π*0.5112, [-9.210340371976182, -9.209774967224805, -9.209444754225593, -9.209348004485669, -9.2093408716431, -9.209348004485669]; - initial_density1=0.0001, initial_density2=0.9999, + ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 @long run_test(test_input_chebyshev, 2*π*1.2671, -2*π*0.8033, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614], - 30; T_e=0.5, nstep=1300, charge_exchange_frequency=2*π*0.0) + 30; composition = Dict{String,Any}("T_e" => 0.5), + nstep=1300, charge_exchange_frequency=2*π*0.0) @long run_test(test_input_chebyshev, 2*π*0.0, -2*π*0.2727, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614]; - T_e=0.5, charge_exchange_frequency=2*π*2.0) + composition = Dict{String,Any}("T_e" => 0.5), + charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 @long run_test(test_input_chebyshev, 2*π*1.9919, -2*π*0.2491, [-2.772588722239781, -2.770327103234265, -2.769006251237427, -2.768619252277729, -2.7685907209074476, -2.768619252277729]; - T_e=4.0) + composition = Dict{String,Any}("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -562,40 +596,47 @@ function run_test_set_chebyshev_split_1_moment() @long run_test(test_input_chebyshev_split_1_moment, 2*π*1.4467, -2*π*0.6020, [-0.00010000500033334732, 0.00046539975104573, 0.0007956127502551822, 0.0008923624901797472, 0.0008994953327500175, - 0.0008923624901797472]; initial_density1=0.9999, - initial_density2=0.0001) + 0.0008923624901797472]; + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) @long run_test(test_input_chebyshev_split_1_moment, 2*π*1.4467, -2*π*0.6020, [-0.00010000500033334732, 0.00046539975104573, 0.0007956127502551822, 0.0008923624901797472, 0.0008994953327500175, - 0.0008923624901797472]; initial_density1=0.9999, - initial_density2=0.0001, charge_exchange_frequency=2*π*2.0) + 0.0008923624901797472]; + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), + charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) @long run_test(test_input_chebyshev_split_1_moment, 2*π*0.0, -2*π*0.5112, [-9.210340371976182, -9.209774967224805, -9.209444754225593, -9.209348004485669, -9.2093408716431, -9.209348004485669]; - initial_density1=0.0001, initial_density2=0.9999, + ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 @long run_test(test_input_chebyshev_split_1_moment, 2*π*1.2671, -2*π*0.8033, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614], - 30; T_e=0.5, nstep=1300, charge_exchange_frequency=2*π*0.0) + 30; composition = Dict{String,Any}("T_e" => 0.5), + nstep=1300, charge_exchange_frequency=2*π*0.0) @long run_test(test_input_chebyshev_split_1_moment, 2*π*0.0, -2*π*0.2727, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614]; - T_e=0.5, charge_exchange_frequency=2*π*2.0) + composition = Dict{String,Any}("T_e" => 0.5), + charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 @long run_test(test_input_chebyshev_split_1_moment, 2*π*1.9919, -2*π*0.2491, [-2.772588722239781, -2.770327103234265, -2.769006251237427, -2.768619252277729, -2.7685907209074476, -2.768619252277729]; - T_e=4.0) + composition = Dict{String,Any}("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -621,41 +662,48 @@ function run_test_set_chebyshev_split_2_moments() @long run_test(test_input_chebyshev_split_2_moments, 2*π*1.4467, -2*π*0.6020, [-0.00010000500033334732, 0.00046539975104573, 0.0007956127502551822, 0.0008923624901797472, 0.0008994953327500175, - 0.0008923624901797472]; initial_density1=0.9999, - initial_density2=0.0001) + 0.0008923624901797472]; + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) @long run_test(test_input_chebyshev_split_2_moments, 2*π*1.4467, -2*π*0.6020, [-0.00010000500033334732, 0.00046539975104573, 0.0007956127502551822, 0.0008923624901797472, 0.0008994953327500175, - 0.0008923624901797472]; initial_density1=0.9999, - initial_density2=0.0001, charge_exchange_frequency=2*π*2.0) + 0.0008923624901797472]; + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), + charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) @long run_test(test_input_chebyshev_split_2_moments, 2*π*0.0, -2*π*0.5112, [-9.210340371976182, -9.209774967224805, -9.209444754225593, -9.209348004485669, -9.2093408716431, -9.209348004485669]; - initial_density1=0.0001, initial_density2=0.9999, + ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 @long run_test(test_input_chebyshev_split_2_moments, 2*π*1.2671, -2*π*0.8033, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614], - 40; T_e=0.5, nstep=1300, nwrite=10, + 40; composition = Dict{String,Any}("T_e" => 0.5), + nstep=1300, nwrite=10, charge_exchange_frequency=2*π*0.0) @long run_test(test_input_chebyshev_split_2_moments, 2*π*0.0, -2*π*0.2727, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614]; - T_e=0.5, charge_exchange_frequency=2*π*2.0) + composition = Dict{String,Any}("T_e" => 0.5), + charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 @long run_test(test_input_chebyshev_split_2_moments, 2*π*1.9919, -2*π*0.2491, [-2.772588722239781, -2.770327103234265, -2.769006251237427, -2.768619252277729, -2.7685907209074476, -2.768619252277729]; - T_e=4.0) + composition = Dict{String,Any}("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -681,40 +729,47 @@ function run_test_set_chebyshev_split_3_moments() @long run_test(test_input_chebyshev_split_3_moments, 2*π*1.4467, -2*π*0.6020, [-0.00010000500033334732, 0.00046539975104573, 0.0007956127502551822, 0.0008923624901797472, 0.0008994953327500175, - 0.0008923624901797472]; initial_density1=0.9999, - initial_density2=0.0001) + 0.0008923624901797472]; + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) @long run_test(test_input_chebyshev_split_3_moments, 2*π*1.4467, -2*π*0.6020, [-0.00010000500033334732, 0.00046539975104573, 0.0007956127502551822, 0.0008923624901797472, 0.0008994953327500175, - 0.0008923624901797472]; initial_density1=0.9999, - initial_density2=0.0001, charge_exchange_frequency=2*π*2.0) + 0.0008923624901797472]; + ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), + charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) @long run_test(test_input_chebyshev_split_3_moments, 2*π*0.0, -2*π*0.5112, [-9.210340371976182, -9.209774967224805, -9.209444754225593, -9.209348004485669, -9.2093408716431, -9.209348004485669]; - initial_density1=0.0001, initial_density2=0.9999, + ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), + neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 @long run_test(test_input_chebyshev_split_3_moments, 2*π*1.2671, -2*π*0.8033, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614], - 80; T_e=0.5, nstep=1300, nwrite=5, charge_exchange_frequency=2*π*0.0) + 80; composition = Dict{String,Any}("T_e" => 0.5), + nstep=1300, nwrite=5, charge_exchange_frequency=2*π*0.0) @long run_test(test_input_chebyshev_split_3_moments, 2*π*0.0, -2*π*0.2727, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614]; - T_e=0.5, charge_exchange_frequency=2*π*2.0) + composition = Dict{String,Any}("T_e" => 0.5), + charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 @long run_test(test_input_chebyshev_split_3_moments, 2*π*1.9919, -2*π*0.2491, [-2.772588722239781, -2.770327103234265, -2.769006251237427, -2.768619252277729, -2.7685907209074476, -2.768619252277729]; - T_e=4.0) + composition = Dict{String,Any}("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end diff --git a/moment_kinetics/test/wall_bc_tests.jl b/moment_kinetics/test/wall_bc_tests.jl index c1c40634d..da3856029 100644 --- a/moment_kinetics/test/wall_bc_tests.jl +++ b/moment_kinetics/test/wall_bc_tests.jl @@ -9,7 +9,7 @@ using Base.Filesystem: tempname using MPI using moment_kinetics.coordinates: define_coordinate -using moment_kinetics.input_structs: grid_input, advection_input +using moment_kinetics.input_structs: grid_input, advection_input, merge_dict_with_kwargs! using moment_kinetics.interpolation: interpolate_to_grid_z using moment_kinetics.load_data: open_readonly_output_file using moment_kinetics.load_data: load_fields_data, @@ -17,48 +17,48 @@ using moment_kinetics.load_data: load_fields_data, load_species_data # default inputs for tests -test_input_finite_difference = Dict("n_ion_species" => 1, - "n_neutral_species" => 1, - "boltzmann_electron_response" => true, +test_input_finite_difference = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, + "n_neutral_species" => 1, + "electron_physics" => "boltzmann_electron_response", + "T_e" => 1.0, + "T_wall" => 1.0), + "ion_species_1" => Dict{String,Any}("initial_density" => 1.0, + "initial_temperature" => 1.0), + "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 0.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "vpa_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 1.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "neutral_species_1" => Dict{String,Any}("initial_density" => 1.0, + "initial_temperature" => 1.0), + "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 0.001, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "vpa_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 1.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), "run_name" => "finite_difference", "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, - "T_e" => 1.0, - "T_wall" => 1.0, - "initial_density1" => 1.0, - "initial_temperature1" => 1.0, - "z_IC_option1" => "gaussian", - "z_IC_density_amplitude1" => 0.0, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 0.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "vpa_IC_option1" => "gaussian", - "vpa_IC_density_amplitude1" => 1.0, - "vpa_IC_density_phase1" => 0.0, - "vpa_IC_upar_amplitude1" => 0.0, - "vpa_IC_upar_phase1" => 0.0, - "vpa_IC_temperature_amplitude1" => 0.0, - "vpa_IC_temperature_phase1" => 0.0, - "initial_density2" => 1.0, - "initial_temperature2" => 1.0, - "z_IC_option2" => "gaussian", - "z_IC_density_amplitude2" => 0.001, - "z_IC_density_phase2" => 0.0, - "z_IC_upar_amplitude2" => 0.0, - "z_IC_upar_phase2" => 0.0, - "z_IC_temperature_amplitude2" => 0.0, - "z_IC_temperature_phase2" => 0.0, - "vpa_IC_option2" => "gaussian", - "vpa_IC_density_amplitude2" => 1.0, - "vpa_IC_density_phase2" => 0.0, - "vpa_IC_upar_amplitude2" => 0.0, - "vpa_IC_upar_phase2" => 0.0, - "vpa_IC_temperature_amplitude2" => 0.0, - "vpa_IC_temperature_phase2" => 0.0, "charge_exchange_frequency" => 2.0, "ionization_frequency" => 2.0, "constant_ionization_rate" => false, @@ -161,7 +161,7 @@ function run_test(test_input, expected_phi, tolerance; args...) # Update default inputs with values to be changed input = merge(test_input, modified_inputs) - + merge_dict_with_kwargs!(input; args...) input["run_name"] = name # Suppress console output while running From 68270f3235457462a05272b11bdb0573c9aa337b Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Sun, 4 Aug 2024 21:39:42 +0100 Subject: [PATCH 08/46] Modify set_defaults_and_check_section!() to explicitly create and merge key => value sections of a Dictionary. This seems to fix the bug in the previous commit. --- moment_kinetics/src/input_structs.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/moment_kinetics/src/input_structs.jl b/moment_kinetics/src/input_structs.jl index 23ff4fade..b2be8e20f 100644 --- a/moment_kinetics/src/input_structs.jl +++ b/moment_kinetics/src/input_structs.jl @@ -764,7 +764,11 @@ function set_defaults_and_check_section!(options::AbstractDict, section_name; for (key_sym, value) ∈ kwargs key = String(key_sym) if !(key ∈ explicit_keys) - section[key] = value + # merge this entry to section Dict + # (creating a temporary Dict seems necessary in general, + # rather than just referencing the unexisting key in the section Dict) + section = merge(section, Dict{String,Any}(key => value)) + #section[key] = value end end From 1db6b713095a3b94dffa3406875ec7d77373dc22 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Mon, 5 Aug 2024 11:23:41 +0100 Subject: [PATCH 09/46] Remove reference to electron_physics_type in post processing script. --- ...r-planck-relaxation-slowing-down-beam.toml | 71 ------------------- .../src/plots_post_processing.jl | 2 +- 2 files changed, 1 insertion(+), 72 deletions(-) delete mode 100644 examples/fokker-planck/fokker-planck-relaxation-slowing-down-beam.toml diff --git a/examples/fokker-planck/fokker-planck-relaxation-slowing-down-beam.toml b/examples/fokker-planck/fokker-planck-relaxation-slowing-down-beam.toml deleted file mode 100644 index 9f0a16f23..000000000 --- a/examples/fokker-planck/fokker-planck-relaxation-slowing-down-beam.toml +++ /dev/null @@ -1,71 +0,0 @@ -# cheap input file for a 0D2V relaxation to a collisional Maxwellian distribution with self-ion collisions. -n_ion_species = 1 -n_neutral_species = 0 -electron_physics = "boltzmann_electron_response" -evolve_moments_density = false -evolve_moments_parallel_flow = false -evolve_moments_parallel_pressure = false -evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option1 = "isotropic-beam" -#vpa_IC_option1 = "directed-beam" -#vpa_IC_v01 = -#vpa_IC_vth0 = -#vpa_IC_vpa0 = -#vpa_IC_vperp0 = -charge_exchange_frequency = 0.0 -ionization_frequency = 0.0 -constant_ionization_rate = false -z_ngrid = 1 -z_nelement = 1 -z_nelement_local = 1 -z_bc = "wall" -z_discretization = "chebyshev_pseudospectral" -r_ngrid = 1 -r_nelement = 1 -r_nelement_local = 1 -r_bc = "periodic" -r_discretization = "chebyshev_pseudospectral" -vpa_ngrid = 5 -vpa_nelement = 32 -vpa_L = 6.0 -vpa_bc = "zero" -vpa_discretization = "gausslegendre_pseudospectral" -vperp_ngrid = 5 -vperp_nelement = 16 -vperp_L = 3.0 -vperp_discretization = "gausslegendre_pseudospectral" -# Fokker-Planck operator requires the "gausslegendre_pseudospectral -# options for the vpa and vperp grids - -[fokker_planck_collisions] -# nuii sets the normalised input C[F,F] Fokker-Planck collision frequency -nuii = 1.0 -slowing_down_test = true -frequency_option = "manual" -use_fokker_planck = true - -[timestepping] -nstep = 1000 -dt = 1.0e-5 -nwrite = 50 -nwrite_dfns = 50 diff --git a/plots_post_processing/plots_post_processing/src/plots_post_processing.jl b/plots_post_processing/plots_post_processing/src/plots_post_processing.jl index 8fdb8fd81..fe606a6cf 100644 --- a/plots_post_processing/plots_post_processing/src/plots_post_processing.jl +++ b/plots_post_processing/plots_post_processing/src/plots_post_processing.jl @@ -60,7 +60,7 @@ using moment_kinetics.manufactured_solns: manufactured_solutions, manufactured_geometry using moment_kinetics.moment_kinetics_input: mk_input, get, get_default_rhostar using moment_kinetics.input_structs: geometry_input, grid_input, species_composition -using moment_kinetics.input_structs: electron_physics_type, boltzmann_electron_response, +using moment_kinetics.input_structs: boltzmann_electron_response, #electron_physics_type, boltzmann_electron_response_with_simple_sheath using moment_kinetics.reference_parameters using moment_kinetics.geo: init_magnetic_geometry From 001b676561e2b09d9effc779defb3c1d1274cdf5 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Mon, 5 Aug 2024 11:25:58 +0100 Subject: [PATCH 10/46] Update example/ .toml files. --- ...lanck-1D2V-even_nz-shorttest-nstep200.toml | 81 +++++------------ ...-planck-relaxation-report-resolutions.toml | 44 +++++---- ...planck-relaxation-slowing-down-alphas.toml | 49 ++++++---- ...fokker-planck-relaxation-slowing-down.toml | 44 +++++---- .../fokker-planck-relaxation.toml | 43 ++++----- ...lowing-down-alphas-no-self-collisions.toml | 48 ++++++---- ...lanck-source-sink-slowing-down-alphas.toml | 49 ++++++---- examples/geometry/1D-mirror.toml | 68 ++++++-------- examples/gk-ions/2D-periodic-gk.toml | 72 +++++++-------- .../nonlinear-sound-wave_cheb_split1.toml | 56 +++++++----- .../nonlinear-sound-wave_cheb_split2.toml | 55 ++++++----- .../nonlinear-sound-wave_cheb_split3.toml | 55 ++++++----- .../nonlinear-sound-wave_fd.toml | 55 ++++++----- .../nonlinear-sound-wave_fd_split1.toml | 55 ++++++----- .../nonlinear-sound-wave_fd_split2.toml | 55 ++++++----- .../nonlinear-sound-wave_fd_split3.toml | 55 ++++++----- .../num-diss-relaxation.toml | 44 +++++---- ...all-bc_recyclefraction0.5_split3-init.toml | 90 ++++++++++-------- .../wall-bc_recyclefraction0.5_split3.toml | 89 ++++++++++-------- ...c_recyclefraction0.5_split3_fekete104.toml | 90 ++++++++++-------- ...bc_recyclefraction0.5_split3_fekete42.toml | 90 ++++++++++-------- ...bc_recyclefraction0.5_split3_fekete43.toml | 90 ++++++++++-------- ...bc_recyclefraction0.5_split3_fekete64.toml | 90 ++++++++++-------- ...ll-bc_recyclefraction0.5_split3_rkf54.toml | 90 ++++++++++-------- .../sheath-bc_cheb_test.toml | 91 +++++++++++-------- .../wall-bc_cheb_test.toml | 89 ++++++++++-------- examples/sound-wave/sound-wave_cheb.toml | 54 ++++++----- .../sound-wave/sound-wave_cheb_split1.toml | 54 ++++++----- .../sound-wave/sound-wave_cheb_split2.toml | 54 ++++++----- .../sound-wave/sound-wave_cheb_split3.toml | 54 ++++++----- examples/sound-wave/sound-wave_fd.toml | 54 ++++++----- examples/sound-wave/sound-wave_fd_split1.toml | 54 ++++++----- examples/sound-wave/sound-wave_fd_split2.toml | 54 ++++++----- examples/sound-wave/sound-wave_fd_split3.toml | 54 ++++++----- examples/wall-bc/wall+sheath-bc.toml | 89 ++++++++++-------- examples/wall-bc/wall-bc_cheb.toml | 88 ++++++++++-------- examples/wall-bc/wall-bc_cheb_split1.toml | 88 ++++++++++-------- examples/wall-bc/wall-bc_cheb_split2.toml | 88 ++++++++++-------- examples/wall-bc/wall-bc_cheb_split3.toml | 88 ++++++++++-------- examples/wall-bc/wall-bc_no-neutrals.toml | 70 ++++++-------- .../wall-bc/wall-bc_no-neutrals_split1.toml | 70 ++++++-------- .../wall-bc/wall-bc_no-neutrals_split2.toml | 70 ++++++-------- .../wall-bc/wall-bc_no-neutrals_split3.toml | 70 ++++++-------- examples/wall-bc/wall-bc_volumerecycle.toml | 90 ++++++++++-------- .../wall-bc/wall-bc_volumerecycle_split1.toml | 90 ++++++++++-------- .../wall-bc/wall-bc_volumerecycle_split2.toml | 90 ++++++++++-------- .../wall-bc/wall-bc_volumerecycle_split3.toml | 90 ++++++++++-------- 47 files changed, 1789 insertions(+), 1461 deletions(-) diff --git a/examples/fokker-planck-1D2V/fokker-planck-1D2V-even_nz-shorttest-nstep200.toml b/examples/fokker-planck-1D2V/fokker-planck-1D2V-even_nz-shorttest-nstep200.toml index 7422ef0b0..9f56e39db 100644 --- a/examples/fokker-planck-1D2V/fokker-planck-1D2V-even_nz-shorttest-nstep200.toml +++ b/examples/fokker-planck-1D2V/fokker-planck-1D2V-even_nz-shorttest-nstep200.toml @@ -1,47 +1,11 @@ -#use_manufactured_solns_for_init = true -#use_manufactured_solns_for_advance = false -n_ion_species = 1 -n_neutral_species = 0 -electron_physics = "boltzmann_electron_response" -#electron_physics = "boltzmann_electron_response_with_simple_sheath" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -#force_Er_zero_at_wall = false #true -#epsilon_offset = 0.1 -#use_vpabar_in_mms_dfni = true -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.0 ionization_frequency = 1.0 constant_ionization_rate = true -nstep = 200 -dt = 1.0e-4 -nwrite = 1000 -nwrite_dfns = 1000 -use_semi_lagrange = false -n_rk_stages = 4 -split_operators = false z_ngrid = 5 z_nelement = 16 #z_nelement_local = 2 @@ -67,31 +31,34 @@ vperp_L = 3.0 #vperp_discretization = "chebyshev_pseudospectral" vperp_discretization = "gausslegendre_pseudospectral" -#vz_ngrid = 17 -#vz_nelement = 4 -#vz_L = 12.0 -#vz_bc = "periodic" -#vz_discretization = "chebyshev_pseudospectral" - -#vr_ngrid = 17 -#vr_nelement = 4 -#vr_L = 12.0 -#vr_bc = "periodic" -#vr_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +#electron_physics = "boltzmann_electron_response_with_simple_sheath" +T_e = 1.0 +T_wall = 1.0 -#vzeta_ngrid = 17 -#vzeta_nelement = 4 -#vzeta_L = 12.0 -#vzeta_bc = "periodic" -#vzeta_discretization = "chebyshev_pseudospectral" +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 -#[ion_numerical_dissipation] -#vpa_dissipation_coefficient = 0.0 -#vperp_dissipation_coefficient = 0.0 -#z_dissipation_coefficient = 0.1 -#r_dissipation_coefficient = 0.0 +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 [fokker_planck_collisions] use_fokker_planck = true nuii = 1.0 frequency_option = "manual" + +[timestepping] +nstep = 50 +dt = 1.0e-4 +nwrite = 10 +nwrite_dfns = 10 diff --git a/examples/fokker-planck/fokker-planck-relaxation-report-resolutions.toml b/examples/fokker-planck/fokker-planck-relaxation-report-resolutions.toml index 3c11ac2d6..b79376025 100644 --- a/examples/fokker-planck/fokker-planck-relaxation-report-resolutions.toml +++ b/examples/fokker-planck/fokker-planck-relaxation-report-resolutions.toml @@ -1,31 +1,8 @@ # cheap input file for a 0D2V relaxation to a collisional Maxwellian distribution with self-ion collisions. -n_ion_species = 1 -n_neutral_species = 0 -electron_physics = "boltzmann_electron_response" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.0 ionization_frequency = 0.0 constant_ionization_rate = false @@ -53,6 +30,27 @@ vperp_bc = "zero" # Fokker-Planck operator requires the "gausslegendre_pseudospectral # options for the vpa and vperp grids +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + + [fokker_planck_collisions] use_fokker_planck = true # nuii sets the normalised input C[F,F] Fokker-Planck collision frequency diff --git a/examples/fokker-planck/fokker-planck-relaxation-slowing-down-alphas.toml b/examples/fokker-planck/fokker-planck-relaxation-slowing-down-alphas.toml index e6b75e29c..f6bccbe51 100644 --- a/examples/fokker-planck/fokker-planck-relaxation-slowing-down-alphas.toml +++ b/examples/fokker-planck/fokker-planck-relaxation-slowing-down-alphas.toml @@ -1,28 +1,9 @@ # cheap input file for a 0D2V relaxation to a collisional Maxwellian distribution with self-ion collisions and collisions with fixed Maxwellian background of cold ions and electrons. -n_ion_species = 1 -n_neutral_species = 0 -electron_physics = "boltzmann_electron_response" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.0 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "isotropic-beam" -vpa_IC_v01 = 1.0 -vpa_IC_vth01 = 0.1 -#vpa_IC_option1 = "directed-beam" -#vpa_IC_vpa01 = -1.5 -#vpa_IC_vperp01 = 0.0 + charge_exchange_frequency = 0.0 ionization_frequency = 0.0 constant_ionization_rate = false @@ -90,3 +71,31 @@ nstep = 50000 dt = 2.5e-4 nwrite = 100 nwrite_dfns = 100 + +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "isotropic-beam" +#initialization_option = "directed-beam" +v0 = 1.0 +vth0 = 0.1 +#vpa0 = -1.5 +#vperp0 = 0.0 diff --git a/examples/fokker-planck/fokker-planck-relaxation-slowing-down.toml b/examples/fokker-planck/fokker-planck-relaxation-slowing-down.toml index 9fe59dbe2..f637a06ef 100644 --- a/examples/fokker-planck/fokker-planck-relaxation-slowing-down.toml +++ b/examples/fokker-planck/fokker-planck-relaxation-slowing-down.toml @@ -1,31 +1,8 @@ # cheap input file for a 0D2V relaxation to a collisional Maxwellian distribution with self-ion collisions. -n_ion_species = 1 -n_neutral_species = 0 -electron_physics = "boltzmann_electron_response" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.0 ionization_frequency = 0.0 constant_ionization_rate = false @@ -51,6 +28,27 @@ vperp_discretization = "gausslegendre_pseudospectral" # Fokker-Planck operator requires the "gausslegendre_pseudospectral # options for the vpa and vperp grids +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + + [fokker_planck_collisions] # nuii sets the normalised input C[F,F] Fokker-Planck collision frequency nuii = 1.0 diff --git a/examples/fokker-planck/fokker-planck-relaxation.toml b/examples/fokker-planck/fokker-planck-relaxation.toml index 0f633c12b..9a512fbf8 100644 --- a/examples/fokker-planck/fokker-planck-relaxation.toml +++ b/examples/fokker-planck/fokker-planck-relaxation.toml @@ -1,31 +1,8 @@ # cheap input file for a 0D2V relaxation to a collisional Maxwellian distribution with self-ion collisions. -n_ion_species = 1 -n_neutral_species = 0 -electron_physics = "boltzmann_electron_response" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.0 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.0 ionization_frequency = 0.0 constant_ionization_rate = false @@ -52,6 +29,26 @@ vperp_discretization = "gausslegendre_pseudospectral" # Fokker-Planck operator requires the "gausslegendre_pseudospectral # options for the vpa and vperp grids +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [fokker_planck_collisions] use_fokker_planck = true # nuii sets the normalised input C[F,F] Fokker-Planck collision frequency diff --git a/examples/fokker-planck/fokker-planck-source-sink-slowing-down-alphas-no-self-collisions.toml b/examples/fokker-planck/fokker-planck-source-sink-slowing-down-alphas-no-self-collisions.toml index 1a95fc210..1300c4ef9 100644 --- a/examples/fokker-planck/fokker-planck-source-sink-slowing-down-alphas-no-self-collisions.toml +++ b/examples/fokker-planck/fokker-planck-source-sink-slowing-down-alphas-no-self-collisions.toml @@ -1,28 +1,8 @@ # cheap input file for a 0D2V relaxation to a collisional Maxwellian distribution with self-ion collisions and collisions with fixed Maxwellian background of cold ions and electrons. -n_ion_species = 1 -n_neutral_species = 0 -electron_physics = "boltzmann_electron_response" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.0 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "isotropic-beam" -vpa_IC_v01 = 1.0 -vpa_IC_vth01 = 0.1 -#vpa_IC_option1 = "directed-beam" -#vpa_IC_vpa01 = -1.5 -#vpa_IC_vperp01 = 0.0 charge_exchange_frequency = 0.0 ionization_frequency = 0.0 constant_ionization_rate = false @@ -50,6 +30,34 @@ vperp_bc = "zero" # Fokker-Planck operator requires the "gausslegendre_pseudospectral # options for the vpa and vperp grids +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "isotropic-beam" +#initialization_option = "directed-beam" +v0 = 1.0 +vth0 = 0.1 +#vpa0 = -1.5 +#vperp0 = 0.0 + [fokker_planck_collisions] # nuii sets the normalised input C[F,F] Fokker-Planck collision frequency nuii = 1.876334222e-3 #(1/nu_alphae, as computed from input diagnostic) diff --git a/examples/fokker-planck/fokker-planck-source-sink-slowing-down-alphas.toml b/examples/fokker-planck/fokker-planck-source-sink-slowing-down-alphas.toml index cd49c82e7..13c56692e 100644 --- a/examples/fokker-planck/fokker-planck-source-sink-slowing-down-alphas.toml +++ b/examples/fokker-planck/fokker-planck-source-sink-slowing-down-alphas.toml @@ -1,28 +1,8 @@ # cheap input file for a 0D2V relaxation to a collisional Maxwellian distribution with self-ion collisions and collisions with fixed Maxwellian background of cold ions and electrons. -n_ion_species = 1 -n_neutral_species = 0 -electron_physics = "boltzmann_electron_response" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.0 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "isotropic-beam" -vpa_IC_v01 = 1.0 -vpa_IC_vth01 = 0.1 -#vpa_IC_option1 = "directed-beam" -#vpa_IC_vpa01 = -1.5 -#vpa_IC_vperp01 = 0.0 charge_exchange_frequency = 0.0 ionization_frequency = 0.0 constant_ionization_rate = false @@ -50,6 +30,35 @@ vperp_bc = "zero" # Fokker-Planck operator requires the "gausslegendre_pseudospectral # options for the vpa and vperp grids +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "isotropic-beam" +#initialization_option = "directed-beam" +v0 = 1.0 +vth0 = 0.1 +#vpa0 = -1.5 +#vperp0 = 0.0 + + [fokker_planck_collisions] # nuii sets the normalised input C[F,F] Fokker-Planck collision frequency nuii = 1.876334222e-3 #(1/nu_alphae, as computed from input diagnostic) diff --git a/examples/geometry/1D-mirror.toml b/examples/geometry/1D-mirror.toml index 6a8fe60a3..4b7a954b1 100644 --- a/examples/geometry/1D-mirror.toml +++ b/examples/geometry/1D-mirror.toml @@ -1,50 +1,10 @@ -n_ion_species = 1 -n_neutral_species = 0 -boltzmann_electron_response = true evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.5 ionization_frequency = 0.05 constant_ionization_rate = true -use_semi_lagrange = false -n_rk_stages = 4 -split_operators = false r_ngrid = 1 r_nelement = 1 z_ngrid = 5 @@ -67,6 +27,34 @@ vz_L = 18.0 vz_bc = "both_zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 +[ion_species] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [ion_numerical_dissipation] vpa_dissipation_coefficient = 1.0e-3 #1.0e-2 #1.0e-1 vperp_dissipation_coefficient = 1.0e-3 #1.0e-2 #1.0e-1 diff --git a/examples/gk-ions/2D-periodic-gk.toml b/examples/gk-ions/2D-periodic-gk.toml index 0d27dfb1e..5e3e14772 100644 --- a/examples/gk-ions/2D-periodic-gk.toml +++ b/examples/gk-ions/2D-periodic-gk.toml @@ -1,51 +1,10 @@ -n_ion_species = 1 -n_neutral_species = 0 -boltzmann_electron_response = true evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -gyrokinetic_ions = true -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.5 ionization_frequency = 0.05 constant_ionization_rate = true -use_semi_lagrange = false -n_rk_stages = 4 -split_operators = false r_ngrid = 5 r_nelement = 2 r_bc = "periodic" @@ -69,6 +28,37 @@ vz_L = 18.0 vz_bc = "both_zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +gyrokinetic_ions = true +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + + [geometry] #option="1D-mirror" DeltaB=0.0 diff --git a/examples/nonlinear-sound-wave/nonlinear-sound-wave_cheb_split1.toml b/examples/nonlinear-sound-wave/nonlinear-sound-wave_cheb_split1.toml index 7912e9680..c8178024f 100644 --- a/examples/nonlinear-sound-wave/nonlinear-sound-wave_cheb_split1.toml +++ b/examples/nonlinear-sound-wave/nonlinear-sound-wave_cheb_split1.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.5 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.5 -z_IC_temperature_phase1 = 3.14159265359 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.5 -z_IC_density_phase2 = 3.14159265359 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.5 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,40 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 3.14159265359 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 3.14159265359 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 0.0 + + [timestepping] nstep = 2000 dt = 0.001 diff --git a/examples/nonlinear-sound-wave/nonlinear-sound-wave_cheb_split2.toml b/examples/nonlinear-sound-wave/nonlinear-sound-wave_cheb_split2.toml index 8e11356d9..46326e0f4 100644 --- a/examples/nonlinear-sound-wave/nonlinear-sound-wave_cheb_split2.toml +++ b/examples/nonlinear-sound-wave/nonlinear-sound-wave_cheb_split2.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = false evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.5 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.5 -z_IC_temperature_phase1 = 3.14159265359 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.5 -z_IC_density_phase2 = 3.14159265359 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.5 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,39 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 3.14159265359 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 3.14159265359 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 0.0 + [timestepping] nstep = 400 dt = 0.001 diff --git a/examples/nonlinear-sound-wave/nonlinear-sound-wave_cheb_split3.toml b/examples/nonlinear-sound-wave/nonlinear-sound-wave_cheb_split3.toml index fc61e6688..fed5d3635 100644 --- a/examples/nonlinear-sound-wave/nonlinear-sound-wave_cheb_split3.toml +++ b/examples/nonlinear-sound-wave/nonlinear-sound-wave_cheb_split3.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.5 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.5 -z_IC_temperature_phase1 = 3.14159265359 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.5 -z_IC_density_phase2 = 3.14159265359 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.5 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,39 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 3.14159265359 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 3.14159265359 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 0.0 + [timestepping] nstep = 200 dt = 0.001 diff --git a/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd.toml b/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd.toml index 6a379b7ce..2d15df95f 100644 --- a/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd.toml +++ b/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.5 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.5 -z_IC_temperature_phase1 = 3.14159265359 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.5 -z_IC_density_phase2 = 3.14159265359 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.5 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,39 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "finite_difference" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 3.14159265359 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 3.14159265359 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 0.0 + [timestepping] nstep = 2000 dt = 0.001 diff --git a/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd_split1.toml b/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd_split1.toml index c2f5b1a6f..0de21547e 100644 --- a/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd_split1.toml +++ b/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd_split1.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.5 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.5 -z_IC_temperature_phase1 = 3.14159265359 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.5 -z_IC_density_phase2 = 3.14159265359 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.5 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,39 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "finite_difference" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 3.14159265359 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 3.14159265359 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 0.0 + [timestepping] nstep = 2000 dt = 0.001 diff --git a/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd_split2.toml b/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd_split2.toml index 8c87a564f..a5322c378 100644 --- a/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd_split2.toml +++ b/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd_split2.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = false evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.5 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.5 -z_IC_temperature_phase1 = 3.14159265359 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.5 -z_IC_density_phase2 = 3.14159265359 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.5 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,39 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "finite_difference" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 3.14159265359 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 3.14159265359 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 0.0 + [timestepping] nstep = 400 dt = 0.001 diff --git a/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd_split3.toml b/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd_split3.toml index 823b932c6..b17c8ff55 100644 --- a/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd_split3.toml +++ b/examples/nonlinear-sound-wave/nonlinear-sound-wave_fd_split3.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.5 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.5 -z_IC_temperature_phase1 = 3.14159265359 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.5 -z_IC_density_phase2 = 3.14159265359 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.5 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,39 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "finite_difference" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 3.14159265359 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.5 +density_phase = 3.14159265359 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.5 +temperature_phase = 0.0 + [timestepping] nstep = 200 dt = 0.001 diff --git a/examples/numerical-dissipation/num-diss-relaxation.toml b/examples/numerical-dissipation/num-diss-relaxation.toml index 6fb8b0086..3b9e46fe5 100644 --- a/examples/numerical-dissipation/num-diss-relaxation.toml +++ b/examples/numerical-dissipation/num-diss-relaxation.toml @@ -1,31 +1,8 @@ # cheap input file for a 0D2V relaxation with numerical diffusion terms d^2 F / dvpa^2 and d^2 F / vperp^2. -n_ion_species = 1 -n_neutral_species = 0 -electron_physics = "boltzmann_electron_response" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.0 ionization_frequency = 0.0 constant_ionization_rate = false @@ -51,6 +28,27 @@ vperp_L = 3.0 vperp_bc = "zero" vperp_discretization = "gausslegendre_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + + [timestepping] nstep = 2000 dt = 1.0e-3 diff --git a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3-init.toml b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3-init.toml index 5efe4c239..3373585ab 100644 --- a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3-init.toml +++ b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3-init.toml @@ -1,47 +1,9 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 krook_collisions_option = "reference_parameters" -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.5 constant_ionization_rate = false @@ -64,6 +26,58 @@ vz_L = 36.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.5 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option= "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] #nstep = 50000 nstep = 1000000 diff --git a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3.toml b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3.toml index 4436f7f8d..d65f893af 100644 --- a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3.toml +++ b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3.toml @@ -1,47 +1,9 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 krook_collisions_option = "reference_parameters" -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.5 constant_ionization_rate = false @@ -63,6 +25,57 @@ vz_nelement = 63 vz_L = 36.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.5 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option= "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 [timestepping] #nstep = 50000 diff --git a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete104.toml b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete104.toml index 2843b91f8..ea1287faf 100644 --- a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete104.toml +++ b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete104.toml @@ -1,47 +1,9 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 krook_collisions_option = "reference_parameters" -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.5 constant_ionization_rate = false @@ -64,6 +26,58 @@ vz_L = 36.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.5 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option= "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] type = "Fekete10(4)" #nstep = 50000 diff --git a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete42.toml b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete42.toml index 27e9087e0..d0c53874d 100644 --- a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete42.toml +++ b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete42.toml @@ -1,47 +1,9 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 krook_collisions_option = "reference_parameters" -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.5 constant_ionization_rate = false @@ -64,6 +26,58 @@ vz_L = 36.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.5 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option= "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] type = "Fekete4(2)" #nstep = 50000 diff --git a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete43.toml b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete43.toml index 82c8e1ff1..3cee6b47a 100644 --- a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete43.toml +++ b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete43.toml @@ -1,47 +1,9 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 krook_collisions_option = "reference_parameters" -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.5 constant_ionization_rate = false @@ -64,6 +26,58 @@ vz_L = 36.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.5 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option= "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] type = "Fekete4(3)" #nstep = 50000 diff --git a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete64.toml b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete64.toml index 8753de127..e4d2e9858 100644 --- a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete64.toml +++ b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_fekete64.toml @@ -1,47 +1,9 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 krook_collisions_option = "reference_parameters" -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.5 constant_ionization_rate = false @@ -64,6 +26,58 @@ vz_L = 36.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.5 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option= "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] type = "Fekete6(4)" #nstep = 50000 diff --git a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_rkf54.toml b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_rkf54.toml index 410d577e0..cf4ebdfc1 100644 --- a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_rkf54.toml +++ b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_rkf54.toml @@ -1,47 +1,9 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 krook_collisions_option = "reference_parameters" -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.5 constant_ionization_rate = false @@ -64,6 +26,58 @@ vz_L = 36.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.5 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option= "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] type = "RKF5(4)" #nstep = 50000 diff --git a/examples/sheath+wall-bc_test/sheath-bc_cheb_test.toml b/examples/sheath+wall-bc_test/sheath-bc_cheb_test.toml index c2ac67f3d..4bb5e56a1 100644 --- a/examples/sheath+wall-bc_test/sheath-bc_cheb_test.toml +++ b/examples/sheath+wall-bc_test/sheath-bc_cheb_test.toml @@ -1,46 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -#boltzmann_electron_response = false -electron_physics = "boltzmann_electron_response_with_simple_sheath" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -phi_wall = -2.690 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 2.0 ionization_frequency = 2.0 constant_ionization_rate = false @@ -56,6 +17,58 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response_with_simple_sheath" +T_e = 1.0 +T_wall = 1.0 +phi_wall = -2.690 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option= "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 40000 dt = 0.001 diff --git a/examples/sheath+wall-bc_test/wall-bc_cheb_test.toml b/examples/sheath+wall-bc_test/wall-bc_cheb_test.toml index db9c4b664..b9ed15f46 100644 --- a/examples/sheath+wall-bc_test/wall-bc_cheb_test.toml +++ b/examples/sheath+wall-bc_test/wall-bc_cheb_test.toml @@ -1,45 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -#boltzmann_electron_response = true -electron_physics = "boltzmann_electron_response" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 2.0 ionization_frequency = 2.0 constant_ionization_rate = false @@ -55,6 +17,57 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option= "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 40000 dt = 0.001 diff --git a/examples/sound-wave/sound-wave_cheb.toml b/examples/sound-wave/sound-wave_cheb.toml index 61891bfd6..4c50b1c65 100644 --- a/examples/sound-wave/sound-wave_cheb.toml +++ b/examples/sound-wave/sound-wave_cheb.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -43,6 +21,38 @@ vz_L = 8.0 vz_bc = "periodic" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [output] binary_format = "netcdf" diff --git a/examples/sound-wave/sound-wave_cheb_split1.toml b/examples/sound-wave/sound-wave_cheb_split1.toml index 4df7c7b09..9ef684754 100644 --- a/examples/sound-wave/sound-wave_cheb_split1.toml +++ b/examples/sound-wave/sound-wave_cheb_split1.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,38 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 1500 dt = 0.002 diff --git a/examples/sound-wave/sound-wave_cheb_split2.toml b/examples/sound-wave/sound-wave_cheb_split2.toml index a859fbc81..27989f73c 100644 --- a/examples/sound-wave/sound-wave_cheb_split2.toml +++ b/examples/sound-wave/sound-wave_cheb_split2.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = false evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,38 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 1500 dt = 0.002 diff --git a/examples/sound-wave/sound-wave_cheb_split3.toml b/examples/sound-wave/sound-wave_cheb_split3.toml index 5b7fe80ea..0443db2d4 100644 --- a/examples/sound-wave/sound-wave_cheb_split3.toml +++ b/examples/sound-wave/sound-wave_cheb_split3.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,38 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 1500 dt = 0.002 diff --git a/examples/sound-wave/sound-wave_fd.toml b/examples/sound-wave/sound-wave_fd.toml index 8d1f11a0b..5c45c3183 100644 --- a/examples/sound-wave/sound-wave_fd.toml +++ b/examples/sound-wave/sound-wave_fd.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,38 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "finite_difference" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 1500 dt = 0.002 diff --git a/examples/sound-wave/sound-wave_fd_split1.toml b/examples/sound-wave/sound-wave_fd_split1.toml index 758b1b387..d25a888d4 100644 --- a/examples/sound-wave/sound-wave_fd_split1.toml +++ b/examples/sound-wave/sound-wave_fd_split1.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,38 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "finite_difference" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 1500 dt = 0.002 diff --git a/examples/sound-wave/sound-wave_fd_split2.toml b/examples/sound-wave/sound-wave_fd_split2.toml index abe2ed22a..658572f1f 100644 --- a/examples/sound-wave/sound-wave_fd_split2.toml +++ b/examples/sound-wave/sound-wave_fd_split2.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = false evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,38 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "finite_difference" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 1500 dt = 0.002 diff --git a/examples/sound-wave/sound-wave_fd_split3.toml b/examples/sound-wave/sound-wave_fd_split3.toml index 15627f0fb..76c205b6a 100644 --- a/examples/sound-wave/sound-wave_fd_split3.toml +++ b/examples/sound-wave/sound-wave_fd_split3.toml @@ -1,29 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -T_e = 1.0 -initial_density1 = 0.5 -initial_temperature1 = 1.0 -initial_density2 = 0.5 -initial_temperature2 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 0.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.62831853071 ionization_frequency = 0.0 r_ngrid = 1 @@ -38,6 +16,38 @@ vpa_L = 8.0 vpa_bc = "periodic" vpa_discretization = "finite_difference" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 + +[ion_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[neutral_species_1] +initial_density = 0.5 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 1500 dt = 0.002 diff --git a/examples/wall-bc/wall+sheath-bc.toml b/examples/wall-bc/wall+sheath-bc.toml index ccfbbde0f..4e582624e 100644 --- a/examples/wall-bc/wall+sheath-bc.toml +++ b/examples/wall-bc/wall+sheath-bc.toml @@ -1,45 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -#boltzmann_electron_response = false -electron_physics = "boltzmann_electron_response_with_simple_sheath" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 2.0 ionization_frequency = 2.0 constant_ionization_rate = false @@ -60,6 +22,57 @@ vz_L = 8.0 vz_bc = "periodic" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response_with_simple_sheath" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_eutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_eutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 10000 dt = 0.001 diff --git a/examples/wall-bc/wall-bc_cheb.toml b/examples/wall-bc/wall-bc_cheb.toml index 4a076b110..d0228533e 100644 --- a/examples/wall-bc/wall-bc_cheb.toml +++ b/examples/wall-bc/wall-bc_cheb.toml @@ -1,44 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.5 ionization_frequency = 0.75 constant_ionization_rate = false @@ -59,6 +22,57 @@ vz_L = 18.0 vz_bc = "both_zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 50000 dt = 1.0e-5 diff --git a/examples/wall-bc/wall-bc_cheb_split1.toml b/examples/wall-bc/wall-bc_cheb_split1.toml index 4c57ebf48..78474d3d0 100644 --- a/examples/wall-bc/wall-bc_cheb_split1.toml +++ b/examples/wall-bc/wall-bc_cheb_split1.toml @@ -1,45 +1,8 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true #runtime_plots = true evolve_moments_density = true evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = true -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.5 ionization_frequency = 0.75 constant_ionization_rate = false @@ -60,6 +23,57 @@ vz_L = 18.0 vz_bc = "both_zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 50000 dt = 1.0e-5 diff --git a/examples/wall-bc/wall-bc_cheb_split2.toml b/examples/wall-bc/wall-bc_cheb_split2.toml index 53f29f0ac..81530feec 100644 --- a/examples/wall-bc/wall-bc_cheb_split2.toml +++ b/examples/wall-bc/wall-bc_cheb_split2.toml @@ -1,45 +1,8 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true #runtime_plots = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = false evolve_moments_conservation = true -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.5 ionization_frequency = 0.75 constant_ionization_rate = false @@ -60,6 +23,57 @@ vz_L = 18.0 vz_bc = "both_zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 50000 dt = 1.0e-5 diff --git a/examples/wall-bc/wall-bc_cheb_split3.toml b/examples/wall-bc/wall-bc_cheb_split3.toml index 3db98a2da..7834ba468 100644 --- a/examples/wall-bc/wall-bc_cheb_split3.toml +++ b/examples/wall-bc/wall-bc_cheb_split3.toml @@ -1,45 +1,8 @@ -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true #runtime_plots = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.5 ionization_frequency = 0.75 constant_ionization_rate = false @@ -60,6 +23,57 @@ vz_L = 18.0 vz_bc = "both_zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 50000 dt = 1.0e-5 diff --git a/examples/wall-bc/wall-bc_no-neutrals.toml b/examples/wall-bc/wall-bc_no-neutrals.toml index ce5da5ba8..fc980405f 100644 --- a/examples/wall-bc/wall-bc_no-neutrals.toml +++ b/examples/wall-bc/wall-bc_no-neutrals.toml @@ -1,50 +1,10 @@ steady_state_residual = true converged_residual_value = 1.0e-3 runtime_plots = true -n_ion_species = 1 -n_neutral_species = 0 -boltzmann_electron_response = true evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 -#charge_exchange_frequency = 0.75 -#ionization_frequency = 0.5 r_ngrid = 1 r_nelement = 1 z_ngrid = 9 @@ -63,6 +23,36 @@ vz_L = 18.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.5 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 100000 dt = 5.0e-4 diff --git a/examples/wall-bc/wall-bc_no-neutrals_split1.toml b/examples/wall-bc/wall-bc_no-neutrals_split1.toml index cae94a045..a9ac4ee25 100644 --- a/examples/wall-bc/wall-bc_no-neutrals_split1.toml +++ b/examples/wall-bc/wall-bc_no-neutrals_split1.toml @@ -1,50 +1,10 @@ steady_state_residual = true converged_residual_value = 1.0e-3 runtime_plots = true -n_ion_species = 1 -n_neutral_species = 0 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 -#charge_exchange_frequency = 0.75 -#ionization_frequency = 0.5 r_ngrid = 1 r_nelement = 1 z_ngrid = 9 @@ -63,6 +23,36 @@ vz_L = 18.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.5 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 100000 dt = 1.0e-4 diff --git a/examples/wall-bc/wall-bc_no-neutrals_split2.toml b/examples/wall-bc/wall-bc_no-neutrals_split2.toml index ce74ec368..66728bc89 100644 --- a/examples/wall-bc/wall-bc_no-neutrals_split2.toml +++ b/examples/wall-bc/wall-bc_no-neutrals_split2.toml @@ -1,50 +1,10 @@ steady_state_residual = true converged_residual_value = 1.0e-3 runtime_plots = true -n_ion_species = 1 -n_neutral_species = 0 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = false evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 -#charge_exchange_frequency = 0.75 -#ionization_frequency = 0.5 r_ngrid = 1 r_nelement = 1 z_ngrid = 9 @@ -63,6 +23,36 @@ vz_L = 18.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.5 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 100000 dt = 1.0e-4 diff --git a/examples/wall-bc/wall-bc_no-neutrals_split3.toml b/examples/wall-bc/wall-bc_no-neutrals_split3.toml index 23316e611..126a72cfd 100644 --- a/examples/wall-bc/wall-bc_no-neutrals_split3.toml +++ b/examples/wall-bc/wall-bc_no-neutrals_split3.toml @@ -1,50 +1,10 @@ steady_state_residual = true converged_residual_value = 1.0e-3 runtime_plots = true -n_ion_species = 1 -n_neutral_species = 0 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 -#charge_exchange_frequency = 0.75 -#ionization_frequency = 0.5 r_ngrid = 1 r_nelement = 1 z_ngrid = 9 @@ -63,6 +23,36 @@ vz_L = 18.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 0 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.5 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 100000 dt = 1.0e-4 diff --git a/examples/wall-bc/wall-bc_volumerecycle.toml b/examples/wall-bc/wall-bc_volumerecycle.toml index 1cbf7f1b2..71892195e 100644 --- a/examples/wall-bc/wall-bc_volumerecycle.toml +++ b/examples/wall-bc/wall-bc_volumerecycle.toml @@ -1,48 +1,10 @@ steady_state_residual = true converged_residual_value = 1.0e-3 #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = true -recycling_fraction = 0.25 -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.5 constant_ionization_rate = false @@ -65,6 +27,58 @@ vz_L = 18.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.25 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 1000000 dt = 3.0e-5 diff --git a/examples/wall-bc/wall-bc_volumerecycle_split1.toml b/examples/wall-bc/wall-bc_volumerecycle_split1.toml index 442ce033d..bc5123654 100644 --- a/examples/wall-bc/wall-bc_volumerecycle_split1.toml +++ b/examples/wall-bc/wall-bc_volumerecycle_split1.toml @@ -1,48 +1,10 @@ steady_state_residual = true converged_residual_value = 1.0e-3 #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = true -recycling_fraction = 0.25 -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.5 constant_ionization_rate = false @@ -65,6 +27,58 @@ vz_L = 18.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.25 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 1000000 dt = 3.0e-5 diff --git a/examples/wall-bc/wall-bc_volumerecycle_split2.toml b/examples/wall-bc/wall-bc_volumerecycle_split2.toml index 08eb2ed6c..acc92a7d2 100644 --- a/examples/wall-bc/wall-bc_volumerecycle_split2.toml +++ b/examples/wall-bc/wall-bc_volumerecycle_split2.toml @@ -1,48 +1,10 @@ steady_state_residual = true converged_residual_value = 1.0e-3 #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = false evolve_moments_conservation = true -recycling_fraction = 0.25 -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.5 constant_ionization_rate = false @@ -65,6 +27,58 @@ vz_L = 18.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.25 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 1000000 dt = 3.0e-5 diff --git a/examples/wall-bc/wall-bc_volumerecycle_split3.toml b/examples/wall-bc/wall-bc_volumerecycle_split3.toml index 0c8dad98d..477a943e9 100644 --- a/examples/wall-bc/wall-bc_volumerecycle_split3.toml +++ b/examples/wall-bc/wall-bc_volumerecycle_split3.toml @@ -1,48 +1,10 @@ steady_state_residual = true converged_residual_value = 1.0e-3 #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.25 -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.5 constant_ionization_rate = false @@ -65,6 +27,58 @@ vz_L = 30.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.25 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] nstep = 1000000 dt = 1.0e-5 From 1a31ca808ee7290ed492cd34bceeeb12d0b87e7b Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Mon, 5 Aug 2024 14:40:54 +0100 Subject: [PATCH 11/46] Make sure n_neutral_species = 0 in gyroaverage_tests.jl --- moment_kinetics/test/gyroaverage_tests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/test/gyroaverage_tests.jl b/moment_kinetics/test/gyroaverage_tests.jl index ff842ec17..e330af474 100644 --- a/moment_kinetics/test/gyroaverage_tests.jl +++ b/moment_kinetics/test/gyroaverage_tests.jl @@ -230,7 +230,7 @@ function gyroaverage_test(absolute_error; rhostar=0.1, pitch=0.5, ngrid=5, kr=2, end function create_test_composition() - input_dict = Dict{String,Any}("composition" => Dict("gyrokinetic_ions" => true ) ) + input_dict = Dict{String,Any}("composition" => Dict("n_ion_species" => 1, "n_neutral_species" => 0, "gyrokinetic_ions" => true ) ) println(input_dict) return get_species_input(input_dict) end From 6a66a11928990c2a99f45ba7254581541990822c Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:41:41 +0100 Subject: [PATCH 12/46] Update debug test inputs. --- examples/gk-ions/2D-periodic-gk.toml | 2 +- .../fokker_planck_collisions_inputs.jl | 42 +++++----- .../debug_test/gyroaverage_inputs.jl | 60 ++++++--------- .../debug_test/harrisonthompson_inputs.jl | 26 ++----- moment_kinetics/debug_test/mms_inputs.jl | 32 ++------ .../debug_test/recycling_fraction_inputs.jl | 76 +++++++++---------- .../restart_interpolation_inputs.jl | 26 +------ .../debug_test/sound_wave_inputs.jl | 26 +------ moment_kinetics/debug_test/wall_bc_inputs.jl | 43 ++--------- 9 files changed, 103 insertions(+), 230 deletions(-) diff --git a/examples/gk-ions/2D-periodic-gk.toml b/examples/gk-ions/2D-periodic-gk.toml index 5e3e14772..19659aede 100644 --- a/examples/gk-ions/2D-periodic-gk.toml +++ b/examples/gk-ions/2D-periodic-gk.toml @@ -2,7 +2,7 @@ evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -charge_exchange_frequency = 0.5 +charge_exchange_frequency = 0.0 ionization_frequency = 0.05 constant_ionization_rate = true r_ngrid = 5 diff --git a/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl b/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl index 912d7787b..305997877 100644 --- a/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl +++ b/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl @@ -7,28 +7,34 @@ test_input_full_f = Dict( "nstep" => 3, "nwrite" => 2, "nwrite_dfns" => 2), - "T_e" => 1.0, - "T_wall" => 1.0, - "electron_physics" => "boltzmann_electron_response", + "composition" => Dict{String,Any}("n_ion_species" => 1, + "n_neutral_species" => 0, + "T_e" => 1.0, + "T_wall" => 1.0, + "electron_physics" => "boltzmann_electron_response"), "evolve_moments_conservation" => false, "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, - "initial_density1" => 0.5, - "initial_density2" => 0.5, - "initial_temperature1" => 1.0, - "initial_temperature2" => 1.0, + "ion_species_1" => Dict{String,Any}("initial_density" => 0.5, + "initial_temperature" => 1.0) + "z_IC_ion_species_1" => Dict{String,Any}("density_amplitude" => 0.001, + "density_phase" => 0.0, + "initialization_option1" => "sinusoid", + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0), "charge_exchange_frequency" => 0.0, "ionization_frequency" => 0.0, "constant_ionization_rate" => false, - "n_ion_species" => 1, - "n_neutral_species" => 0, - "nuii" => 1.0, + "fokker_planck_collisions" => Dict{String,Any}("use_fokker_planck" => true, + "nuii" => 1.0, + "frequency_option" => "manual"), "r_bc" => "periodic", "r_discretization" => "chebyshev_pseudospectral", "r_nelement" => 1, "r_ngrid" => 3, - "split_operators" => false, "vpa_L" => 6.0, "vpa_bc" => "zero", "vpa_discretization" => "gausslegendre_pseudospectral", @@ -38,20 +44,6 @@ test_input_full_f = Dict( "vperp_discretization" => "gausslegendre_pseudospectral", "vperp_nelement" => 2, "vperp_ngrid" => 3, - "z_IC_density_amplitude1" => 0.001, - "z_IC_density_amplitude2" => 0.001, - "z_IC_density_phase1" => 0.0, - "z_IC_density_phase2" => 0.0, - "z_IC_option1" => "sinusoid", - "z_IC_option2" => "sinusoid", - "z_IC_temperature_amplitude1" => 0.0, - "z_IC_temperature_amplitude2" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "z_IC_temperature_phase2" => 0.0, - "z_IC_upar_amplitude1" => 0.0, - "z_IC_upar_amplitude2" => 0.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_upar_phase2" => 0.0, "z_bc" => "wall", "z_discretization" => "chebyshev_pseudospectral", "z_nelement" => 1, diff --git a/moment_kinetics/debug_test/gyroaverage_inputs.jl b/moment_kinetics/debug_test/gyroaverage_inputs.jl index e0a8a5ffe..47bc914de 100644 --- a/moment_kinetics/debug_test/gyroaverage_inputs.jl +++ b/moment_kinetics/debug_test/gyroaverage_inputs.jl @@ -3,48 +3,32 @@ test_type = "gyroaverage" # default inputs for tests test_input = Dict( "run_name" => "gyroaverage", - "n_ion_species" => 1, - "n_neutral_species" => 0, + "composition" => Dict("n_ion_species" => 1, + "n_neutral_species" => 0, + "gyrokinetic_ions" => true, + "T_e" => 1.0, + "T_wall" => 1.0), "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, - "gyrokinetic_ions" => true, - "T_e" => 1.0, - "T_wall" => 1.0, - "initial_density1" => 1.0, - "initial_temperature1" => 1.0, - "z_IC_option1" => "gaussian", - "z_IC_density_amplitude1" => 0.001, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 1.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "vpa_IC_option1" => "gaussian", - "vpa_IC_density_amplitude1" => 1.0, - "vpa_IC_density_phase1" => 0.0, - "vpa_IC_upar_amplitude1" => 0.0, - "vpa_IC_upar_phase1" => 0.0, - "vpa_IC_temperature_amplitude1" => 0.0, - "vpa_IC_temperature_phase1" => 0.0, - "initial_density2" => 1.0, - "initial_temperature2" => 1.0, - "z_IC_option2" => "gaussian", - "z_IC_density_amplitude2" => 0.001, - "z_IC_density_phase2" => 0.0, - "z_IC_upar_amplitude2" => -1.0, - "z_IC_upar_phase2" => 0.0, - "z_IC_temperature_amplitude2" => 0.0, - "z_IC_temperature_phase2" => 0.0, - "vpa_IC_option2" => "gaussian", - "vpa_IC_density_amplitude2" => 1.0, - "vpa_IC_density_phase2" => 0.0, - "vpa_IC_upar_amplitude2" => 0.0, - "vpa_IC_upar_phase2" => 0.0, - "vpa_IC_temperature_amplitude2" => 0.0, - "vpa_IC_temperature_phase2" => 0.0, - "charge_exchange_frequency" => 0.5, + "ion_species_1" => Dict("initial_density" => 1.0, + "initial_temperature1" => 1.0), + "z_IC_ion_species_1" => Dict("initialization_option" => "gaussian", + "density_amplitude" => 0.001, + "density_phase" => 0.0, + "upar_amplitude" => 1.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "vpa_IC_ion_species_1" => Dict("initialization_option" => "gaussian", + "density_amplitude" => 1.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0, + "charge_exchange_frequency" => 0.0, "ionization_frequency" => 0.05, "constant_ionization_rate" => true, "timestepping" => Dict{String,Any}("nstep" => 3, diff --git a/moment_kinetics/debug_test/harrisonthompson_inputs.jl b/moment_kinetics/debug_test/harrisonthompson_inputs.jl index 6b12546a8..3ef6ebac2 100644 --- a/moment_kinetics/debug_test/harrisonthompson_inputs.jl +++ b/moment_kinetics/debug_test/harrisonthompson_inputs.jl @@ -1,33 +1,17 @@ test_type = "Harrison-Thompson wall boundary condition" # default inputs for tests -test_input_finite_difference = Dict("n_ion_species" => 2, - "n_neutral_species" => 2, - "boltzmann_electron_response" => true, +test_input_finite_difference = Dict("composition" => Dict("n_ion_species" => 2, + "n_neutral_species" => 2, + "T_e" => 1.0, + "T_wall" => 1.0, + "electron_physics" => "boltzmann_electron_response"), "run_name" => "finite_difference", "base_directory" => test_output_directory, "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, - "T_e" => 1.0, - "T_wall" => 1.0, - "initial_density1" => 1.0, - "initial_temperature1" => 1.0, - "z_IC_option1" => "gaussian", - "z_IC_density_amplitude1" => 0.001, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 0.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "vpa_IC_option1" => "gaussian", - "vpa_IC_density_amplitude1" => 1.0, - "vpa_IC_density_phase1" => 0.0, - "vpa_IC_upar_amplitude1" => 0.0, - "vpa_IC_upar_phase1" => 0.0, - "vpa_IC_temperature_amplitude1" => 0.0, - "vpa_IC_temperature_phase1" => 0.0, "charge_exchange_frequency" => 0.0, #"ionization_frequency" => 0.25, "ionization_frequency" => 0.688, diff --git a/moment_kinetics/debug_test/mms_inputs.jl b/moment_kinetics/debug_test/mms_inputs.jl index 79fae0812..8379754cc 100644 --- a/moment_kinetics/debug_test/mms_inputs.jl +++ b/moment_kinetics/debug_test/mms_inputs.jl @@ -2,35 +2,17 @@ test_type = "MMS" # default inputs for tests test_input = Dict( - "use_manufactured_solns" => true, - "n_ion_species" => 1, - "n_neutral_species" => 1, - "electron_physics" => "boltzmann_electron_response", - "run_name" => "MMS-2D-wall_cheb-with-neutrals", + "manufactured_solns" => Dict("use_for_advance"=>true), "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, - "T_e" => 1.0, - "T_wall" => 1.0, - "initial_density1" => 0.5, - "initial_temperature1" => 1.0, - "initial_density2" => 0.5, - "initial_temperature2" => 1.0, - "z_IC_option1" => "sinusoid", - "z_IC_density_amplitude1" => 0.001, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 0.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "z_IC_option2" => "sinusoid", - "z_IC_density_amplitude2" => 0.001, - "z_IC_density_phase2" => 0.0, - "z_IC_upar_amplitude2" => 0.0, - "z_IC_upar_phase2" => 0.0, - "z_IC_temperature_amplitude2" => 0.0, - "z_IC_temperature_phase2" => 0.0, + "composition" => Dict("n_ion_species" => 1, + "n_neutral_species" => 1, + "electron_physics" => "boltzmann_electron_response", + "T_e" => 1.0, + "T_wall" => 1.0), + "run_name" => "MMS-2D-wall_cheb-with-neutrals", "charge_exchange_frequency" => 0.0, "ionization_frequency" => 0.0, "timestepping" => Dict{String,Any}("nstep" => 3, diff --git a/moment_kinetics/debug_test/recycling_fraction_inputs.jl b/moment_kinetics/debug_test/recycling_fraction_inputs.jl index 643b7c954..f933c2845 100644 --- a/moment_kinetics/debug_test/recycling_fraction_inputs.jl +++ b/moment_kinetics/debug_test/recycling_fraction_inputs.jl @@ -1,50 +1,50 @@ test_type = "Recycling fraction and adaptive timestepping" -test_input = Dict("n_ion_species" => 1, - "n_neutral_species" => 1, - "boltzmann_electron_response" => true, +test_input = Dict("composition" => Dict("n_ion_species" => 1, + "n_neutral_species" => 1, + "electron_physics" => "boltzmann_electron_response", + "recycling_fraction" => 0.5, + "T_e" => 0.2, + "T_wall" => 0.1, + "ion_species_1" => Dict("initial_density" => 1.0, + "initial_temperature" => 1.0), "run_name" => "full-f", "base_directory" => test_output_directory, "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, - "recycling_fraction" => 0.5, "krook_collisions" => Dict{String,Any}("use_krook" => true), - "T_e" => 0.2, - "T_wall" => 0.1, - "initial_density1" => 1.0, - "initial_temperature1" => 1.0, - "z_IC_option1" => "gaussian", - "z_IC_density_amplitude1" => 0.001, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 1.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "vpa_IC_option1" => "gaussian", - "vpa_IC_density_amplitude1" => 1.0, - "vpa_IC_density_phase1" => 0.0, - "vpa_IC_upar_amplitude1" => 0.0, - "vpa_IC_upar_phase1" => 0.0, - "vpa_IC_temperature_amplitude1" => 0.0, - "vpa_IC_temperature_phase1" => 0.0, - "initial_density2" => 1.0, - "initial_temperature2" => 1.0, - "z_IC_option2" => "gaussian", - "z_IC_density_amplitude2" => 0.001, - "z_IC_density_phase2" => 0.0, - "z_IC_upar_amplitude2" => -1.0, - "z_IC_upar_phase2" => 0.0, - "z_IC_temperature_amplitude2" => 0.0, - "z_IC_temperature_phase2" => 0.0, - "vpa_IC_option2" => "gaussian", - "vpa_IC_density_amplitude2" => 1.0, - "vpa_IC_density_phase2" => 0.0, - "vpa_IC_upar_amplitude2" => 0.0, - "vpa_IC_upar_phase2" => 0.0, - "vpa_IC_temperature_amplitude2" => 0.0, - "vpa_IC_temperature_phase2" => 0.0, + "z_IC_ion_species_1" => Dict("density_amplitude" => 0.001, + "density_phase" => 0.0, + "upar_amplitude" => 1.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0, + "initialization_option" => "gaussian"), + "vpa_IC_ion_species_1" => Dict("initialization_option" => "gaussian", + "density_amplitude" => 1.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "neutral_species_1" => Dict("initial_density" => 1.0, + "initial_temperature" => 1.0), + "z_IC_neutral_species_1" => Dict("initialization_option" => "gaussian", + "density_amplitude" => 0.001, + "density_phase" => 0.0, + "upar_amplitude" => -1.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "vpa_IC_neutral_species_1" => Dict("initialization_option" => "gaussian", + "density_amplitude" => 1.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), "charge_exchange_frequency" => 0.75, "ionization_frequency" => 0.5, "constant_ionization_rate" => false, diff --git a/moment_kinetics/debug_test/restart_interpolation_inputs.jl b/moment_kinetics/debug_test/restart_interpolation_inputs.jl index c914bc231..ba9663060 100644 --- a/moment_kinetics/debug_test/restart_interpolation_inputs.jl +++ b/moment_kinetics/debug_test/restart_interpolation_inputs.jl @@ -3,33 +3,15 @@ test_type = "restart_interpolation" # default inputs for tests base_input = Dict( "run_name" => "base", - "n_ion_species" => 2, - "n_neutral_species" => 2, - "boltzmann_electron_response" => true, + "composition" => Dict("n_ion_species" => 2, + "n_neutral_species" => 2, + "electron_physics" => "boltzmann_electron_response", + "T_e" => 1.0), "base_directory" => test_output_directory, "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => true, - "T_e" => 1.0, - "initial_density1" => 0.5, - "initial_temperature1" => 1.0, - "initial_density2" => 0.5, - "initial_temperature2" => 1.0, - "z_IC_option1" => "sinusoid", - "z_IC_density_amplitude1" => 0.001, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 0.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "z_IC_option2" => "sinusoid", - "z_IC_density_amplitude2" => 0.001, - "z_IC_density_phase2" => 0.0, - "z_IC_upar_amplitude2" => 0.0, - "z_IC_upar_phase2" => 0.0, - "z_IC_temperature_amplitude2" => 0.0, - "z_IC_temperature_phase2" => 0.0, "charge_exchange_frequency" => 2*π*0.1, "ionization_frequency" => 0.0, "timestepping" => Dict{String,Any}("nstep" => 3, diff --git a/moment_kinetics/debug_test/sound_wave_inputs.jl b/moment_kinetics/debug_test/sound_wave_inputs.jl index 5814c5662..6e78f7a5d 100644 --- a/moment_kinetics/debug_test/sound_wave_inputs.jl +++ b/moment_kinetics/debug_test/sound_wave_inputs.jl @@ -3,33 +3,15 @@ test_type = "sound_wave" # default inputs for tests test_input_finite_difference_1D1V = Dict( "run_name" => "finite_difference_1D1V", - "n_ion_species" => 2, - "n_neutral_species" => 2, - "boltzmann_electron_response" => true, + "composition" => Dict("n_ion_species" => 2, + "n_neutral_species" => 2, + "electron_physics" => "boltzmann_electron_response", + "T_e" => 1.0), "base_directory" => test_output_directory, "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => true, - "T_e" => 1.0, - "initial_density1" => 0.5, - "initial_temperature1" => 1.0, - "initial_density2" => 0.5, - "initial_temperature2" => 1.0, - "z_IC_option1" => "sinusoid", - "z_IC_density_amplitude1" => 0.001, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 0.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "z_IC_option2" => "sinusoid", - "z_IC_density_amplitude2" => 0.001, - "z_IC_density_phase2" => 0.0, - "z_IC_upar_amplitude2" => 0.0, - "z_IC_upar_phase2" => 0.0, - "z_IC_temperature_amplitude2" => 0.0, - "z_IC_temperature_phase2" => 0.0, "charge_exchange_frequency" => 2*π*0.1, "ionization_frequency" => 0.0, "timestepping" => Dict{String,Any}("nstep" => 3, diff --git a/moment_kinetics/debug_test/wall_bc_inputs.jl b/moment_kinetics/debug_test/wall_bc_inputs.jl index 632f904d9..110735137 100644 --- a/moment_kinetics/debug_test/wall_bc_inputs.jl +++ b/moment_kinetics/debug_test/wall_bc_inputs.jl @@ -3,49 +3,16 @@ test_type = "Wall boundary conditions" # default inputs for tests test_input_finite_difference_1D1V = Dict( "run_name" => "finite_difference_1D1V", - "n_ion_species" => 2, - "n_neutral_species" => 2, - "boltzmann_electron_response" => true, + "composition" => Dict("n_ion_species" => 2, + "n_neutral_species" => 2, + "electron_physics" => "boltzmann_electron_response", + "T_e" => 1.0, + "T_wall" => 1.0), "base_directory" => test_output_directory, "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => true, - "electron_physics" => "boltzmann_electron_response", - "T_e" => 1.0, - "T_wall" => 1.0, - "initial_density1" => 1.0, - "initial_temperature1" => 1.0, - "z_IC_option1" => "gaussian", - "z_IC_density_amplitude1" => 0.001, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 0.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "vpa_IC_option1" => "gaussian", - "vpa_IC_density_amplitude1" => 1.0, - "vpa_IC_density_phase1" => 0.0, - "vpa_IC_upar_amplitude1" => 0.0, - "vpa_IC_upar_phase1" => 0.0, - "vpa_IC_temperature_amplitude1" => 0.0, - "vpa_IC_temperature_phase1" => 0.0, - "initial_density2" => 1.0, - "initial_temperature2" => 1.0, - "z_IC_option2" => "gaussian", - "z_IC_density_amplitude2" => 0.001, - "z_IC_density_phase2" => 0.0, - "z_IC_upar_amplitude2" => 0.0, - "z_IC_upar_phase2" => 0.0, - "z_IC_temperature_amplitude2" => 0.0, - "z_IC_temperature_phase2" => 0.0, - "vpa_IC_option2" => "gaussian", - "vpa_IC_density_amplitude2" => 1.0, - "vpa_IC_density_phase2" => 0.0, - "vpa_IC_upar_amplitude2" => 0.0, - "vpa_IC_upar_phase2" => 0.0, - "vpa_IC_temperature_amplitude2" => 0.0, - "vpa_IC_temperature_phase2" => 0.0, "charge_exchange_frequency" => 2.0, "ionization_frequency" => 2.0, "constant_ionization_rate" => false, From 3870268a332c6f109c605fe02762f25021039e8c Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Mon, 5 Aug 2024 17:40:24 +0100 Subject: [PATCH 13/46] Correct typos. --- moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl | 2 +- moment_kinetics/debug_test/gyroaverage_inputs.jl | 2 +- moment_kinetics/debug_test/recycling_fraction_inputs.jl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl b/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl index 305997877..6d0b8d70b 100644 --- a/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl +++ b/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl @@ -17,7 +17,7 @@ test_input_full_f = Dict( "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "ion_species_1" => Dict{String,Any}("initial_density" => 0.5, - "initial_temperature" => 1.0) + "initial_temperature" => 1.0), "z_IC_ion_species_1" => Dict{String,Any}("density_amplitude" => 0.001, "density_phase" => 0.0, "initialization_option1" => "sinusoid", diff --git a/moment_kinetics/debug_test/gyroaverage_inputs.jl b/moment_kinetics/debug_test/gyroaverage_inputs.jl index 47bc914de..3f0e1199d 100644 --- a/moment_kinetics/debug_test/gyroaverage_inputs.jl +++ b/moment_kinetics/debug_test/gyroaverage_inputs.jl @@ -27,7 +27,7 @@ test_input = Dict( "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, - "temperature_phase" => 0.0, + "temperature_phase" => 0.0), "charge_exchange_frequency" => 0.0, "ionization_frequency" => 0.05, "constant_ionization_rate" => true, diff --git a/moment_kinetics/debug_test/recycling_fraction_inputs.jl b/moment_kinetics/debug_test/recycling_fraction_inputs.jl index f933c2845..51f4e852f 100644 --- a/moment_kinetics/debug_test/recycling_fraction_inputs.jl +++ b/moment_kinetics/debug_test/recycling_fraction_inputs.jl @@ -5,7 +5,7 @@ test_input = Dict("composition" => Dict("n_ion_species" => 1, "electron_physics" => "boltzmann_electron_response", "recycling_fraction" => 0.5, "T_e" => 0.2, - "T_wall" => 0.1, + "T_wall" => 0.1), "ion_species_1" => Dict("initial_density" => 1.0, "initial_temperature" => 1.0), "run_name" => "full-f", From 5fc4c21eadbe92aa660bf1846a8de08e7ba0e39e Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Tue, 6 Aug 2024 09:07:56 +0100 Subject: [PATCH 14/46] Correct typo. --- moment_kinetics/debug_test/gyroaverage_inputs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/debug_test/gyroaverage_inputs.jl b/moment_kinetics/debug_test/gyroaverage_inputs.jl index 3f0e1199d..36fa7051b 100644 --- a/moment_kinetics/debug_test/gyroaverage_inputs.jl +++ b/moment_kinetics/debug_test/gyroaverage_inputs.jl @@ -13,7 +13,7 @@ test_input = Dict( "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, "ion_species_1" => Dict("initial_density" => 1.0, - "initial_temperature1" => 1.0), + "initial_temperature" => 1.0), "z_IC_ion_species_1" => Dict("initialization_option" => "gaussian", "density_amplitude" => 0.001, "density_phase" => 0.0, From fc190391f67b78eed47a0ea31d98460c3cc4c495 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Tue, 6 Aug 2024 09:18:49 +0100 Subject: [PATCH 15/46] Correct typo. --- moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl b/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl index 6d0b8d70b..5eb8f76b8 100644 --- a/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl +++ b/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl @@ -20,7 +20,7 @@ test_input_full_f = Dict( "initial_temperature" => 1.0), "z_IC_ion_species_1" => Dict{String,Any}("density_amplitude" => 0.001, "density_phase" => 0.0, - "initialization_option1" => "sinusoid", + "initialization_option" => "sinusoid", "temperature_amplitude" => 0.0, "temperature_phase" => 0.0, "upar_amplitude" => 0.0, From 30f9e588fde29ba016b5035f30143cf43a6db91a Mon Sep 17 00:00:00 2001 From: John Omotani Date: Wed, 7 Aug 2024 13:45:39 +0100 Subject: [PATCH 16/46] Function `options_to_TOML()` adds special handling for `Enum` --- moment_kinetics/src/file_io.jl | 3 +-- moment_kinetics/src/input_structs.jl | 24 +++++++++++++++++++++++- moment_kinetics/src/parameter_scans.jl | 4 ++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/moment_kinetics/src/file_io.jl b/moment_kinetics/src/file_io.jl index 1aea757ce..df91d308c 100644 --- a/moment_kinetics/src/file_io.jl +++ b/moment_kinetics/src/file_io.jl @@ -19,7 +19,6 @@ using ..type_definitions: mk_float, mk_int using LibGit2 using MPI using Pkg -using TOML @debug_shared_array using ..communication: DebugMPISharedArray @@ -335,7 +334,7 @@ function write_provenance_tracking_info!(fid, parallel_io, run_id, restart_time_ # Convert input_dict into a TOML-formatted string so that we can store it in a # single variable. io_buffer = IOBuffer() - TOML.print(io_buffer, input_dict) + options_to_TOML(io_buffer, input_dict) input_string = String(take!(io_buffer)) write_single_value!(provenance_tracking, "input", input_string, parallel_io=parallel_io, diff --git a/moment_kinetics/src/input_structs.jl b/moment_kinetics/src/input_structs.jl index f81d28a30..2fa125166 100644 --- a/moment_kinetics/src/input_structs.jl +++ b/moment_kinetics/src/input_structs.jl @@ -16,12 +16,13 @@ export io_input export pp_input export geometry_input export set_defaults_and_check_top_level!, set_defaults_and_check_section!, - Dict_to_NamedTuple + options_to_TOML, Dict_to_NamedTuple using ..communication using ..type_definitions: mk_float, mk_int using MPI +using TOML """ """ @@ -722,4 +723,25 @@ function Dict_to_NamedTuple(d) return NamedTuple(Symbol(k)=>v for (k,v) ∈ d) end +""" + options_to_toml(io::IO [=stdout], data::AbstractDict; sorted=false, by=identity) + +Convert `moment_kinetics` 'options' (in the form of a `Dict`) to TOML format. + +This function is defined so that we can handle some extra types, for example `Enum`. + +For descriptions of the arguments, see `TOML.print`. +""" +function options_to_TOML(args...; kwargs...) + function handle_extra_types(x) + if isa(x, Enum) + return string(x) + else + error("Unhandled type $(typeof(x)) for x=$x") + end + end + + return TOML.print(handle_extra_types, args...; kwargs...) +end + end diff --git a/moment_kinetics/src/parameter_scans.jl b/moment_kinetics/src/parameter_scans.jl index 62fbc0af9..4cd896e0e 100644 --- a/moment_kinetics/src/parameter_scans.jl +++ b/moment_kinetics/src/parameter_scans.jl @@ -4,10 +4,10 @@ export get_scan_inputs, generate_scan_input_files using ..command_line_options: get_options using ..moment_kinetics_input: read_input_file +using ..input_structs: options_to_TOML using Glob using OrderedCollections: OrderedDict -using TOML """ get_scan_inputs(scan_inputs::AbstractDict) @@ -184,7 +184,7 @@ function generate_scan_input_files(scan_input::AbstractDict, dirname::AbstractSt # The run name will be created from the name of the input file, so do not need # to save "run_name" in the file. pop!(input, "run_name") - TOML.print(io, input) + options_to_TOML(io, input) end end From 812540d3e2f738362e0251f2dd670d01d12bc2f0 Mon Sep 17 00:00:00 2001 From: John Omotani Date: Thu, 8 Aug 2024 11:22:47 +0100 Subject: [PATCH 17/46] Handle `Enum` variables in `set_defaults_and_check_section!()` Use our `Enum`-handling method of `Base.get()` to handle `Enum` type variables in `set_defaults_and_check_section!()`. --- moment_kinetics/src/input_structs.jl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/moment_kinetics/src/input_structs.jl b/moment_kinetics/src/input_structs.jl index 2fa125166..47aea55ce 100644 --- a/moment_kinetics/src/input_structs.jl +++ b/moment_kinetics/src/input_structs.jl @@ -704,11 +704,12 @@ function set_defaults_and_check_section!(options::AbstractDict, section_name; # Set default values if a key was not set explicitly explicit_keys = keys(section) - for (key_sym, value) ∈ kwargs + for (key_sym, default_value) ∈ kwargs key = String(key_sym) - if !(key ∈ explicit_keys) - section[key] = value - end + + # Use `Base.get()` here to take advantage of our `Enum`-handling method of + # `Base.get()` defined above. + section[key] = get(section, key, default_value) end return section From e471a2b1372dc31f0dfb622b2e831c8546aa5005 Mon Sep 17 00:00:00 2001 From: mrhardman <29800382+mrhardman@users.noreply.github.com> Date: Thu, 8 Aug 2024 18:30:26 +0100 Subject: [PATCH 18/46] Update moment_kinetics/src/species_input.jl Co-authored-by: John Omotani --- moment_kinetics/src/species_input.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/src/species_input.jl b/moment_kinetics/src/species_input.jl index 7ac468987..519645909 100644 --- a/moment_kinetics/src/species_input.jl +++ b/moment_kinetics/src/species_input.jl @@ -53,7 +53,7 @@ function get_species_input(toml_input) ion_spec_params_list = Array{ion_species_parameters,1}(undef,nspec_ion) neutral_spec_params_list = Array{neutral_species_parameters,1}(undef,nspec_neutral) for is in 1:nspec_ion - spec_section = set_defaults_and_check_section!(toml_input, "ion_species_"*string(is), + spec_section = set_defaults_and_check_section!(toml_input, "ion_species_$is", # [ion_species_1], [ion_species_2], etc # mass of ion species mass = 1.0, From 1a047651bbb374eb746641a79f731b28f1f72105 Mon Sep 17 00:00:00 2001 From: mrhardman <29800382+mrhardman@users.noreply.github.com> Date: Thu, 8 Aug 2024 18:30:52 +0100 Subject: [PATCH 19/46] Update moment_kinetics/src/species_input.jl Co-authored-by: John Omotani --- moment_kinetics/src/species_input.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/src/species_input.jl b/moment_kinetics/src/species_input.jl index 519645909..0e8183b25 100644 --- a/moment_kinetics/src/species_input.jl +++ b/moment_kinetics/src/species_input.jl @@ -160,7 +160,7 @@ function get_species_input(toml_input) r_IC_input= Dict(Symbol(k)=>v for (k,v) in r_IC_section) r_IC = spatial_initial_condition_input(; r_IC_input...) - vpa_IC_section = set_defaults_and_check_section!(toml_input, "vz_IC_neutral_species_"*string(isn), + vpa_IC_section = set_defaults_and_check_section!(toml_input, "vz_IC_neutral_species_$isn", # [neutral_vpa_IC_species_1], [neutral_vpa_IC_species_2], etc initialization_option = "gaussian", width = 1.0, From 1f3c555cdc429030e3389534aa3f9efb09424f3b Mon Sep 17 00:00:00 2001 From: mrhardman <29800382+mrhardman@users.noreply.github.com> Date: Thu, 8 Aug 2024 18:31:23 +0100 Subject: [PATCH 20/46] Update moment_kinetics/src/species_input.jl Co-authored-by: John Omotani --- moment_kinetics/src/species_input.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/src/species_input.jl b/moment_kinetics/src/species_input.jl index 0e8183b25..bfb28eb34 100644 --- a/moment_kinetics/src/species_input.jl +++ b/moment_kinetics/src/species_input.jl @@ -64,7 +64,7 @@ function get_species_input(toml_input) # initial temperature initial_temperature = 1.0) - z_IC_section = set_defaults_and_check_section!(toml_input, "z_IC_ion_species_"*string(is), + z_IC_section = set_defaults_and_check_section!(toml_input, "z_IC_ion_species_$is", # [ion_z_IC_species_1], [ion_z_IC_species_2], etc initialization_option = "gaussian", width = 0.125, From cca4ac3804a4a29ac61506d1b44c7e57433e40ae Mon Sep 17 00:00:00 2001 From: mrhardman <29800382+mrhardman@users.noreply.github.com> Date: Thu, 8 Aug 2024 18:31:47 +0100 Subject: [PATCH 21/46] Update moment_kinetics/src/species_input.jl Co-authored-by: John Omotani --- moment_kinetics/src/species_input.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/src/species_input.jl b/moment_kinetics/src/species_input.jl index bfb28eb34..1d184b9b6 100644 --- a/moment_kinetics/src/species_input.jl +++ b/moment_kinetics/src/species_input.jl @@ -79,7 +79,7 @@ function get_species_input(toml_input) z_IC_input = Dict(Symbol(k)=>v for (k,v) in z_IC_section) z_IC = spatial_initial_condition_input(; z_IC_input...) - r_IC_section = set_defaults_and_check_section!(toml_input, "r_IC_ion_species_"*string(is), + r_IC_section = set_defaults_and_check_section!(toml_input, "r_IC_ion_species_$is", # [ion_r_IC_species_1], [ion_r_IC_species_2], etc initialization_option = "gaussian", width = 0.125, From 29d4b522666201647047241b892a1e3b460c6a3e Mon Sep 17 00:00:00 2001 From: mrhardman <29800382+mrhardman@users.noreply.github.com> Date: Thu, 8 Aug 2024 18:33:42 +0100 Subject: [PATCH 22/46] Update moment_kinetics/src/species_input.jl Co-authored-by: John Omotani --- moment_kinetics/src/species_input.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/src/species_input.jl b/moment_kinetics/src/species_input.jl index 1d184b9b6..b63e88406 100644 --- a/moment_kinetics/src/species_input.jl +++ b/moment_kinetics/src/species_input.jl @@ -94,7 +94,7 @@ function get_species_input(toml_input) r_IC_input= Dict(Symbol(k)=>v for (k,v) in r_IC_section) r_IC = spatial_initial_condition_input(; r_IC_input...) - vpa_IC_section = set_defaults_and_check_section!(toml_input, "vpa_IC_ion_species_"*string(is), + vpa_IC_section = set_defaults_and_check_section!(toml_input, "vpa_IC_ion_species_$is", # [ion_vpa_IC_species_1], [ion_vpa_IC_species_2], etc initialization_option = "gaussian", width = 1.0, From 512a4a20261e3617ec928cf01a200bacb6b8e930 Mon Sep 17 00:00:00 2001 From: mrhardman <29800382+mrhardman@users.noreply.github.com> Date: Thu, 8 Aug 2024 18:34:04 +0100 Subject: [PATCH 23/46] Update moment_kinetics/src/species_input.jl Co-authored-by: John Omotani --- moment_kinetics/src/species_input.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/src/species_input.jl b/moment_kinetics/src/species_input.jl index b63e88406..2bc728e36 100644 --- a/moment_kinetics/src/species_input.jl +++ b/moment_kinetics/src/species_input.jl @@ -121,7 +121,7 @@ function get_species_input(toml_input) ion_spec_params_list[is] = ion_species_parameters(; spec_input...) end for isn in 1:nspec_neutral - spec_section = set_defaults_and_check_section!(toml_input, "neutral_species_"*string(isn), + spec_section = set_defaults_and_check_section!(toml_input, "neutral_species_$isn", # [neutral_species_1], [neutral_species_2], etc # mass of neutral species mass = 1.0, From 8a8913adf30dcfdc7b2176ad2fa4a155d2647001 Mon Sep 17 00:00:00 2001 From: mrhardman <29800382+mrhardman@users.noreply.github.com> Date: Thu, 8 Aug 2024 18:34:28 +0100 Subject: [PATCH 24/46] Update moment_kinetics/src/species_input.jl Co-authored-by: John Omotani --- moment_kinetics/src/species_input.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/src/species_input.jl b/moment_kinetics/src/species_input.jl index 2bc728e36..b74fe5c56 100644 --- a/moment_kinetics/src/species_input.jl +++ b/moment_kinetics/src/species_input.jl @@ -130,7 +130,7 @@ function get_species_input(toml_input) # initial temperature initial_temperature = 1.0) - z_IC_section = set_defaults_and_check_section!(toml_input, "z_IC_neutral_species_"*string(isn), + z_IC_section = set_defaults_and_check_section!(toml_input, "z_IC_neutral_species_$isn", # [neutral_z_IC_species_1], [neutral_z_IC_species_2], etc initialization_option = "gaussian", width = 0.125, From 07d9df896202a69bf4e47f9bc63a2f5c4b699062 Mon Sep 17 00:00:00 2001 From: mrhardman <29800382+mrhardman@users.noreply.github.com> Date: Thu, 8 Aug 2024 18:34:49 +0100 Subject: [PATCH 25/46] Update moment_kinetics/src/species_input.jl Co-authored-by: John Omotani --- moment_kinetics/src/species_input.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/src/species_input.jl b/moment_kinetics/src/species_input.jl index b74fe5c56..458f7814f 100644 --- a/moment_kinetics/src/species_input.jl +++ b/moment_kinetics/src/species_input.jl @@ -145,7 +145,7 @@ function get_species_input(toml_input) z_IC_input = Dict(Symbol(k)=>v for (k,v) in z_IC_section) z_IC = spatial_initial_condition_input(; z_IC_input...) - r_IC_section = set_defaults_and_check_section!(toml_input, "r_IC_neutral_species_"*string(isn), + r_IC_section = set_defaults_and_check_section!(toml_input, "r_IC_neutral_species_$isn", # [neutral_r_IC_species_1], [neutral_r_IC_species_2], etc initialization_option = "gaussian", width = 0.125, From 23e94f20f253969325839a996c808ab7f2fc6175 Mon Sep 17 00:00:00 2001 From: mrhardman <29800382+mrhardman@users.noreply.github.com> Date: Thu, 8 Aug 2024 18:38:05 +0100 Subject: [PATCH 26/46] Update moment_kinetics/src/species_input.jl Co-authored-by: John Omotani --- moment_kinetics/src/species_input.jl | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/moment_kinetics/src/species_input.jl b/moment_kinetics/src/species_input.jl index 458f7814f..45c71d4f2 100644 --- a/moment_kinetics/src/species_input.jl +++ b/moment_kinetics/src/species_input.jl @@ -187,32 +187,11 @@ function get_species_input(toml_input) neutral_spec_params_list[isn] = neutral_species_parameters(; spec_input...) end # construct composition dict - #println(composition_section) - #println(ion_spec_params_list) - #println(neutral_spec_params_list) - #println(composition_section["n_ion_species"]) species_dict = Dict("n_species" => nspec_tot, "ion" => ion_spec_params_list, "neutral" => neutral_spec_params_list) - #println(species_dict) composition_section = merge(composition_section,species_dict) - #println(composition_section) input = Dict(Symbol(k)=>v for (k,v) in composition_section) - #println(input) # construct composition struct composition = species_composition(; input...) - #println(composition) - #println("") - #for is in 1:composition.n_ion_species - #println("ion_species_"*string(is)) - #println("mass: ",composition.ion[1].mass) - #println("Zs: ",composition.ion[1].zeds) - #println("") - #end - - #for isn in 1:composition.n_neutral_species - # println("neutral_species_"*string(isn)) - # println("mass: ",composition.neutral[1].mass) - # println("") - #end ## checks and errors if !(0.0 <= composition.recycling_fraction <= 1.0) From ea64dc3d052750338e00a813b7a7ff8ae0269d5b Mon Sep 17 00:00:00 2001 From: mrhardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 9 Aug 2024 08:53:47 +0100 Subject: [PATCH 27/46] Update moment_kinetics/test/gyroaverage_tests.jl Co-authored-by: John Omotani --- moment_kinetics/test/gyroaverage_tests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/test/gyroaverage_tests.jl b/moment_kinetics/test/gyroaverage_tests.jl index e330af474..5da4a0314 100644 --- a/moment_kinetics/test/gyroaverage_tests.jl +++ b/moment_kinetics/test/gyroaverage_tests.jl @@ -230,7 +230,7 @@ function gyroaverage_test(absolute_error; rhostar=0.1, pitch=0.5, ngrid=5, kr=2, end function create_test_composition() - input_dict = Dict{String,Any}("composition" => Dict("n_ion_species" => 1, "n_neutral_species" => 0, "gyrokinetic_ions" => true ) ) + input_dict = Dict{String,Any}("composition" => Dict{String,Any}("n_ion_species" => 1, "n_neutral_species" => 0, "gyrokinetic_ions" => true ) ) println(input_dict) return get_species_input(input_dict) end From 8cc9292fa19ff863ea4548d1003ad39fb55fcfdd Mon Sep 17 00:00:00 2001 From: mrhardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 9 Aug 2024 08:54:14 +0100 Subject: [PATCH 28/46] Update moment_kinetics/src/input_structs.jl Co-authored-by: John Omotani --- moment_kinetics/src/input_structs.jl | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/moment_kinetics/src/input_structs.jl b/moment_kinetics/src/input_structs.jl index b2be8e20f..7b7cccff1 100644 --- a/moment_kinetics/src/input_structs.jl +++ b/moment_kinetics/src/input_structs.jl @@ -792,18 +792,13 @@ keyword arguments are also a mix of Dicts and non-Dicts """ function merge_dict_with_kwargs!(dict_base; args...) - #println("before merge: ",dict_base) for (k,v) in args - println(k, " ", v) - if String(k) in keys(dict_base) - if isa(v,AbstractDict) - v = merge(dict_base[String(k)],v) - end + k = String(k) + if k in keys(dict_base) && isa(v, AbstractDict) + v = merge(dict_base[k], v) end - dict_mod = Dict(String(k) => v) - dict_base = merge(dict_base, dict_mod) + dict_base[k] = v end - #println("after merge: ",dict_base) return nothing end From e56433daefa2943f371262ec024c2bdd79c6f7b9 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 9 Aug 2024 16:15:44 +0100 Subject: [PATCH 29/46] Refactor inputs for tests following addition of kinetic electron features from last merge. --- .../debug_test/kinetic_electron_inputs.jl | 76 ++++++++--------- moment_kinetics/src/input_structs.jl | 2 +- moment_kinetics/src/moment_kinetics_input.jl | 6 +- moment_kinetics/src/species_input.jl | 7 +- .../test/Krook_collisions_tests.jl | 8 +- .../test/braginskii_electrons_imex_tests.jl | 84 +++++++++---------- .../fokker_planck_time_evolution_tests.jl | 8 +- moment_kinetics/test/harrisonthompson.jl | 8 +- .../test/nonlinear_sound_wave_tests.jl | 8 +- .../test/recycling_fraction_tests.jl | 8 +- .../test/restart_interpolation_tests.jl | 20 ++--- moment_kinetics/test/sound_wave_tests.jl | 13 +-- moment_kinetics/test/wall_bc_tests.jl | 8 +- 13 files changed, 105 insertions(+), 151 deletions(-) diff --git a/moment_kinetics/debug_test/kinetic_electron_inputs.jl b/moment_kinetics/debug_test/kinetic_electron_inputs.jl index 684b114ff..b7db6850e 100644 --- a/moment_kinetics/debug_test/kinetic_electron_inputs.jl +++ b/moment_kinetics/debug_test/kinetic_electron_inputs.jl @@ -1,49 +1,49 @@ test_type = "Kinetic electron" -test_input = Dict("n_ion_species" => 1, - "n_neutral_species" => 1, - "electron_physics" => "kinetic_electrons", +test_input = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, + "n_neutral_species" => 1, + "electron_physics" => "kinetic_electrons", + "recycling_fraction" => 0.5, + "T_e" => 0.2, + "T_wall" => 0.1), "run_name" => "kinetic_electron", "base_directory" => test_output_directory, "evolve_moments_density" => true, "evolve_moments_parallel_flow" => true, "evolve_moments_parallel_pressure" => true, "evolve_moments_conservation" => true, - "recycling_fraction" => 0.5, - "T_e" => 0.2, - "T_wall" => 0.1, - "initial_density1" => 1.0, - "initial_temperature1" => 1.0, - "z_IC_option1" => "gaussian", - "z_IC_density_amplitude1" => 0.001, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 1.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.0, - "z_IC_temperature_phase1" => 0.0, - "vpa_IC_option1" => "gaussian", - "vpa_IC_density_amplitude1" => 1.0, - "vpa_IC_density_phase1" => 0.0, - "vpa_IC_upar_amplitude1" => 0.0, - "vpa_IC_upar_phase1" => 0.0, - "vpa_IC_temperature_amplitude1" => 0.0, - "vpa_IC_temperature_phase1" => 0.0, - "initial_density2" => 1.0, - "initial_temperature2" => 1.0, - "z_IC_option2" => "gaussian", - "z_IC_density_amplitude2" => 0.001, - "z_IC_density_phase2" => 0.0, - "z_IC_upar_amplitude2" => -1.0, - "z_IC_upar_phase2" => 0.0, - "z_IC_temperature_amplitude2" => 0.0, - "z_IC_temperature_phase2" => 0.0, - "vpa_IC_option2" => "gaussian", - "vpa_IC_density_amplitude2" => 1.0, - "vpa_IC_density_phase2" => 0.0, - "vpa_IC_upar_amplitude2" => 0.0, - "vpa_IC_upar_phase2" => 0.0, - "vpa_IC_temperature_amplitude2" => 0.0, - "vpa_IC_temperature_phase2" => 0.0, + "ion_species_1" => Dict{String,Any}("initial_density" => 1.0, + "initial_temperature" => 1.0), + "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 0.001, + "density_phase" => 0.0, + "upar_amplitude" => 1.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "vpa_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 1.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase1" => 0.0), + "neutral_species_1" => Dict{String,Any}("initial_density" => 1.0, + "initial_temperature" => 1.0), + "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 0.001, + "density_phase" => 0.0, + "upar_amplitude" => -1.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "vpa_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 1.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), "charge_exchange_frequency" => 0.75, "ionization_frequency" => 0.5, "constant_ionization_rate" => false, diff --git a/moment_kinetics/src/input_structs.jl b/moment_kinetics/src/input_structs.jl index 78011a2cf..c913ef422 100644 --- a/moment_kinetics/src/input_structs.jl +++ b/moment_kinetics/src/input_structs.jl @@ -379,7 +379,7 @@ Base.@kwdef struct species_composition # * if electron_physics=boltzmann_electron_response_with_simple_sheath, the electron # density is fixed to be Nₑ*(eϕ/T_e) and N_e is calculated using a current # condition at the wall - electron_physics::String + electron_physics::electron_physics_type # if false -- wall bc uses true Knudsen cosine to specify neutral pdf leaving the wall # if true -- use a simpler pdf that is easier to integrate use_test_neutral_wall_pdf::Bool diff --git a/moment_kinetics/src/moment_kinetics_input.jl b/moment_kinetics/src/moment_kinetics_input.jl index 844363b54..ec76fb356 100644 --- a/moment_kinetics/src/moment_kinetics_input.jl +++ b/moment_kinetics/src/moment_kinetics_input.jl @@ -87,14 +87,12 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) # Reference parameters that define the conversion between physical quantities and # normalised values used in the code. reference_params = setup_reference_parameters(scan_input) - - # Set me_over_mi here so we can use reference_params - composition.me_over_mi = reference_params.me / reference_params.mref - + ## set geometry_input geometry_in = setup_geometry_input(scan_input, get_default_rhostar(reference_params)) charge_exchange = get(scan_input, "charge_exchange_frequency", 2.0*sqrt(composition.ion[1].initial_temperature)) + charge_exchange_electron = get(scan_input, "electron_charge_exchange_frequency", 0.0) ionization = get(scan_input, "ionization_frequency", charge_exchange) ionization_electron = get(scan_input, "electron_ionization_frequency", ionization) ionization_energy = get(scan_input, "ionization_energy", 0.0) diff --git a/moment_kinetics/src/species_input.jl b/moment_kinetics/src/species_input.jl index 45c71d4f2..35d8755e0 100644 --- a/moment_kinetics/src/species_input.jl +++ b/moment_kinetics/src/species_input.jl @@ -11,9 +11,12 @@ using ..input_structs: set_defaults_and_check_section! using ..input_structs: species_composition, ion_species_parameters, neutral_species_parameters using ..input_structs: spatial_initial_condition_input, velocity_initial_condition_input using ..input_structs: boltzmann_electron_response, boltzmann_electron_response_with_simple_sheath +using ..reference_parameters: setup_reference_parameters function get_species_input(toml_input) - + + reference_params = setup_reference_parameters(toml_input) + # read general composition parameters composition_section = set_defaults_and_check_section!(toml_input, "composition", # n_ion_species is the number of evolved ion species @@ -35,7 +38,7 @@ function get_species_input(toml_input) # ratio of the neutral particle mass to the ion mass mn_over_mi = 1.0, # ratio of the electron particle mass to the ion mass - me_over_mi = 1.0/1836.0, + me_over_mi = reference_params.me / reference_params.mref, # if false use true Knudsen cosine for neutral wall bc use_test_neutral_wall_pdf = false, # The ion flux reaching the wall that is recycled as neutrals is reduced by diff --git a/moment_kinetics/test/Krook_collisions_tests.jl b/moment_kinetics/test/Krook_collisions_tests.jl index a42d2d8c8..9e95b4a4d 100644 --- a/moment_kinetics/test/Krook_collisions_tests.jl +++ b/moment_kinetics/test/Krook_collisions_tests.jl @@ -167,10 +167,10 @@ function run_test(test_input, rtol, atol; args...) # Make a copy to make sure nothing modifies the input Dicts defined in this test # script. - test_input = deepcopy(test_input) + input = deepcopy(test_input) # Convert keyword arguments to a unique name - name = test_input["run_name"] + name = input["run_name"] if length(args) > 0 name = string(name, "_", (string(k, "-", v, "_") for (k, v) in args)...) @@ -181,11 +181,7 @@ function run_test(test_input, rtol, atol; args...) # Provide some progress info println(" - testing ", name) - # Convert dict from symbol keys to String keys - modified_inputs = Dict(String(k) => v for (k, v) in args) - # Update default inputs with values to be changed - input = merge(test_input, modified_inputs) merge_dict_with_kwargs!(input; args...) input["run_name"] = name diff --git a/moment_kinetics/test/braginskii_electrons_imex_tests.jl b/moment_kinetics/test/braginskii_electrons_imex_tests.jl index f784e0cf2..d2a81bbc7 100644 --- a/moment_kinetics/test/braginskii_electrons_imex_tests.jl +++ b/moment_kinetics/test/braginskii_electrons_imex_tests.jl @@ -10,53 +10,53 @@ using Base.Filesystem: tempname using MPI using moment_kinetics.coordinates: define_coordinate -using moment_kinetics.input_structs: grid_input, advection_input +using moment_kinetics.input_structs: grid_input, advection_input, merge_dict_with_kwargs! using moment_kinetics.interpolation: interpolate_to_grid_z using moment_kinetics.load_data: get_run_info_no_setup, close_run_info, get_variable # default inputs for tests -test_input = Dict("n_ion_species" => 1, - "n_neutral_species" => 1, - "electron_physics" => "braginskii_fluid", +test_input = Dict{String,Any}( "composition" => Dict{String,Any}("n_ion_species" => 1, + "n_neutral_species" => 1, + "electron_physics" => "braginskii_fluid", + "T_e" => 0.2), "run_name" => "braginskii-electrons-imex", "evolve_moments_density" => true, "evolve_moments_parallel_flow" => true, "evolve_moments_parallel_pressure" => true, "evolve_moments_conservation" => true, - "T_e" => 0.2, + "ion_species_1" => Dict{String,Any}("initial_density" => 1.0, + "initial_temperature" => 1.0), + "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "density_amplitude" => 0.1, + "density_phase" => 0.0, + "upar_amplitude" => 1.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.1, + "temperature_phase" => 1.0), + "vpa_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 1.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "neutral_species_1" => Dict{String,Any}("initial_density" => 1.0, + "initial_temperature" => 1.0), + "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "density_amplitude" => 0.001, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), + "vpa_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "density_amplitude" => 1.0, + "density_phase" => 0.0, + "upar_amplitude" => 0.0, + "upar_phase" => 0.0, + "temperature_amplitude" => 0.0, + "temperature_phase" => 0.0), "nu_ei" => 1.0e3, - "initial_density1" => 1.0, - "initial_temperature1" => 1.0, - "z_IC_option1" => "sinusoid", - "z_IC_density_amplitude1" => 0.1, - "z_IC_density_phase1" => 0.0, - "z_IC_upar_amplitude1" => 1.0, - "z_IC_upar_phase1" => 0.0, - "z_IC_temperature_amplitude1" => 0.1, - "z_IC_temperature_phase1" => 1.0, - "vpa_IC_option1" => "gaussian", - "vpa_IC_density_amplitude1" => 1.0, - "vpa_IC_density_phase1" => 0.0, - "vpa_IC_upar_amplitude1" => 0.0, - "vpa_IC_upar_phase1" => 0.0, - "vpa_IC_temperature_amplitude1" => 0.0, - "vpa_IC_temperature_phase1" => 0.0, - "initial_density2" => 1.0, - "initial_temperature2" => 1.0, - "z_IC_option2" => "sinusoid", - "z_IC_density_amplitude2" => 0.001, - "z_IC_density_phase2" => 0.0, - "z_IC_upar_amplitude2" => 0.0, - "z_IC_upar_phase2" => 0.0, - "z_IC_temperature_amplitude2" => 0.0, - "z_IC_temperature_phase2" => 0.0, - "vpa_IC_option2" => "gaussian", - "vpa_IC_density_amplitude2" => 1.0, - "vpa_IC_density_phase2" => 0.0, - "vpa_IC_upar_amplitude2" => 0.0, - "vpa_IC_upar_phase2" => 0.0, - "vpa_IC_temperature_amplitude2" => 0.0, - "vpa_IC_temperature_phase2" => 0.0, "charge_exchange_frequency" => 0.75, "ionization_frequency" => 0.5, "constant_ionization_rate" => false, @@ -106,10 +106,10 @@ function run_test(test_input, expected_p, expected_q, expected_vt; rtol=1.e-6, # Make a copy to make sure nothing modifies the input Dicts defined in this test # script. - test_input = deepcopy(test_input) + input = deepcopy(test_input) # Convert keyword arguments to a unique name - name = test_input["run_name"] + name = input["run_name"] if length(args) > 0 name = string(name, "_", (string(k, "-", v, "_") for (k, v) in args)...) @@ -120,12 +120,8 @@ function run_test(test_input, expected_p, expected_q, expected_vt; rtol=1.e-6, # Provide some progress info println(" - testing ", name) - # Convert dict from symbol keys to String keys - modified_inputs = Dict(String(k) => v for (k, v) in args) - # Update default inputs with values to be changed - input = merge(test_input, modified_inputs) - + merge_dict_with_kwargs!(input; args...) input["run_name"] = name # Suppress console output while running diff --git a/moment_kinetics/test/fokker_planck_time_evolution_tests.jl b/moment_kinetics/test/fokker_planck_time_evolution_tests.jl index cbfca1a1a..b7338bec3 100644 --- a/moment_kinetics/test/fokker_planck_time_evolution_tests.jl +++ b/moment_kinetics/test/fokker_planck_time_evolution_tests.jl @@ -282,14 +282,14 @@ function run_test(test_input, expected, rtol, atol, upar_rtol=nothing; args...) # Make a copy to make sure nothing modifies the input Dicts defined in this test # script. - test_input = deepcopy(test_input) + input = deepcopy(test_input) if upar_rtol === nothing upar_rtol = rtol end # Convert keyword arguments to a unique name - name = test_input["run_name"] + name = input["run_name"] if length(args) > 0 name = string(name, "_", (string(k, "-", v, "_") for (k, v) in args)...) @@ -300,11 +300,7 @@ function run_test(test_input, expected, rtol, atol, upar_rtol=nothing; args...) # Provide some progress info println(" - testing ", name) - # Convert dict from symbol keys to String keys - modified_inputs = Dict(String(k) => v for (k, v) in args) - # Update default inputs with values to be changed - input = merge(test_input, modified_inputs) merge_dict_with_kwargs!(input; args...) input["run_name"] = name # Suppress console output while running diff --git a/moment_kinetics/test/harrisonthompson.jl b/moment_kinetics/test/harrisonthompson.jl index b0371a295..2640689a7 100644 --- a/moment_kinetics/test/harrisonthompson.jl +++ b/moment_kinetics/test/harrisonthompson.jl @@ -157,10 +157,10 @@ function run_test(test_input, analytic_rtol, analytic_atol, expected_phi, # Make a copy to make sure nothing modifies the input Dicts defined in this test # script. - test_input = deepcopy(test_input) + input = deepcopy(test_input) # Convert keyword arguments to a unique name - name = test_input["run_name"] + name = input["run_name"] if length(args) > 0 name = string(name, "_", (string(k, "-", v, "_") for (k, v) in args)...) @@ -171,11 +171,7 @@ function run_test(test_input, analytic_rtol, analytic_atol, expected_phi, # Provide some progress info println(" - testing ", name) - # Convert dict from symbol keys to String keys - modified_inputs = Dict(String(k) => v for (k, v) in args) - # Update default inputs with values to be changed - input = merge(test_input, modified_inputs) merge_dict_with_kwargs!(input; args...) input["run_name"] = name diff --git a/moment_kinetics/test/nonlinear_sound_wave_tests.jl b/moment_kinetics/test/nonlinear_sound_wave_tests.jl index cd773b5e2..fe7668185 100644 --- a/moment_kinetics/test/nonlinear_sound_wave_tests.jl +++ b/moment_kinetics/test/nonlinear_sound_wave_tests.jl @@ -26,14 +26,14 @@ function run_test(test_input, rtol, atol, upar_rtol=nothing; args...) # Make a copy to make sure nothing modifies the input Dicts defined in this test # script. - test_input = deepcopy(test_input) + input = deepcopy(test_input) if upar_rtol === nothing upar_rtol = rtol end # Convert keyword arguments to a unique name - name = test_input["run_name"] + name = input["run_name"] if length(args) > 0 name = string(name, "_", (string(k, "-", v, "_") for (k, v) in args)...) @@ -44,11 +44,7 @@ function run_test(test_input, rtol, atol, upar_rtol=nothing; args...) # Provide some progress info println(" - testing ", name) - # Convert dict from symbol keys to String keys - modified_inputs = Dict(String(k) => v for (k, v) in args) - # Update default inputs with values to be changed - input = merge(test_input, modified_inputs) merge_dict_with_kwargs!(input; args...) input["run_name"] = name diff --git a/moment_kinetics/test/recycling_fraction_tests.jl b/moment_kinetics/test/recycling_fraction_tests.jl index 4a4f7ca4e..29a9ce3dd 100644 --- a/moment_kinetics/test/recycling_fraction_tests.jl +++ b/moment_kinetics/test/recycling_fraction_tests.jl @@ -173,10 +173,10 @@ function run_test(test_input, expected_phi; rtol=4.e-14, atol=1.e-15, args...) # Make a copy to make sure nothing modifies the input Dicts defined in this test # script. - test_input = deepcopy(test_input) + input = deepcopy(test_input) # Convert keyword arguments to a unique name - name = test_input["run_name"] + name = input["run_name"] if length(args) > 0 name = string(name, "_", (string(k, "-", v, "_") for (k, v) in args)...) @@ -187,11 +187,7 @@ function run_test(test_input, expected_phi; rtol=4.e-14, atol=1.e-15, args...) # Provide some progress info println(" - testing ", name) - # Convert dict from symbol keys to String keys - modified_inputs = Dict(String(k) => v for (k, v) in args) - # Update default inputs with values to be changed - input = merge(test_input, modified_inputs) merge_dict_with_kwargs!(input; args...) input["run_name"] = name diff --git a/moment_kinetics/test/restart_interpolation_tests.jl b/moment_kinetics/test/restart_interpolation_tests.jl index 9c0a1c99b..6e2b88b67 100644 --- a/moment_kinetics/test/restart_interpolation_tests.jl +++ b/moment_kinetics/test/restart_interpolation_tests.jl @@ -9,7 +9,7 @@ using Base.Filesystem: tempname using moment_kinetics.communication using moment_kinetics.coordinates: define_coordinate using moment_kinetics.file_io: io_has_parallel -using moment_kinetics.input_structs: grid_input, advection_input, hdf5 +using moment_kinetics.input_structs: grid_input, advection_input, hdf5, merge_dict_with_kwargs! using moment_kinetics.load_data: open_readonly_output_file, load_coordinate_data, load_species_data, load_fields_data, load_ion_moments_data, load_pdf_data, @@ -72,7 +72,7 @@ function run_test(test_input, base, message, rtol, atol; tol_3V, kwargs...) # Make a copy to make sure nothing modifies the input Dicts defined in this test # script. - test_input = deepcopy(test_input) + input = deepcopy(test_input) if tol_3V === nothing atol_3V = atol @@ -82,9 +82,9 @@ function run_test(test_input, base, message, rtol, atol; tol_3V, kwargs...) rtol_3V = tol_3V end - parallel_io = test_input["output"]["parallel_io"] + parallel_io = input["output"]["parallel_io"] # Convert keyword arguments to a unique name - name = test_input["run_name"] + name = input["run_name"] if length(kwargs) > 0 name = string(name, (string(String(k)[1], v) for (k, v) in kwargs)...) end @@ -95,17 +95,7 @@ function run_test(test_input, base, message, rtol, atol; tol_3V, kwargs...) # Provide some progress info println(" - testing ", message) - # Convert from Tuple of Pairs with symbol keys to Dict with String keys - modified_inputs = Dict(String(k) => v for (k, v) in kwargs - if String(k) ∉ keys(test_input["timestepping"])) - modified_timestepping_inputs = Dict(String(k) => v for (k, v) in kwargs - if String(k) ∈ keys(test_input["timestepping"])) - - # Update default inputs with values to be changed - input = merge(test_input, modified_inputs) - input["timestepping"] = merge(test_input["timestepping"], - modified_timestepping_inputs) - + merge_dict_with_kwargs!(input; args...) input["run_name"] = name # Suppress console output while running diff --git a/moment_kinetics/test/sound_wave_tests.jl b/moment_kinetics/test/sound_wave_tests.jl index 9cf362d4d..7fc9d4b20 100644 --- a/moment_kinetics/test/sound_wave_tests.jl +++ b/moment_kinetics/test/sound_wave_tests.jl @@ -138,10 +138,10 @@ function run_test(test_input, analytic_frequency, analytic_growth_rate, # Make a copy to make sure nothing modifies the input Dicts defined in this test # script. - test_input = deepcopy(test_input) + input = deepcopy(test_input) # Convert keyword arguments to a unique name - name = test_input["run_name"] + name = input["run_name"] shortname = name if length(args) > 0 name = string(name, "_", (string(k, "-", v, "_") for (k, v) in args)...) @@ -154,16 +154,7 @@ function run_test(test_input, analytic_frequency, analytic_growth_rate, # Provide some progress info println(" - testing ", name) - # Convert dict from symbol keys to String keys - modified_inputs = Dict(String(k) => v for (k, v) in args - if String(k) ∉ keys(test_input["timestepping"])) - modified_timestepping_inputs = Dict(String(k) => v for (k, v) in args - if String(k) ∈ keys(test_input["timestepping"])) - # Update default inputs with values to be changed - input = merge(test_input, modified_inputs) - input["timestepping"] = merge(test_input["timestepping"], - modified_timestepping_inputs) merge_dict_with_kwargs!(input; args...) input["run_name"] = shortname diff --git a/moment_kinetics/test/wall_bc_tests.jl b/moment_kinetics/test/wall_bc_tests.jl index 770327c3d..fea852b89 100644 --- a/moment_kinetics/test/wall_bc_tests.jl +++ b/moment_kinetics/test/wall_bc_tests.jl @@ -142,10 +142,10 @@ function run_test(test_input, expected_phi, tolerance; args...) # Make a copy to make sure nothing modifies the input Dicts defined in this test # script. - test_input = deepcopy(test_input) + input = deepcopy(test_input) # Convert keyword arguments to a unique name - name = test_input["run_name"] * ", with element spacing: " * test_input["z_element_spacing_option"] + name = input["run_name"] * ", with element spacing: " * input["z_element_spacing_option"] if length(args) > 0 name = string(name, "_", (string(k, "-", v, "_") for (k, v) in args)...) @@ -156,11 +156,7 @@ function run_test(test_input, expected_phi, tolerance; args...) # Provide some progress info println(" - testing ", name) - # Convert dict from symbol keys to String keys - modified_inputs = Dict(String(k) => v for (k, v) in args) - # Update default inputs with values to be changed - input = merge(test_input, modified_inputs) merge_dict_with_kwargs!(input; args...) input["run_name"] = name From ed691d14039985dcaa85ebc06c9c6a818c292d30 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 9 Aug 2024 16:16:39 +0100 Subject: [PATCH 30/46] Delete old test scripts used to design refactor of inputs. --- test_scripts/dict_merge.jl | 28 --------- test_scripts/species_input_test.jl | 95 ------------------------------ 2 files changed, 123 deletions(-) delete mode 100644 test_scripts/dict_merge.jl delete mode 100644 test_scripts/species_input_test.jl diff --git a/test_scripts/dict_merge.jl b/test_scripts/dict_merge.jl deleted file mode 100644 index 3cca83f03..000000000 --- a/test_scripts/dict_merge.jl +++ /dev/null @@ -1,28 +0,0 @@ -export dict_merge_test - -dict_base = Dict("a" => 1, - "bdict" => Dict("a" => 2, "f" =>3), - "cdict" => Dict("a" => 2, "f" =>3)) - -function dict_merge_test(dict_base=dict_base; args...) - println("before merge: ",dict_base) - for (k,v) in args - println(k, " ", v) - if String(k) in keys(dict_base) - if isa(v,AbstractDict) - v = merge(dict_base[String(k)],v) - end - end - dict_mod = Dict(String(k) => v) - dict_base = merge(dict_base, dict_mod) - end - println("after merge: ",dict_base) -end - - -if abspath(PROGRAM_FILE) == @__FILE__ - using Pkg - Pkg.activate(".") - - dict_merge_test(a=4,bdict=Dict("g"=>6.0,"h" => 8),zed=74,xx=Dict("sz" => 5)) -end \ No newline at end of file diff --git a/test_scripts/species_input_test.jl b/test_scripts/species_input_test.jl deleted file mode 100644 index eb580eac7..000000000 --- a/test_scripts/species_input_test.jl +++ /dev/null @@ -1,95 +0,0 @@ -export species_input_test - -import moment_kinetics -using moment_kinetics.input_structs: set_defaults_and_check_section! -using moment_kinetics.type_definitions: mk_float, mk_int - -Base.@kwdef struct ion_spec_params - # mass - mass::mk_float - # charge number - zeds::mk_float -end - -Base.@kwdef struct neutral_spec_params - # mass - mass::mk_float -end - -""" -""" -Base.@kwdef struct spec_composition - # n_ion_species is the number of evolved ion species - n_ion_species::mk_int - # n_neutral_species is the number of evolved neutral species - n_neutral_species::mk_int - ion_species::Vector{ion_spec_params} - neutral_species::Vector{neutral_spec_params} -end - -const test_toml_base = Dict( "composition" => Dict("n_ion_species" => 2,"n_neutral_species" => 2), - "ion_species_1" => Dict("mass" => 2.0, "zeds" => 4.0), - "ion_species_2" => Dict("mass" => 3.0, "zeds" => 5.0), - "neutral_species_1" => Dict("mass" => 2.5), - "neutral_species_2" => Dict("mass" => 3.5)) - - -function species_input_test(toml_input=test_toml_base) - comp_input_section = set_defaults_and_check_section!(toml_input, "composition", - n_ion_species = 1, - n_neutral_species = 1) - nspec_ion = comp_input_section["n_ion_species"] - nspec_neutral = comp_input_section["n_neutral_species"] - # read species parameters - ion_spec_params_list = Array{ion_spec_params,1}(undef,nspec_ion) - neutral_spec_params_list = Array{neutral_spec_params,1}(undef,nspec_neutral) - for is in 1:nspec_ion - spec_input_section = set_defaults_and_check_section!(toml_input, "ion_species_"*string(is), - mass = 1.0, - zeds = 1.0) - spec_input = Dict(Symbol(k)=>v for (k,v) in spec_input_section) - println(spec_input) - ion_spec_params_list[is] = ion_spec_params(; spec_input...) - end - for isn in 1:nspec_neutral - spec_input_section = set_defaults_and_check_section!(toml_input, "neutral_species_"*string(isn), - mass = 1.0) - spec_input = Dict(Symbol(k)=>v for (k,v) in spec_input_section) - println(spec_input) - neutral_spec_params_list[isn] = neutral_spec_params(; spec_input...) - end - # construct composition dict - println(comp_input_section) - println(ion_spec_params_list) - println(neutral_spec_params_list) - println(comp_input_section["n_ion_species"]) - newdict = Dict("ion_species" => ion_spec_params_list, "neutral_species" => neutral_spec_params_list) - println(newdict) - comp_input_section = merge(comp_input_section,newdict) - println(comp_input_section) - input = Dict(Symbol(k)=>v for (k,v) in comp_input_section) - println(input) - # construct composition struct - composition = spec_composition(; input...) - println(composition) - println("") - for is in 1:composition.n_ion_species - println("ion_species_"*string(is)) - println("mass: ",composition.ion_species[1].mass) - println("Zs: ",composition.ion_species[1].zeds) - println("") - end - - for isn in 1:composition.n_neutral_species - println("neutral_species_"*string(isn)) - println("mass: ",composition.neutral_species[1].mass) - println("") - end -end - -if abspath(PROGRAM_FILE) == @__FILE__ - using Pkg - Pkg.activate(".") - - species_input_test() -end \ No newline at end of file From da389b0ac9db9a284e3b9a78c77c6bf51c39f593 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 9 Aug 2024 16:32:52 +0100 Subject: [PATCH 31/46] Refactor restart_interpolation_tests.jl. --- .../test/restart_interpolation_tests.jl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/moment_kinetics/test/restart_interpolation_tests.jl b/moment_kinetics/test/restart_interpolation_tests.jl index 6e2b88b67..4ad098a44 100644 --- a/moment_kinetics/test/restart_interpolation_tests.jl +++ b/moment_kinetics/test/restart_interpolation_tests.jl @@ -66,8 +66,8 @@ restart_test_input_chebyshev_split_3_moments = Run a sound-wave 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, base, message, rtol, atol; tol_3V, kwargs...) - # by passing keyword arguments to run_test, kwargs becomes a Tuple of Pairs which can be used to +function run_test(test_input, base, message, rtol, atol; tol_3V, args...) + # by passing keyword arguments to run_test, args becomes a Tuple of Pairs which can be used to # update the default inputs # Make a copy to make sure nothing modifies the input Dicts defined in this test @@ -85,8 +85,8 @@ function run_test(test_input, base, message, rtol, atol; tol_3V, kwargs...) parallel_io = input["output"]["parallel_io"] # Convert keyword arguments to a unique name name = input["run_name"] - if length(kwargs) > 0 - name = string(name, (string(String(k)[1], v) for (k, v) in kwargs)...) + if length(args) > 0 + name = string(name, (string(String(k)[1], v) for (k, v) in args)...) end if parallel_io name *= "parallel-io" @@ -280,7 +280,7 @@ end function runtests() function do_tests(label, rtol=1.0e-3, nstep=50, include_moment_kinetic=true; - tol_3V=nothing, kwargs...) + tol_3V=nothing, args...) # Only testing Chebyshev discretization because interpolation not yet implemented # for finite-difference @@ -322,7 +322,7 @@ function runtests() this_input = deepcopy(restart_test_input_chebyshev) this_input["base_directory"] = test_output_directory this_input["output"]["parallel_io"] = parallel_io - run_test(this_input, base, message, rtol, 1.e-15; tol_3V=tol_3V, kwargs...) + run_test(this_input, base, message, rtol, 1.e-15; tol_3V=tol_3V, args...) end if include_moment_kinetic message = "restart split 1 from $base_label$label" @@ -330,21 +330,21 @@ function runtests() this_input = deepcopy(restart_test_input_chebyshev_split_1_moment) this_input["base_directory"] = test_output_directory this_input["output"]["parallel_io"] = parallel_io - run_test(this_input, base, message, rtol, 1.e-15; tol_3V=tol_3V, kwargs...) + run_test(this_input, base, message, rtol, 1.e-15; tol_3V=tol_3V, args...) end message = "restart split 2 from $base_label$label" @testset "$message" begin this_input = deepcopy(restart_test_input_chebyshev_split_2_moments) this_input["base_directory"] = test_output_directory this_input["output"]["parallel_io"] = parallel_io - run_test(this_input, base, message, rtol, 1.e-15; tol_3V=tol_3V, kwargs...) + run_test(this_input, base, message, rtol, 1.e-15; tol_3V=tol_3V, args...) end message = "restart split 3 from $base_label$label" @testset "$message" begin this_input = deepcopy(restart_test_input_chebyshev_split_3_moments) this_input["base_directory"] = test_output_directory this_input["output"]["parallel_io"] = parallel_io - run_test(this_input, base, message, rtol, 1.e-15; tol_3V=tol_3V, kwargs...) + run_test(this_input, base, message, rtol, 1.e-15; tol_3V=tol_3V, args...) end end From e2770e5e9b5a3e70a4f05f0e753d1ee03fbc51ed Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 9 Aug 2024 16:38:06 +0100 Subject: [PATCH 32/46] Remove get_composition() function as redundant. --- .../makie_post_processing/src/shared_utils.jl | 10 +--------- .../plots_post_processing/src/plot_MMS_sequence.jl | 5 +++-- .../plots_post_processing/src/plots_post_processing.jl | 5 +++-- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/makie_post_processing/makie_post_processing/src/shared_utils.jl b/makie_post_processing/makie_post_processing/src/shared_utils.jl index 9f5289ae7..a1ff9afe5 100644 --- a/makie_post_processing/makie_post_processing/src/shared_utils.jl +++ b/makie_post_processing/makie_post_processing/src/shared_utils.jl @@ -1,6 +1,6 @@ module shared_utils -export calculate_and_write_frequencies, get_geometry, get_composition +export calculate_and_write_frequencies, get_geometry using moment_kinetics.analysis: fit_delta_phi_mode using moment_kinetics.array_allocation: allocate_float @@ -63,14 +63,6 @@ function calculate_and_write_frequencies(run_name, ntime, time, z, itime_min, it return frequency, growth_rate, shifted_time, fitted_delta_phi end -""" -""" -function get_composition(scan_input) - composition = get_species_input(scan_input) - return composition - -end - function get_geometry(scan_input,z,r) reference_params = setup_reference_parameters(scan_input) reference_rhostar = get_default_rhostar(reference_params) diff --git a/plots_post_processing/plots_post_processing/src/plot_MMS_sequence.jl b/plots_post_processing/plots_post_processing/src/plot_MMS_sequence.jl index 92d780b27..a6c0568f7 100644 --- a/plots_post_processing/plots_post_processing/src/plot_MMS_sequence.jl +++ b/plots_post_processing/plots_post_processing/src/plot_MMS_sequence.jl @@ -17,7 +17,7 @@ using ..post_processing_input: pp using ..plots_post_processing: compare_ion_pdf_symbolic_test, compare_fields_symbolic_test using ..plots_post_processing: compare_moments_symbolic_test, compare_neutral_pdf_symbolic_test using ..plots_post_processing: allocate_global_zr_neutral_moments, allocate_global_zr_ion_moments -using ..plots_post_processing: allocate_global_zr_fields, get_composition +using ..plots_post_processing: allocate_global_zr_fields using ..plots_post_processing: get_coords_nelement, get_coords_ngrid using moment_kinetics.array_allocation: allocate_float using moment_kinetics.type_definitions: mk_float, mk_int @@ -32,6 +32,7 @@ using moment_kinetics.manufactured_solns: manufactured_solutions, manufactured_e using moment_kinetics.moment_kinetics_input: mk_input, read_input_file, get_default_rhostar using moment_kinetics.input_structs: geometry_input using moment_kinetics.reference_parameters +using moment_kinetics.species_input: get_species_input import Base: get @@ -240,7 +241,7 @@ function get_MMS_error_data(path_list,scan_type,scan_name) else Lr_in = 1.0 end - composition = get_composition(scan_input) + composition = get_species_input(scan_input) reference_params = setup_reference_parameters(scan_input) option = get(scan_input, "geometry_option", "constant-helical") #"1D-mirror" diff --git a/plots_post_processing/plots_post_processing/src/plots_post_processing.jl b/plots_post_processing/plots_post_processing/src/plots_post_processing.jl index 6295cdae9..a9f2bc82d 100644 --- a/plots_post_processing/plots_post_processing/src/plots_post_processing.jl +++ b/plots_post_processing/plots_post_processing/src/plots_post_processing.jl @@ -63,10 +63,11 @@ using moment_kinetics.moment_kinetics_input: mk_input, get, get_default_rhostar using moment_kinetics.input_structs: geometry_input, grid_input, species_composition using moment_kinetics.input_structs: boltzmann_electron_response, #electron_physics_type, boltzmann_electron_response_with_simple_sheath +using moment_kinetics.species_input: get_species_input using moment_kinetics.reference_parameters using moment_kinetics.geo: init_magnetic_geometry using .post_processing_input: pp -using .shared_utils: calculate_and_write_frequencies, get_geometry, get_composition +using .shared_utils: calculate_and_write_frequencies, get_geometry using TOML import Base: get @@ -679,7 +680,7 @@ function analyze_and_plot_data(prefix...; run_index=nothing) geometry = get_tuple_of_return_values(get_geometry, scan_input, z, r) composition = - get_tuple_of_return_values(get_composition, scan_input) + get_tuple_of_return_values(get_species_input, scan_input) # initialise the post-processing input options nwrite_movie, itime_min, itime_max, nwrite_movie_pdfs, itime_min_pdfs, itime_max_pdfs, From c6532f021020fbed71dbd7b298f535a837760a2e Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 9 Aug 2024 17:12:25 +0100 Subject: [PATCH 33/46] Refactor geometry_input function. --- .../makie_post_processing/src/shared_utils.jl | 6 +----- moment_kinetics/src/geo.jl | 16 ++++++++++++++-- moment_kinetics/src/moment_kinetics_input.jl | 12 +----------- moment_kinetics/test/gyroaverage_tests.jl | 4 ++-- .../src/plot_MMS_sequence.jl | 10 ++-------- .../src/plots_post_processing.jl | 2 +- 6 files changed, 21 insertions(+), 29 deletions(-) diff --git a/makie_post_processing/makie_post_processing/src/shared_utils.jl b/makie_post_processing/makie_post_processing/src/shared_utils.jl index a1ff9afe5..7ce536326 100644 --- a/makie_post_processing/makie_post_processing/src/shared_utils.jl +++ b/makie_post_processing/makie_post_processing/src/shared_utils.jl @@ -8,10 +8,8 @@ using moment_kinetics.coordinates: define_coordinate using moment_kinetics.input_structs: boltzmann_electron_response, boltzmann_electron_response_with_simple_sheath, grid_input, geometry_input, species_composition -using moment_kinetics.moment_kinetics_input: get_default_rhostar, setup_reference_parameters using moment_kinetics.type_definitions: mk_float, mk_int using moment_kinetics.reference_parameters: setup_reference_parameters -using moment_kinetics.moment_kinetics_input: get_default_rhostar using moment_kinetics.geo: init_magnetic_geometry, setup_geometry_input using moment_kinetics.species_input: get_species_input using MPI @@ -64,9 +62,7 @@ function calculate_and_write_frequencies(run_name, ntime, time, z, itime_min, it end function get_geometry(scan_input,z,r) - reference_params = setup_reference_parameters(scan_input) - reference_rhostar = get_default_rhostar(reference_params) - geo_in = setup_geometry_input(scan_input, reference_rhostar) + geo_in = setup_geometry_input(scan_input) geometry = init_magnetic_geometry(geo_in,z,r) return geometry end diff --git a/moment_kinetics/src/geo.jl b/moment_kinetics/src/geo.jl index 3635230dc..41be4d0db 100644 --- a/moment_kinetics/src/geo.jl +++ b/moment_kinetics/src/geo.jl @@ -12,7 +12,7 @@ using ..input_structs: geometry_input, set_defaults_and_check_section! using ..file_io: input_option_error using ..array_allocation: allocate_float using ..type_definitions: mk_float, mk_int - +using ..reference_parameters: setup_reference_parameters """ struct containing the geometric data necessary for @@ -60,6 +60,15 @@ gbdriftr::Array{mk_float,2} gbdriftz::Array{mk_float,2} end +""" + function get_default_rhostar(reference_params) + +Calculate the normalised ion gyroradius at reference parameters +""" +function get_default_rhostar(reference_params) + return reference_params.cref / reference_params.Omegaref / reference_params.Lref +end + """ function to read the geometry input data from the TOML file @@ -72,7 +81,10 @@ DeltaB = 0.0 option = "" """ -function setup_geometry_input(toml_input::Dict, reference_rhostar) +function setup_geometry_input(toml_input::Dict) + + reference_params = setup_reference_parameters(toml_input) + reference_rhostar = get_default_rhostar(reference_params) # read the input toml and specify a sensible default input_section = set_defaults_and_check_section!(toml_input, "geometry", # begin default inputs (as kwargs) diff --git a/moment_kinetics/src/moment_kinetics_input.jl b/moment_kinetics/src/moment_kinetics_input.jl index ec76fb356..e2407734e 100644 --- a/moment_kinetics/src/moment_kinetics_input.jl +++ b/moment_kinetics/src/moment_kinetics_input.jl @@ -6,7 +6,6 @@ export mk_input export performance_test #export advective_form export read_input_file -export get_default_rhostar using ..type_definitions: mk_float, mk_int using ..array_allocation: allocate_float @@ -89,7 +88,7 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) reference_params = setup_reference_parameters(scan_input) ## set geometry_input - geometry_in = setup_geometry_input(scan_input, get_default_rhostar(reference_params)) + geometry_in = setup_geometry_input(scan_input) charge_exchange = get(scan_input, "charge_exchange_frequency", 2.0*sqrt(composition.ion[1].initial_temperature)) charge_exchange_electron = get(scan_input, "electron_charge_exchange_frequency", 0.0) @@ -1154,13 +1153,4 @@ function check_input_initialization(composition, species, io) end end -""" - function get_default_rhostar(reference_params) - -Calculate the normalised ion gyroradius at reference parameters -""" -function get_default_rhostar(reference_params) - return reference_params.cref / reference_params.Omegaref / reference_params.Lref -end - end diff --git a/moment_kinetics/test/gyroaverage_tests.jl b/moment_kinetics/test/gyroaverage_tests.jl index 5da4a0314..ebb309b22 100644 --- a/moment_kinetics/test/gyroaverage_tests.jl +++ b/moment_kinetics/test/gyroaverage_tests.jl @@ -145,7 +145,7 @@ function gyroaverage_test(absolute_error; rhostar=0.1, pitch=0.5, ngrid=5, kr=2, # create test geometry option = "constant-helical" inputdict = Dict("geometry" => Dict("option" => option, "rhostar" => rhostar, "pitch" => pitch)) - geometry_in = setup_geometry_input(inputdict, 0.1) + geometry_in = setup_geometry_input(inputdict) geometry = init_magnetic_geometry(geometry_in,z,r) # create test composition @@ -231,7 +231,7 @@ end function create_test_composition() input_dict = Dict{String,Any}("composition" => Dict{String,Any}("n_ion_species" => 1, "n_neutral_species" => 0, "gyrokinetic_ions" => true ) ) - println(input_dict) + #println(input_dict) return get_species_input(input_dict) end diff --git a/plots_post_processing/plots_post_processing/src/plot_MMS_sequence.jl b/plots_post_processing/plots_post_processing/src/plot_MMS_sequence.jl index a6c0568f7..17ba9c02b 100644 --- a/plots_post_processing/plots_post_processing/src/plot_MMS_sequence.jl +++ b/plots_post_processing/plots_post_processing/src/plot_MMS_sequence.jl @@ -29,7 +29,7 @@ using moment_kinetics.load_data: load_block_data, load_coordinate_data, load_inp using moment_kinetics.load_data: read_distributed_zr_data!, construct_global_zr_coords using moment_kinetics.velocity_moments: integrate_over_vspace using moment_kinetics.manufactured_solns: manufactured_solutions, manufactured_electric_fields -using moment_kinetics.moment_kinetics_input: mk_input, read_input_file, get_default_rhostar +using moment_kinetics.moment_kinetics_input: mk_input, read_input_file using moment_kinetics.input_structs: geometry_input using moment_kinetics.reference_parameters using moment_kinetics.species_input: get_species_input @@ -242,13 +242,7 @@ function get_MMS_error_data(path_list,scan_type,scan_name) Lr_in = 1.0 end composition = get_species_input(scan_input) - - reference_params = setup_reference_parameters(scan_input) - option = get(scan_input, "geometry_option", "constant-helical") #"1D-mirror" - pitch = get(scan_input, "pitch", 1.0) - rhostar = get(scan_input, "rhostar", get_default_rhostar(reference_params)) - DeltaB = get(scan_input, "DeltaB", 1.0) - geo_in = geometry_input(rhostar,option,pitch,DeltaB) + geo_in = setup_geometry_input(scan_input) manufactured_solns_list = manufactured_solutions(manufactured_solns_input,Lr_in,z.L,r_bc,z_bc,geo_in,composition,species,r.n,vperp.n) dfni_func = manufactured_solns_list.dfni_func diff --git a/plots_post_processing/plots_post_processing/src/plots_post_processing.jl b/plots_post_processing/plots_post_processing/src/plots_post_processing.jl index a9f2bc82d..82c6726db 100644 --- a/plots_post_processing/plots_post_processing/src/plots_post_processing.jl +++ b/plots_post_processing/plots_post_processing/src/plots_post_processing.jl @@ -59,7 +59,7 @@ using moment_kinetics.velocity_moments: integrate_over_vspace using moment_kinetics.manufactured_solns: manufactured_solutions, manufactured_electric_fields, manufactured_geometry -using moment_kinetics.moment_kinetics_input: mk_input, get, get_default_rhostar +using moment_kinetics.moment_kinetics_input: mk_input, get using moment_kinetics.input_structs: geometry_input, grid_input, species_composition using moment_kinetics.input_structs: boltzmann_electron_response, #electron_physics_type, boltzmann_electron_response_with_simple_sheath From bab300e67e16985dbb8bdb2eaa055022240ff9fc Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 9 Aug 2024 18:59:39 +0100 Subject: [PATCH 34/46] Add OptionsDict type to avoid further bugs where Dict() is not passed {String,Any} arguments. Further namelist input Dicts should use OptionsDict. --- .../fokker_planck_collisions_inputs.jl | 13 +- .../debug_test/gyroaverage_inputs.jl | 17 +- .../debug_test/harrisonthompson_inputs.jl | 7 +- .../debug_test/kinetic_electron_inputs.jl | 25 +-- moment_kinetics/debug_test/mms_inputs.jl | 11 +- .../debug_test/recycling_fraction_inputs.jl | 33 +-- .../restart_interpolation_inputs.jl | 19 +- .../debug_test/sound_wave_inputs.jl | 69 +++---- moment_kinetics/debug_test/wall_bc_inputs.jl | 27 +-- moment_kinetics/src/load_data.jl | 4 +- moment_kinetics/src/moment_kinetics_input.jl | 8 +- moment_kinetics/src/type_definitions.jl | 5 + .../test/Krook_collisions_tests.jl | 16 +- .../test/braginskii_electrons_imex_tests.jl | 23 ++- .../fokker_planck_time_evolution_tests.jl | 12 +- moment_kinetics/test/gyroaverage_tests.jl | 4 +- moment_kinetics/test/harrisonthompson.jl | 11 +- .../test/nonlinear_solver_tests.jl | 10 +- ...ear_sound_wave_inputs_and_expected_data.jl | 12 +- .../test/nonlinear_sound_wave_tests.jl | 2 +- .../test/recycling_fraction_tests.jl | 31 +-- .../test/restart_interpolation_tests.jl | 4 +- moment_kinetics/test/sound_wave_tests.jl | 191 +++++++++--------- moment_kinetics/test/wall_bc_tests.jl | 17 +- 24 files changed, 295 insertions(+), 276 deletions(-) diff --git a/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl b/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl index 5eb8f76b8..671a69448 100644 --- a/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl +++ b/moment_kinetics/debug_test/fokker_planck_collisions_inputs.jl @@ -1,13 +1,14 @@ +using moment_kinetics.type_definitions: OptionsDict test_type = "Fokker-Planck collisions" # default input for test -test_input_full_f = Dict( +test_input_full_f = OptionsDict( "run_name" => "full_f", - "timestepping" => Dict{String,Any}("dt" => 0.0, + "timestepping" => OptionsDict("dt" => 0.0, "nstep" => 3, "nwrite" => 2, "nwrite_dfns" => 2), - "composition" => Dict{String,Any}("n_ion_species" => 1, + "composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 0, "T_e" => 1.0, "T_wall" => 1.0, @@ -16,9 +17,9 @@ test_input_full_f = Dict( "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, - "ion_species_1" => Dict{String,Any}("initial_density" => 0.5, + "ion_species_1" => OptionsDict("initial_density" => 0.5, "initial_temperature" => 1.0), - "z_IC_ion_species_1" => Dict{String,Any}("density_amplitude" => 0.001, + "z_IC_ion_species_1" => OptionsDict("density_amplitude" => 0.001, "density_phase" => 0.0, "initialization_option" => "sinusoid", "temperature_amplitude" => 0.0, @@ -28,7 +29,7 @@ test_input_full_f = Dict( "charge_exchange_frequency" => 0.0, "ionization_frequency" => 0.0, "constant_ionization_rate" => false, - "fokker_planck_collisions" => Dict{String,Any}("use_fokker_planck" => true, + "fokker_planck_collisions" => OptionsDict("use_fokker_planck" => true, "nuii" => 1.0, "frequency_option" => "manual"), "r_bc" => "periodic", diff --git a/moment_kinetics/debug_test/gyroaverage_inputs.jl b/moment_kinetics/debug_test/gyroaverage_inputs.jl index 36fa7051b..516d4c674 100644 --- a/moment_kinetics/debug_test/gyroaverage_inputs.jl +++ b/moment_kinetics/debug_test/gyroaverage_inputs.jl @@ -1,9 +1,10 @@ +using moment_kinetics.type_definitions: OptionsDict test_type = "gyroaverage" # default inputs for tests -test_input = Dict( +test_input = OptionsDict( "run_name" => "gyroaverage", - "composition" => Dict("n_ion_species" => 1, + "composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 0, "gyrokinetic_ions" => true, "T_e" => 1.0, @@ -12,16 +13,16 @@ test_input = Dict( "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, - "ion_species_1" => Dict("initial_density" => 1.0, + "ion_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), - "z_IC_ion_species_1" => Dict("initialization_option" => "gaussian", + "z_IC_ion_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 0.001, "density_phase" => 0.0, "upar_amplitude" => 1.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "vpa_IC_ion_species_1" => Dict("initialization_option" => "gaussian", + "vpa_IC_ion_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 1.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, @@ -31,7 +32,7 @@ test_input = Dict( "charge_exchange_frequency" => 0.0, "ionization_frequency" => 0.05, "constant_ionization_rate" => true, - "timestepping" => Dict{String,Any}("nstep" => 3, + "timestepping" => OptionsDict("nstep" => 3, "dt" => 1.0e-12, "nwrite" => 2, "nwrite_dfns" => 2,), @@ -57,9 +58,9 @@ test_input = Dict( "vz_L" => 6.0, "vz_bc" => "zero", "vz_discretization" => "chebyshev_pseudospectral", - "numerical_dissipation" => Dict("vpa_dissipation_coefficient" => 1.0e-3, + "numerical_dissipation" => OptionsDict("vpa_dissipation_coefficient" => 1.0e-3, "vperp_dissipation_coefficient" => 1.0e-3), - "geometry" => Dict("DeltaB"=>0.0, + "geometry" => OptionsDict("DeltaB"=>0.0, "option"=>"constant-helical", "pitch"=>0.1, "rhostar"=> 0.1), diff --git a/moment_kinetics/debug_test/harrisonthompson_inputs.jl b/moment_kinetics/debug_test/harrisonthompson_inputs.jl index 3ef6ebac2..e1d1a9507 100644 --- a/moment_kinetics/debug_test/harrisonthompson_inputs.jl +++ b/moment_kinetics/debug_test/harrisonthompson_inputs.jl @@ -1,7 +1,8 @@ +using moment_kinetics.type_definitions: OptionsDict test_type = "Harrison-Thompson wall boundary condition" # default inputs for tests -test_input_finite_difference = Dict("composition" => Dict("n_ion_species" => 2, +test_input_finite_difference = OptionsDict("composition" => OptionsDict("n_ion_species" => 2, "n_neutral_species" => 2, "T_e" => 1.0, "T_wall" => 1.0, @@ -16,7 +17,7 @@ test_input_finite_difference = Dict("composition" => Dict("n_ion_species" => 2, #"ionization_frequency" => 0.25, "ionization_frequency" => 0.688, "constant_ionization_rate" => true, - "timestepping" => Dict{String,Any}("nstep" => 3, + "timestepping" => OptionsDict("nstep" => 3, "dt" => 0.0005, "nwrite" => 2, "type" => "SSPRK2", @@ -43,7 +44,7 @@ test_input_finite_difference = Dict("composition" => Dict("n_ion_species" => 2, "vr_nelement" => 1) test_input_chebyshev = merge(test_input_finite_difference, - Dict("run_name" => "chebyshev_pseudospectral", + OptionsDict("run_name" => "chebyshev_pseudospectral", "z_discretization" => "chebyshev_pseudospectral", "z_ngrid" => 3, "z_nelement" => 2, diff --git a/moment_kinetics/debug_test/kinetic_electron_inputs.jl b/moment_kinetics/debug_test/kinetic_electron_inputs.jl index b7db6850e..02949e10c 100644 --- a/moment_kinetics/debug_test/kinetic_electron_inputs.jl +++ b/moment_kinetics/debug_test/kinetic_electron_inputs.jl @@ -1,6 +1,7 @@ test_type = "Kinetic electron" +using moment_kinetics.type_definitions: OptionsDict -test_input = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, +test_input = OptionsDict("composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 1, "electron_physics" => "kinetic_electrons", "recycling_fraction" => 0.5, @@ -12,32 +13,32 @@ test_input = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, "evolve_moments_parallel_flow" => true, "evolve_moments_parallel_pressure" => true, "evolve_moments_conservation" => true, - "ion_species_1" => Dict{String,Any}("initial_density" => 1.0, + "ion_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), - "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "z_IC_ion_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 0.001, "density_phase" => 0.0, "upar_amplitude" => 1.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "vpa_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "vpa_IC_ion_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 1.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase1" => 0.0), - "neutral_species_1" => Dict{String,Any}("initial_density" => 1.0, + "neutral_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), - "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "z_IC_neutral_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 0.001, "density_phase" => 0.0, "upar_amplitude" => -1.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "vpa_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "vpa_IC_neutral_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 1.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, @@ -47,7 +48,7 @@ test_input = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, "charge_exchange_frequency" => 0.75, "ionization_frequency" => 0.5, "constant_ionization_rate" => false, - "timestepping" => Dict{String,Any}("type" => "Fekete4(3)", + "timestepping" => OptionsDict("type" => "Fekete4(3)", "nstep" => 3, "dt" => 2.0e-8, "minimum_dt" => 1.0e-8, @@ -55,7 +56,7 @@ test_input = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, "step_update_prefactor" => 0.4, "nwrite" => 2, "split_operators" => false), - "electron_timestepping" => Dict{String,Any}("type" => "Fekete4(3)", + "electron_timestepping" => OptionsDict("type" => "Fekete4(3)", "nstep" => 10, "dt" => 4.0e-11, "minimum_dt" => 2.0e-11, @@ -81,13 +82,13 @@ test_input = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, "vz_L" => 6.0, "vz_bc" => "zero", "vz_discretization" => "chebyshev_pseudospectral", - "ion_source" => Dict{String,Any}("active" => true, + "ion_source" => OptionsDict("active" => true, "z_profile" => "gaussian", "z_width" => 0.125, "source_strength" => 2.0, "source_T" => 2.0), - "krook_collisions" => Dict{String,Any}("use_krook" => true), - "numerical_dissipation" => Dict{String,Any}("force_minimum_pdf_value" => 0.0, + "krook_collisions" => OptionsDict("use_krook" => true), + "numerical_dissipation" => OptionsDict("force_minimum_pdf_value" => 0.0, "vpa_dissipation_coefficient" => 1e-2)) diff --git a/moment_kinetics/debug_test/mms_inputs.jl b/moment_kinetics/debug_test/mms_inputs.jl index 8379754cc..5db15d46b 100644 --- a/moment_kinetics/debug_test/mms_inputs.jl +++ b/moment_kinetics/debug_test/mms_inputs.jl @@ -1,13 +1,14 @@ +using moment_kinetics.type_definitions: OptionsDict test_type = "MMS" # default inputs for tests -test_input = Dict( - "manufactured_solns" => Dict("use_for_advance"=>true), +test_input = OptionsDict( + "manufactured_solns" => OptionsDict("use_for_advance"=>true), "evolve_moments_density" => false, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, - "composition" => Dict("n_ion_species" => 1, + "composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 1, "electron_physics" => "boltzmann_electron_response", "T_e" => 1.0, @@ -15,7 +16,7 @@ test_input = Dict( "run_name" => "MMS-2D-wall_cheb-with-neutrals", "charge_exchange_frequency" => 0.0, "ionization_frequency" => 0.0, - "timestepping" => Dict{String,Any}("nstep" => 3, + "timestepping" => OptionsDict("nstep" => 3, "dt" => 1.e-8, "nwrite" => 2, "type" => "SSPRK2", @@ -52,7 +53,7 @@ test_input = Dict( "vzeta_L" => 12.0, "vzeta_bc" => "none", "vzeta_discretization" => "chebyshev_pseudospectral", - "geometry" => Dict{String,Any}("rhostar" => 1.0,), + "geometry" => OptionsDict("rhostar" => 1.0,), ) test_input_list = [ diff --git a/moment_kinetics/debug_test/recycling_fraction_inputs.jl b/moment_kinetics/debug_test/recycling_fraction_inputs.jl index 51f4e852f..a10e7e5fa 100644 --- a/moment_kinetics/debug_test/recycling_fraction_inputs.jl +++ b/moment_kinetics/debug_test/recycling_fraction_inputs.jl @@ -1,12 +1,13 @@ test_type = "Recycling fraction and adaptive timestepping" +using moment_kinetics.type_definitions: OptionsDict -test_input = Dict("composition" => Dict("n_ion_species" => 1, +test_input = OptionsDict("composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 1, "electron_physics" => "boltzmann_electron_response", "recycling_fraction" => 0.5, "T_e" => 0.2, "T_wall" => 0.1), - "ion_species_1" => Dict("initial_density" => 1.0, + "ion_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), "run_name" => "full-f", "base_directory" => test_output_directory, @@ -14,31 +15,31 @@ test_input = Dict("composition" => Dict("n_ion_species" => 1, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, - "krook_collisions" => Dict{String,Any}("use_krook" => true), - "z_IC_ion_species_1" => Dict("density_amplitude" => 0.001, + "krook_collisions" => OptionsDict("use_krook" => true), + "z_IC_ion_species_1" => OptionsDict("density_amplitude" => 0.001, "density_phase" => 0.0, "upar_amplitude" => 1.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0, "initialization_option" => "gaussian"), - "vpa_IC_ion_species_1" => Dict("initialization_option" => "gaussian", + "vpa_IC_ion_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 1.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "neutral_species_1" => Dict("initial_density" => 1.0, + "neutral_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), - "z_IC_neutral_species_1" => Dict("initialization_option" => "gaussian", + "z_IC_neutral_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 0.001, "density_phase" => 0.0, "upar_amplitude" => -1.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "vpa_IC_neutral_species_1" => Dict("initialization_option" => "gaussian", + "vpa_IC_neutral_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 1.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, @@ -48,7 +49,7 @@ test_input = Dict("composition" => Dict("n_ion_species" => 1, "charge_exchange_frequency" => 0.75, "ionization_frequency" => 0.5, "constant_ionization_rate" => false, - "timestepping" => Dict{String,Any}("type" => "Fekete4(3)", + "timestepping" => OptionsDict("type" => "Fekete4(3)", "nstep" => 3, "dt" => 1.0e-8, "minimum_dt" => 1.0e-8, @@ -73,7 +74,7 @@ test_input = Dict("composition" => Dict("n_ion_species" => 1, "vz_L" => 6.0, "vz_bc" => "zero", "vz_discretization" => "chebyshev_pseudospectral", - "ion_source" => Dict("active" => true, + "ion_source" => OptionsDict("active" => true, "z_profile" => "gaussian", "z_width" => 0.125, "source_strength" => 2.0, @@ -81,23 +82,23 @@ test_input = Dict("composition" => Dict("n_ion_species" => 1, test_input_split1 = merge(test_input, - Dict("run_name" => "split1", + OptionsDict("run_name" => "split1", "evolve_moments_density" => true, "evolve_moments_conservation" => true)) test_input_split2 = merge(test_input_split1, - Dict("run_name" => "split2", + OptionsDict("run_name" => "split2", "evolve_moments_parallel_flow" => true)) test_input_split2["timestepping"] = merge(test_input_split2["timestepping"], - Dict{String,Any}("step_update_prefactor" => 0.4)) + OptionsDict("step_update_prefactor" => 0.4)) test_input_split3 = merge(test_input_split2, - Dict("run_name" => "split3", + OptionsDict("run_name" => "split3", "evolve_moments_parallel_pressure" => true, "vpa_nelement" => 8, "vz_nelement" => 8, - "numerical_dissipation" => Dict{String,Any}("force_minimum_pdf_value" => 0.0, + "numerical_dissipation" => OptionsDict("force_minimum_pdf_value" => 0.0, "vpa_dissipation_coefficient" => 1e-2))) test_input_split3["timestepping"] = merge(test_input_split3["timestepping"], - Dict{String,Any}("dt" => 1.0e-9, + OptionsDict("dt" => 1.0e-9, "minimum_dt" => 1.0e-9)) diff --git a/moment_kinetics/debug_test/restart_interpolation_inputs.jl b/moment_kinetics/debug_test/restart_interpolation_inputs.jl index ba9663060..1041423cf 100644 --- a/moment_kinetics/debug_test/restart_interpolation_inputs.jl +++ b/moment_kinetics/debug_test/restart_interpolation_inputs.jl @@ -1,9 +1,10 @@ test_type = "restart_interpolation" +using moment_kinetics.type_definitions: OptionsDict # default inputs for tests -base_input = Dict( +base_input = OptionsDict( "run_name" => "base", - "composition" => Dict("n_ion_species" => 2, + "composition" => OptionsDict("n_ion_species" => 2, "n_neutral_species" => 2, "electron_physics" => "boltzmann_electron_response", "T_e" => 1.0), @@ -14,7 +15,7 @@ base_input = Dict( "evolve_moments_conservation" => true, "charge_exchange_frequency" => 2*π*0.1, "ionization_frequency" => 0.0, - "timestepping" => Dict{String,Any}("nstep" => 3, + "timestepping" => OptionsDict("nstep" => 3, "dt" => 0.0, "nwrite" => 2, "type" => "SSPRK2", @@ -41,29 +42,29 @@ base_input = Dict( "vzeta_nelement" => 1, "vr_ngrid" => 1, "vr_nelement" => 1, - "ion_numerical_dissipation" => Dict{String,Any}("force_minimum_pdf_value" => 0.0), - "neutral_numerical_dissipation" => Dict{String,Any}("force_minimum_pdf_value" => 0.0)) + "ion_numerical_dissipation" => OptionsDict("force_minimum_pdf_value" => 0.0), + "neutral_numerical_dissipation" => OptionsDict("force_minimum_pdf_value" => 0.0)) test_input = merge(base_input, - Dict("run_name" => "full-f", + OptionsDict("run_name" => "full-f", "z_nelement" => 3, "vpa_nelement" => 3, "vz_nelement" => 3)) test_input_split1 = merge(test_input, - Dict("run_name" => "split1", + OptionsDict("run_name" => "split1", "evolve_moments_density" => true)) test_input_split2 = merge(test_input_split1 , - Dict("run_name" => "split2", + OptionsDict("run_name" => "split2", "evolve_moments_parallel_flow" => true)) test_input_split3 = merge(test_input_split2, - Dict("run_name" => "split3", + OptionsDict("run_name" => "split3", "evolve_moments_parallel_pressure" => true)) test_input_list = [ diff --git a/moment_kinetics/debug_test/sound_wave_inputs.jl b/moment_kinetics/debug_test/sound_wave_inputs.jl index 6e78f7a5d..9d2f32fd2 100644 --- a/moment_kinetics/debug_test/sound_wave_inputs.jl +++ b/moment_kinetics/debug_test/sound_wave_inputs.jl @@ -1,9 +1,10 @@ test_type = "sound_wave" +using moment_kinetics.type_definitions: OptionsDict # default inputs for tests -test_input_finite_difference_1D1V = Dict( +test_input_finite_difference_1D1V = OptionsDict( "run_name" => "finite_difference_1D1V", - "composition" => Dict("n_ion_species" => 2, + "composition" => OptionsDict("n_ion_species" => 2, "n_neutral_species" => 2, "electron_physics" => "boltzmann_electron_response", "T_e" => 1.0), @@ -14,7 +15,7 @@ test_input_finite_difference_1D1V = Dict( "evolve_moments_conservation" => true, "charge_exchange_frequency" => 2*π*0.1, "ionization_frequency" => 0.0, - "timestepping" => Dict{String,Any}("nstep" => 3, + "timestepping" => OptionsDict("nstep" => 3, "dt" => 1.e-8, "nwrite" => 2, "type" => "SSPRK2", @@ -44,42 +45,42 @@ test_input_finite_difference_1D1V = Dict( test_input_finite_difference_1D1V_split_1_moment = merge(test_input_finite_difference_1D1V, - Dict("run_name" => "finite_difference_1D1V_split_1_moment", + OptionsDict("run_name" => "finite_difference_1D1V_split_1_moment", "evolve_moments_density" => true)) test_input_finite_difference_1D1V_split_2_moments = merge(test_input_finite_difference_1D1V_split_1_moment, - Dict("run_name" => "finite_difference_1D1V_split_2_moments", + OptionsDict("run_name" => "finite_difference_1D1V_split_2_moments", "evolve_moments_parallel_flow" => true)) test_input_finite_difference_1D1V_split_3_moments = merge(test_input_finite_difference_1D1V_split_2_moments, - Dict("run_name" => "finite_difference_1D1V_split_3_moments", + OptionsDict("run_name" => "finite_difference_1D1V_split_3_moments", "evolve_moments_parallel_pressure" => true)) test_input_finite_difference_cx0_1D1V = merge(test_input_finite_difference_1D1V, - Dict("run_name" => "finite_difference_cx0_1D1V", + OptionsDict("run_name" => "finite_difference_cx0_1D1V", "charge_exchange_frequency" => 0.0)) test_input_finite_difference_cx0_1D1V_split_1_moment = merge(test_input_finite_difference_cx0_1D1V, - Dict("run_name" => "finite_difference_cx0_1D1V_split_1_moment", + OptionsDict("run_name" => "finite_difference_cx0_1D1V_split_1_moment", "evolve_moments_density" => true)) test_input_finite_difference_cx0_1D1V_split_2_moments = merge(test_input_finite_difference_cx0_1D1V_split_1_moment, - Dict("run_name" => "finite_difference_cx0_1D1V_split_2_moments", + OptionsDict("run_name" => "finite_difference_cx0_1D1V_split_2_moments", "evolve_moments_parallel_flow" => true)) test_input_finite_difference_cx0_1D1V_split_3_moments = merge(test_input_finite_difference_cx0_1D1V_split_2_moments, - Dict("run_name" => "finite_difference_cx0_1D1V_split_3_moments", + OptionsDict("run_name" => "finite_difference_cx0_1D1V_split_3_moments", "evolve_moments_parallel_pressure" => true)) test_input_finite_difference = merge(test_input_finite_difference_1D1V, - Dict("run_name" => "finite_difference", + OptionsDict("run_name" => "finite_difference", "r_ngrid" => 4, "r_nelement" => 1, "r_discretization" => "finite_difference", @@ -98,41 +99,41 @@ test_input_finite_difference = test_input_finite_difference_split_1_moment = merge(test_input_finite_difference, - Dict("run_name" => "finite_difference_split_1_moment", + OptionsDict("run_name" => "finite_difference_split_1_moment", "evolve_moments_density" => true)) test_input_finite_difference_split_2_moments = merge(test_input_finite_difference_split_1_moment, - Dict("run_name" => "finite_difference_split_2_moments", + OptionsDict("run_name" => "finite_difference_split_2_moments", "evolve_moments_parallel_flow" => true)) test_input_finite_difference_split_3_moments = merge(test_input_finite_difference_split_2_moments, - Dict("run_name" => "finite_difference_split_3_moments", + OptionsDict("run_name" => "finite_difference_split_3_moments", "evolve_moments_parallel_pressure" => true)) test_input_finite_difference_cx0 = merge(test_input_finite_difference, - Dict("run_name" => "finite_difference_cx0", + OptionsDict("run_name" => "finite_difference_cx0", "charge_exchange_frequency" => 0.0)) test_input_finite_difference_cx0_split_1_moment = merge(test_input_finite_difference_cx0, - Dict("run_name" => "finite_difference_cx0_split_1_moment", + OptionsDict("run_name" => "finite_difference_cx0_split_1_moment", "evolve_moments_density" => true)) test_input_finite_difference_cx0_split_2_moments = merge(test_input_finite_difference_cx0_split_1_moment, - Dict("run_name" => "finite_difference_cx0_split_2_moments", + OptionsDict("run_name" => "finite_difference_cx0_split_2_moments", "evolve_moments_parallel_flow" => true)) test_input_finite_difference_cx0_split_3_moments = merge(test_input_finite_difference_cx0_split_2_moments, - Dict("run_name" => "finite_difference_cx0_split_3_moments", + OptionsDict("run_name" => "finite_difference_cx0_split_3_moments", "evolve_moments_parallel_pressure" => true)) test_input_chebyshev = merge(test_input_finite_difference, - Dict("run_name" => "chebyshev_pseudospectral", + OptionsDict("run_name" => "chebyshev_pseudospectral", "r_discretization" => "chebyshev_pseudospectral", "r_ngrid" => 3, "r_nelement" => 1, @@ -157,42 +158,42 @@ test_input_chebyshev = merge(test_input_finite_difference, test_input_chebyshev_split_1_moment = merge(test_input_chebyshev, - Dict("run_name" => "chebyshev_pseudospectral_split_1_moment", + OptionsDict("run_name" => "chebyshev_pseudospectral_split_1_moment", "evolve_moments_density" => true)) test_input_chebyshev_split_2_moments = merge(test_input_chebyshev_split_1_moment, - Dict("run_name" => "chebyshev_pseudospectral_split_2_moments", + OptionsDict("run_name" => "chebyshev_pseudospectral_split_2_moments", "evolve_moments_parallel_flow" => true)) test_input_chebyshev_split_3_moments = merge(test_input_chebyshev_split_2_moments, - Dict("run_name" => "chebyshev_pseudospectral_split_3_moments", + OptionsDict("run_name" => "chebyshev_pseudospectral_split_3_moments", "evolve_moments_parallel_pressure" => true)) test_input_chebyshev_cx0 = merge(test_input_chebyshev, - Dict("run_name" => "chebyshev_pseudospectral_cx0", + OptionsDict("run_name" => "chebyshev_pseudospectral_cx0", "charge_exchange_frequency" => 0.0)) test_input_chebyshev_cx0_split_1_moment = merge(test_input_chebyshev_cx0, - Dict("run_name" => "chebyshev_pseudospectral_cx0_split_1_moment", + OptionsDict("run_name" => "chebyshev_pseudospectral_cx0_split_1_moment", "evolve_moments_density" => true)) test_input_chebyshev_cx0_split_2_moments = merge(test_input_chebyshev_cx0_split_1_moment, - Dict("run_name" => "chebyshev_pseudospectral_cx0_split_2_moments", + OptionsDict("run_name" => "chebyshev_pseudospectral_cx0_split_2_moments", "evolve_moments_parallel_flow" => true)) test_input_chebyshev_cx0_split_3_moments = merge(test_input_chebyshev_cx0_split_2_moments, - Dict("run_name" => "chebyshev_pseudospectral_cx0_split_3_moments", + OptionsDict("run_name" => "chebyshev_pseudospectral_cx0_split_3_moments", "evolve_moments_parallel_pressure" => true)) test_input_chebyshev_1D1V = merge(test_input_finite_difference_1D1V, - Dict("run_name" => "chebyshev_pseudospectral_1D1V", + OptionsDict("run_name" => "chebyshev_pseudospectral_1D1V", "z_discretization" => "chebyshev_pseudospectral", "z_ngrid" => 3, "z_nelement" => 2, @@ -205,37 +206,37 @@ test_input_chebyshev_1D1V = test_input_chebyshev_1D1V_split_1_moment = merge(test_input_chebyshev_1D1V, - Dict("run_name" => "chebyshev_pseudospectral_1D1V_split_1_moment", + OptionsDict("run_name" => "chebyshev_pseudospectral_1D1V_split_1_moment", "evolve_moments_density" => true)) test_input_chebyshev_1D1V_split_2_moments = merge(test_input_chebyshev_1D1V_split_1_moment, - Dict("run_name" => "chebyshev_pseudospectral_1D1V_split_2_moments", + OptionsDict("run_name" => "chebyshev_pseudospectral_1D1V_split_2_moments", "evolve_moments_parallel_flow" => true)) test_input_chebyshev_1D1V_split_3_moments = merge(test_input_chebyshev_1D1V_split_2_moments, - Dict("run_name" => "chebyshev_pseudospectral_1D1V_split_3_moments", + OptionsDict("run_name" => "chebyshev_pseudospectral_1D1V_split_3_moments", "evolve_moments_parallel_pressure" => true, "runtime_plots" => true)) test_input_chebyshev_cx0_1D1V = merge(test_input_chebyshev_1D1V, - Dict("run_name" => "chebyshev_pseudospectral_cx0_1D1V", + OptionsDict("run_name" => "chebyshev_pseudospectral_cx0_1D1V", "charge_exchange_frequency" => 0.0)) test_input_chebyshev_cx0_1D1V_split_1_moment = merge(test_input_chebyshev_cx0_1D1V, - Dict("run_name" => "chebyshev_pseudospectral_cx0_1D1V_split_1_moment", + OptionsDict("run_name" => "chebyshev_pseudospectral_cx0_1D1V_split_1_moment", "evolve_moments_density" => true)) test_input_chebyshev_cx0_1D1V_split_2_moments = merge(test_input_chebyshev_cx0_1D1V_split_1_moment, - Dict("run_name" => "chebyshev_pseudospectral_cx0_1D1V_split_2_moments", + OptionsDict("run_name" => "chebyshev_pseudospectral_cx0_1D1V_split_2_moments", "evolve_moments_parallel_flow" => true)) test_input_chebyshev_cx0_1D1V_split_3_moments = merge(test_input_chebyshev_cx0_1D1V_split_2_moments, - Dict("run_name" => "chebyshev_pseudospectral_cx0_1D1V_split_3_moments", + OptionsDict("run_name" => "chebyshev_pseudospectral_cx0_1D1V_split_3_moments", "evolve_moments_parallel_pressure" => true)) test_input_list = [ diff --git a/moment_kinetics/debug_test/wall_bc_inputs.jl b/moment_kinetics/debug_test/wall_bc_inputs.jl index 110735137..b333b8d3b 100644 --- a/moment_kinetics/debug_test/wall_bc_inputs.jl +++ b/moment_kinetics/debug_test/wall_bc_inputs.jl @@ -1,9 +1,10 @@ test_type = "Wall boundary conditions" +using moment_kinetics.type_definitions: OptionsDict # default inputs for tests -test_input_finite_difference_1D1V = Dict( +test_input_finite_difference_1D1V = OptionsDict( "run_name" => "finite_difference_1D1V", - "composition" => Dict("n_ion_species" => 2, + "composition" => OptionsDict("n_ion_species" => 2, "n_neutral_species" => 2, "electron_physics" => "boltzmann_electron_response", "T_e" => 1.0, @@ -16,7 +17,7 @@ test_input_finite_difference_1D1V = Dict( "charge_exchange_frequency" => 2.0, "ionization_frequency" => 2.0, "constant_ionization_rate" => false, - "timestepping" => Dict{String,Any}("nstep" => 3, + "timestepping" => OptionsDict("nstep" => 3, "dt" => 1.0e-8, "nwrite" => 2, "type" => "SSPRK2", @@ -46,12 +47,12 @@ test_input_finite_difference_1D1V = Dict( test_input_finite_difference_simple_sheath_1D1V = merge( test_input_finite_difference_1D1V, - Dict("run_name" => "finite_difference_simple_sheath_1D1V", + OptionsDict("run_name" => "finite_difference_simple_sheath_1D1V", "electron_physics" => "boltzmann_electron_response_with_simple_sheath")) test_input_finite_difference = merge( test_input_finite_difference_1D1V, - Dict("run_name" => "finite_difference", + OptionsDict("run_name" => "finite_difference", "r_ngrid" => 4, "r_nelement" => 1, "r_discretization" => "finite_difference", @@ -70,12 +71,12 @@ test_input_finite_difference = merge( test_input_finite_difference_simple_sheath = merge( test_input_finite_difference, - Dict("run_name" => "finite_difference_simple_sheath", + OptionsDict("run_name" => "finite_difference_simple_sheath", "electron_physics" => "boltzmann_electron_response_with_simple_sheath")) test_input_chebyshev_1D1V = merge( test_input_finite_difference_1D1V, - Dict("run_name" => "chebyshev_pseudospectral_1D1V", + OptionsDict("run_name" => "chebyshev_pseudospectral_1D1V", "z_discretization" => "chebyshev_pseudospectral", "z_ngrid" => 3, "z_nelement" => 2, @@ -87,26 +88,26 @@ test_input_chebyshev_1D1V = merge( "vz_nelement" => 2)) test_input_chebyshev_split1_1D1V = merge(test_input_chebyshev_1D1V, - Dict("run_name" => "chebyshev_pseudospectral_split1_1D1V", + OptionsDict("run_name" => "chebyshev_pseudospectral_split1_1D1V", "evolve_moments_density" => true)) test_input_chebyshev_split2_1D1V = merge(test_input_chebyshev_split1_1D1V, - Dict("run_name" => "chebyshev_pseudospectral_split2_1D1V", + OptionsDict("run_name" => "chebyshev_pseudospectral_split2_1D1V", "evolve_moments_parallel_flow" => true)) test_input_chebyshev_split3_1D1V = merge(test_input_chebyshev_split2_1D1V, - Dict("run_name" => "chebyshev_pseudospectral_split3_1D1V", + OptionsDict("run_name" => "chebyshev_pseudospectral_split3_1D1V", "evolve_moments_parallel_pressure" => true)) test_input_chebyshev_simple_sheath_1D1V = merge( test_input_chebyshev_1D1V, - Dict("run_name" => "chebyshev_pseudospectral_simple_sheath_1D1V", + OptionsDict("run_name" => "chebyshev_pseudospectral_simple_sheath_1D1V", "electron_physics" => "boltzmann_electron_response_with_simple_sheath")) test_input_chebyshev = merge( test_input_chebyshev_1D1V, - Dict("run_name" => "chebyshev_pseudospectral", + OptionsDict("run_name" => "chebyshev_pseudospectral", "r_discretization" => "chebyshev_pseudospectral", "r_ngrid" => 3, "r_nelement" => 1, @@ -125,7 +126,7 @@ test_input_chebyshev = merge( test_input_chebyshev_simple_sheath = merge( test_input_chebyshev, - Dict("run_name" => "chebyshev_pseudospectral_simple_sheath", + OptionsDict("run_name" => "chebyshev_pseudospectral_simple_sheath", "electron_physics" => "boltzmann_electron_response_with_simple_sheath")) test_input_list = [ diff --git a/moment_kinetics/src/load_data.jl b/moment_kinetics/src/load_data.jl index f4c887b84..3eb5ebbd0 100644 --- a/moment_kinetics/src/load_data.jl +++ b/moment_kinetics/src/load_data.jl @@ -30,7 +30,7 @@ using ..looping using ..moment_kinetics_input: mk_input using ..neutral_vz_advection: update_speed_neutral_vz! using ..neutral_z_advection: update_speed_neutral_z! -using ..type_definitions: mk_float, mk_int +using ..type_definitions: mk_float, mk_int, OptionsDict using ..utils: get_CFL!, get_minimum_CFL_z, get_minimum_CFL_vpa, get_minimum_CFL_neutral_z, get_minimum_CFL_neutral_vz, enum_from_string using ..vpa_advection: update_speed_vpa! @@ -189,7 +189,7 @@ function read_Dict_from_section(file_or_group, section_name; ignore_subsections= # Function that can be called recursively to read nested Dicts from sub-groups in # the output file section_io = get_group(file_or_group, section_name) - section = Dict{String,Any}() + section = OptionsDict() for key ∈ get_variable_keys(section_io) section[key] = load_variable(section_io, key) diff --git a/moment_kinetics/src/moment_kinetics_input.jl b/moment_kinetics/src/moment_kinetics_input.jl index e2407734e..b36a315bd 100644 --- a/moment_kinetics/src/moment_kinetics_input.jl +++ b/moment_kinetics/src/moment_kinetics_input.jl @@ -7,7 +7,7 @@ export performance_test #export advective_form export read_input_file -using ..type_definitions: mk_float, mk_int +using ..type_definitions: mk_float, mk_int, OptionsDict using ..array_allocation: allocate_float using ..communication using ..coordinates: define_coordinate @@ -448,9 +448,9 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) is_1V = (vperp.ngrid == vperp.nelement_global == 1 && vzeta.ngrid == vzeta.nelement_global == 1 && vr.ngrid == vr.nelement_global == 1) - ion_num_diss_param_dict = get(scan_input, "ion_numerical_dissipation", Dict{String,Any}()) - electron_num_diss_param_dict = get(scan_input, "electron_numerical_dissipation", Dict{String,Any}()) - neutral_num_diss_param_dict = get(scan_input, "neutral_numerical_dissipation", Dict{String,Any}()) + ion_num_diss_param_dict = get(scan_input, "ion_numerical_dissipation", OptionsDict()) + electron_num_diss_param_dict = get(scan_input, "electron_numerical_dissipation", OptionsDict()) + neutral_num_diss_param_dict = get(scan_input, "neutral_numerical_dissipation", OptionsDict()) num_diss_params = setup_numerical_dissipation(ion_num_diss_param_dict, electron_num_diss_param_dict, neutral_num_diss_param_dict, is_1V) diff --git a/moment_kinetics/src/type_definitions.jl b/moment_kinetics/src/type_definitions.jl index d0a6f6943..e53fea73d 100644 --- a/moment_kinetics/src/type_definitions.jl +++ b/moment_kinetics/src/type_definitions.jl @@ -4,6 +4,7 @@ module type_definitions export mk_float export mk_int +export OptionsDict """ """ @@ -13,4 +14,8 @@ const mk_float = Float64 """ const mk_int = Int64 +""" +""" +const OptionsDict = Dict{String,Any} + end diff --git a/moment_kinetics/test/Krook_collisions_tests.jl b/moment_kinetics/test/Krook_collisions_tests.jl index 9e95b4a4d..806bad279 100644 --- a/moment_kinetics/test/Krook_collisions_tests.jl +++ b/moment_kinetics/test/Krook_collisions_tests.jl @@ -14,7 +14,7 @@ using moment_kinetics.load_data: open_readonly_output_file, load_coordinate_data load_neutral_particle_moments_data, load_neutral_pdf_data, load_time_data, load_species_data using moment_kinetics.interpolation: interpolate_to_grid_z, interpolate_to_grid_vpa -using moment_kinetics.type_definitions: mk_float +using moment_kinetics.type_definitions: mk_float, OptionsDict # Useful parameters const z_L = 1.0 # always 1 in normalized units? @@ -85,23 +85,23 @@ const expected = 0.024284888662941113 0.010011392733734206 0.008423252360063494 0.019281192435730943 0.036719507768509525 0.041644492169994836 0.03692283098105331 0.03638215764882269 0.04191389118981368 0.04071460358290303 0.024284888662941134]) # default inputs for tests -test_input_full_f = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, +test_input_full_f = Dict("composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 1, "electron_physics" => "boltzmann_electron_response", "T_e" => 1.0, "T_wall" => 1.0), - "ion_species_1" => Dict{String,Any}("initial_density" => 0.5, + "ion_species_1" => OptionsDict("initial_density" => 0.5, "initial_temperature" => 1.0), - "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "z_IC_ion_species_1" => OptionsDict("initialization_option" => "sinusoid", "density_amplitude" => 0.5, "density_phase" => 0.0, "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.5, "temperature_phase" => mk_float(π)), - "neutral_species_1" => Dict{String,Any}("initial_density" => 0.5, + "neutral_species_1" => OptionsDict("initial_density" => 0.5, "initial_temperature" => 1.0), - "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "z_IC_neutral_species_1" => OptionsDict("initialization_option" => "sinusoid", "density_amplitude" => 0.5, "density_phase" => mk_float(π), "upar_amplitude" => 0.0, @@ -113,10 +113,10 @@ test_input_full_f = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, "evolve_moments_parallel_flow" => false, "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => true, - "krook_collisions" => Dict{String,Any}("use_krook" => true,"frequency_option" => "reference_parameters"), + "krook_collisions" => OptionsDict("use_krook" => true,"frequency_option" => "reference_parameters"), "charge_exchange_frequency" => 2*π*0.1, "ionization_frequency" => 0.0, - "timestepping" => Dict{String,Any}("nstep" => 100, + "timestepping" => OptionsDict("nstep" => 100, "dt" => 0.001, "nwrite" => 100, "nwrite_dfns" => 100, diff --git a/moment_kinetics/test/braginskii_electrons_imex_tests.jl b/moment_kinetics/test/braginskii_electrons_imex_tests.jl index d2a81bbc7..4bf902b8c 100644 --- a/moment_kinetics/test/braginskii_electrons_imex_tests.jl +++ b/moment_kinetics/test/braginskii_electrons_imex_tests.jl @@ -13,9 +13,10 @@ using moment_kinetics.coordinates: define_coordinate using moment_kinetics.input_structs: grid_input, advection_input, merge_dict_with_kwargs! using moment_kinetics.interpolation: interpolate_to_grid_z using moment_kinetics.load_data: get_run_info_no_setup, close_run_info, get_variable +using moment_kinetics.type_definitions: OptionsDict # default inputs for tests -test_input = Dict{String,Any}( "composition" => Dict{String,Any}("n_ion_species" => 1, +test_input = OptionsDict( "composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 1, "electron_physics" => "braginskii_fluid", "T_e" => 0.2), @@ -24,32 +25,32 @@ test_input = Dict{String,Any}( "composition" => Dict{String,Any}("n_ion_species" "evolve_moments_parallel_flow" => true, "evolve_moments_parallel_pressure" => true, "evolve_moments_conservation" => true, - "ion_species_1" => Dict{String,Any}("initial_density" => 1.0, + "ion_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), - "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "z_IC_ion_species_1" => OptionsDict("initialization_option" => "sinusoid", "density_amplitude" => 0.1, "density_phase" => 0.0, "upar_amplitude" => 1.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.1, "temperature_phase" => 1.0), - "vpa_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "vpa_IC_ion_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 1.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "neutral_species_1" => Dict{String,Any}("initial_density" => 1.0, + "neutral_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), - "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "z_IC_neutral_species_1" => OptionsDict("initialization_option" => "sinusoid", "density_amplitude" => 0.001, "density_phase" => 0.0, "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "vpa_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "vpa_IC_neutral_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 1.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, @@ -60,7 +61,7 @@ test_input = Dict{String,Any}( "composition" => Dict{String,Any}("n_ion_species" "charge_exchange_frequency" => 0.75, "ionization_frequency" => 0.5, "constant_ionization_rate" => false, - "timestepping" => Dict{String,Any}("type" => "KennedyCarpenterARK324", + "timestepping" => OptionsDict("type" => "KennedyCarpenterARK324", "implicit_ion_advance" => false, "implicit_vpa_advection" => false, "nstep" => 10000, @@ -69,7 +70,7 @@ test_input = Dict{String,Any}( "composition" => Dict{String,Any}("n_ion_species" "rtol" => 1.0e-7, "nwrite" => 10000, "high_precision_error_sum" => true), - "nonlinear_solver" => Dict{String,Any}("nonlinear_max_iterations" => 100), + "nonlinear_solver" => OptionsDict("nonlinear_max_iterations" => 100), "r_ngrid" => 1, "r_nelement" => 1, "z_ngrid" => 17, @@ -86,9 +87,9 @@ test_input = Dict{String,Any}( "composition" => Dict{String,Any}("n_ion_species" "vz_L" => 12.0, "vz_bc" => "zero", "vz_discretization" => "chebyshev_pseudospectral", - "ion_numerical_dissipation" => Dict{String,Any}("force_minimum_pdf_value" => 0.0, + "ion_numerical_dissipation" => OptionsDict("force_minimum_pdf_value" => 0.0, "vpa_dissipation_coefficient" => 1e0), - "neutral_numerical_dissipation" => Dict{String,Any}("force_minimum_pdf_value" => 0.0, + "neutral_numerical_dissipation" => OptionsDict("force_minimum_pdf_value" => 0.0, "vz_dissipation_coefficient" => 1e-1)) if global_size[] > 2 && global_size[] % 2 == 0 diff --git a/moment_kinetics/test/fokker_planck_time_evolution_tests.jl b/moment_kinetics/test/fokker_planck_time_evolution_tests.jl index b7338bec3..5a0567091 100644 --- a/moment_kinetics/test/fokker_planck_time_evolution_tests.jl +++ b/moment_kinetics/test/fokker_planck_time_evolution_tests.jl @@ -10,7 +10,7 @@ using moment_kinetics.load_data: open_readonly_output_file, load_coordinate_data load_species_data, load_fields_data, load_ion_moments_data, load_pdf_data, load_time_data, load_species_data -using moment_kinetics.type_definitions: mk_float +using moment_kinetics.type_definitions: mk_float, OptionsDict const analytical_rtol = 3.e-2 const regression_rtol = 2.e-8 @@ -225,13 +225,13 @@ end # default inputs for tests test_input_gauss_legendre = Dict("run_name" => "gausslegendre_pseudospectral", "base_directory" => test_output_directory, - "composition" => Dict{String,Any}("n_ion_species" => 1, + "composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 0, "electron_physics" => "boltzmann_electron_response", "T_e" => 1.0), - "ion_species_1" => Dict{String,Any}("initial_density" => 0.5, + "ion_species_1" => OptionsDict("initial_density" => 0.5, "initial_temperature" => 1.0), - "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "z_IC_ion_species_1" => OptionsDict("initialization_option" => "sinusoid", "density_amplitude" => 0.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, @@ -251,7 +251,7 @@ test_input_gauss_legendre = Dict("run_name" => "gausslegendre_pseudospectral", "charge_exchange_frequency" => 0.0, "constant_ionization_rate" => false, "electron_physics" => "boltzmann_electron_response", - "fokker_planck_collisions" => Dict{String,Any}("use_fokker_planck" => true, "nuii" => 1.0, "frequency_option" => "manual"), + "fokker_planck_collisions" => OptionsDict("use_fokker_planck" => true, "nuii" => 1.0, "frequency_option" => "manual"), "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, "evolve_moments_parallel_flow" => false, @@ -266,7 +266,7 @@ test_input_gauss_legendre = Dict("run_name" => "gausslegendre_pseudospectral", "r_nelement" => 1, "r_nelement_local" => 1, "r_bc" => "periodic", - "timestepping" => Dict{String,Any}("dt" => 0.01, + "timestepping" => OptionsDict("dt" => 0.01, "nstep" => 5000, "nwrite" => 5000, "nwrite_dfns" => 5000 )) diff --git a/moment_kinetics/test/gyroaverage_tests.jl b/moment_kinetics/test/gyroaverage_tests.jl index ebb309b22..c4f2e5a2a 100644 --- a/moment_kinetics/test/gyroaverage_tests.jl +++ b/moment_kinetics/test/gyroaverage_tests.jl @@ -16,7 +16,7 @@ using moment_kinetics.looping using moment_kinetics.array_allocation: allocate_float, allocate_shared_float using moment_kinetics.gyroaverages: gyroaverage_pdf! using moment_kinetics.gyroaverages: gyroaverage_field!, init_gyro_operators -using moment_kinetics.type_definitions: mk_float, mk_int +using moment_kinetics.type_definitions: mk_float, mk_int, OptionsDict using moment_kinetics.species_input: get_species_input print_test_results = false @@ -230,7 +230,7 @@ function gyroaverage_test(absolute_error; rhostar=0.1, pitch=0.5, ngrid=5, kr=2, end function create_test_composition() - input_dict = Dict{String,Any}("composition" => Dict{String,Any}("n_ion_species" => 1, "n_neutral_species" => 0, "gyrokinetic_ions" => true ) ) + input_dict = OptionsDict("composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 0, "gyrokinetic_ions" => true ) ) #println(input_dict) return get_species_input(input_dict) end diff --git a/moment_kinetics/test/harrisonthompson.jl b/moment_kinetics/test/harrisonthompson.jl index 2640689a7..0945f72e2 100644 --- a/moment_kinetics/test/harrisonthompson.jl +++ b/moment_kinetics/test/harrisonthompson.jl @@ -12,6 +12,7 @@ using moment_kinetics.load_data: open_readonly_output_file using moment_kinetics.load_data: load_fields_data, load_time_data using moment_kinetics.load_data: load_species_data, load_coordinate_data using moment_kinetics.input_structs: merge_dict_with_kwargs! +using moment_kinetics.type_definitions: OptionsDict ionization_frequency = 0.688 @@ -62,21 +63,21 @@ function findphi(z, R_ion) end # default inputs for tests -test_input_finite_difference = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, +test_input_finite_difference = Dict("composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 0, "electron_physics" => "boltzmann_electron_response", "T_e" => 1.0, "T_wall" => 1.0), - "ion_species_1" => Dict{String,Any}("initial_density" => 1.0, + "ion_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), - "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "z_IC_ion_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 0.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "vpa_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "vpa_IC_ion_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 1.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, @@ -91,7 +92,7 @@ test_input_finite_difference = Dict("composition" => Dict{String,Any}("n_ion_spe "charge_exchange_frequency" => 0.0, "ionization_frequency" => 0.0, "constant_ionization_rate" => true, - "timestepping" => Dict{String,Any}("nstep" => 9000, + "timestepping" => OptionsDict("nstep" => 9000, "dt" => 0.0005, "nwrite" => 9000, "split_operators" => false), diff --git a/moment_kinetics/test/nonlinear_solver_tests.jl b/moment_kinetics/test/nonlinear_solver_tests.jl index 23d62acf9..b37dc0187 100644 --- a/moment_kinetics/test/nonlinear_solver_tests.jl +++ b/moment_kinetics/test/nonlinear_solver_tests.jl @@ -9,7 +9,7 @@ using moment_kinetics.input_structs: advection_input using moment_kinetics.looping using moment_kinetics.looping: setup_loop_ranges! using moment_kinetics.nonlinear_solvers -using moment_kinetics.type_definitions: mk_float, mk_int +using moment_kinetics.type_definitions: mk_float, mk_int, OptionsDict using MPI @@ -113,8 +113,8 @@ function linear_test() end nl_solver_params = setup_nonlinear_solve( - Dict{String,Any}("nonlinear_solver" => - Dict{String,Any}("rtol" => 0.0, + OptionsDict("nonlinear_solver" => + OptionsDict("rtol" => 0.0, "atol" => atol, "linear_restart" => restart, "linear_max_restarts" => max_restarts)), @@ -245,8 +245,8 @@ function nonlinear_test() end nl_solver_params = setup_nonlinear_solve( - Dict{String,Any}("nonlinear_solver" => - Dict{String,Any}("rtol" => 0.0, + OptionsDict("nonlinear_solver" => + OptionsDict("rtol" => 0.0, "atol" => atol, "linear_restart" => restart, "linear_max_restarts" => max_restarts, diff --git a/moment_kinetics/test/nonlinear_sound_wave_inputs_and_expected_data.jl b/moment_kinetics/test/nonlinear_sound_wave_inputs_and_expected_data.jl index 8e5ab4988..031591e51 100644 --- a/moment_kinetics/test/nonlinear_sound_wave_inputs_and_expected_data.jl +++ b/moment_kinetics/test/nonlinear_sound_wave_inputs_and_expected_data.jl @@ -82,22 +82,22 @@ const expected = 0.024285034070612672 0.01001177872485688 0.00842420216637052 0.019283695804388705 0.03672486160719087 0.04165072188572364 0.0369234055803037 0.036374533667106045 0.041904838760501203 0.040712367539469434 0.02428503407061266]) # default inputs for tests -test_input_finite_difference = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, +test_input_finite_difference = Dict("composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 1, "electron_physics" => "boltzmann_electron_response", "T_e" => 1.0), - "ion_species_1" => Dict{String,Any}("initial_density" => 0.5, + "ion_species_1" => OptionsDict("initial_density" => 0.5, "initial_temperature" => 1.0), - "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "z_IC_ion_species_1" => OptionsDict("initialization_option" => "sinusoid", "density_amplitude" => 0.5, "density_phase" => 0.0, "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.5, "temperature_phase" => mk_float(π)), - "neutral_species_1" => Dict{String,Any}("initial_density" => 0.5, + "neutral_species_1" => OptionsDict("initial_density" => 0.5, "initial_temperature" => 1.0), - "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "z_IC_neutral_species_1" => OptionsDict("initialization_option" => "sinusoid", "density_amplitude" => 0.5, "density_phase" => mk_float(π), "upar_amplitude" => 0.0, @@ -111,7 +111,7 @@ test_input_finite_difference = Dict("composition" => Dict{String,Any}("n_ion_spe "evolve_moments_conservation" => true, "charge_exchange_frequency" => 2*π*0.1, "ionization_frequency" => 0.0, - "timestepping" => Dict{String,Any}("nstep" => 100, + "timestepping" => OptionsDict("nstep" => 100, "dt" => 0.001, "nwrite" => 100, "nwrite_dfns" => 100, diff --git a/moment_kinetics/test/nonlinear_sound_wave_tests.jl b/moment_kinetics/test/nonlinear_sound_wave_tests.jl index fe7668185..7da52ab70 100644 --- a/moment_kinetics/test/nonlinear_sound_wave_tests.jl +++ b/moment_kinetics/test/nonlinear_sound_wave_tests.jl @@ -9,7 +9,7 @@ using moment_kinetics.input_structs: grid_input, advection_input, merge_dict_wit using moment_kinetics.interpolation: interpolate_to_grid_z, interpolate_to_grid_vpa using moment_kinetics.load_data: get_run_info_no_setup, close_run_info, postproc_load_variable -using moment_kinetics.type_definitions: mk_float +using moment_kinetics.type_definitions: mk_float, OptionsDict const analytical_rtol = 3.e-2 const regression_rtol = 2.e-8 diff --git a/moment_kinetics/test/recycling_fraction_tests.jl b/moment_kinetics/test/recycling_fraction_tests.jl index 29a9ce3dd..23a65fd19 100644 --- a/moment_kinetics/test/recycling_fraction_tests.jl +++ b/moment_kinetics/test/recycling_fraction_tests.jl @@ -14,40 +14,41 @@ using moment_kinetics.input_structs: grid_input, advection_input, merge_dict_wit using moment_kinetics.interpolation: interpolate_to_grid_z using moment_kinetics.load_data: get_run_info_no_setup, close_run_info, postproc_load_variable +using moment_kinetics.type_definitions: OptionsDict # default inputs for tests -test_input = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, +test_input = Dict("composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 1, "electron_physics" => "boltzmann_electron_response", "T_e" => 0.2, "T_wall" => 0.1, "recycling_fraction" => 0.5), - "ion_species_1" => Dict{String,Any}("initial_density" => 1.0, + "ion_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), - "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "z_IC_ion_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 0.0, "density_phase" => 0.0, "upar_amplitude" => 1.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "vpa_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "vpa_IC_ion_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 1.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "neutral_species_1" => Dict{String,Any}("initial_density" => 1.0, + "neutral_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), - "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "z_IC_neutral_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 0.001, "density_phase" => 0.0, "upar_amplitude" => -1.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "vpa_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "vpa_IC_neutral_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 1.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, @@ -62,7 +63,7 @@ test_input = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, "charge_exchange_frequency" => 0.75, "ionization_frequency" => 0.5, "constant_ionization_rate" => false, - "timestepping" => Dict{String,Any}("nstep" => 1000, + "timestepping" => OptionsDict("nstep" => 1000, "dt" => 1.0e-4, "nwrite" => 1000, "split_operators" => false), @@ -107,8 +108,8 @@ test_input_split3 = merge(test_input_split2, "vpa_nelement" => 31, "vz_nelement" => 31, "evolve_moments_parallel_pressure" => true, - "ion_numerical_dissipation" => Dict{String,Any}("force_minimum_pdf_value" => 0.0, "vpa_dissipation_coefficient" => 1e-2), - "neutral_numerical_dissipation" => Dict{String,Any}("force_minimum_pdf_value" => 0.0, "vz_dissipation_coefficient" => 1e-2))) + "ion_numerical_dissipation" => OptionsDict("force_minimum_pdf_value" => 0.0, "vpa_dissipation_coefficient" => 1e-2), + "neutral_numerical_dissipation" => OptionsDict("force_minimum_pdf_value" => 0.0, "vz_dissipation_coefficient" => 1e-2))) test_input_split3["timestepping"] = merge(test_input_split3["timestepping"], Dict("dt" => 1.0e-5, "write_error_diagnostics" => true, @@ -116,7 +117,7 @@ test_input_split3["timestepping"] = merge(test_input_split3["timestepping"], # default inputs for adaptive timestepping tests test_input_adaptive = merge(test_input, - Dict{String,Any}("run_name" => "adaptive full-f", + OptionsDict("run_name" => "adaptive full-f", "z_ngrid" => 5, "z_nelement" => 16, "vpa_ngrid" => 6, @@ -130,7 +131,7 @@ test_input_adaptive = merge(test_input, # though the difference should be negligible compared to the # discretization error of the simulation). test_input_adaptive["timestepping"] = merge(test_input_adaptive["timestepping"], - Dict{String,Any}("type" => "Fekete4(3)", + OptionsDict("type" => "Fekete4(3)", "nstep" => 5000, "dt" => 1.0e-5, "minimum_dt" => 1.0e-5, @@ -147,18 +148,18 @@ test_input_adaptive_split2 = merge(test_input_adaptive_split1, Dict("run_name" => "adaptive split2", "evolve_moments_parallel_flow" => true)) test_input_adaptive_split2["timestepping"] = merge(test_input_adaptive_split2["timestepping"], - Dict{String,Any}("step_update_prefactor" => 0.4)) + OptionsDict("step_update_prefactor" => 0.4)) test_input_adaptive_split3 = merge(test_input_adaptive_split2, Dict("run_name" => "adaptive split3", "evolve_moments_parallel_pressure" => true, - "numerical_dissipation" => Dict{String,Any}("force_minimum_pdf_value" => 0.0, + "numerical_dissipation" => OptionsDict("force_minimum_pdf_value" => 0.0, "vpa_dissipation_coefficient" => 1e-2))) # The initial conditions seem to make the split3 case hard to advance without any # failures. In a real simulation, would just set the minimum_dt higher to try to get # through this without crashing. For this test, want the timestep to adapt (not just sit # at minimum_dt), so just set a very small timestep. test_input_adaptive_split3["timestepping"] = merge(test_input_adaptive_split3["timestepping"], - Dict{String,Any}("dt" => 1.0e-7, + OptionsDict("dt" => 1.0e-7, "rtol" => 2.0e-4, "atol" => 2.0e-10, "minimum_dt" => 1.0e-7, diff --git a/moment_kinetics/test/restart_interpolation_tests.jl b/moment_kinetics/test/restart_interpolation_tests.jl index 4ad098a44..5f6778feb 100644 --- a/moment_kinetics/test/restart_interpolation_tests.jl +++ b/moment_kinetics/test/restart_interpolation_tests.jl @@ -18,7 +18,7 @@ using moment_kinetics.load_data: open_readonly_output_file, load_coordinate_data using moment_kinetics.interpolation: interpolate_to_grid_z, interpolate_to_grid_vpa using moment_kinetics.load_data: get_run_info_no_setup, close_run_info, postproc_load_variable -using moment_kinetics.type_definitions: mk_float +using moment_kinetics.type_definitions: mk_float, OptionsDict include("nonlinear_sound_wave_inputs_and_expected_data.jl") @@ -30,7 +30,7 @@ if global_size[] > 1 && global_size[] % 2 == 0 # Test using distributed-memory base_input["z_nelement_local"] = base_input["z_nelement"] ÷ 2 end -base_input["output"] = Dict{String,Any}("parallel_io" => false) +base_input["output"] = OptionsDict("parallel_io" => false) restart_test_input_chebyshev = merge(deepcopy(base_input), diff --git a/moment_kinetics/test/sound_wave_tests.jl b/moment_kinetics/test/sound_wave_tests.jl index 7fc9d4b20..cd8b3dcb8 100644 --- a/moment_kinetics/test/sound_wave_tests.jl +++ b/moment_kinetics/test/sound_wave_tests.jl @@ -13,6 +13,7 @@ using moment_kinetics.load_data: load_fields_data, load_time_data using moment_kinetics.load_data: load_species_data, load_coordinate_data using moment_kinetics.analysis: analyze_fields_data using moment_kinetics.analysis: fit_delta_phi_mode +using moment_kinetics.type_definitions: OptionsDict const analytical_rtol = 3.e-2 const regression_rtol = 1.e-14 @@ -24,22 +25,22 @@ const binary_format = (force_optional_dependencies || io_has_implementation(netc "netcdf" : "hdf5" # default inputs for tests -test_input_finite_difference = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, +test_input_finite_difference = Dict("composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 1, "electron_physics" => "boltzmann_electron_response", "T_e" => 1.0), - "ion_species_1" => Dict{String,Any}("initial_density" => 0.5, + "ion_species_1" => OptionsDict("initial_density" => 0.5, "initial_temperature" => 1.0), - "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "z_IC_ion_species_1" => OptionsDict("initialization_option" => "sinusoid", "density_amplitude" => 0.001, "density_phase" => 0.0, "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "neutral_species_1" => Dict{String,Any}("initial_density" => 0.5, + "neutral_species_1" => OptionsDict("initial_density" => 0.5, "initial_temperature" => 1.0), - "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "sinusoid", + "z_IC_neutral_species_1" => OptionsDict("initialization_option" => "sinusoid", "density_amplitude" => 0.001, "density_phase" => 0.0, "upar_amplitude" => 0.0, @@ -53,7 +54,7 @@ test_input_finite_difference = Dict("composition" => Dict{String,Any}("n_ion_spe "evolve_moments_conservation" => true, "charge_exchange_frequency" => 2*π*0.1, "ionization_frequency" => 0.0, - "timestepping" => Dict{String,Any}("nstep" => 1500, + "timestepping" => OptionsDict("nstep" => 1500, "dt" => 0.002, "nwrite" => 20, "split_operators" => false), @@ -79,7 +80,7 @@ test_input_finite_difference = Dict("composition" => Dict{String,Any}("n_ion_spe "vz_L" => 8.0, "vz_bc" => "periodic", "vz_discretization" => "finite_difference", - "output" => Dict{String,Any}("binary_format" => binary_format) + "output" => OptionsDict("binary_format" => binary_format) ) test_input_finite_difference_split_1_moment = @@ -260,46 +261,46 @@ function run_test_set_finite_difference() [-0.001068422466592656, -0.001050527721698838, -0.0010288041337549816, -0.0010033394223323698, -0.0009742364063442995, -0.000941612585497573]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001)) @long run_test(test_input_finite_difference, 2*π*1.4467, -2*π*0.6020, [-0.001068422466592656, -0.001050527721698838, -0.0010288041337549816, -0.0010033394223323698, -0.0009742364063442995, -0.000941612585497573]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001), charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999)) @long run_test(test_input_finite_difference, 2*π*0.0, -2*π*0.5112, [-9.211308789442441, -9.211290894697548, -9.211269171109604, -9.21124370639818, -9.211214603382192, -9.211181979561346]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 @long run_test(test_input_finite_difference, 2*π*1.2671, -2*π*0.8033, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544], 30; - composition = Dict{String,Any}("T_e" => 0.5), + composition = OptionsDict("T_e" => 0.5), nstep=1300, charge_exchange_frequency=2*π*0.0) @long run_test(test_input_finite_difference, 2*π*0.0, -2*π*0.2727, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; - composition = Dict{String,Any}("T_e" => 0.5), + composition = OptionsDict("T_e" => 0.5), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 @long run_test(test_input_finite_difference, 2*π*1.9919, -2*π*0.2491, [-2.7764623921048157, -2.776390813125241, -2.7763039187734666, -2.7762020599277726, -2.7760856478638214, -2.775955152580435]; - composition = Dict{String,Any}("T_e" => 4.0)) + composition = OptionsDict("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -325,45 +326,45 @@ function run_test_set_finite_difference_split_1_moment() run_test(test_input_finite_difference_split_1_moment, 2*π*1.4467, -2*π*0.6020, [-0.0010684224665919893, -0.0010505277216983934, -0.0010288041337547594, -0.0010033394223312585, -0.0009742364063434105, -0.0009416125854969064]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001)) run_test(test_input_finite_difference_split_1_moment, 2*π*1.4467, -2*π*0.6020, [-0.0010684224665919893, -0.0010505277216983934, -0.0010288041337547594, -0.0010033394223312585, -0.0009742364063434105, -0.0009416125854969064]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001), charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999)) run_test(test_input_finite_difference_split_1_moment, 2*π*0.0, -2*π*0.5112, [-9.211308789442441, -9.211290894697548, -9.211269171109604, -9.21124370639818, -9.211214603382192, -9.211181979561346]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 run_test(test_input_finite_difference_split_1_moment, 2*π*1.2671, -2*π*0.8033, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544], 30; - composition = Dict{String,Any}("T_e" => 0.5), + composition = OptionsDict("T_e" => 0.5), nstep=1300, charge_exchange_frequency=2*π*0.0) run_test(test_input_finite_difference_split_1_moment, 2*π*0.0, -2*π*0.2727, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; - composition = Dict{String,Any}("T_e" => 0.5), + composition = OptionsDict("T_e" => 0.5), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 run_test(test_input_finite_difference_split_1_moment, 2*π*1.9919, -2*π*0.2491, [-2.7764623921048157, -2.776390813125241, -2.7763039187734666, -2.7762020599277726, -2.7760856478638214, -2.775955152580435]; - composition = Dict{String,Any}("T_e" => 4.0)) + composition = OptionsDict("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -389,45 +390,45 @@ function run_test_set_finite_difference_split_2_moments() run_test(test_input_finite_difference_split_2_moments, 2*π*1.4467, -2*π*0.6020, [-0.0010684224665919893, -0.0010505277216983934, -0.0010288041337547594, -0.0010033394223312585, -0.0009742364063434105, -0.0009416125854969064]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001)) run_test(test_input_finite_difference_split_2_moments, 2*π*1.4467, -2*π*0.6020, [-0.0010684224665919893, -0.0010505277216983934, -0.0010288041337547594, -0.0010033394223312585, -0.0009742364063434105, -0.0009416125854969064]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001), charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999)) run_test(test_input_finite_difference_split_2_moments, 2*π*0.0, -2*π*0.5112, [-9.211308789442441, -9.211290894697548, -9.211269171109604, -9.21124370639818, -9.211214603382192, -9.211181979561346]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 run_test(test_input_finite_difference_split_2_moments, 2*π*1.2671, -2*π*0.8033, [-0.34706673733456106, -0.3470627566790802, -0.3470579059173919, -0.347052193699157, -0.34704563020982493, -0.3470382271523149], 30; - composition = Dict{String,Any}("T_e" => 0.5), + composition = OptionsDict("T_e" => 0.5), nstep=1300, z_ngrid=150, charge_exchange_frequency=2*π*0.0) run_test(test_input_finite_difference_split_2_moments, 2*π*0.0, -2*π*0.2727, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; - composition = Dict{String,Any}("T_e" => 0.5), + composition = OptionsDict("T_e" => 0.5), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 run_test(test_input_finite_difference_split_2_moments, 2*π*1.9919, -2*π*0.2491, [-2.7764623921048157, -2.776390813125241, -2.7763039187734666, -2.7762020599277726, -2.7760856478638214, -2.775955152580435]; - composition = Dict{String,Any}("T_e" => 4.0)) + composition = OptionsDict("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -455,14 +456,14 @@ function run_test_set_finite_difference_split_3_moments() -2*π*0.6020, [-0.0010684224665919893, -0.0010505277216983934, -0.0010288041337547594, -0.0010033394223312585, -0.0009742364063434105, -0.0009416125854969064]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001)) @long run_test(test_input_finite_difference_split_3_moments, 2*π*1.4467, -2*π*0.6020, [-0.0010684224665919893, -0.0010505277216983934, -0.0010288041337547594, -0.0010033394223312585, -0.0009742364063434105, -0.0009416125854969064]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001), charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999)) @long run_test(test_input_finite_difference_split_3_moments, 2*π*0.0, -2*π*0.5112, [-9.211308789442441, -9.211290894697548, -9.211269171109604, -9.21124370639818, -9.211214603382192, -9.211181979561346]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 @@ -484,12 +485,12 @@ function run_test_set_finite_difference_split_3_moments() -2*π*0.8033, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544], 30; - composition = Dict{String,Any}("T_e" => 0.5), + composition = OptionsDict("T_e" => 0.5), nstep=1300, charge_exchange_frequency=2*π*0.0) @long run_test(test_input_finite_difference_split_3_moments, 2*π*0.0, -2*π*0.2727, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; - composition = Dict{String,Any}("T_e" => 0.5), + composition = OptionsDict("T_e" => 0.5), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 @@ -497,7 +498,7 @@ function run_test_set_finite_difference_split_3_moments() -2*π*0.2491, [-2.7764623921048157, -2.776390813125241, -2.7763039187734666, -2.7762020599277726, -2.7760856478638214, -2.775955152580435]; - composition = Dict{String,Any}("T_e" => 4.0)) + composition = OptionsDict("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -523,45 +524,45 @@ function run_test_set_chebyshev() @long run_test(test_input_chebyshev, 2*π*1.4467, -2*π*0.6020, [-0.00010000500033334732, 0.0004653997510461739, 0.0007956127502558478, 0.0008923624901804128, 0.0008994953327500175, 0.0008923624901804128]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001)) @long run_test(test_input_chebyshev, 2*π*1.4467, -2*π*0.6020, [-0.00010000500033334732, 0.0004653997510461739, 0.0007956127502558478, 0.0008923624901804128, 0.0008994953327500175, 0.0008923624901804128]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001), charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999)) @long run_test(test_input_chebyshev, 2*π*0.0, -2*π*0.5112, [-9.210340371976182, -9.209774967224805, -9.209444754225593, -9.209348004485669, -9.2093408716431, -9.209348004485669]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 @long run_test(test_input_chebyshev, 2*π*1.2671, -2*π*0.8033, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614], - 30; composition = Dict{String,Any}("T_e" => 0.5), + 30; composition = OptionsDict("T_e" => 0.5), nstep=1300, charge_exchange_frequency=2*π*0.0) @long run_test(test_input_chebyshev, 2*π*0.0, -2*π*0.2727, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614]; - composition = Dict{String,Any}("T_e" => 0.5), + composition = OptionsDict("T_e" => 0.5), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 @long run_test(test_input_chebyshev, 2*π*1.9919, -2*π*0.2491, [-2.772588722239781, -2.770327103234265, -2.769006251237427, -2.768619252277729, -2.7685907209074476, -2.768619252277729]; - composition = Dict{String,Any}("T_e" => 4.0)) + composition = OptionsDict("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -588,46 +589,46 @@ function run_test_set_chebyshev_split_1_moment() [-0.00010000500033334732, 0.00046539975104573, 0.0007956127502551822, 0.0008923624901797472, 0.0008994953327500175, 0.0008923624901797472]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001)) @long run_test(test_input_chebyshev_split_1_moment, 2*π*1.4467, -2*π*0.6020, [-0.00010000500033334732, 0.00046539975104573, 0.0007956127502551822, 0.0008923624901797472, 0.0008994953327500175, 0.0008923624901797472]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001), charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999)) @long run_test(test_input_chebyshev_split_1_moment, 2*π*0.0, -2*π*0.5112, [-9.210340371976182, -9.209774967224805, -9.209444754225593, -9.209348004485669, -9.2093408716431, -9.209348004485669]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 @long run_test(test_input_chebyshev_split_1_moment, 2*π*1.2671, -2*π*0.8033, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614], - 30; composition = Dict{String,Any}("T_e" => 0.5), + 30; composition = OptionsDict("T_e" => 0.5), nstep=1300, charge_exchange_frequency=2*π*0.0) @long run_test(test_input_chebyshev_split_1_moment, 2*π*0.0, -2*π*0.2727, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614]; - composition = Dict{String,Any}("T_e" => 0.5), + composition = OptionsDict("T_e" => 0.5), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 @long run_test(test_input_chebyshev_split_1_moment, 2*π*1.9919, -2*π*0.2491, [-2.772588722239781, -2.770327103234265, -2.769006251237427, -2.768619252277729, -2.7685907209074476, -2.768619252277729]; - composition = Dict{String,Any}("T_e" => 4.0)) + composition = OptionsDict("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -654,47 +655,47 @@ function run_test_set_chebyshev_split_2_moments() [-0.00010000500033334732, 0.00046539975104573, 0.0007956127502551822, 0.0008923624901797472, 0.0008994953327500175, 0.0008923624901797472]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001)) @long run_test(test_input_chebyshev_split_2_moments, 2*π*1.4467, -2*π*0.6020, [-0.00010000500033334732, 0.00046539975104573, 0.0007956127502551822, 0.0008923624901797472, 0.0008994953327500175, 0.0008923624901797472]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001), charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999)) @long run_test(test_input_chebyshev_split_2_moments, 2*π*0.0, -2*π*0.5112, [-9.210340371976182, -9.209774967224805, -9.209444754225593, -9.209348004485669, -9.2093408716431, -9.209348004485669]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 @long run_test(test_input_chebyshev_split_2_moments, 2*π*1.2671, -2*π*0.8033, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614], - 40; composition = Dict{String,Any}("T_e" => 0.5), + 40; composition = OptionsDict("T_e" => 0.5), nstep=1300, nwrite=10, charge_exchange_frequency=2*π*0.0) @long run_test(test_input_chebyshev_split_2_moments, 2*π*0.0, -2*π*0.2727, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614]; - composition = Dict{String,Any}("T_e" => 0.5), + composition = OptionsDict("T_e" => 0.5), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 @long run_test(test_input_chebyshev_split_2_moments, 2*π*1.9919, -2*π*0.2491, [-2.772588722239781, -2.770327103234265, -2.769006251237427, -2.768619252277729, -2.7685907209074476, -2.768619252277729]; - composition = Dict{String,Any}("T_e" => 4.0)) + composition = OptionsDict("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end @@ -721,46 +722,46 @@ function run_test_set_chebyshev_split_3_moments() [-0.00010000500033334732, 0.00046539975104573, 0.0007956127502551822, 0.0008923624901797472, 0.0008994953327500175, 0.0008923624901797472]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001)) + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001)) @long run_test(test_input_chebyshev_split_3_moments, 2*π*1.4467, -2*π*0.6020, [-0.00010000500033334732, 0.00046539975104573, 0.0007956127502551822, 0.0008923624901797472, 0.0008994953327500175, 0.0008923624901797472]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.9999), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.0001), + ion_species_1 = OptionsDict("initial_density" => 0.9999), + neutral_species_1 = OptionsDict("initial_density" => 0.0001), charge_exchange_frequency=2*π*2.0) # n_i< 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999)) + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999)) @long run_test(test_input_chebyshev_split_3_moments, 2*π*0.0, -2*π*0.5112, [-9.210340371976182, -9.209774967224805, -9.209444754225593, -9.209348004485669, -9.2093408716431, -9.209348004485669]; - ion_species_1 = Dict{String,Any}("initial_density" => 0.0001), - neutral_species_1 = Dict{String,Any}("initial_density" => 0.9999), + ion_species_1 = OptionsDict("initial_density" => 0.0001), + neutral_species_1 = OptionsDict("initial_density" => 0.9999), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=0.5 @long run_test(test_input_chebyshev_split_3_moments, 2*π*1.2671, -2*π*0.8033, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614], - 80; composition = Dict{String,Any}("T_e" => 0.5), + 80; composition = OptionsDict("T_e" => 0.5), nstep=1300, nwrite=5, charge_exchange_frequency=2*π*0.0) @long run_test(test_input_chebyshev_split_3_moments, 2*π*0.0, -2*π*0.2727, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614]; - composition = Dict{String,Any}("T_e" => 0.5), + composition = OptionsDict("T_e" => 0.5), charge_exchange_frequency=2*π*2.0) # n_i=n_n T_e=4 @long run_test(test_input_chebyshev_split_3_moments, 2*π*1.9919, -2*π*0.2491, [-2.772588722239781, -2.770327103234265, -2.769006251237427, -2.768619252277729, -2.7685907209074476, -2.768619252277729]; - composition = Dict{String,Any}("T_e" => 4.0)) + composition = OptionsDict("T_e" => 4.0)) # CX=2*π*2.0 case with T_e=4 is too hard to converge, so skip end diff --git a/moment_kinetics/test/wall_bc_tests.jl b/moment_kinetics/test/wall_bc_tests.jl index fea852b89..ccb03adbe 100644 --- a/moment_kinetics/test/wall_bc_tests.jl +++ b/moment_kinetics/test/wall_bc_tests.jl @@ -15,39 +15,40 @@ using moment_kinetics.load_data: open_readonly_output_file using moment_kinetics.load_data: load_fields_data, load_pdf_data, load_time_data, load_species_data +using moment_kinetics.type_definitions: OptionsDict # default inputs for tests -test_input_finite_difference = Dict("composition" => Dict{String,Any}("n_ion_species" => 1, +test_input_finite_difference = Dict("composition" => OptionsDict("n_ion_species" => 1, "n_neutral_species" => 1, "electron_physics" => "boltzmann_electron_response", "T_e" => 1.0, "T_wall" => 1.0), - "ion_species_1" => Dict{String,Any}("initial_density" => 1.0, + "ion_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), - "z_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "z_IC_ion_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 0.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "vpa_IC_ion_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "vpa_IC_ion_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 1.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "neutral_species_1" => Dict{String,Any}("initial_density" => 1.0, + "neutral_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), - "z_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "z_IC_neutral_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 0.001, "density_phase" => 0.0, "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "vpa_IC_neutral_species_1" => Dict{String,Any}("initialization_option" => "gaussian", + "vpa_IC_neutral_species_1" => OptionsDict("initialization_option" => "gaussian", "density_amplitude" => 1.0, "density_phase" => 0.0, "upar_amplitude" => 0.0, @@ -62,7 +63,7 @@ test_input_finite_difference = Dict("composition" => Dict{String,Any}("n_ion_spe "charge_exchange_frequency" => 2.0, "ionization_frequency" => 2.0, "constant_ionization_rate" => false, - "timestepping" => Dict{String,Any}("nstep" => 10000, + "timestepping" => OptionsDict("nstep" => 10000, "dt" => 1.0e-5, "nwrite" => 100, "split_operators" => false), From 5db7ba08f34bdc179a838b51857e094cff0cb41c Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Fri, 9 Aug 2024 19:54:50 +0100 Subject: [PATCH 35/46] Modify collision struct setup functions to only take scan_input as an argument to prevent inconsistent supply of reference parameters, and to reduce duplicate code if these structs are included in mms tests or diagnostics. --- moment_kinetics/src/fokker_planck.jl | 4 +++- moment_kinetics/src/krook_collisions.jl | 4 +++- moment_kinetics/src/maxwell_diffusion.jl | 7 ++++--- moment_kinetics/src/moment_kinetics_input.jl | 6 +++--- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/moment_kinetics/src/fokker_planck.jl b/moment_kinetics/src/fokker_planck.jl index fb9c6ef19..2365ce0c4 100644 --- a/moment_kinetics/src/fokker_planck.jl +++ b/moment_kinetics/src/fokker_planck.jl @@ -70,6 +70,7 @@ using ..fokker_planck_calculus: calculate_rosenbluth_potentials_via_elliptic_sol using ..fokker_planck_test: Cssp_fully_expanded_form, calculate_collisional_fluxes, H_Maxwellian, dGdvperp_Maxwellian using ..fokker_planck_test: d2Gdvpa2_Maxwellian, d2Gdvperpdvpa_Maxwellian, d2Gdvperp2_Maxwellian, dHdvpa_Maxwellian, dHdvperp_Maxwellian using ..fokker_planck_test: F_Maxwellian, dFdvpa_Maxwellian, dFdvperp_Maxwellian +using ..reference_parameters: setup_reference_parameters """ Function for reading Fokker Planck collision operator input parameters. @@ -80,7 +81,8 @@ use_fokker_planck = true nuii = 1.0 frequency_option = "manual" """ -function setup_fkpl_collisions_input(toml_input::Dict, reference_params) +function setup_fkpl_collisions_input(toml_input::Dict) + reference_params = setup_reference_parameters(toml_input) # get reference collision frequency (note factor of 1/2 due to definition choices) nuii_fkpl_default = 0.5*get_reference_collision_frequency_ii(reference_params) # read the input toml and specify a sensible default diff --git a/moment_kinetics/src/krook_collisions.jl b/moment_kinetics/src/krook_collisions.jl index 1880610e9..c05d0cd08 100644 --- a/moment_kinetics/src/krook_collisions.jl +++ b/moment_kinetics/src/krook_collisions.jl @@ -10,6 +10,7 @@ using ..input_structs: krook_collisions_input, set_defaults_and_check_section! using ..reference_parameters: get_reference_collision_frequency_ii, get_reference_collision_frequency_ee, get_reference_collision_frequency_ei +using ..reference_parameters: setup_reference_parameters """ @@ -21,7 +22,8 @@ use_krook = true nuii0 = 1.0 frequency_option = "manual" """ -function setup_krook_collisions_input(toml_input::Dict, reference_params) +function setup_krook_collisions_input(toml_input::Dict) + reference_params = setup_reference_parameters(toml_input) # get reference collision frequency nuii_krook_default = get_reference_collision_frequency_ii(reference_params) nuee_krook_default = get_reference_collision_frequency_ee(reference_params) diff --git a/moment_kinetics/src/maxwell_diffusion.jl b/moment_kinetics/src/maxwell_diffusion.jl index 03b4daa96..124e43176 100644 --- a/moment_kinetics/src/maxwell_diffusion.jl +++ b/moment_kinetics/src/maxwell_diffusion.jl @@ -18,7 +18,7 @@ export setup_mxwl_diff_collisions_input, ion_vpa_maxwell_diffusion!, neutral_vz_ using ..looping using ..input_structs: mxwl_diff_collisions_input, set_defaults_and_check_section! using ..calculus: second_derivative! -using ..reference_parameters: get_reference_collision_frequency_ii +using ..reference_parameters: get_reference_collision_frequency_ii, setup_reference_parameters """ Function for reading Maxwell diffusion operator input parameters. @@ -29,7 +29,8 @@ use_maxwell_diffusion = true D_ii = 1.0 diffusion_coefficient_option = "manual" """ -function setup_mxwl_diff_collisions_input(toml_input::Dict, reference_params) +function setup_mxwl_diff_collisions_input(toml_input::Dict) + reference_params = setup_reference_parameters(toml_input) # get reference diffusion coefficient, made up of collision frequency and # thermal speed for now. NOTE THAT THIS CONSTANT PRODUCES ERRORS. DO NOT USE D_ii_mxwl_diff_default = get_reference_collision_frequency_ii(reference_params)# * @@ -256,4 +257,4 @@ function neutral_vz_maxwell_diffusion!(f_out, f_in, moments, vzeta, vr, vz, spec return nothing end -end # maxwell_diffusion \ No newline at end of file +end # maxwell_diffusion diff --git a/moment_kinetics/src/moment_kinetics_input.jl b/moment_kinetics/src/moment_kinetics_input.jl index f4efcff2e..ae4aa258a 100644 --- a/moment_kinetics/src/moment_kinetics_input.jl +++ b/moment_kinetics/src/moment_kinetics_input.jl @@ -97,11 +97,11 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) ionization_energy = get(scan_input, "ionization_energy", 0.0) nu_ei = get(scan_input, "nu_ei", 0.0) # set up krook collision inputs - krook_input = setup_krook_collisions_input(scan_input, reference_params) + krook_input = setup_krook_collisions_input(scan_input) # set up Fokker-Planck collision inputs - fkpl_input = setup_fkpl_collisions_input(scan_input, reference_params) + fkpl_input = setup_fkpl_collisions_input(scan_input) # set up maxwell diffusion collision inputs - mxwl_diff_input = setup_mxwl_diff_collisions_input(scan_input, reference_params) + mxwl_diff_input = setup_mxwl_diff_collisions_input(scan_input) # write total collision struct using the structs above, as each setup function # for the collisions outputs itself a struct of the type of collision, which # is a substruct of the overall collisions_input struct. From be6cfb4601f6084a323691feff9b22752cf22b78 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Sun, 11 Aug 2024 20:48:01 +0100 Subject: [PATCH 36/46] Update precompile files to reflect refactor of composition inputs. --- util/precompile_makie_plots.jl | 4 ++-- util/precompile_plots_plots.jl | 4 ++-- util/precompile_run.jl | 22 +++++++++++----------- util/precompile_run_kinetic-electrons.jl | 6 +++--- util/precompile_run_long.jl | 6 +++--- util/precompile_run_long_debug1.jl | 6 +++--- util/precompile_run_short.jl | 3 ++- 7 files changed, 26 insertions(+), 25 deletions(-) diff --git a/util/precompile_makie_plots.jl b/util/precompile_makie_plots.jl index 80a0dcb1e..132556e93 100644 --- a/util/precompile_makie_plots.jl +++ b/util/precompile_makie_plots.jl @@ -1,4 +1,5 @@ using moment_kinetics +using moment_kinetics.type_definitions: OptionsDict using makie_post_processing # Create a temporary directory for test output @@ -8,7 +9,6 @@ mkpath(test_output_directory) input_dict = Dict("run_name"=>run_name, "base_directory" => test_output_directory, - "dt" => 0.0, "r_ngrid" => 5, "r_nelement" => 1, "r_bc" => "periodic", @@ -42,7 +42,7 @@ input_dict = Dict("run_name"=>run_name, "vz_bc" => "periodic", "vz_L" => 4.0, "vz_discretization" => "chebyshev_pseudospectral", - "timestepping" => Dict{String,Any}("nstep" => 1)) + "timestepping" => OptionsDict("nstep" => 1, "dt" => 2.0e-11)) run_moment_kinetics(input_dict) diff --git a/util/precompile_plots_plots.jl b/util/precompile_plots_plots.jl index a67d85103..e299919fc 100644 --- a/util/precompile_plots_plots.jl +++ b/util/precompile_plots_plots.jl @@ -1,4 +1,5 @@ using moment_kinetics +using moment_kinetics.type_definitions: OptionsDict using plots_post_processing # Create a temporary directory for test output @@ -8,7 +9,6 @@ mkpath(test_output_directory) input_dict = Dict("run_name"=>run_name, "base_directory" => test_output_directory, - "dt" => 0.0, "r_ngrid" => 5, "r_nelement" => 1, "r_bc" => "periodic", @@ -42,7 +42,7 @@ input_dict = Dict("run_name"=>run_name, "vz_bc" => "periodic", "vz_L" => 4.0, "vz_discretization" => "chebyshev_pseudospectral", - "timestepping" => Dict{String,Any}("nstep" => 1)) + "timestepping" => OptionsDict("nstep" => 1, "dt" => 2.0e-11)) run_moment_kinetics(input_dict) diff --git a/util/precompile_run.jl b/util/precompile_run.jl index d4e16965e..1ce0a69d1 100644 --- a/util/precompile_run.jl +++ b/util/precompile_run.jl @@ -3,6 +3,7 @@ using Pkg Pkg.activate(".") using moment_kinetics +using moment_kinetics.type_definitions: OptionsDict # Create a temporary directory for test output test_output_directory = tempname() @@ -10,7 +11,6 @@ mkpath(test_output_directory) base_input = Dict("run_name" => "precompilation", "base_directory" => test_output_directory, - "dt" => 0.0, "r_ngrid" => 5, "r_nelement" => 3, "r_bc" => "periodic", @@ -44,7 +44,7 @@ base_input = Dict("run_name" => "precompilation", "vz_bc" => "zero", "vz_L" => 8.0, "vz_discretization" => "finite_difference", - "timestepping" => Dict{String,Any}("nstep" => 1)) + "timestepping" => OptionsDict("nstep" => 1, "dt" => 2.0e-11)) cheb_input = merge(base_input, Dict("r_discretization" => "chebyshev_pseudospectral", "z_discretization" => "chebyshev_pseudospectral", "vperp_discretization" => "chebyshev_pseudospectral", @@ -66,22 +66,22 @@ for input ∈ [base_input, cheb_input, wall_bc_input, wall_bc_cheb_input] push!(inputs_list, x) end -collisions_input1 = merge(wall_bc_cheb_input, Dict("n_neutral_species" => 0, - "krook_collisions" => Dict{String,Any}("use_krook" => true), - "fokker_planck_collisions" => Dict{String,Any}("use_fokker_planck" => true, "self_collisions" => true, "slowing_down_test" => true), +collisions_input1 = merge(wall_bc_cheb_input, Dict( "composition" => OptionsDict("n_neutral_species" => 0), + "krook_collisions" => OptionsDict("use_krook" => true), + "fokker_planck_collisions" => OptionsDict("use_fokker_planck" => true, "self_collisions" => true, "slowing_down_test" => true), "vperp_discretization" => "gausslegendre_pseudospectral", "vpa_discretization" => "gausslegendre_pseudospectral", )) -collisions_input2 = merge(wall_bc_cheb_input, Dict("n_neutral_species" => 0, - "krook_collisions" => Dict{String,Any}("use_krook" => true), - "fokker_planck_collisions" => Dict{String,Any}("use_fokker_planck" => true, "self_collisions" => true, "slowing_down_test" => true), +collisions_input2 = merge(wall_bc_cheb_input, Dict("composition" => OptionsDict("n_neutral_species" => 0), + "krook_collisions" => OptionsDict("use_krook" => true), + "fokker_planck_collisions" => OptionsDict("use_fokker_planck" => true, "self_collisions" => true, "slowing_down_test" => true), "vperp_discretization" => "gausslegendre_pseudospectral", "vpa_discretization" => "gausslegendre_pseudospectral", "vperp_bc" => "zero-impose-regularity", )) # add an additional input for every geometry option available in addition to the default -geo_input1 = merge(wall_bc_cheb_input, Dict("n_neutral_species" => 0, - "geometry" => Dict{String,Any}("option" => "1D-mirror", "DeltaB" => 0.5, "pitch" => 0.5, "rhostar" => 1.0))) +geo_input1 = merge(wall_bc_cheb_input, Dict("composition" => OptionsDict("n_neutral_species" => 0), + "geometry" => OptionsDict("option" => "1D-mirror", "DeltaB" => 0.5, "pitch" => 0.5, "rhostar" => 1.0))) kinetic_electron_input = merge(cheb_input, Dict("evolve_moments_density" => true, "evolve_moments_parallel_flow" => true, @@ -95,7 +95,7 @@ kinetic_electron_input = merge(cheb_input, Dict("evolve_moments_density" => true "vr_ngrid" => 1, "vr_nelement" => 1, "electron_physics" => "kinetic_electrons", - "electron_timestepping" => Dict{String,Any}("nstep" => 1, + "electron_timestepping" => OptionsDict("nstep" => 1, "dt" => 2.0e-11, "initialization_residual_value" => 1.0e10, "converged_residual_value" => 1.0e10, diff --git a/util/precompile_run_kinetic-electrons.jl b/util/precompile_run_kinetic-electrons.jl index b605fcf16..158375036 100644 --- a/util/precompile_run_kinetic-electrons.jl +++ b/util/precompile_run_kinetic-electrons.jl @@ -3,6 +3,7 @@ using Pkg Pkg.activate(".") using moment_kinetics +using moment_kinetics.type_definitions: OptionsDict # Create a temporary directory for test output test_output_directory = tempname() @@ -10,7 +11,6 @@ mkpath(test_output_directory) input = Dict("run_name" => "precompilation", "base_directory" => test_output_directory, - "dt" => 0.0, "evolve_moments_density" => true, "evolve_moments_parallel_flow" => true, "evolve_moments_parallel_pressure" => true, @@ -48,9 +48,9 @@ input = Dict("run_name" => "precompilation", "vz_bc" => "zero", "vz_L" => 8.0, "vz_discretization" => "chebyshev_pseudospectral", - "timestepping" => Dict{String,Any}("nstep" => 1, + "timestepping" => OptionsDict("nstep" => 1, "dt" => 2.0e-11), - "electron_timestepping" => Dict{String,Any}("nstep" => 1, + "electron_timestepping" => OptionsDict("nstep" => 1, "dt" => 2.0e-11, "initialization_residual_value" => 1.0e10, "converged_residual_value" => 1.0e10, diff --git a/util/precompile_run_long.jl b/util/precompile_run_long.jl index fb80de9d6..441935757 100644 --- a/util/precompile_run_long.jl +++ b/util/precompile_run_long.jl @@ -6,6 +6,7 @@ using Pkg Pkg.activate(".") using moment_kinetics +using moment_kinetics.type_definitions: OptionsDict # Create a temporary directory for test output test_output_directory = tempname() @@ -13,7 +14,6 @@ mkpath(test_output_directory) base_input = Dict("run_name"=>"precompilation", "base_directory" => test_output_directory, - "dt" => 0.0, "z_ngrid" => 5, "z_nelement" => 1, "z_bc" => "periodic", @@ -22,13 +22,13 @@ base_input = Dict("run_name"=>"precompilation", "vpa_nelement" => 1, "vpa_bc" => "periodic", "vpa_discretization" => "finite_difference", - "timestepping" => Dict{String,Any}("nstep" => 1)) + "timestepping" => OptionsDict("nstep" => 1, "dt" => 2.0e-11)) cheb_input = merge(base_input, Dict("z_discretization" => "chebyshev_pseudospectral", "vpa_discretization" => "chebyshev_pseudospectral")) wall_bc_input = merge(base_input, Dict("z_bc" => "wall")) wall_bc_cheb_input = merge(cheb_input, Dict("z_bc" => "wall")) -inputs_list = Vector{Dict{String, Any}}(undef, 0) +inputs_list = Vector{OptionsDict}(undef, 0) for input ∈ [base_input, cheb_input, wall_bc_input, wall_bc_cheb_input] push!(inputs_list, input) x = merge(input, Dict("evolve_moments_density" => true, "ionization_frequency" => 0.0)) diff --git a/util/precompile_run_long_debug1.jl b/util/precompile_run_long_debug1.jl index 3340e140a..dbc009bfa 100644 --- a/util/precompile_run_long_debug1.jl +++ b/util/precompile_run_long_debug1.jl @@ -6,6 +6,7 @@ using Pkg Pkg.activate(".") using moment_kinetics +using moment_kinetics.type_definitions: OptionsDict # Create a temporary directory for test output test_output_directory = tempname() @@ -13,7 +14,6 @@ mkpath(test_output_directory) base_input = Dict("run_name"=>"precompilation", "base_directory" => test_output_directory, - "dt" => 0.0, "z_ngrid" => 5, "z_nelement" => 1, "z_bc" => "periodic", @@ -22,13 +22,13 @@ base_input = Dict("run_name"=>"precompilation", "vpa_nelement" => 1, "vpa_bc" => "periodic", "vpa_discretization" => "finite_difference", - "timestepping" => Dict{String,Any}("nstep" => 1)) + "timestepping" => OptionsDict("nstep" => 1, "dt" => 2.0e-11)) cheb_input = merge(base_input, Dict("z_discretization" => "chebyshev_pseudospectral", "vpa_discretization" => "chebyshev_pseudospectral")) wall_bc_input = merge(base_input, Dict("z_bc" => "wall")) wall_bc_cheb_input = merge(cheb_input, Dict("z_bc" => "wall")) -inputs_list = Vector{Dict{String, Any}}(undef, 0) +inputs_list = Vector{OptionsDict}(undef, 0) for input ∈ [base_input, cheb_input, wall_bc_input, wall_bc_cheb_input] push!(inputs_list, input) x = merge(input, Dict("evolve_moments_density" => true, "ionization_frequency" => 0.0)) diff --git a/util/precompile_run_short.jl b/util/precompile_run_short.jl index fb2ac5109..458cf803f 100644 --- a/util/precompile_run_short.jl +++ b/util/precompile_run_short.jl @@ -3,6 +3,7 @@ using Pkg Pkg.activate(".") using moment_kinetics +using moment_kinetics.type_definitions: OptionsDict # Create a temporary directory for test output test_output_directory = tempname() @@ -10,7 +11,7 @@ mkpath(test_output_directory) input_dict = Dict("run_name"=>"precompilation", "base_directory" => test_output_directory, - "timestepping" => Dict{String,Any}("nstep" => 1)) + "timestepping" => OptionsDict("nstep" => 1, "dt" => 2.0e-11)) to = TimerOutput() run_moment_kinetics(to, input_dict) From 22f843560e3a6a4aea318b79d6a11cd7b991fd6f Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Mon, 12 Aug 2024 09:08:59 +0100 Subject: [PATCH 37/46] Correct typo. --- examples/recycling-fraction/wall-bc_recyclefraction0.5.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/recycling-fraction/wall-bc_recyclefraction0.5.toml b/examples/recycling-fraction/wall-bc_recyclefraction0.5.toml index 2eacd74ad..556877c95 100644 --- a/examples/recycling-fraction/wall-bc_recyclefraction0.5.toml +++ b/examples/recycling-fraction/wall-bc_recyclefraction0.5.toml @@ -36,7 +36,7 @@ initial_density = 1.0 initial_temperature = 1.0 [z_IC_ion_species_1] -intialization_option = "gaussian" +initialization_option = "gaussian" density_amplitude = 0.001 density_phase = 0.0 upar_amplitude = 1.0 From 40569786764c31f0b61934b534fda7fa45f198fc Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Mon, 12 Aug 2024 10:02:03 +0100 Subject: [PATCH 38/46] Update kinetic electron examples are remove presumed outdated examples using old boltzmann electron logical flag. --- .../periodic_split3_boltzmann.toml | 90 +++++++++-------- .../periodic_split3_braginskii-IMEX.toml | 88 +++++++++-------- .../periodic_split3_braginskii.toml | 88 +++++++++-------- .../periodic_split3_kinetic-IMEX.toml | 88 +++++++++-------- .../periodic_split3_kinetic.toml | 88 +++++++++-------- ...ic_split3_kinetic_high-collisionality.toml | 88 +++++++++-------- .../wall+sheath-bc_boltzmann_loworder.toml | 89 +++++++++-------- .../wall+sheath-bc_kinetic.toml | 89 +++++++++-------- ...wall+sheath-bc_kinetic_krook_loworder.toml | 89 +++++++++-------- .../wall+sheath-bc_kinetic_loworder.toml | 89 +++++++++-------- ...fraction0.5_split3_boltzmann-vpadiss0.toml | 97 ------------------- ...c_recyclefraction0.5_split3_boltzmann.toml | 97 ------------------- ...on0.5_split3_braginskii-vpadiss0-IMEX.toml | 90 +++++++++-------- ...lefraction0.5_split3_kinetic-vpadiss0.toml | 90 +++++++++-------- ...l-bc_recyclefraction0.5_split3_SSPRK4.toml | 2 +- 15 files changed, 611 insertions(+), 651 deletions(-) delete mode 100644 examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_boltzmann-vpadiss0.toml delete mode 100644 examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_boltzmann.toml diff --git a/examples/kinetic-electrons/periodic_split3_boltzmann.toml b/examples/kinetic-electrons/periodic_split3_boltzmann.toml index 27a3eff33..5ad042d4b 100644 --- a/examples/kinetic-electrons/periodic_split3_boltzmann.toml +++ b/examples/kinetic-electrons/periodic_split3_boltzmann.toml @@ -1,46 +1,8 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -electron_physics = "boltzmann_electron_response" evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.1 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.1 -z_IC_temperature_phase1 = 1.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.0 constant_ionization_rate = false @@ -63,6 +25,58 @@ vz_L = 12.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +recycling_fraction = 0.5 +T_e = 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.1 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.1 +temperature_phase = 1.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] type = "Fekete4(3)" nstep = 1000000 diff --git a/examples/kinetic-electrons/periodic_split3_braginskii-IMEX.toml b/examples/kinetic-electrons/periodic_split3_braginskii-IMEX.toml index 4dfe44807..f359c859d 100644 --- a/examples/kinetic-electrons/periodic_split3_braginskii-IMEX.toml +++ b/examples/kinetic-electrons/periodic_split3_braginskii-IMEX.toml @@ -1,46 +1,8 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -electron_physics = "braginskii_fluid" evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.1 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.1 -z_IC_temperature_phase1 = 1.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.0 constant_ionization_rate = false @@ -63,6 +25,56 @@ vz_L = 12.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "braginskii_fluid" +recycling_fraction = 0.5 +T_e = 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.1 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.1 +temperature_phase = 1.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 + [timestepping] type = "KennedyCarpenterARK324" implicit_ion_advance = false diff --git a/examples/kinetic-electrons/periodic_split3_braginskii.toml b/examples/kinetic-electrons/periodic_split3_braginskii.toml index 31741e462..6f5c8d737 100644 --- a/examples/kinetic-electrons/periodic_split3_braginskii.toml +++ b/examples/kinetic-electrons/periodic_split3_braginskii.toml @@ -1,46 +1,8 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -electron_physics = "braginskii_fluid" evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.1 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.1 -z_IC_temperature_phase1 = 1.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.0 constant_ionization_rate = false @@ -63,6 +25,56 @@ vz_L = 12.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "braginskii_fluid" +recycling_fraction = 0.5 +T_e = 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.1 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.1 +temperature_phase = 1.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 + [timestepping] type = "Fekete4(3)" nstep = 1000000 diff --git a/examples/kinetic-electrons/periodic_split3_kinetic-IMEX.toml b/examples/kinetic-electrons/periodic_split3_kinetic-IMEX.toml index ea91e79fa..e5a02086f 100644 --- a/examples/kinetic-electrons/periodic_split3_kinetic-IMEX.toml +++ b/examples/kinetic-electrons/periodic_split3_kinetic-IMEX.toml @@ -1,46 +1,8 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -electron_physics = "kinetic_electrons" evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.1 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.1 -z_IC_temperature_phase1 = 1.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.0 constant_ionization_rate = false @@ -63,6 +25,56 @@ vz_L = 12.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "kinetic_electrons" +recycling_fraction = 0.5 +T_e = 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.1 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.1 +temperature_phase = 1.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 + [timestepping] type = "KennedyCarpenterARK324" implicit_electron_advance = true diff --git a/examples/kinetic-electrons/periodic_split3_kinetic.toml b/examples/kinetic-electrons/periodic_split3_kinetic.toml index c2c734a78..d4a1140d0 100644 --- a/examples/kinetic-electrons/periodic_split3_kinetic.toml +++ b/examples/kinetic-electrons/periodic_split3_kinetic.toml @@ -1,46 +1,8 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -electron_physics = "kinetic_electrons" evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.1 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.1 -z_IC_temperature_phase1 = 1.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.0 constant_ionization_rate = false @@ -63,6 +25,56 @@ vz_L = 12.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "kinetic_electrons" +recycling_fraction = 0.5 +T_e = 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.1 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.1 +temperature_phase = 1.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 + [timestepping] #type = "KennedyCarpenterARK324" type = "Fekete4(3)" diff --git a/examples/kinetic-electrons/periodic_split3_kinetic_high-collisionality.toml b/examples/kinetic-electrons/periodic_split3_kinetic_high-collisionality.toml index 133d76b16..a0c44f500 100644 --- a/examples/kinetic-electrons/periodic_split3_kinetic_high-collisionality.toml +++ b/examples/kinetic-electrons/periodic_split3_kinetic_high-collisionality.toml @@ -1,46 +1,8 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -electron_physics = "kinetic_electrons" evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "sinusoid" -z_IC_density_amplitude1 = 0.1 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.1 -z_IC_temperature_phase1 = 1.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "sinusoid" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.0 constant_ionization_rate = false @@ -63,6 +25,56 @@ vz_L = 12.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "kinetic_electrons" +recycling_fraction = 0.5 +T_e = 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.1 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.1 +temperature_phase = 1.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "sinusoid" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 + [reference_params] Tref = 20.0 diff --git a/examples/kinetic-electrons/wall+sheath-bc_boltzmann_loworder.toml b/examples/kinetic-electrons/wall+sheath-bc_boltzmann_loworder.toml index 35bb42e02..cb1b24116 100644 --- a/examples/kinetic-electrons/wall+sheath-bc_boltzmann_loworder.toml +++ b/examples/kinetic-electrons/wall+sheath-bc_boltzmann_loworder.toml @@ -1,47 +1,9 @@ steady_state_residual = true converged_residual_value = 1.0e-3 -n_ion_species = 1 -n_neutral_species = 1 -#boltzmann_electron_response = false -#electron_physics = "kinetic_electrons" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 2.0 electron_charge_exchange_frequency = 0.0 nu_ei = 0.0 @@ -71,6 +33,57 @@ vz_L = 12.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "boltzmann_electron_response" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [output] ascii_output = true diff --git a/examples/kinetic-electrons/wall+sheath-bc_kinetic.toml b/examples/kinetic-electrons/wall+sheath-bc_kinetic.toml index a0a928479..8136e86d0 100644 --- a/examples/kinetic-electrons/wall+sheath-bc_kinetic.toml +++ b/examples/kinetic-electrons/wall+sheath-bc_kinetic.toml @@ -1,45 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -#boltzmann_electron_response = false -electron_physics = "kinetic_electrons" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 2.0 electron_charge_exchange_frequency = 0.0 nu_ei = 0.0 @@ -70,6 +32,57 @@ vz_L = 8.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "kinetic_electrons" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [output] ascii_output = true diff --git a/examples/kinetic-electrons/wall+sheath-bc_kinetic_krook_loworder.toml b/examples/kinetic-electrons/wall+sheath-bc_kinetic_krook_loworder.toml index da7a1bf63..f932d0357 100644 --- a/examples/kinetic-electrons/wall+sheath-bc_kinetic_krook_loworder.toml +++ b/examples/kinetic-electrons/wall+sheath-bc_kinetic_krook_loworder.toml @@ -1,45 +1,7 @@ -n_ion_species = 1 -n_neutral_species = 1 -#boltzmann_electron_response = false -electron_physics = "kinetic_electrons" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 2.0 electron_charge_exchange_frequency = 0.0 nu_ei = 0.0 @@ -69,6 +31,57 @@ vz_L = 8.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "kinetic_electrons" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [output] ascii_output = true diff --git a/examples/kinetic-electrons/wall+sheath-bc_kinetic_loworder.toml b/examples/kinetic-electrons/wall+sheath-bc_kinetic_loworder.toml index c1e8a7637..1b8ca705d 100644 --- a/examples/kinetic-electrons/wall+sheath-bc_kinetic_loworder.toml +++ b/examples/kinetic-electrons/wall+sheath-bc_kinetic_loworder.toml @@ -1,47 +1,9 @@ steady_state_residual = true converged_residual_value = 1.0e-3 -n_ion_species = 1 -n_neutral_species = 1 -#boltzmann_electron_response = false -electron_physics = "kinetic_electrons" evolve_moments_density = false evolve_moments_parallel_flow = false evolve_moments_parallel_pressure = false evolve_moments_conservation = false -T_e = 1.0 -T_wall = 1.0 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = 0.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 2.0 electron_charge_exchange_frequency = 0.0 nu_ei = 0.0 @@ -71,6 +33,57 @@ vz_L = 12.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "kinetic_electrons" +T_e = 1.0 +T_wall = 1.0 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [output] #ascii_output = true diff --git a/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_boltzmann-vpadiss0.toml b/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_boltzmann-vpadiss0.toml deleted file mode 100644 index 58998f2f0..000000000 --- a/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_boltzmann-vpadiss0.toml +++ /dev/null @@ -1,97 +0,0 @@ -#runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true -evolve_moments_density = true -evolve_moments_parallel_flow = true -evolve_moments_parallel_pressure = true -evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 0.05 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 1.0 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 -charge_exchange_frequency = 0.75 -ionization_frequency = 0.5 -constant_ionization_rate = false -r_ngrid = 1 -r_nelement = 1 -z_ngrid = 5 -z_nelement = 32 -z_nelement_local = 16 -z_bc = "wall" -z_discretization = "chebyshev_pseudospectral" -z_element_spacing_option = "sqrt" -vpa_ngrid = 6 -vpa_nelement = 63 -vpa_L = 36.0 -vpa_bc = "zero" -vpa_discretization = "chebyshev_pseudospectral" -vz_ngrid = 6 -vz_nelement = 63 -vz_L = 36.0 -vz_bc = "zero" -vz_discretization = "chebyshev_pseudospectral" - -[timestepping] -type = "Fekete4(3)" -#nstep = 50000 -nstep = 3000000 -dt = 1.0e-6 -minimum_dt = 1.0e-6 -nwrite = 10000 -nwrite_dfns = 100000 -steady_state_residual = true -converged_residual_value = 1.0e-3 - -[ion_source] -active = true -z_profile = "gaussian" -z_width = 0.125 -source_strength = 2.0 -source_T = 2.0 - -[ion_numerical_dissipation] -#vpa_dissipation_coefficient = 1.0e-1 -#vpa_dissipation_coefficient = 1.0e-2 -#vpa_dissipation_coefficient = 1.0e-3 -force_minimum_pdf_value = 0.0 - -[neutral_numerical_dissipation] -#vz_dissipation_coefficient = 1.0e-1 -#vz_dissipation_coefficient = 1.0e-2 -#vz_dissipation_coefficient = 1.0e-3 -force_minimum_pdf_value = 0.0 - -[krook_collisions] -use_krook = true diff --git a/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_boltzmann.toml b/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_boltzmann.toml deleted file mode 100644 index 4b36701ae..000000000 --- a/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_boltzmann.toml +++ /dev/null @@ -1,97 +0,0 @@ -#runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -boltzmann_electron_response = true -evolve_moments_density = true -evolve_moments_parallel_flow = true -evolve_moments_parallel_pressure = true -evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 -charge_exchange_frequency = 0.75 -ionization_frequency = 0.5 -constant_ionization_rate = false -r_ngrid = 1 -r_nelement = 1 -z_ngrid = 5 -z_nelement = 32 -z_nelement_local = 16 -z_bc = "wall" -z_discretization = "chebyshev_pseudospectral" -z_element_spacing_option = "sqrt" -vpa_ngrid = 6 -vpa_nelement = 63 -vpa_L = 36.0 -vpa_bc = "zero" -vpa_discretization = "chebyshev_pseudospectral" -vz_ngrid = 6 -vz_nelement = 63 -vz_L = 36.0 -vz_bc = "zero" -vz_discretization = "chebyshev_pseudospectral" - -[timestepping] -type = "Fekete4(3)" -#nstep = 50000 -nstep = 1000000 -dt = 1.0e-6 -minimum_dt = 1.0e-6 -nwrite = 10000 -nwrite_dfns = 100000 -steady_state_residual = true -converged_residual_value = 1.0e-3 - -[ion_source] -active = true -z_profile = "gaussian" -z_width = 0.125 -source_strength = 2.0 -source_T = 2.0 - -[ion_numerical_dissipation] -vpa_dissipation_coefficient = 1.0e-1 -#vpa_dissipation_coefficient = 1.0e-2 -#vpa_dissipation_coefficient = 1.0e-3 -force_minimum_pdf_value = 0.0 - -[neutral_numerical_dissipation] -vz_dissipation_coefficient = 1.0e-1 -#vz_dissipation_coefficient = 1.0e-2 -#vz_dissipation_coefficient = 1.0e-3 -force_minimum_pdf_value = 0.0 - -[krook_collisions] -use_krook = true diff --git a/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_braginskii-vpadiss0-IMEX.toml b/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_braginskii-vpadiss0-IMEX.toml index c9230a33a..d0ab7a225 100644 --- a/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_braginskii-vpadiss0-IMEX.toml +++ b/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_braginskii-vpadiss0-IMEX.toml @@ -1,46 +1,8 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -electron_physics = "braginskii_fluid" evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 1.0 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.5 constant_ionization_rate = false @@ -64,6 +26,58 @@ vz_L = 36.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "braginskii_fluid" +recycling_fraction = 0.5 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] type = "KennedyCarpenterARK324" #type = "KennedyCarpenterARK324-explicit" diff --git a/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_kinetic-vpadiss0.toml b/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_kinetic-vpadiss0.toml index 0a66ed75e..1fb3f2874 100644 --- a/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_kinetic-vpadiss0.toml +++ b/examples/kinetic-electrons/wall-bc_recyclefraction0.5_split3_kinetic-vpadiss0.toml @@ -1,46 +1,8 @@ #runtime_plots = true -n_ion_species = 1 -n_neutral_species = 1 -electron_physics = "kinetic_electrons_with_temperature_equation" evolve_moments_density = true evolve_moments_parallel_flow = true evolve_moments_parallel_pressure = true evolve_moments_conservation = true -recycling_fraction = 0.5 -T_e = 0.2 # 1.0 -T_wall = 0.1 -initial_density1 = 1.0 -initial_temperature1 = 0.1 -z_IC_option1 = "gaussian" -z_IC_density_amplitude1 = 0.001 -z_IC_density_phase1 = 0.0 -z_IC_upar_amplitude1 = 1.0 -z_IC_upar_phase1 = 0.0 -z_IC_temperature_amplitude1 = 0.0 -z_IC_temperature_phase1 = 0.0 -vpa_IC_option1 = "gaussian" -vpa_IC_density_amplitude1 = 1.0 -vpa_IC_density_phase1 = 0.0 -vpa_IC_upar_amplitude1 = 0.0 -vpa_IC_upar_phase1 = 0.0 -vpa_IC_temperature_amplitude1 = 0.0 -vpa_IC_temperature_phase1 = 0.0 -initial_density2 = 1.0 -initial_temperature2 = 1.0 -z_IC_option2 = "gaussian" -z_IC_density_amplitude2 = 0.001 -z_IC_density_phase2 = 0.0 -z_IC_upar_amplitude2 = -1.0 -z_IC_upar_phase2 = 0.0 -z_IC_temperature_amplitude2 = 0.0 -z_IC_temperature_phase2 = 0.0 -vpa_IC_option2 = "gaussian" -vpa_IC_density_amplitude2 = 1.0 -vpa_IC_density_phase2 = 0.0 -vpa_IC_upar_amplitude2 = 0.0 -vpa_IC_upar_phase2 = 0.0 -vpa_IC_temperature_amplitude2 = 0.0 -vpa_IC_temperature_phase2 = 0.0 charge_exchange_frequency = 0.75 ionization_frequency = 0.5 constant_ionization_rate = false @@ -63,6 +25,58 @@ vz_L = 36.0 vz_bc = "zero" vz_discretization = "chebyshev_pseudospectral" +[composition] +n_ion_species = 1 +n_neutral_species = 1 +electron_physics = "kinetic_electrons_with_temperature_equation" +recycling_fraction = 0.5 +T_e = 0.2 # 1.0 +T_wall = 0.1 + +[ion_species_1] +initial_density = 1.0 +initial_temperature = 0.1 + +[z_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = 1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_ion_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[neutral_species_1] +initial_density = 1.0 +initial_temperature = 1.0 + +[z_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 0.001 +density_phase = 0.0 +upar_amplitude = -1.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + +[vpa_IC_neutral_species_1] +initialization_option = "gaussian" +density_amplitude = 1.0 +density_phase = 0.0 +upar_amplitude = 0.0 +upar_phase = 0.0 +temperature_amplitude = 0.0 +temperature_phase = 0.0 + [timestepping] type = "Fekete4(3)" #nstep = 50000 diff --git a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_SSPRK4.toml b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_SSPRK4.toml index 64b87866f..a9e7f5f1b 100644 --- a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_SSPRK4.toml +++ b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_SSPRK4.toml @@ -37,7 +37,7 @@ initial_temperature = 1.0 [z_IC_ion_species_1] initialization_option = "gaussian" -density_amplitude1 = 0.001 +density_amplitude = 0.001 density_phase = 0.0 upar_amplitude = 1.0 upar_phase = 0.0 From 536e5f5e6fd4c67283dee986fa8147a1789c2a7b Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Mon, 12 Aug 2024 10:17:08 +0100 Subject: [PATCH 39/46] Correct typo --- .../wall-bc_recyclefraction0.5_split3_SSPRK4.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_SSPRK4.toml b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_SSPRK4.toml index a9e7f5f1b..bd0fe2676 100644 --- a/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_SSPRK4.toml +++ b/examples/recycling-fraction/wall-bc_recyclefraction0.5_split3_SSPRK4.toml @@ -45,7 +45,7 @@ temperature_amplitude = 0.0 temperature_phase = 0.0 [vpa_IC_ion_species_1] -option = "gaussian" +initialization_option = "gaussian" density_amplitude = 1.0 density_phase = 0.0 upar_amplitude = 0.0 From 67cfd2b79e486e3a76665297504bd34e65992da4 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Mon, 12 Aug 2024 10:22:44 +0100 Subject: [PATCH 40/46] Correct typo --- moment_kinetics/debug_test/kinetic_electron_inputs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/debug_test/kinetic_electron_inputs.jl b/moment_kinetics/debug_test/kinetic_electron_inputs.jl index 02949e10c..cc8c50f3e 100644 --- a/moment_kinetics/debug_test/kinetic_electron_inputs.jl +++ b/moment_kinetics/debug_test/kinetic_electron_inputs.jl @@ -28,7 +28,7 @@ test_input = OptionsDict("composition" => OptionsDict("n_ion_species" => 1, "upar_amplitude" => 0.0, "upar_phase" => 0.0, "temperature_amplitude" => 0.0, - "temperature_phase1" => 0.0), + "temperature_phase" => 0.0), "neutral_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), "z_IC_neutral_species_1" => OptionsDict("initialization_option" => "gaussian", From 13a2bd32884e0dd0797cee1614fbf174f979e36e Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Tue, 13 Aug 2024 12:32:16 +0100 Subject: [PATCH 41/46] Add some checks to detect old input files to provide a warning to the user of the new input structure. --- moment_kinetics/src/moment_kinetics_input.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/moment_kinetics/src/moment_kinetics_input.jl b/moment_kinetics/src/moment_kinetics_input.jl index ae4aa258a..99459663c 100644 --- a/moment_kinetics/src/moment_kinetics_input.jl +++ b/moment_kinetics/src/moment_kinetics_input.jl @@ -53,7 +53,11 @@ function mk_input(scan_input=Dict(); save_inputs_to_txt=false, ignore_MPI=true) # Check for input options that used to exist, but do not any more. If these are # present, the user probably needs to update their input file. - removed_options_list = ("Bzed", "Bmag", "rhostar", "geometry_option", "pitch", "DeltaB") + removed_options_list = ("Bzed", "Bmag", "rhostar", "geometry_option", "pitch", "DeltaB", + "n_ion_species","n_neutral_species","recycling_fraction","gyrokinetic_ions","T_e","T_wall", + "z_IC_option1","z_IC_option2","vpa_IC_option1","vpa_IC_option2", + "boltzmann_electron_response","boltzmann_electron_response_with_simple_sheath", + "electron_physics","nstep","dt") for opt in removed_options_list if opt ∈ keys(scan_input) error("Option '$opt' is no longer used. Please update your input file. You " From 9028b0ef975d5f98adb4662891c7a1d8810c0799 Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Tue, 13 Aug 2024 12:32:43 +0100 Subject: [PATCH 42/46] Catch incorrectly placed "electron_physics" option. --- moment_kinetics/test/fokker_planck_time_evolution_tests.jl | 2 -- util/precompile_run.jl | 2 +- util/precompile_run_kinetic-electrons.jl | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/moment_kinetics/test/fokker_planck_time_evolution_tests.jl b/moment_kinetics/test/fokker_planck_time_evolution_tests.jl index 5a0567091..544a5fafa 100644 --- a/moment_kinetics/test/fokker_planck_time_evolution_tests.jl +++ b/moment_kinetics/test/fokker_planck_time_evolution_tests.jl @@ -249,8 +249,6 @@ test_input_gauss_legendre = Dict("run_name" => "gausslegendre_pseudospectral", "vperp_discretization" => "gausslegendre_pseudospectral", "ionization_frequency" => 0.0, "charge_exchange_frequency" => 0.0, - "constant_ionization_rate" => false, - "electron_physics" => "boltzmann_electron_response", "fokker_planck_collisions" => OptionsDict("use_fokker_planck" => true, "nuii" => 1.0, "frequency_option" => "manual"), "evolve_moments_parallel_pressure" => false, "evolve_moments_conservation" => false, diff --git a/util/precompile_run.jl b/util/precompile_run.jl index 1ce0a69d1..41f6b1d57 100644 --- a/util/precompile_run.jl +++ b/util/precompile_run.jl @@ -94,7 +94,7 @@ kinetic_electron_input = merge(cheb_input, Dict("evolve_moments_density" => true "vzeta_nelement" => 1, "vr_ngrid" => 1, "vr_nelement" => 1, - "electron_physics" => "kinetic_electrons", + "composition" => OptionsDict("electron_physics" => "kinetic_electrons"), "electron_timestepping" => OptionsDict("nstep" => 1, "dt" => 2.0e-11, "initialization_residual_value" => 1.0e10, diff --git a/util/precompile_run_kinetic-electrons.jl b/util/precompile_run_kinetic-electrons.jl index 158375036..212d9f9bf 100644 --- a/util/precompile_run_kinetic-electrons.jl +++ b/util/precompile_run_kinetic-electrons.jl @@ -14,7 +14,7 @@ input = Dict("run_name" => "precompilation", "evolve_moments_density" => true, "evolve_moments_parallel_flow" => true, "evolve_moments_parallel_pressure" => true, - "electron_physics" => "kinetic_electrons", + "composition" => OptionsDict("electron_physics" => "kinetic_electrons"), "r_ngrid" => 1, "r_nelement" => 1, "r_bc" => "periodic", From e95c7c8227b0568b89e89be2e48c56e77912689c Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Tue, 13 Aug 2024 17:10:25 +0100 Subject: [PATCH 43/46] Potential fix of DebugMPISharedArray shape mismatch. --- moment_kinetics/src/communication.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/src/communication.jl b/moment_kinetics/src/communication.jl index be3ed60a3..f8fa46fff 100644 --- a/moment_kinetics/src/communication.jl +++ b/moment_kinetics/src/communication.jl @@ -433,7 +433,7 @@ end previous_is_read .= true previous_is_written = Array{Bool}(undef, dims) previous_is_written .= true - return DebugMPISharedArray(array, is_initialized, is_read, is_written, + return DebugMPISharedArray(array, accessed, is_initialized, is_read, is_written, creation_stack_trace, previous_is_read, previous_is_written) end From bc825f0ebc371a82c46c15d8676a53ad4889b5ae Mon Sep 17 00:00:00 2001 From: Michael Hardman <29800382+mrhardman@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:06:29 +0100 Subject: [PATCH 44/46] Add functions for merging dicts of dicts, both in place and with a return value. Use the return value function to correct the merging of Dicts in the wall_bc_inputs.jl file. Note that the behaviour of merge() on Dicts of Dicts is to replace values of keyword arguements which are themselves Dicts, hence the need for these functions. Presumably these functions could be improved by making them recursive to merge Dicts with arbitrary many levels of Dicts (if no base Julia solution is available). --- moment_kinetics/debug_test/wall_bc_inputs.jl | 17 +++++----- moment_kinetics/src/input_structs.jl | 35 +++++++++++++++++++- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/moment_kinetics/debug_test/wall_bc_inputs.jl b/moment_kinetics/debug_test/wall_bc_inputs.jl index 926d1fb9a..6698d2700 100644 --- a/moment_kinetics/debug_test/wall_bc_inputs.jl +++ b/moment_kinetics/debug_test/wall_bc_inputs.jl @@ -1,5 +1,6 @@ test_type = "Wall boundary conditions" using moment_kinetics.type_definitions: OptionsDict +using moment_kinetics.input_structs: merge_dict_of_dicts # default inputs for tests test_input_finite_difference_1D1V = OptionsDict( @@ -45,10 +46,10 @@ test_input_finite_difference_1D1V = OptionsDict( "vr_ngrid" => 1, "vr_nelement" => 1) -test_input_finite_difference_simple_sheath_1D1V = merge( +test_input_finite_difference_simple_sheath_1D1V = merge_dict_of_dicts( test_input_finite_difference_1D1V, OptionsDict("run_name" => "finite_difference_simple_sheath_1D1V", - "electron_physics" => "boltzmann_electron_response_with_simple_sheath")) + "composition" => OptionsDict("electron_physics" => "boltzmann_electron_response_with_simple_sheath"))) test_input_finite_difference = merge( test_input_finite_difference_1D1V, @@ -69,10 +70,10 @@ test_input_finite_difference = merge( "vzeta_nelement" => 1, "vzeta_discretization" => "finite_difference")) -test_input_finite_difference_simple_sheath = merge( +test_input_finite_difference_simple_sheath = merge_dict_of_dicts( test_input_finite_difference, OptionsDict("run_name" => "finite_difference_simple_sheath", - "electron_physics" => "boltzmann_electron_response_with_simple_sheath")) + "composition" => OptionsDict("electron_physics" => "boltzmann_electron_response_with_simple_sheath"))) test_input_chebyshev_1D1V = merge( test_input_finite_difference_1D1V, @@ -100,10 +101,10 @@ test_input_chebyshev_split3_1D1V = merge(test_input_chebyshev_split2_1D1V, "evolve_moments_parallel_pressure" => true)) -test_input_chebyshev_simple_sheath_1D1V = merge( +test_input_chebyshev_simple_sheath_1D1V = merge_dict_of_dicts( test_input_chebyshev_1D1V, OptionsDict("run_name" => "chebyshev_pseudospectral_simple_sheath_1D1V", - "electron_physics" => "boltzmann_electron_response_with_simple_sheath")) + "composition" => OptionsDict("electron_physics" => "boltzmann_electron_response_with_simple_sheath"))) test_input_chebyshev = merge( test_input_chebyshev_1D1V, @@ -124,10 +125,10 @@ test_input_chebyshev = merge( "vzeta_ngrid" => 3, "vzeta_nelement" => 1)) -test_input_chebyshev_simple_sheath = merge( +test_input_chebyshev_simple_sheath = merge_dict_of_dicts( test_input_chebyshev, OptionsDict("run_name" => "chebyshev_pseudospectral_simple_sheath", - "electron_physics" => "boltzmann_electron_response_with_simple_sheath")) + "composition" => OptionsDict("electron_physics" => "boltzmann_electron_response_with_simple_sheath"))) test_input_list = [ #test_input_finite_difference, diff --git a/moment_kinetics/src/input_structs.jl b/moment_kinetics/src/input_structs.jl index 4a16949fa..2c257d5f1 100644 --- a/moment_kinetics/src/input_structs.jl +++ b/moment_kinetics/src/input_structs.jl @@ -18,7 +18,7 @@ export pp_input export geometry_input export set_defaults_and_check_top_level!, set_defaults_and_check_section!, options_to_TOML, Dict_to_NamedTuple -export merge_dict_with_kwargs! +export merge_dict_with_kwargs!, merge_dict_of_dicts!, merge_dict_of_dicts using ..communication using ..type_definitions: mk_float, mk_int @@ -850,6 +850,39 @@ function merge_dict_with_kwargs!(dict_base; args...) return nothing end +""" +Dict merge function for merging Dicts of Dicts +In place merge, returns nothing +""" + +function merge_dict_of_dicts!(dict_base, dict_mod) + for (k,v) in dict_mod + k = String(k) + if k in keys(dict_base) && isa(v, AbstractDict) + v = merge(dict_base[k], v) + end + dict_base[k] = v + end + return nothing +end + +""" +Dict merge function for merging Dicts of Dicts +Creates new dict, which is returned +""" + +function merge_dict_of_dicts(dict_base, dict_mod) + dict_new = deepcopy(dict_base) + for (k,v) in dict_mod + k = String(k) + if k in keys(dict_new) && isa(v, AbstractDict) + v = merge(dict_new[k], v) + end + dict_new[k] = v + end + return dict_new +end + """ options_to_toml(io::IO [=stdout], data::AbstractDict; sorted=false, by=identity) From 6c538515b970f24bfe46f6cfa26856bf6d36f40c Mon Sep 17 00:00:00 2001 From: John Omotani Date: Wed, 4 Sep 2024 14:00:06 +0100 Subject: [PATCH 45/46] Fix too-long output dir names for 'long' tests When an OptionsDict is passed as a keyword argument in the long tests, the `shortname` could become too long. Add some special handling for AbstractDict arguments to prevent this, by truncating the name. Also pass OptionsDict for timestepping arguments. --- .../test/restart_interpolation_tests.jl | 47 ++++++++++++------- moment_kinetics/test/sound_wave_tests.jl | 32 +++++++++---- 2 files changed, 52 insertions(+), 27 deletions(-) diff --git a/moment_kinetics/test/restart_interpolation_tests.jl b/moment_kinetics/test/restart_interpolation_tests.jl index 5f6778feb..ca6a166ba 100644 --- a/moment_kinetics/test/restart_interpolation_tests.jl +++ b/moment_kinetics/test/restart_interpolation_tests.jl @@ -34,7 +34,7 @@ base_input["output"] = OptionsDict("parallel_io" => false) restart_test_input_chebyshev = merge(deepcopy(base_input), - Dict("run_name" => "restart_chebyshev_pseudospectral", + OptionsDict("run_name" => "restart_chebyshev_pseudospectral", "r_ngrid" => 3, "r_nelement" => 2, "r_discretization" => "chebyshev_pseudospectral", "z_ngrid" => 17, "z_nelement" => 2, @@ -47,18 +47,18 @@ end restart_test_input_chebyshev_split_1_moment = merge(deepcopy(restart_test_input_chebyshev), - Dict("run_name" => "restart_chebyshev_pseudospectral_split_1_moment", + OptionsDict("run_name" => "restart_chebyshev_pseudospectral_split_1_moment", "evolve_moments_density" => true)) restart_test_input_chebyshev_split_2_moments = merge(deepcopy(restart_test_input_chebyshev_split_1_moment), - Dict("run_name" => "restart_chebyshev_pseudospectral_split_2_moments", + OptionsDict("run_name" => "restart_chebyshev_pseudospectral_split_2_moments", "r_ngrid" => 1, "r_nelement" => 1, "evolve_moments_parallel_flow" => true)) restart_test_input_chebyshev_split_3_moments = merge(deepcopy(restart_test_input_chebyshev_split_2_moments), - Dict("run_name" => "restart_chebyshev_pseudospectral_split_3_moments", + OptionsDict("run_name" => "restart_chebyshev_pseudospectral_split_3_moments", "evolve_moments_parallel_pressure" => true, "vpa_L" => 1.5*vpa_L, "vz_L" => 1.5*vpa_L)) @@ -84,9 +84,19 @@ function run_test(test_input, base, message, rtol, atol; tol_3V, args...) parallel_io = input["output"]["parallel_io"] # Convert keyword arguments to a unique name + function stringify_arg(key, value) + if isa(value, AbstractDict) + return string(string(key)[1], (stringify_arg(k, v) for (k, v) in value)...) + else + return string(string(key)[1], value) + end + end name = input["run_name"] if length(args) > 0 - name = string(name, (string(String(k)[1], v) for (k, v) in args)...) + name = string(name, "_", (stringify_arg(k, v) for (k, v) in args)...) + + # Remove trailing "_" + name = chop(name) end if parallel_io name *= "parallel-io" @@ -288,14 +298,14 @@ function runtests() base_input_full_f = deepcopy(base_input) base_input_full_f["timestepping"] = merge(base_input["timestepping"], - Dict("nstep" => nstep)) + OptionsDict("nstep" => nstep)) base_input_evolve_density = merge(base_input_full_f, - Dict("evolve_moments_density" => true)) + OptionsDict("evolve_moments_density" => true)) base_input_evolve_upar = merge(base_input_evolve_density, - Dict("evolve_moments_parallel_flow" => true, + OptionsDict("evolve_moments_parallel_flow" => true, "vpa_L" => 1.5*vpa_L, "vz_L" => 1.5*vpa_L)) base_input_evolve_ppar = merge(base_input_evolve_upar, - Dict("evolve_moments_parallel_pressure" => true, + OptionsDict("evolve_moments_parallel_pressure" => true, "vpa_L" => 1.5*vpa_L, "vz_L" => 1.5*vpa_L)) for (base, base_label) ∈ ((base_input_full_f, "full-f"), @@ -363,11 +373,11 @@ function runtests() # Note: only do 2 steps in 2V/3V mode because it is so slow. Also, linear # interpolation used for ion-neutral coupling in 2V/3V case has low accuracy, so # use looser tolerance for various things. - @long do_tests(", 2V/3V", 1.0e-1, 98, false; tol_3V=0.3, nstep=2, r_ngrid=1, - r_nelement=1, vperp_ngrid=17, vperp_nelement=4, vperp_L=vpa_L, - vpa_ngrid=17, vpa_nelement=8, vzeta_ngrid=17, vzeta_nelement=4, - vzeta_L=vpa_L, vr_ngrid=17, vr_nelement=4, vr_L=vpa_L, vz_ngrid=17, - vz_nelement=8) + @long do_tests(", 2V/3V", 1.0e-1, 98, false; tol_3V=0.3, + timestepping=OptionsDict("nstep" => 2), r_ngrid=1, r_nelement=1, + vperp_ngrid=17, vperp_nelement=4, vperp_L=vpa_L, vpa_ngrid=17, + vpa_nelement=8, vzeta_ngrid=17, vzeta_nelement=4, vzeta_L=vpa_L, + vr_ngrid=17, vr_nelement=4, vr_L=vpa_L, vz_ngrid=17, vz_nelement=8) if io_has_parallel(Val(hdf5)) orig_base_input = deepcopy(base_input) @@ -381,10 +391,11 @@ function runtests() # interpolation used for ion-neutral coupling in 2V/3V case has low accuracy, # so use looser tolerance for various things. @long do_tests(", 2V/3V, parallel I/O", 2.0e-1, 98, false; tol_3V=0.3, - nstep=2, r_ngrid=1, r_nelement=1, vperp_ngrid=17, - vperp_nelement=4, vperp_L=vpa_L, vpa_ngrid=17, vpa_nelement=8, - vzeta_ngrid=17, vzeta_nelement=4, vzeta_L=vpa_L, vr_ngrid=17, - vr_nelement=4, vr_L=vpa_L, vz_ngrid=17, vz_nelement=8) + timestepping=OptionsDict("nstep" => 2), r_ngrid=1, + r_nelement=1, vperp_ngrid=17, vperp_nelement=4, vperp_L=vpa_L, + vpa_ngrid=17, vpa_nelement=8, vzeta_ngrid=17, vzeta_nelement=4, + vzeta_L=vpa_L, vr_ngrid=17, vr_nelement=4, vr_L=vpa_L, + vz_ngrid=17, vz_nelement=8) global base_input = orig_base_input end diff --git a/moment_kinetics/test/sound_wave_tests.jl b/moment_kinetics/test/sound_wave_tests.jl index cd8b3dcb8..7da2ab497 100644 --- a/moment_kinetics/test/sound_wave_tests.jl +++ b/moment_kinetics/test/sound_wave_tests.jl @@ -142,11 +142,18 @@ function run_test(test_input, analytic_frequency, analytic_growth_rate, input = deepcopy(test_input) # Convert keyword arguments to a unique name + function stringify_arg(key, value) + if isa(value, AbstractDict) + return string(string(key)[1], (stringify_arg(k, v) for (k, v) in value)...) + else + return string(string(key)[1], value) + end + end name = input["run_name"] shortname = name if length(args) > 0 name = string(name, "_", (string(k, "-", v, "_") for (k, v) in args)...) - shortname = string(shortname, "_", (string(string(k)[1], v) for (k, v) in args)...) + shortname = string(shortname, "_", (stringify_arg(k, v) for (k, v) in args)...) # Remove trailing "_" name = chop(name) @@ -289,7 +296,8 @@ function run_test_set_finite_difference() [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544], 30; composition = OptionsDict("T_e" => 0.5), - nstep=1300, charge_exchange_frequency=2*π*0.0) + timestepping = OptionsDict("nstep" => 1300), + charge_exchange_frequency=2*π*0.0) @long run_test(test_input_finite_difference, 2*π*0.0, -2*π*0.2727, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; @@ -353,7 +361,8 @@ function run_test_set_finite_difference_split_1_moment() [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544], 30; composition = OptionsDict("T_e" => 0.5), - nstep=1300, charge_exchange_frequency=2*π*0.0) + timestepping = OptionsDict("nstep" => 1300), + charge_exchange_frequency=2*π*0.0) run_test(test_input_finite_difference_split_1_moment, 2*π*0.0, -2*π*0.2727, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; @@ -417,7 +426,8 @@ function run_test_set_finite_difference_split_2_moments() [-0.34706673733456106, -0.3470627566790802, -0.3470579059173919, -0.347052193699157, -0.34704563020982493, -0.3470382271523149], 30; composition = OptionsDict("T_e" => 0.5), - nstep=1300, z_ngrid=150, charge_exchange_frequency=2*π*0.0) + timestepping = OptionsDict("nstep" => 1300), z_ngrid=150, + charge_exchange_frequency=2*π*0.0) run_test(test_input_finite_difference_split_2_moments, 2*π*0.0, -2*π*0.2727, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; @@ -486,7 +496,8 @@ function run_test_set_finite_difference_split_3_moments() -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544], 30; composition = OptionsDict("T_e" => 0.5), - nstep=1300, charge_exchange_frequency=2*π*0.0) + timestepping = OptionsDict("nstep" => 1300), + charge_exchange_frequency=2*π*0.0) @long run_test(test_input_finite_difference_split_3_moments, 2*π*0.0, -2*π*0.2727, [-0.34705779901310196, -0.34704885164065513, -0.3470379898466833, -0.3470252574909716, -0.3470107059829777, -0.3469943940725544]; @@ -551,7 +562,8 @@ function run_test_set_chebyshev() [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614], 30; composition = OptionsDict("T_e" => 0.5), - nstep=1300, charge_exchange_frequency=2*π*0.0) + timestepping = OptionsDict("nstep" => 1300), + charge_exchange_frequency=2*π*0.0) @long run_test(test_input_chebyshev, 2*π*0.0, -2*π*0.2727, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614]; @@ -617,7 +629,8 @@ function run_test_set_chebyshev_split_1_moment() [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614], 30; composition = OptionsDict("T_e" => 0.5), - nstep=1300, charge_exchange_frequency=2*π*0.0) + timestepping = OptionsDict("nstep" => 1300), + charge_exchange_frequency=2*π*0.0) @long run_test(test_input_chebyshev_split_1_moment, 2*π*0.0, -2*π*0.2727, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614]; @@ -683,7 +696,7 @@ function run_test_set_chebyshev_split_2_moments() [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614], 40; composition = OptionsDict("T_e" => 0.5), - nstep=1300, nwrite=10, + timestepping = OptionsDict("nstep" => 1300, "nwrite" => 10), charge_exchange_frequency=2*π*0.0) @long run_test(test_input_chebyshev_split_2_moments, 2*π*0.0, -2*π*0.2727, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, @@ -750,7 +763,8 @@ function run_test_set_chebyshev_split_3_moments() [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614], 80; composition = OptionsDict("T_e" => 0.5), - nstep=1300, nwrite=5, charge_exchange_frequency=2*π*0.0) + timestepping = OptionsDict("nstep" => 1300, "nwrite" => 5), + charge_exchange_frequency=2*π*0.0) @long run_test(test_input_chebyshev_split_3_moments, 2*π*0.0, -2*π*0.2727, [-0.34657359027997264, -0.34629088790428314, -0.34612578140467837, -0.34607740653471614, -0.34607384011343095, -0.34607740653471614]; From 2c6452d006c0df193e3d2129c9a78a41f712eccf Mon Sep 17 00:00:00 2001 From: John Omotani Date: Wed, 4 Sep 2024 14:01:33 +0100 Subject: [PATCH 46/46] Fix regression in inputs for 'recycling fraction' debug tests The T_wall setting had been accidentally altered (or failed to merge?) when the inputs were refactored, causing sqrt(-1) errors. Reset T_wall to a working value. --- moment_kinetics/debug_test/recycling_fraction_inputs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment_kinetics/debug_test/recycling_fraction_inputs.jl b/moment_kinetics/debug_test/recycling_fraction_inputs.jl index a10e7e5fa..fdefdfe8a 100644 --- a/moment_kinetics/debug_test/recycling_fraction_inputs.jl +++ b/moment_kinetics/debug_test/recycling_fraction_inputs.jl @@ -6,7 +6,7 @@ test_input = OptionsDict("composition" => OptionsDict("n_ion_species" => 1, "electron_physics" => "boltzmann_electron_response", "recycling_fraction" => 0.5, "T_e" => 0.2, - "T_wall" => 0.1), + "T_wall" => 2.0), "ion_species_1" => OptionsDict("initial_density" => 1.0, "initial_temperature" => 1.0), "run_name" => "full-f",