Skip to content

Commit

Permalink
Use explicit pseudotimestep for electrons when ion timestep not IMEX
Browse files Browse the repository at this point in the history
If the ion timestep is not IMEX, the electron pressure cannot be
advanced implicitly, which is required for a stable implicit electron
timestep. Therefore when not using an IMEX timestep method for ions, use
explicit timestepping for electron pseudotimestepping loop.
  • Loading branch information
johnomotani committed Jan 12, 2025
1 parent 8666711 commit 82e8765
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions moment_kinetics/src/initial_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,8 @@ function initialize_electron_pdf!(scratch, scratch_electron, pdf, moments, field
if !skip_electron_solve
# Can't let this counter stay set to 0
t_params.electron.dfns_output_counter[] = max(t_params.electron.dfns_output_counter[], 1)
implicit_electron_pseudotimestep = (nl_solver_params.electron_advance !== nothing)
electron_solution_method = implicit_electron_pseudotimestep ? "backward_euler" : "artificial_time_derivative"
success =
@views update_electron_pdf!(scratch_electron, pdf.electron.norm,
moments, fields.phi, r, z, vperp, vpa,
Expand All @@ -720,7 +722,8 @@ function initialize_electron_pdf!(scratch, scratch_electron, pdf, moments, field
io_electron=io_initial_electron,
initial_time=code_time,
residual_tolerance=t_input["initialization_residual_value"],
evolve_ppar=true)
evolve_ppar=true,
solution_method=electron_solution_method)
if success != ""
error("!!!max number of iterations for electron pdf update exceeded!!!\n"
* "Stopping at $(Dates.format(now(), dateformat"H:MM:SS"))")
Expand Down Expand Up @@ -795,7 +798,8 @@ function initialize_electron_pdf!(scratch, scratch_electron, pdf, moments, field
max_electron_pdf_iterations,
max_electron_sim_time;
io_electron=io_initial_electron,
evolve_ppar=true, ion_dt=t_params.dt[])
evolve_ppar=true, ion_dt=t_params.dt[],
solution_method=electron_solution_method)
end
if success != ""
error("!!!max number of iterations for electron pdf update exceeded!!!\n"
Expand Down
2 changes: 1 addition & 1 deletion moment_kinetics/src/time_advance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2551,7 +2551,7 @@ moments and moment derivatives
electron_vpa_advect, scratch_dummy, t_params.electron, collisions,
composition, external_source_settings, num_diss_params,
nl_solver_params.electron_advance, max_electron_pdf_iterations,
max_electron_sim_time)
max_electron_sim_time, solution_method="artificial_time_derivative")
success = kinetic_electron_success
end
end
Expand Down

0 comments on commit 82e8765

Please sign in to comment.