Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve and document 'recycling fraction' example inputs #231

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions examples/recycling-fraction/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'Recycling fraction' examples
=============================

The input files in this directory are for a 1D1V example with a central source
of plasma particles and energy, and a recycling fraction of 0.5 at the walls
providing a source of neutrals. Plasma and neutrals are coupled by charge
exchange and ionization, with ad-hoc constant rates chosen to give a
penetration depth of neutrals into the domain that is similar to the size of
the domain (to avoid as much as possible very steep gradients near the sheath
entrances).

On the numerical side, these examples use a compressed grid near the target -
to provide better resolution of steep gradients near the sheath entrance - and
adaptive, explicit timestepping.

Running the examples
--------------------

To minimise the computer time needed to reach steady state solutions, there is
an input file for an initialisation drift-kinetic run with lower-order finite
elements, which provides a good initial condition for higher resolution runs.
Drift kinetic runs allow longer timesteps, and the 'split2' case (with
separately evolved density and parallel flow) is slightly closer to the steady
state of the full moment-kinetic 'split3' case (with separately evolved
density, parallel flow, and parallel pressure), so provides a better initial
guess. The suggested sequence for runs is:
```julia
julia> using moment_kinetics
julia> run_moment_kinetics("examples/recycling-fraction/wall-bc_recyclefraction0.5-init.toml")
julia> run_moment_kinetics("examples/recycling-fraction/wall-bc_recyclefraction0.5.toml"; restart="runs/wall-bc_recyclefraction0.5-init/wall-bc_recyclefraction0.5-init.dfns.h5")
julia> run_moment_kinetics("examples/recycling-fraction/wall-bc_recyclefraction0.5_split1.toml"; restart="runs/wall-bc_recyclefraction0.5/wall-bc_recyclefraction0.5.dfns.h5")
julia> run_moment_kinetics("examples/recycling-fraction/wall-bc_recyclefraction0.5_split2.toml"; restart="runs/wall-bc_recyclefraction0.5/wall-bc_recyclefraction0.5.dfns.h5")
julia> run_moment_kinetics("examples/recycling-fraction/wall-bc_recyclefraction0.5_split3.toml"; restart="runs/wall-bc_recyclefraction0.5_split2/wall-bc_recyclefraction0.5_split2.dfns.h5")
```
The full moment-kinetic run 'split3' is still quite slow, ~6.5hrs on 8 cores.

Remember that runs can be paused by doing `touch stop` in the output directory, and restarted with, e.g.
```julia
julia> run_moment_kinetics("examples/recycling-fraction/wall-bc_recyclefraction0.5_split3.toml"; restart=true)
```

There are several other input files in this directory that use different
Runge-Kutta timestepping schemes for the full moment-kinetic 'split3' case, but
unless you are experimenting with timestepping schemes the `"Fekete4(3)"` used
for all the runs mentioned above seems to be a reasonable choice.
93 changes: 93 additions & 0 deletions examples/recycling-fraction/wall-bc_recyclefraction0.5-init.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
n_ion_species = 1
n_neutral_species = 1
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 # 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 = 10000000
dt = 1.0e-5
minimum_dt = 1.0e-6
nwrite = 10000
nwrite_dfns = 10000
split_operators = false
steady_state_residual = true
converged_residual_value = 1.0e-3

[krook_collisions]
use_krook = true

[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

[neutral_numerical_dissipation]
#vz_dissipation_coefficient = 1.0e-1
#vz_dissipation_coefficient = 1.0e-2
#vz_dissipation_coefficient = 1.0e-3
98 changes: 98 additions & 0 deletions examples/recycling-fraction/wall-bc_recyclefraction0.5.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
n_ion_species = 1
n_neutral_species = 1
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 # 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 = 9
z_nelement = 32
z_nelement_local = 16
z_bc = "wall"
z_discretization = "chebyshev_pseudospectral"
z_element_spacing_option = "sqrt"
vpa_ngrid = 10
vpa_nelement = 63
vpa_L = 36.0
vpa_bc = "zero"
vpa_discretization = "chebyshev_pseudospectral"
vz_ngrid = 10
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-5
#minimum_dt = 1.0e-8
minimum_dt = 1.0e-6
step_update_prefactor = 0.5
atol = 1.0e-10
#atol = 1.0e-9
nwrite = 10000
nwrite_dfns = 10000
split_operators = false
steady_state_residual = true
converged_residual_value = 1.0e-3

[krook_collisions]
use_krook = true

[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

[neutral_numerical_dissipation]
#vz_dissipation_coefficient = 1.0e-1
#vz_dissipation_coefficient = 1.0e-2
#vz_dissipation_coefficient = 1.0e-3
98 changes: 98 additions & 0 deletions examples/recycling-fraction/wall-bc_recyclefraction0.5_split1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
n_ion_species = 1
n_neutral_species = 1
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
constant_ionization_rate = false
r_ngrid = 1
r_nelement = 1
z_ngrid = 9
z_nelement = 32
z_nelement_local = 16
z_bc = "wall"
z_discretization = "chebyshev_pseudospectral"
z_element_spacing_option = "sqrt"
vpa_ngrid = 10
vpa_nelement = 63
vpa_L = 36.0
vpa_bc = "zero"
vpa_discretization = "chebyshev_pseudospectral"
vz_ngrid = 10
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-5
#minimum_dt = 1.0e-8
minimum_dt = 1.0e-6
step_update_prefactor = 0.5
atol = 1.0e-10
#atol = 1.0e-9
nwrite = 10000
nwrite_dfns = 10000
split_operators = false
steady_state_residual = true
converged_residual_value = 1.0e-3

[krook_collisions]
use_krook = true

[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

[neutral_numerical_dissipation]
#vz_dissipation_coefficient = 1.0e-1
#vz_dissipation_coefficient = 1.0e-2
#vz_dissipation_coefficient = 1.0e-3
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@

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_parallel_pressure = false
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
Expand Down Expand Up @@ -80,6 +77,9 @@ split_operators = false
steady_state_residual = true
converged_residual_value = 1.0e-3

[krook_collisions]
use_krook = true

[ion_source]
active = true
z_profile = "gaussian"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#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
Expand Down Expand Up @@ -65,15 +62,19 @@ vz_bc = "zero"
vz_discretization = "chebyshev_pseudospectral"

[timestepping]
#nstep = 50000
nstep = 1000000
dt = 1.0e-6
type = "Fekete4(3)"
nstep = 100000
dt = 1.0e-5
minimum_dt = 1.0e-6
nwrite = 1000
nwrite_dfns = 1000
split_operators = false
steady_state_residual = true
converged_residual_value = 1.0e-3

[krook_collisions]
use_krook = true

[ion_source]
active = true
z_profile = "gaussian"
Expand Down
Loading
Loading