electron_kinetic_equation

moment_kinetics.electron_kinetic_equation.calculate_contribution_from_z_advection!Method

calculates the contribution to the residual of the electron kinetic equation from the z advection term: residual = zdot * d(pdf)/dz + wpadot * d(pdf)/dwpa - pdf * prefactor INPUTS: zadvectionterm = dummy array to be filled with the contribution to the residual from the z advection term pdf = modified electron pdf used in the kinetic equation = (true electron pdf / dense) * vthe vthe = electron thermal speed z = z grid vpa = vparallel grid zspectral = spectral representation of the z grid scratchdummy = dummy array to be used for temporary storage OUTPUT: zadvectionterm = updated contribution to the residual from the z advection term

source
moment_kinetics.electron_kinetic_equation.electron_backward_euler!Method

Update the electron distribution function using backward-Euler for an artifical time advance of the electron kinetic equation until a steady-state solution is reached.

Note that this function does not use the runge_kutta timestep functionality. t_params.previous_dt[] is used to store the (adaptively updated) initial timestep of the pseudotimestepping loop (initial value of t_params.dt[] within electron_backward_euler!()). t_params.dt[] is adapted according to the iteration counts of the Newton solver.

source
moment_kinetics.electron_kinetic_equation.electron_kinetic_equation_euler_update!Method
electron_kinetic_equation_euler_update!(f_out, ppar_out, f_in, ppar_in, moments,
                                        z, vperp, vpa, z_spectral, vpa_spectral,
                                        z_advect, vpa_advect, scratch_dummy,
                                        collisions, composition,
                                        external_source_settings,
                                        num_diss_params, t_params, ir;
                                        evolve_ppar=false, ion_dt=nothing)

Do a forward-Euler update of the electron kinetic equation.

When evolve_ppar=true is passed, also updates the electron parallel pressure.

Note that this function operates on a single point in r, given by ir, and f_out, ppar_out, f_in, and ppar_in should have no r-dimension.

source
moment_kinetics.electron_kinetic_equation.fill_electron_kinetic_equation_Jacobian!Method
fill_electron_kinetic_equation_Jacobian!(jacobian_matrix, f, ppar, moments,
                                         collisions, composition, z, vperp, vpa,
                                         z_spectral, vperp_specral,
                                         vpa_spectral, z_advect, vpa_advect,
                                         scratch_dummy, external_source_settings,
                                         num_diss_params, t_params, ion_dt,
                                         ir, evolve_ppar)

Fill a pre-allocated matrix with the Jacobian matrix for electron kinetic equation and (if evolve_ppar=true) the electron energy equation.

source
moment_kinetics.electron_kinetic_equation.implicit_electron_advance!Method
implicit_electron_advance!()

Do an implicit solve which finds: the steady-state electron shape function $g_e$; the backward-Euler advanced electron pressure which is updated using $g_e$ at the new time-level.

The r-dimension is not parallelised. For 1D runs this makes no difference. In 2D it might or might not be necessary. If r-dimension parallelisation is needed, it would need some work. The simplest option would be a non-parallelised outer loop over r, with each nonlinear solve being parallelised over {z,vperp,vpa}. More efficient might be to add an equivalent to the 'anyv' parallelisation used for the collision operator (e.g. 'anyzv'?) to allow the outer r-loop to be parallelised.

source
moment_kinetics.electron_kinetic_equation.update_electron_pdf!Method

updateelectronpdf is a function that uses the electron kinetic equation to solve for the updated electron pdf

The electron kinetic equation is: zdot * d(pdf)/dz + wpadot * d(pdf)/dwpa = pdf * pre_factor

INPUTS:
scratch = `scratch_pdf` struct used to store Runge-Kutta stages
pdf = modified electron pdf @ previous time level = (true electron pdf / dens_e) * vth_e
dens = electron density
vthe = electron thermal speed
ppar = electron parallel pressure
ddens_dz = z-derivative of the electron density
dppar_dz = z-derivative of the electron parallel pressure
dqpar_dz = z-derivative of the electron parallel heat flux
dvth_dz = z-derivative of the electron thermal speed
z = struct containing z-coordinate information
vpa = struct containing vpa-coordinate information
z_spectral = struct containing spectral information for the z-coordinate
vpa_spectral = struct containing spectral information for the vpa-coordinate
scratch_dummy = dummy arrays to be used for temporary storage
dt = time step size
max_electron_pdf_iterations = maximum number of iterations to use in the solution of the electron kinetic equation
ion_dt = if this is passed, the electron pressure is evolved in a form that results in
         a backward-Euler update on the ion timestep (ion_dt) once the electron
         pseudo-timestepping reaches steady state.

