Skip to content

Commit

Permalink
Merge pull request #200 from mabarnes/cross-species-collisions
Browse files Browse the repository at this point in the history
Cross species collisions
  • Loading branch information
mrhardman authored Apr 30, 2024
2 parents c0880a5 + 959cb63 commit b860d61
Show file tree
Hide file tree
Showing 15 changed files with 834 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ charge_exchange_frequency = 0.0
ionization_frequency = 0.0
constant_ionization_rate = false

nstep = 200000
dt = 1.0e-3
nwrite = 50
nwrite_dfns = 50
use_semi_lagrange = false
n_rk_stages = 4
split_operators = false
z_ngrid = 1
z_nelement = 1
z_nelement_local = 1
Expand Down Expand Up @@ -64,3 +57,9 @@ use_fokker_planck = true
# nuii sets the normalised input C[F,F] Fokker-Planck collision frequency
nuii = 1.0
frequency_option = "manual"

[timestepping]
nstep = 200000
dt = 1.0e-3
nwrite = 50
nwrite_dfns = 50
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 = true
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 = 50000
dt = 5.0e-4
nwrite = 100
nwrite_dfns = 100
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# 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
65 changes: 65 additions & 0 deletions examples/fokker-planck/fokker-planck-relaxation-slowing-down.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 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
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
1 change: 0 additions & 1 deletion examples/fokker-planck/fokker-planck-relaxation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,3 @@ nstep = 5000
dt = 1.0e-2
nwrite = 5000
nwrite_dfns = 5000
split_operators = false
2 changes: 1 addition & 1 deletion moment_kinetics/src/communication.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function __init__()
if !MPI.Initialized()
MPI.Init()
end

comm_world.val = MPI.COMM_WORLD.val

global_rank[] = MPI.Comm_rank(comm_world)
Expand Down
3 changes: 2 additions & 1 deletion moment_kinetics/src/coordinates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ function define_coordinate(input, parallel_io::Bool=false; run_directory=nothing
cell_width, igrid, ielement, imin, imax, igrid_full, input.discretization, input.fd_option, input.cheb_option,
input.bc, wgts, uniform_grid, duniform_dgrid, scratch, copy(scratch), copy(scratch), scratch_shared, scratch_shared2,
scratch_2d, copy(scratch_2d), advection, send_buffer, receive_buffer, input.comm,
local_io_range, global_io_range, element_scale, element_shift, input.element_spacing_option, element_boundaries)
local_io_range, global_io_range, element_scale, element_shift, input.element_spacing_option,
element_boundaries)

if coord.n == 1 && occursin("v", coord.name)
spectral = null_velocity_dimension_info()
Expand Down
Loading

0 comments on commit b860d61

Please sign in to comment.