Skip to content

Commit

Permalink
Merge pull request #237 from mabarnes/electrons
Browse files Browse the repository at this point in the history
Kinetic electrons
  • Loading branch information
johnomotani authored Aug 8, 2024
2 parents b776ef2 + 94010a8 commit dad73fc
Show file tree
Hide file tree
Showing 69 changed files with 13,560 additions and 1,546 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/debug_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,23 @@ jobs:
version: '1.10'
arch: x64
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
with:
project: 'moment_kinetics/'
- name: Debug test
run: |
cd moment_kinetics
# Hard code the debug level so that we can run without using the
# `--compiled-modules=no` flag, which breaks Symbolics.jl at the
# moment.
sed -i -e "s/_debug_level = get_options.*/_debug_level = 2/" src/debugging.jl
sed -i -e "s/_debug_level = get_options.*/_debug_level = 2/" moment_kinetics/src/debugging.jl
julia --project -e 'using MPIPreferences; MPIPreferences.use_system_binary(); using Pkg; Pkg.precompile()'
touch Project.toml
julia --project -O3 --check-bounds=yes -e 'using Pkg; Pkg.add(["MPI", "MPIPreferences", "PackageCompiler", "Symbolics"]); using MPIPreferences; MPIPreferences.use_system_binary()'
julia --project -O3 --check-bounds=yes -e 'using Pkg; Pkg.develop(path="moment_kinetics/"); Pkg.precompile()'
julia --project -O3 --check-bounds=yes precompile.jl --debug 2
# Need to use openmpi so that the following arguments work:
# * `--mca rmaps_base_oversubscribe 1` allows oversubscription (more processes
# than physical cores).
# * `--mca mpi_yield_when_idle 1` changes a setting to prevent excessively
# terrible performance when oversubscribing.
## Don't use --compiled-modules=no for now, as it currently breaks Symbolics.jl
#mpiexec -np 4 --mca rmaps_base_oversubscribe 1 julia --project --check-bounds=yes --compiled-modules=no debug_test/sound_wave_tests.jl --debug 2
mpiexec -np 4 --mca rmaps_base_oversubscribe 1 julia --project --check-bounds=yes debug_test/runtests.jl --debug 2
#mpiexec -np 4 --mca rmaps_base_oversubscribe 1 julia --project --check-bounds=yes --compiled-modules=no moment_kinetics/debug_test/sound_wave_tests.jl --debug 2
mpiexec -np 4 --mca rmaps_base_oversubscribe 1 julia --project -Jmoment_kinetics.so -O3 --check-bounds=yes moment_kinetics/debug_test/runtests.jl --debug 2
6 changes: 5 additions & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ jobs:
touch Project.toml
julia -O3 --project -e 'import Pkg; Pkg.develop(path="moment_kinetics/"); Pkg.add("NCDatasets"); Pkg.precompile()'
# Reduce nstep for each example to 10 to avoid the CI job taking too long
julia -O3 --project -e 'using moment_kinetics; for (root, dirs, files) in walkdir("examples") for file in files if endswith(file, ".toml") filename = joinpath(root, file); println(filename); input = moment_kinetics.moment_kinetics_input.read_input_file(filename); t_input = get(input, "timestepping", Dict{String,Any}()); t_input["nstep"] = 10; t_input["dt"] = 1.0e-10; pop!(input, "z_nelement_local", ""); pop!(input, "r_nelement_local", ""); run_moment_kinetics(input) end end end'
# Note we skip the example `if (occursin("ARK", get(t_input, "type", "") && Sys.isapple())`
# because the way we use MINPACK.jl (needed for nonlinear solvers
# used for implicit parts of timestep) doesn't currently work on
# macOS.
julia -O3 --project -e 'using moment_kinetics; for (root, dirs, files) in walkdir("examples") for file in files if endswith(file, ".toml") filename = joinpath(root, file); println(filename); input = moment_kinetics.moment_kinetics_input.read_input_file(filename); t_input = get(input, "timestepping", Dict{String,Any}()); if (occursin("ARK", get(t_input, "type", "")) && Sys.isapple()) continue end; t_input["nstep"] = 10; t_input["dt"] = 1.0e-12; input["timestepping"] = t_input; pop!(input, "z_nelement_local", ""); pop!(input, "r_nelement_local", ""); electron_t_input = get(input, "electron_timestepping", Dict{String,Any}()); electron_t_input["initialization_residual_value"] = 1.0e8; electron_t_input["converged_residual_value"] = 1.0e8; input["electron_timestepping"] = electron_t_input; nl_solver_input = get(input, "nonlinear_solver", Dict{String,Any}()); nl_solver_input["rtol"] = 1.0e6; nl_solver_input["atol"] = 1.0e6; input["nonlinear_solver"] = nl_solver_input; run_moment_kinetics(input) end end end'
91 changes: 91 additions & 0 deletions examples/kinetic-electrons/periodic_split3_boltzmann.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#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
nu_ei = 1000.0
r_ngrid = 1
r_nelement = 1
z_ngrid = 17
z_nelement = 16
#z_nelement_local = 16
z_bc = "periodic"
z_discretization = "chebyshev_pseudospectral"
vpa_ngrid = 6
vpa_nelement = 31
vpa_L = 12.0
vpa_bc = "zero"
vpa_discretization = "chebyshev_pseudospectral"
vz_ngrid = 6
vz_nelement = 31
vz_L = 12.0
vz_bc = "zero"
vz_discretization = "chebyshev_pseudospectral"