OUTPUT: pdf = updated (modified) electron pdf

source
moment_kinetics.electron_kinetic_equation.update_electron_pdf_with_picard_iteration!Method

use Picard iteration to solve the electron kinetic equation

The electron kinetic equation is: zdot * d(pdf)/dz + wpadot * d(pdf)/dwpa = pdf * pre_factor Picard iteration uses the previous iteration of the electron pdf to calculate the next iteration: zdot * d(pdf^{i+1})/dz + wpadot^{i} * d(pdf^{i})/dwpa = pdf^{i} * prefactor^{i}

INPUTS: pdf = modified electron pdf @ previous time level = (true electron pdf / dense) * vthe dens = electron density vthe = electron thermal speed ppar = electron parallel pressure ddensdz = z-derivative of the electron density dppardz = z-derivative of the electron parallel pressure dqpardz = z-derivative of the electron parallel heat flux dvthdz = z-derivative of the electron thermal speed z = struct containing z-coordinate information vpa = struct containing vpa-coordinate information zspectral = struct containing spectral information for the z-coordinate vpaspectral = struct containing spectral information for the vpa-coordinate scratchdummy = dummy arrays to be used for temporary storage maxelectronpdfiterations = maximum number of iterations to use in the solution of the electron kinetic equation OUTPUT: pdf = updated (modified) electron pdf

source
moment_kinetics.electron_kinetic_equation.update_electron_pdf_with_shooting_method!Method

updateelectronpdfwithshooting_method is a function that using a shooting method to solve for the electron pdf

The electron kinetic equation is: zdot * d(pdf)/dz + wpadot * d(pdf)/dwpa = pdf * prefactor The shooting method is 'explicit' in z, solving zdoti * (pdf{i+1} - pdf{i})/dz{i} + wpadot{i} * d(pdf{i})/dwpa = pdf{i} * prefactor{i}

INPUTS:
pdf = modified electron pdf @ previous time level = (true electron pdf / dens_e) * vth_e
dens = electron density
vthe = electron thermal speed
ppar = electron parallel pressure
ddens_dz = z-derivative of the electron density
dppar_dz = z-derivative of the electron parallel pressure
dqpar_dz = z-derivative of the electron parallel heat flux
dvth_dz = z-derivative of the electron thermal speed
z = struct containing z-coordinate information
vpa = struct containing vpa-coordinate information
vpa_spectral = struct containing spectral information for the vpa-coordinate
scratch_dummy = dummy arrays to be used for temporary storage

OUTPUT: pdf = updated (modified) electron pdf

source
moment_kinetics.electron_kinetic_equation.update_electron_pdf_with_time_advance!Method

updateelectronpdfwithtime_advance is a function that introduces an artifical time derivative to advance the electron kinetic equation until a steady-state solution is reached.

The electron kinetic equation is: zdot * d(pdf)/dz + wpadot * d(pdf)/dwpa = pdf * pre_factor

INPUTS:
pdf = modified electron pdf @ previous time level = (true electron pdf / dens_e) * vth_e
dens = electron density
vthe = electron thermal speed
ppar = electron parallel pressure
ddens_dz = z-derivative of the electron density
dppar_dz = z-derivative of the electron parallel pressure
dqpar_dz = z-derivative of the electron parallel heat flux
dvth_dz = z-derivative of the electron thermal speed
z = struct containing z-coordinate information
vpa = struct containing vpa-coordinate information
z_spectral = struct containing spectral information for the z-coordinate
vpa_spectral = struct containing spectral information for the vpa-coordinate
scratch_dummy = dummy arrays to be used for temporary storage
max_electron_pdf_iterations = maximum number of iterations to use in the solution of the electron kinetic equation
io_electron = info struct for binary file I/O
initial_time = initial value for the (pseudo-)time
ion_dt = if this is passed, the electron pressure is evolved in a form that results in
         a backward-Euler update on the ion timestep (ion_dt) once the electron
         pseudo-timestepping reaches steady state.

OUTPUT: pdf = updated (modified) electron pdf

source