Skip to content

Commit

Permalink
Merge pull request #253 from mabarnes/fix-electron-outputs-for-Boltzmann
Browse files Browse the repository at this point in the history
Fix electron moment outputs when using Boltzmann response
  • Loading branch information
johnomotani authored Sep 16, 2024
2 parents 3038940 + afb6ba9 commit 6a5fb4a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
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

0 comments on commit 6a5fb4a

Please sign in to comment.