Skip to content

Commit

Permalink
Merge branch 'master' into TOML-print-enum2
Browse files Browse the repository at this point in the history
  • Loading branch information
johnomotani committed Aug 8, 2024
2 parents 812540d + dad73fc commit 6cbce08
Show file tree
Hide file tree
Showing 100 changed files with 14,434 additions and 1,908 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'
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ evolve_moments_parallel_flow = false
evolve_moments_parallel_pressure = false
evolve_moments_conservation = false
#force_Er_zero_at_wall = false #true
#Er_constant = 0.0
#epsilon_offset = 0.1
#use_vpabar_in_mms_dfni = true
T_e = 1.0
Expand Down Expand Up @@ -95,4 +94,4 @@ vperp_discretization = "gausslegendre_pseudospectral"
[fokker_planck_collisions]
use_fokker_planck = true
nuii = 1.0
frequency_option = "manual"
frequency_option = "manual"
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# 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

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 = 3.0
vpa_bc = "zero"
vpa_discretization = "gausslegendre_pseudospectral"
vperp_ngrid = 5
vperp_nelement = 16
vperp_L = 1.5
vperp_discretization = "gausslegendre_pseudospectral"
vperp_bc = "zero"
# 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.876334222e-3 #(1/nu_alphae, as computed from input diagnostic)
Zi = 2.0
self_collisions = true
slowing_down_test = true
frequency_option = "manual"
use_fokker_planck = true
use_conserving_corrections = true
sd_density = 1.0
sd_temp = 0.025 # TD/Ealpha
sd_mi = 0.5 # mD/malpha
sd_me = 0.000013616 # 0.25/1836.0 me/malpha
sd_q = 1.0

[ion_source]
active=false
source_strength=0.0
source_T=0.005
source_n=1.0
r_profile="constant"
r_width=1.0
r_relative_minimum=0.0
z_profile="gaussian"
z_width=0.1
z_relative_minimum=0.0
source_v0 = 1.0
#source_type="alphas"
source_type="alphas-with-losses"
#source_type="beam-with-losses"
#source_vpa0 = 1.0
#source_vperp0 = 1.0
sink_strength = 0.0
sink_vth=0.07071067811865475

[timestepping]
nstep = 50000
dt = 2.5e-4
nwrite = 100
nwrite_dfns = 100
2 changes: 1 addition & 1 deletion examples/fokker-planck/fokker-planck-relaxation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ 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_amplitude1 = 0.0
z_IC_density_phase1 = 0.0
z_IC_upar_amplitude1 = 0.0
z_IC_upar_phase1 = 0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# 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

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 = 3.0
vpa_bc = "zero"
vpa_discretization = "gausslegendre_pseudospectral"
vperp_ngrid = 5
vperp_nelement = 16
vperp_L = 1.5
vperp_discretization = "gausslegendre_pseudospectral"
vperp_bc = "zero"
# 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.876334222e-3 #(1/nu_alphae, as computed from input diagnostic)
Zi = 2.0
self_collisions = false
slowing_down_test = true
frequency_option = "manual"
use_fokker_planck = true
sd_density = 1.0
sd_temp = 0.0025 # TD/Ealpha
sd_mi = 0.5 # mD/malpha
sd_me = 0.000013616 # 0.25/1836.0 me/malpha
sd_q = 1.0

[ion_source]
active=true
source_strength=1.0
source_T=0.005
source_n=1.0
r_profile="constant"
r_width=1.0
r_relative_minimum=0.0
z_profile="gaussian"
z_width=0.1
z_relative_minimum=0.0
source_v0 = 1.0
#source_type="alphas"
source_type="alphas-with-losses"
#source_type="beam-with-losses"
#source_vpa0 = 1.0
#source_vperp0 = 1.0
sink_strength = 1.0
sink_vth=0.07071067811865475

[timestepping]
nstep = 250000
dt = 1.0e-4
nwrite = 500
nwrite_dfns = 500
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ sink_strength = 1.0
sink_vth=0.07071067811865475

[timestepping]
nstep = 50000
dt = 5.0e-4
nwrite = 100
nwrite_dfns = 100
nstep = 250000
dt = 1.0e-4
nwrite = 500
nwrite_dfns = 500
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
Loading

0 comments on commit 6cbce08

Please sign in to comment.