external_sources
moment_kinetics.external_sources
— ModuleMaxwellian 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.
moment_kinetics.external_sources.external_electron_source!
— Methodexternal_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.
moment_kinetics.external_sources.external_electron_source_controller!
— Methodexternal_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.
moment_kinetics.external_sources.external_ion_source!
— Methodexternal_ion_source!(pdf, fvec, moments, ion_source_settings, vperp, vpa, dt)
Add external source term to the ion kinetic equation.
moment_kinetics.external_sources.external_ion_source_controller!
— Methodexternal_ion_source_controller!(fvec_in, moments, ion_source_settings, dt)
Calculate the amplitude when using a PI controller for the density to set the external source amplitude.
moment_kinetics.external_sources.external_neutral_source!
— Methodexternal_neutral_source!(pdf, fvec, moments, neutral_source_settings, vzeta, vr,
vz, dt)
Add external source term to the neutral kinetic equation.
moment_kinetics.external_sources.external_neutral_source_controller!
— Methodexternal_neutral_source_controller!(fvec_in, moments, neutral_source_settings, r,
z, dt)
Calculate the amplitude when using a PI controller for the density to set the external source amplitude.
moment_kinetics.external_sources.get_source_profile
— Methodget_source_profile(profile_type, width, min_val, coord)
Create a profile of type profile_type
with width width
for coordinate coord
.
moment_kinetics.external_sources.initialize_external_source_amplitude!
— Methodinitialize_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
moment_kinetics.external_sources.initialize_external_source_controller_integral!
— Methodfunction initializeexternalsourcecontrollerintegral!( moments, externalsourcesettings, nneutralspecies)
Initialize the arrays moments.ion.external_source_controller_integral
and moments.neutral.external_source_controller_integral
, using the settings in external_source_settings
moment_kinetics.external_sources.setup_external_sources!
— Methodsetup_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.
moment_kinetics.external_sources.total_external_electron_source_controllers!
— Methodtotal_external_electron_source_controllers!(fvec_in, moments, electron_sources, dt)
Contribute all of the electron source controllers to fvec_in, one by one.
moment_kinetics.external_sources.total_external_electron_sources!
— Methodtotal_external_electron_sources!(pdf_out, pdf_in, electron_density, electron_upar,
moments, composition, electron_sources, vperp,
vpa, dt, ir)
Contribute all of the electron sources to the electron pdf, one by one.
moment_kinetics.external_sources.total_external_ion_source_controllers!
— Methodtotal_external_ion_source_controllers!(fvec_in, moments, ion_sources, dt)
Contribute all of the ion source controllers to fvec_in, one by one.
moment_kinetics.external_sources.total_external_ion_sources!
— Methodtotal_external_ion_sources!(pdf, fvec, moments, ion_sources, vperp, vpa, dt, scratch_dummy)
Contribute all of the ion sources to the ion pdf, one by one.
moment_kinetics.external_sources.total_external_neutral_source_controllers!
— Methodtotal_external_neutral_source_controllers!(fvec_in, moments, neutral_sources, dt)
Contribute all of the neutral source controllers to fvec_in, one by one.