[timestepping]
type = "Fekete4(3)"
nstep = 1000000
dt = 1.0e-6
minimum_dt = 1.0e-7
rtol = 1.0e-7
nwrite = 10000
nwrite_dfns = 100000
steady_state_residual = true
converged_residual_value = 1.0e-3

[nonlinear_solver]
nonlinear_max_iterations = 100
#rtol = 1.0e-9
#atol = 1.0e-12

[ion_numerical_dissipation]
vpa_dissipation_coefficient = 1.0e0
force_minimum_pdf_value = 0.0

[neutral_numerical_dissipation]
vz_dissipation_coefficient = 1.0e-1
force_minimum_pdf_value = 0.0

[krook_collisions]
use_krook = true
110 changes: 110 additions & 0 deletions examples/kinetic-electrons/periodic_split3_braginskii-IMEX.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#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
nu_ei = 1000.0
r_ngrid = 1
r_nelement = 1
z_ngrid = 17
z_nelement = 16
#z_nelement_local = 16
z_bc = "periodic"
z_discretization = "chebyshev_pseudospectral"
vpa_ngrid = 6
vpa_nelement = 31
vpa_L = 12.0
vpa_bc = "zero"
vpa_discretization = "chebyshev_pseudospectral"
vz_ngrid = 6
vz_nelement = 31
vz_L = 12.0
vz_bc = "zero"
vz_discretization = "chebyshev_pseudospectral"

[timestepping]
type = "KennedyCarpenterARK324"
implicit_ion_advance = false
implicit_vpa_advection = false
implicit_braginskii_conduction = true
nstep = 1000000
dt = 1.0e-6
minimum_dt = 1.0e-7
rtol = 1.0e-7
nwrite = 10000
nwrite_dfns = 100000
steady_state_residual = true
converged_residual_value = 1.0e-3
#[timestepping]
#type = "KennedyCarpenterARK324"
#implicit_ion_advance = false
#implicit_vpa_advection = false
#implicit_braginskii_conduction = true
#nstep = 1000000
#dt = 1.0e-6
#minimum_dt = 1.0e-7
#rtol = 1.0e-7
#nwrite = 100
#nwrite_dfns = 100
#steady_state_residual = true
#converged_residual_value = 1.0e-3
#write_after_fixed_step_count = true
#write_error_diagnostics = true
#write_steady_state_diagnostics = true

[nonlinear_solver]
nonlinear_max_iterations = 100
#rtol = 1.0e-9
#atol = 1.0e-12

[ion_numerical_dissipation]
vpa_dissipation_coefficient = 1.0e0
force_minimum_pdf_value = 0.0

[neutral_numerical_dissipation]
vz_dissipation_coefficient = 1.0e-1
force_minimum_pdf_value = 0.0

[krook_collisions]
use_krook = true
104 changes: 104 additions & 0 deletions examples/kinetic-electrons/periodic_split3_braginskii.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#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
nu_ei = 1000.0
r_ngrid = 1
r_nelement = 1
z_ngrid = 17
z_nelement = 16
#z_nelement_local = 16
z_bc = "periodic"
z_discretization = "chebyshev_pseudospectral"
vpa_ngrid = 6
vpa_nelement = 31
vpa_L = 12.0
vpa_bc = "zero"
vpa_discretization = "chebyshev_pseudospectral"
vz_ngrid = 6
vz_nelement = 31
vz_L = 12.0
vz_bc = "zero"
vz_discretization = "chebyshev_pseudospectral"

[timestepping]
type = "Fekete4(3)"
nstep = 1000000
dt = 1.0e-6
minimum_dt = 1.0e-9
rtol = 1.0e-7
nwrite = 10000
nwrite_dfns = 100000
steady_state_residual = true
converged_residual_value = 1.0e-3
#[timestepping]
#type = "Fekete4(3)"
#nstep = 1000000
#dt = 1.0e-6
#minimum_dt = 1.0e-9
#rtol = 1.0e-7
#nwrite = 1000
#nwrite_dfns = 1000
#steady_state_residual = true
#converged_residual_value = 1.0e-3
#write_after_fixed_step_count = true
#write_error_diagnostics = true
#write_steady_state_diagnostics = true

[nonlinear_solver]
nonlinear_max_iterations = 100
#rtol = 1.0e-9
#atol = 1.0e-12

[ion_numerical_dissipation]
vpa_dissipation_coefficient = 1.0e0
force_minimum_pdf_value = 0.0

[neutral_numerical_dissipation]
vz_dissipation_coefficient = 1.0e-1
force_minimum_pdf_value = 0.0

[krook_collisions]
use_krook = true
Loading

0 comments on commit dad73fc

Please sign in to comment.