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

First pull request LM_sandbox to electrons-jto-debug #192

Merged
merged 16 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ ionization_frequency = 2.0
#electron_ionization_frequency = 2.0
#ionization_energy = 1.0
constant_ionization_rate = false
nstep = 1000000
nstep = 1000
LucasMontoya4 marked this conversation as resolved.
Show resolved Hide resolved
#nstep = 1
dt = 1.0e-5
nwrite = 10000
nwrite = 100
LucasMontoya4 marked this conversation as resolved.
Show resolved Hide resolved
nwrite_dfns = 10000
use_semi_lagrange = false
n_rk_stages = 4
Expand Down Expand Up @@ -85,8 +85,8 @@ ascii_output = true
[numerical_dissipation]
#moment_dissipation_coefficient = 0.0001
#moment_dissipation_coefficient = 1.0
vpa_dissipation_coefficient = 0.002
#vpa_dissipation_coefficient = 0.1
#vpa_dissipation_coefficient = 0.002
ion_vpa_dissipation_coefficient = 0.1
johnomotani marked this conversation as resolved.
Show resolved Hide resolved
#vpa_dissipation_coefficient = 0.2
#vpa_dissipation_coefficient = 2.0
#vpa_dissipation_coefficient = 20.0
13 changes: 6 additions & 7 deletions moment_kinetics/src/numerical_dissipation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ using ..type_definitions: mk_float
Base.@kwdef struct numerical_dissipation_parameters
vpa_boundary_buffer_damping_rate::mk_float = -1.0
vpa_boundary_buffer_diffusion_coefficient::mk_float = -1.0
vpa_dissipation_coefficient::mk_float = -1.0
ion_vpa_dissipation_coefficient::mk_float = -1.0
vz_dissipation_coefficient::mk_float = -1.0
vperp_dissipation_coefficient::mk_float = -1.0
z_dissipation_coefficient::mk_float = -1.0
Expand All @@ -29,12 +29,12 @@ Base.@kwdef struct numerical_dissipation_parameters
end

function setup_numerical_dissipation(input_section::Dict, is_1V)
if is_1V && "vpa_dissipation_coefficient" ∈ keys(input_section)
if is_1V && "ion_vpa_dissipation_coefficient" ∈ keys(input_section)
# Set default for vz_dissipation_coefficient the same as
# vpa_dissipation_coefficient for 1V case
# ion_vpa_dissipation_coefficient for 1V case
input_section["vz_dissipation_coefficient"] =
get(input_section, "vz_dissipation_coefficient",
input_section["vpa_dissipation_coefficient"])
input_section["ion_vpa_dissipation_coefficient"])
end

input = Dict(Symbol(k)=>v for (k,v) in input_section)
Expand Down Expand Up @@ -243,9 +243,8 @@ vpa_dissipation_coefficient = 0.1
```
"""
function vpa_dissipation!(f_out, f_in, vpa, spectral::T_spectral, dt,
num_diss_params::numerical_dissipation_parameters) where T_spectral
diffusion_coefficient) where T_spectral

diffusion_coefficient = num_diss_params.vpa_dissipation_coefficient
if diffusion_coefficient <= 0.0 || vpa.n == 1
return nothing
end
Expand Down Expand Up @@ -534,7 +533,7 @@ function r_dissipation_neutral!(f_out, f_in, r, r_spectral::T_spectral, dt,
end

"""
force_minimum_pdf_value!(f, num_diss_paras::numerical_dissipation_parameters)
force_minimum_pdf_value!(f, num_diss_params::numerical_dissipation_parameters)
johnomotani marked this conversation as resolved.
Show resolved Hide resolved

Set a minimum value for the pdf-sized array `f`. Any points less than the minimum are
set to the minimum. By default, no minimum is applied. The minimum value can be set by
Expand Down
4 changes: 2 additions & 2 deletions moment_kinetics/src/time_advance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ function setup_advance_flags(moments, composition, t_input, collisions,
# flag to determine if a d^2/dr^2 operator is present
r_diffusion = (advance_numerical_dissipation && num_diss_params.r_dissipation_coefficient > 0.0)
# flag to determine if a d^2/dvpa^2 operator is present
vpa_diffusion = ((advance_numerical_dissipation && num_diss_params.vpa_dissipation_coefficient > 0.0) || explicit_weakform_fp_collisions)
vpa_diffusion = ((advance_numerical_dissipation && num_diss_params.ion_vpa_dissipation_coefficient > 0.0) || explicit_weakform_fp_collisions)
vz_diffusion = (advance_numerical_dissipation && num_diss_params.vz_dissipation_coefficient > 0.0)
end

Expand Down Expand Up @@ -1863,7 +1863,7 @@ function euler_time_advance!(fvec_out, fvec_in, pdf, fields, moments,
# add numerical dissipation
if advance.numerical_dissipation
vpa_dissipation!(fvec_out.pdf, fvec_in.pdf, vpa, vpa_spectral, dt,
num_diss_params)
num_diss_params.ion_vpa_dissipation_coefficient)
vperp_dissipation!(fvec_out.pdf, fvec_in.pdf, vperp, vperp_spectral, dt,
num_diss_params)
z_dissipation!(fvec_out.pdf, fvec_in.pdf, z, z_spectral, dt,
Expand Down
Loading