external_sources

moment_kinetics.external_sourcesModule

Maxwellian source terms with spatially varying parameters representing external sources of particles and energy.

Note there is no parallel momentum input from the external sources.

The sources can be controlled by a PI controller to set density to a target value or profile. Note that the PI controller should not be used with operator splitting - implementing it in a way that would be compatible with splitting is complicated because the source contributes to several terms.

source
moment_kinetics.external_sources.external_electron_source!Method
external_electron_source!(pdf_out, pdf_in, electron_density, electron_upar,
                          moments, composition, electron_source, index, vperp,
                          vpa, dt, ir)

Add external source term to the electron kinetic equation.

Note that this function operates on a single point in r, given by ir, and pdf_out, pdf_in, electron_density, and electron_upar should have no r-dimension.

source
moment_kinetics.external_sources.external_electron_source_controller!Method
external_electron_source_controller!(fvec_in, moments, electron_source_settings, dt)

Calculate the amplitude, e.g. when using a PI controller for the density to set the external source amplitude.

As the electron density source must be equal to the ion density source in order not to inject charge into the simulation, the electron source (at least in some modes of operation) depends on the ion source, so external_ion_source_controller! must be called before this function is called so that moments.ion.external_source_amplitude is up to date.

source
moment_kinetics.external_sources.initialize_external_source_amplitude!Method
initialize_external_source_amplitude!(moments, external_source_settings, vperp,
                                      vzeta, vr, n_neutral_species)

Initialize the arrays moments.ion.external_source_amplitude, moments.ion.external_source_density_amplitude, moments.ion.external_source_momentum_amplitude, moments.ion.external_source_pressure_amplitude, moments.electron.external_source_amplitude, moments.electron.external_source_density_amplitude, moments.electron.external_source_momentum_amplitude, moments.electron.external_source_pressure_amplitude, moments.neutral.external_source_amplitude, moments.neutral.external_source_density_amplitude, moments.neutral.external_source_momentum_amplitude, and moments.neutral.external_source_pressure_amplitude, using the settings in external_source_settings

source
moment_kinetics.external_sources.setup_external_sources!Method
setup_external_sources!(input_dict, r, z)

Set up parameters for the external sources using settings in input_dict.

Updates input_dict with defaults for unset parameters.

r and z are the coordinates.coordinate objects for the r- and z-coordinates.

Returns a NamedTuple (ion=ion_source_settings, neutral=neutral_source_settings) containing two NamedTuples of settings.

source