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

Fix electron moment outputs when using Boltzmann response #253

Merged
merged 3 commits into from
Sep 16, 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
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,10 @@ function plots_for_variable(run_info, variable_name; plot_prefix, has_rdim=true,
all(ri.collisions.krook_collisions_option == "none" for ri ∈ run_info)
# No Krook collisions active, so do not make plots.
return nothing
elseif variable_name ∈ union(electron_moment_variables, electron_source_variables, electron_dfn_variables) &&
all(ri.composition.electron_physics ∈ (boltzmann_electron_response, boltzmann_electron_response_with_simple_sheath)
for ri ∈ run_info)
return nothing
end

println("Making plots for $variable_name")
Expand Down
5 changes: 5 additions & 0 deletions moment_kinetics/src/electron_fluid_equations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ function calculate_electron_upar_from_charge_conservation!(upar_e, updated, dens
# convert from parallel particle flux to parallel particle density
upar_e[iz,ir] /= dens_e[iz,ir]
end
else
begin_r_z_region()
@loop_r_z ir iz begin
upar_e[iz,ir] = upar_i[iz,ir,1]
end
end
updated[] = true
end
Expand Down
20 changes: 12 additions & 8 deletions moment_kinetics/src/initial_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function initialize_electrons!(pdf, moments, fields, geometry, composition, r, z
# Not restarting, so create initial profiles

# initialise the electron thermal speed profile
init_electron_vth!(moments.electron.vth, moments.ion.vth, composition.T_e, composition.me_over_mi, z.grid)
init_electron_vth!(moments.electron.vth, moments.ion.vth, composition, z.grid)
begin_r_z_region()
# calculate the electron temperature from the thermal speed
@loop_r_z ir iz begin
Expand Down Expand Up @@ -1063,14 +1063,18 @@ initialise the electron thermal speed profile.
for now the only initialisation option for the temperature is constant in z.
returns vth0 = sqrt(2*Ts/Te)
"""
function init_electron_vth!(vth_e, vth_i, T_e, me_over_mi, z)
function init_electron_vth!(vth_e, vth_i, composition, z)
begin_r_z_region()
# @loop_r_z ir iz begin
# vth_e[iz,ir] = sqrt(T_e)
# end
@loop_r_z ir iz begin
vth_e[iz,ir] = vth_i[iz,ir,1] / sqrt(me_over_mi)
#vth_e[iz,ir] = exp(-5*(z[iz]/z[end])^2)/sqrt(me_over_mi)
if composition.electron_physics ∈ (boltzmann_electron_response,
boltzmann_electron_response_with_simple_sheath)
@loop_r_z ir iz begin
vth_e[iz,ir] = sqrt(composition.T_e / composition.me_over_mi)
end
else
@loop_r_z ir iz begin
vth_e[iz,ir] = vth_i[iz,ir,1] / sqrt(composition.me_over_mi)
#vth_e[iz,ir] = exp(-5*(z[iz]/z[end])^2)/sqrt(composition.me_over_mi)
end
end
end

Expand Down
Loading