Skip to content

Commit

Permalink
Ensure moment derivatives are initialised before they are used
Browse files Browse the repository at this point in the history
The earlier-initialised values are only used during initialisation to
calculate some advection speeds whose sign is then checked to set
boundary conditions, so the differences caused by this error were small,
but previously (for evolving-upar and evolving-ppar cases) uninitialised
arrays were used, which could change randomly.
  • Loading branch information
johnomotani committed Nov 2, 2023
1 parent cf27594 commit 58aa424
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/time_advance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ function setup_time_advance!(pdf, vz, vr, vzeta, vpa, vperp, z, r, vz_spectral,
fields.phi0 .= fields.phi
end

# Preliminary calculation of moment derivatives, to be used for initial version of
# 'speed' in advect objects, which are needed for boundary conditions on the
# distribution function which is then used to (possibly) re-calculate the moments
# after which the initial values of moment derivatives are re-calculated.
calculate_moment_derivatives!(moments, scratch[1], scratch_dummy, z, z_spectral, num_diss_params)

##
# Charged particle advection only
##
Expand Down

0 comments on commit 58aa424

Please sign in to comment.