chombo-discharge
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Physics::ItoKMC::ItoKMCJSON Class Reference

Implementation of ItoKMCPhysics which parses input data from a JSON file. More...

#include <CD_ItoKMCJSON.H>

Inheritance diagram for Physics::ItoKMC::ItoKMCJSON:
Inheritance graph
[legend]
Collaboration diagram for Physics::ItoKMC::ItoKMCJSON:
Collaboration graph
[legend]

Public Types

using FunctionXt = std::function< Real(const RealVect a_position, const Real a_time)>
 Function alias for e.g. initial data. More...
 
using FunctionEN = std::function< Real(const Real a_E, const Real a_N)>
 Function for encapsulating operations f = f(E,N). field in Townsend units. More...
 
using FunctionX = std::function< Real(const RealVect a_position)>
 Function for encapsulating a function f = f(x) where x is the physical coordinates. More...
 
using FunctionEX = std::function< Real(const Real E, const RealVect x)>
 Function for encapsulating a function f = f(E, x) where E is the electric field at physical coordinates x. More...
 
using FunctionEVX = std::function< Real(const Real E, const Real V, const RealVect x)>
 Function for encapsulating a function f = f(E, V, x) where E is the electric field at physical coordinates x, and V is a grid cell volume. More...
 
using FunctionT = std::function< Real(const Real a_T)>
 Function for encapsulating a function f = f(T) where T is the temperature of some species. More...
 
using FunctionTT = std::function< Real(const Real a_T1, const Real a_T2)>
 Function for encapsulating a function f = f(T1, T2) where T1/T2 are temperatures of two species. More...
 

Public Member Functions

 ItoKMCJSON ()
 Default constructor.
 
virtual ~ItoKMCJSON () noexcept
 Destructor.
 
virtual void parseRuntimeOptions () noexcept override
 Parse run-time options.
 
virtual Real computeDt (const RealVect a_E, const RealVect a_pos, const Vector< Real > a_densities) const noexcept override
 Compute a physics-based time step. More...
 
virtual Real computeAlpha (const Real a_E, const RealVect a_pos) const noexcept override
 Compute Townsend ionization coefficient. More...
 
virtual Real computeEta (const Real a_E, const RealVect a_pos) const noexcept override
 Compute Townsend attachment coefficient. More...
 
virtual Vector< std::string > getPlotVariableNames () const noexcept override
 Get number of plot variables.
 
virtual Vector< Real > getPlotVariables (const RealVect a_E, const RealVect a_pos, const Vector< Real > &a_phi, const Vector< RealVect > &a_gradPhi, const Real a_dx, const Real a_kappa) const noexcept override
 Get plot variables. More...
 
virtual int getNumberOfPlotVariables () const noexcept override
 Get number of plot variables.
 
virtual bool needGradients () const noexcept override
 Return true/false if physics model needs species gradients.
 
virtual Vector< Real > computeMobilities (const Real a_time, const RealVect a_pos, const RealVect a_E) const noexcept override
 Compute the Ito solver mobilities. More...
 
virtual Vector< Real > computeDiffusionCoefficients (const Real a_time, const RealVect a_pos, const RealVect a_E) const noexcept override
 Compute the Ito solver diffusion coefficients. More...
 
virtual void secondaryEmissionEB (Vector< List< ItoParticle >> &a_secondaryParticles, Vector< Real > &a_secondaryCDRFluxes, Vector< List< Photon >> &a_secondaryPhotons, const Vector< List< ItoParticle >> &a_primaryParticles, const Vector< Real > &a_primaryCDRFluxes, const Vector< List< Photon >> &a_primaryPhotons, const RealVect &a_E, const RealVect &a_cellCenter, const RealVect &a_cellCentroid, const RealVect &a_bndryCentroid, const RealVect &a_bndryNormal, const Real a_bndryArea, const Real a_dx, const Real a_dt, const bool a_isDielectric, const int a_matIndex) const noexcept override
 Resolve secondary emission at the EB. More...
 
- Public Member Functions inherited from Physics::ItoKMC::ItoKMCPhysics
 ItoKMCPhysics () noexcept
 Constructor. Does nothing.
 
virtual ~ItoKMCPhysics () noexcept
 Destructor. Does nothing.
 
void defineKMC () const noexcept
 Define the KMC solver and state.
 
void killKMC () const noexcept
 Kill the KMC solver.
 
const Vector< RefCountedPtr< ItoSpecies > > & getItoSpecies () const
 Get all particle drift-diffusion species. More...
 
const Vector< RefCountedPtr< CdrSpecies > > & getCdrSpecies () const
 Get all fluid drift-diffusion species. More...
 
const Vector< RefCountedPtr< RtSpecies > > & getRtSpecies () const
 Get all photon species. More...
 
int getNumItoSpecies () const
 Return number of Ito solvers.
 
int getNumCdrSpecies () const
 Return number of CDR solvers.
 
int getNumPlasmaSpecies () const
 Return total number of plasma species.
 
int getNumPhotonSpecies () const
 Return number of RTE solvers.
 
const std::map< int, std::pair< SpeciesType, int > > & getSpeciesMap () const noexcept
 Get the internal mapping between plasma species and Ito solvers.
 
virtual Real initialSigma (const Real a_time, const RealVect a_pos) const
 Set initial surface charge. Default is 0, override if you want. More...
 
void advanceKMC (Vector< FPR > &a_numParticles, Vector< FPR > &a_numNewPhotons, const Vector< Real > &a_phi, const Vector< RealVect > &a_gradPhi, const Real a_dt, const RealVect a_E, const RealVect a_pos, const Real a_dx, const Real a_kappa) const
 Advance particles. More...
 
void reconcileParticles (Vector< List< ItoParticle > * > &a_particles, const Vector< FPR > &a_newNumParticles, const Vector< FPR > &a_oldNumParticles, const RealVect a_cellPos, const RealVect a_centroidPos, const RealVect a_lo, const RealVect a_hi, const RealVect a_bndryCentroid, const RealVect a_bndryNormal, const Real a_dx, const Real a_kappa) const noexcept
 Reconcile the number of particles. More...
 
void reconcilePhotons (Vector< List< Photon > * > &a_newPhotons, const Vector< FPR > &a_numNewPhotons, const RealVect a_cellPos, const RealVect a_centroidPos, const RealVect a_lo, const RealVect a_hi, const RealVect a_bndryCentroid, const RealVect a_bndryNormal, const Real a_dx, const Real a_kappa) const noexcept
 Generate new photons. More...
 
void reconcilePhotoionization (Vector< List< ItoParticle > * > &a_itoParticles, Vector< List< PointParticle > * > &a_cdrParticles, const Vector< List< Photon > * > &a_absorbedPhotons) const noexcept
 Reconcile photoionization reactions. More...
 

Protected Member Functions

virtual std::string trim (const std::string &a_string) const noexcept
 Trim a string. This removes whitespace before/after. More...
 
virtual void parseJSON ()
 Parse the JSON file.
 
virtual void parseVerbose () noexcept
 Parse chattiness.
 
virtual void throwParserError (const std::string a_error) const noexcept
 Throw a parser error. More...
 
virtual void throwParserWarning (const std::string a_warning) const noexcept
 Throw a parser wearning. More...
 
virtual bool doesFileExist (const std::string a_filename) const noexcept
 Check if a file exists. More...
 
virtual bool isBackgroundSpecies (const std::string &a_name) const noexcept
 Return true if species is a background species. More...
 
virtual bool isPlasmaSpecies (const std::string &a_name) const noexcept
 Return true if species is a plasma species. More...
 
virtual bool isPhotonSpecies (const std::string &a_name) const noexcept
 Return true if species is a photon species. More...
 
virtual bool containsWildcard (const std::string a_str) const noexcept
 Check if a string contains the wildcard @ and return true if it does. More...
 
virtual bool containsBracket (const std::string a_str) const noexcept
 Check if a string contains standard brackets. More...
 
virtual bool isBracketed (const std::string a_str) const noexcept
 Check if a string contains starts with '(' and ends with ')'. More...
 
virtual void checkMolarFraction (const RealVect a_position) const noexcept
 Check that molar fraction is one. Throws a warning if it isn't. More...
 
virtual void sanctifyPlasmaReaction (const std::vector< std::string > &a_reactants, const std::vector< std::string > &a_products, const std::string &a_reaction) const noexcept
 Check that a plasma reaction makes sense. I.e. that all species are properly defined and that it conserves charge. More...
 
virtual void sanctifyPhotoReaction (const std::vector< std::string > &a_reactants, const std::vector< std::string > &a_products, const std::string &a_reaction) const noexcept
 Check that a photo-reaction makes sense. I.e. that all species are properly defined and that it conserves charge. More...
 
virtual void initializeGasLaw ()
 Initialize gas law.
 
virtual void initializeBackgroundSpecies ()
 Initialize the background species.
 
virtual void initializeTownsendCoefficient (const std::string a_coeff)
 Parse one of the Townsend coefficients. More...
 
virtual void initializeAutomaticTownsend (const std::string a_coeff)
 Initialize automatic Townsend coefficient (ionizatino or attachment) from the reaction rates. More...
 
virtual void previewFunctionEX (const nlohmann::json &a_json, const FunctionEX &a_function) const
 Simple function for previewing a rate/coefficient defined as a function f = f(E,x) More...
 
virtual void printFluidRates () const noexcept
 Print the fluid-representation of the reaction rates.
 
virtual void initializePlasmaSpecies ()
 Initialize the plasma species.
 
virtual void initializeParticles ()
 Parse initial particles.
 
virtual void initializeMobilities ()
 Initialize mobility functions.
 
virtual void initializeDiffusionCoefficients ()
 Initialize diffusion coefficients.
 
virtual void initializeTemperatures ()
 Initialize the plasma species temperatures.
 
virtual void initializePhotonSpecies ()
 Initialize the photon species.
 
virtual void initializePlasmaReactions ()
 Initialize plasma reactions.
 
virtual void initializePhotoReactions ()
 Initialize photo-reactions.
 
virtual void initializeSurfaceEmission (const std::string a_surface)
 Initialize surface reactions. More...
 
virtual void parseReactionString (std::vector< std::string > &a_reactants, std::vector< std::string > &a_products, const std::string &a_reaction) const noexcept
 Parses a reaction string into reactangs and products. More...
 
virtual void getReactionSpecies (std::list< size_t > &a_backgroundReactants, std::list< size_t > &a_plasmaReactants, std::list< size_t > &a_photonReactants, std::list< size_t > &a_backgroundProducts, std::list< size_t > &a_plasmaProducts, std::list< size_t > &a_photonProducts, const std::vector< std::string > &a_reactants, const std::vector< std::string > &a_products) const noexcept
 Turn reactants and products strings into indices. More...
 
virtual std::pair< FunctionEVX, FunctionEXparsePlasmaReactionRate (const nlohmann::json &a_reactionJSON, const std::list< size_t > &a_backgroundReactants, const std::list< size_t > &a_plasmaReactants) const
 Parse a plasma reaction rate and turn it into a function. More...
 
virtual std::pair< bool, std::string > parsePlasmaReactionPlot (const nlohmann::json &a_reactionJSON) const
 Parse whether or not a reaction rate should be plotted. More...
 
virtual std::pair< bool, std::string > parsePlasmaReactionGradientCorrection (const nlohmann::json &a_reactionJSON) const
 Parse whether or not a reaction uses a gradient correction for the rate. More...
 
virtual LookupTable1D< Real, 1 > parseTableEByN (const nlohmann::json &a_tableEntry, const std::string &a_dataID) const
 Parse a table which is stored in E/N format. More...
 
virtual std::vector< std::tuple< std::string, std::vector< std::string >, std::vector< std::string > > > parseReactionWildcards (const std::vector< std::string > &a_reactants, const std::vector< std::string > &a_products, const nlohmann::json &a_reactionJSON) const noexcept
 Make a reaction set into a superset. This parses wildcards '@' in reaction string. More...
 
virtual void updateReactionRates (std::vector< std::shared_ptr< const KMCReaction >> &a_kmcReactions, const RealVect a_E, const RealVect a_pos, const Vector< Real > &a_phi, const Vector< RealVect > &a_gradPhi, const Real a_dx, const Real a_kappa) const noexcept override
 Update reaction rates. More...
 
std::vector< size_t > multinomial (const size_t N, const std::discrete_distribution< size_t > &a_distribution) const noexcept
 Sample a multinomial distribution with N samples. More...
 
- Protected Member Functions inherited from Physics::ItoKMC::ItoKMCPhysics
void define () noexcept
 Define method – defines all the internal machinery.
 
void defineSpeciesMap () noexcept
 Build internal representation of how we distinguish the Ito and CDR solvers. More...
 
void definePhotoPathways () noexcept
 Define pathways for photo-reactions.
 
void parsePPC () noexcept
 Parse the maximum number of particles generated per cell.
 
void parseDebug () noexcept
 Parse the maximum number of particles generated per cell.
 
void parseAlgorithm () noexcept
 Parse reaction algorithm.
 
void removeParticles (List< ItoParticle > &a_particles, const long long a_numToRemove) const
 Remove particles from the input list. More...
 

Protected Attributes

bool m_verbose
 Verbose or not.
 
bool m_plotGas
 Plot gas pressure, density, and temperature.
 
bool m_plotAlpha
 Plot Townsend ionization coefficient.
 
bool m_plotEta
 Plot Townsend attachment coefficient.
 
bool m_skipReactions
 A flag for skipping reactions completely.
 
bool m_previewRates
 Preview rates or not.
 
int m_numPlasmaSpecies
 Total number of plasma species.
 
int m_numPhotonSpecies
 Total number of photon species.
 
nlohmann::json m_json
 Nohmanns implementation of JSON files.
 
std::string m_jsonFile
 Input JSON file name.
 
std::set< std::string > m_allSpecies
 All species that have been defined. More...
 
std::map< std::string, int > m_backgroundSpeciesMap
 Map of string-int identifiers for background species.
 
std::map< int, std::string > m_backgroundSpeciesMapInverse
 Map of int-string identifiers for background species.
 
std::vector< ItoKMCBackgroundSpeciesm_backgroundSpecies
 Map of background species. More...
 
std::vector< bool > m_backgroundSpeciesPlot
 Plot background species or not. More...
 
std::map< std::string, SpeciesTypem_plasmaSpeciesTypes
 Map for identifying a species name with a solver type.
 
std::map< std::string, int > m_itoSpeciesMap
 Map for indexing from an ID to an Ito solver index.
 
std::map< std::string, int > m_cdrSpeciesMap
 Map for indexing from an ID to an Ito solver index.
 
std::map< std::string, int > m_plasmaIndexMap
 Map for indexing a plasma species name to a global index in the solver vectors.
 
std::map< std::string, int > m_photonIndexMap
 Map for indexing a photon species name to a global index in the solver vectors.
 
std::vector< FunctionEXm_mobilityFunctions
 Mobilities for the various species.
 
std::vector< FunctionEXm_diffusionCoefficients
 Diffusion coefficients for the various species.
 
std::vector< FunctionEXm_plasmaTemperatures
 Plasma species temperatures.
 
std::vector< FunctionEVXm_kmcReactionRates
 Function-based plasma reaction rates. Same index as the actual reactions.
 
std::vector< FunctionEXm_fluidRates
 Function-based plasma reaction rates as if they appeared in the reaction rate equation. Same index as actual reactions. More...
 
std::vector< std::list< size_t > > m_plasmaReactionBackgroundReactants
 List of background species involved in a reaction.
 
std::vector< std::list< size_t > > m_plasmaReactionPlasmaReactants
 List of plasma species on the left-hand side of a reaction.
 
std::vector< std::list< size_t > > m_plasmaReactionPlasmaProducts
 List of plasma species on the right-hand side of a reaction.
 
std::vector< std::list< size_t > > m_plasmaReactionPhotonProducts
 List of photon species on the right-hand side of a reaction.
 
std::vector< std::pair< bool, std::string > > m_kmcReactionGradientCorrections
 Whether or not a reaction uses a gradient correction for the rate (Soloviev et. al. paper)
 
std::vector< std::pair< bool, std::string > > m_kmcReactionRatePlots
 Map of reactions that will be plotted.
 
std::map< int, std::pair< bool, int > > m_plasmaReactionSolovievCorrection
 Map of reactions that will be plotted.
 
std::pair< bool, std::string > m_autoAlpha
 Flag if the user wants to compute the alpha coefficient from the reactions.
 
std::pair< bool, std::string > m_autoEta
 Flag if the user wants to compute the alpha coefficient from the reactions.
 
FunctionEX m_alpha
 Townsend ionization coefficient. Defined during parseAlpha.
 
FunctionEX m_eta
 Townsend attachment coefficient. Defined during parseEta.
 
FunctionX m_gasPressure
 Background gas pressure.
 
FunctionX m_gasTemperature
 Background gas temperature.
 
FunctionX m_gasNumberDensity
 Background gas number density.
 
- Protected Attributes inherited from Physics::ItoKMC::ItoKMCPhysics
Algorithm m_algorithm
 Algorithm to use for KMC advance.
 
ParticlePlacement m_particlePlacement
 Particle placement algorithm.
 
std::map< int, std::pair< SpeciesType, int > > m_speciesMap
 Map for associating a plasma species with an Ito solver or CDR solver.
 
std::string m_className
 Class name. Used for options parsing.
 
bool m_debug
 Turn on/off debugging.
 
bool m_isDefined
 Is defined or not.
 
std::vector< KMCReactionm_kmcReactions
 List of reactions for the KMC solver.
 
std::vector< ItoKMCPhotoReactionm_photoReactions
 List of photoionization reactions.
 
std::map< int, std::pair< std::discrete_distribution< int >, std::map< int, int > > > m_photoPathways
 Random number generators for photoionization pathways. More...
 
ItoKMCSurfaceReactionSet m_surfaceReactions
 Surface reactions.
 
Vector< RefCountedPtr< ItoSpecies > > m_itoSpecies
 List of solver-tracked particle drift-diffusion species.
 
Vector< RefCountedPtr< CdrSpecies > > m_cdrSpecies
 List of solver-tracked fluid drift-diffusion species.
 
Vector< RefCountedPtr< RtSpecies > > m_rtSpecies
 List of solver-tracked photon species.
 
int m_maxNewParticles
 Maximum new number of particles generated by the chemistry advance.
 
int m_maxNewPhotons
 Maximum new number of photons generated by the chemistry advance.
 
int m_Ncrit
 Solver setting for the Cao et. al algorithm. More...
 
int m_NSSA
 Solver setting for the Cao et. al algorithm. More...
 
Real m_SSAlim
 Solver setting for the Cao et. al. algorithm. More...
 
Real m_eps
 Solver setting for the Cao et. al. algorithm. More...
 

Additional Inherited Members

- Protected Types inherited from Physics::ItoKMC::ItoKMCPhysics
enum class  Algorithm {
  SSA , TauPlain , TauMidpoint , HybridPlain ,
  HybridMidpoint
}
 Enum for switching between KMC algorithms. More...
 
enum class  ParticlePlacement { Random , Centroid }
 Enum for switching between various particle placement algorithms.
 
- Static Protected Attributes inherited from Physics::ItoKMC::ItoKMCPhysics
static thread_local bool m_hasKMCSolver
 Is the KMC solver defined or not.
 
static thread_local KMCSolverType m_kmcSolver
 Kinetic Monte Carlo solver used in advanceReactionNetwork.
 
static thread_local KMCState m_kmcState
 KMC state used in advanceReactionNetwork.
 
static thread_local std::vector< std::shared_ptr< const KMCReaction > > m_kmcReactionsThreadLocal
 KMC reactions used in advanceReactionNetowkr. More...
 

Detailed Description

Implementation of ItoKMCPhysics which parses input data from a JSON file.

Member Typedef Documentation

◆ FunctionEN

using Physics::ItoKMC::ItoKMCJSON::FunctionEN = std::function<Real(const Real a_E, const Real a_N)>

Function for encapsulating operations f = f(E,N). field in Townsend units.

Parameters
[in]a_EElectric field in SI units.
[in]a_NNeutral density.
Returns
Returns f = f(E,N).
Note
a_E is in SI units and the neutral density is in m^-3.

◆ FunctionEVX

using Physics::ItoKMC::ItoKMCJSON::FunctionEVX = std::function<Real(const Real E, const Real V, const RealVect x)>

Function for encapsulating a function f = f(E, V, x) where E is the electric field at physical coordinates x, and V is a grid cell volume.

Parameters
[in]EElectric field magnitude in SI units.
[in]VVolume
[in]xPhysical coordinates

◆ FunctionEX

using Physics::ItoKMC::ItoKMCJSON::FunctionEX = std::function<Real(const Real E, const RealVect x)>

Function for encapsulating a function f = f(E, x) where E is the electric field at physical coordinates x.

Parameters
[in]EElectric field magnitude in SI units.
[in]xPhysical coordinates

◆ FunctionT

using Physics::ItoKMC::ItoKMCJSON::FunctionT = std::function<Real(const Real a_T)>

Function for encapsulating a function f = f(T) where T is the temperature of some species.

Parameters
[in]a_TSome temperature.

◆ FunctionTT

using Physics::ItoKMC::ItoKMCJSON::FunctionTT = std::function<Real(const Real a_T1, const Real a_T2)>

Function for encapsulating a function f = f(T1, T2) where T1/T2 are temperatures of two species.

Parameters
[in]a_T1Some species temperature.
[in]a_T2Some other species temperature.

◆ FunctionX

using Physics::ItoKMC::ItoKMCJSON::FunctionX = std::function<Real(const RealVect a_position)>

Function for encapsulating a function f = f(x) where x is the physical coordinates.

Parameters
[in]a_positionPhysical coordinates
Returns
Returns f(x)

◆ FunctionXt

using Physics::ItoKMC::ItoKMCJSON::FunctionXt = std::function<Real(const RealVect a_position, const Real a_time)>

Function alias for e.g. initial data.

Parameters
[in]a_positionPhysical coordinates
[in]a_timeTime

Member Function Documentation

◆ checkMolarFraction()

void ItoKMCJSON::checkMolarFraction ( const RealVect  a_position) const
protectedvirtualnoexcept

Check that molar fraction is one. Throws a warning if it isn't.

Parameters
[in]a_positionPhysical coordinates

◆ computeAlpha()

Real ItoKMCJSON::computeAlpha ( const Real  a_E,
const RealVect  a_pos 
) const
overridevirtualnoexcept

Compute Townsend ionization coefficient.

Parameters
[in]a_EElectric field.
[in]a_posPhysical coordinates

Implements Physics::ItoKMC::ItoKMCPhysics.

◆ computeDiffusionCoefficients()

Vector< Real > ItoKMCJSON::computeDiffusionCoefficients ( const Real  a_time,
const RealVect  a_pos,
const RealVect  a_E 
) const
overridevirtualnoexcept

Compute the Ito solver diffusion coefficients.

Parameters
[in]a_timeTime
[in]a_posPosition
[in]a_EElectric field

Implements Physics::ItoKMC::ItoKMCPhysics.

◆ computeDt()

Real ItoKMCJSON::computeDt ( const RealVect  a_E,
const RealVect  a_pos,
const Vector< Real >  a_densities 
) const
overridevirtualnoexcept

Compute a physics-based time step.

Parameters
[in]a_EElectric field.
[in]a_posPosition
[in]a_numParticlesNumber of particles per cell

Reimplemented from Physics::ItoKMC::ItoKMCPhysics.

◆ computeEta()

Real ItoKMCJSON::computeEta ( const Real  a_E,
const RealVect  a_pos 
) const
overridevirtualnoexcept

Compute Townsend attachment coefficient.

Parameters
[in]a_EElectric field.
[in]a_posPhysical coordinates

Implements Physics::ItoKMC::ItoKMCPhysics.

◆ computeMobilities()

Vector< Real > ItoKMCJSON::computeMobilities ( const Real  a_time,
const RealVect  a_pos,
const RealVect  a_E 
) const
overridevirtualnoexcept

Compute the Ito solver mobilities.

Parameters
[in]a_timeTime
[in]a_posPosition
[in]a_EElectric field

Implements Physics::ItoKMC::ItoKMCPhysics.

◆ containsBracket()

bool ItoKMCJSON::containsBracket ( const std::string  a_str) const
protectedvirtualnoexcept

Check if a string contains standard brackets.

Parameters
[in]a_strInput string

◆ containsWildcard()

bool ItoKMCJSON::containsWildcard ( const std::string  a_str) const
protectedvirtualnoexcept

Check if a string contains the wildcard @ and return true if it does.

Parameters
[in]a_strInput string

◆ doesFileExist()

bool ItoKMCJSON::doesFileExist ( const std::string  a_filename) const
protectedvirtualnoexcept

Check if a file exists.

Parameters
[in]a_filenameFile name

◆ getPlotVariables()

Vector< Real > ItoKMCJSON::getPlotVariables ( const RealVect  a_E,
const RealVect  a_pos,
const Vector< Real > &  a_phi,
const Vector< RealVect > &  a_gradPhi,
const Real  a_dx,
const Real  a_kappa 
) const
overridevirtualnoexcept

Get plot variables.

Parameters
[in]a_EElectric field
[in]a_posPhysical position
[in]a_phiPlasma species densities
[in]a_gradPhiDensity gradients for plasma species.
[in]a_dxGrid resolution
[in]a_kappaCut-cell volume fraction

Reimplemented from Physics::ItoKMC::ItoKMCPhysics.

◆ getReactionSpecies()

void ItoKMCJSON::getReactionSpecies ( std::list< size_t > &  a_backgroundReactants,
std::list< size_t > &  a_plasmaReactants,
std::list< size_t > &  a_photonReactants,
std::list< size_t > &  a_backgroundProducts,
std::list< size_t > &  a_plasmaProducts,
std::list< size_t > &  a_photonProducts,
const std::vector< std::string > &  a_reactants,
const std::vector< std::string > &  a_products 
) const
protectedvirtualnoexcept

Turn reactants and products strings into indices.

Parameters
[out]a_backgroundReactantsBackground reactant indices
[out]a_plasmaReactantsPlasma reactant indices
[out]a_photonReactantsPhoton reactant indices
[out]a_backgroundProductsBackground product indices
[out]a_plasmaProductsPlasma product indices
[out]a_photonProductsPhoton product indices
[in]a_reactantsReactants
[in]a_productsProducts

◆ initializeAutomaticTownsend()

void ItoKMCJSON::initializeAutomaticTownsend ( const std::string  a_coeff)
protectedvirtual

Initialize automatic Townsend coefficient (ionizatino or attachment) from the reaction rates.

Parameters
[in]a_coeffWhich coefficient. Must be "alpha" or "eta"

◆ initializeSurfaceEmission()

void ItoKMCJSON::initializeSurfaceEmission ( const std::string  a_surface)
protectedvirtual

Initialize surface reactions.

Parameters
[in]a_surfaceSurface type

◆ initializeTownsendCoefficient()

void ItoKMCJSON::initializeTownsendCoefficient ( const std::string  a_coeff)
protectedvirtual

Parse one of the Townsend coefficients.

Parameters
[in]a_coeffWhich coefficient. Must be "alpha" or "eta"

◆ isBackgroundSpecies()

bool ItoKMCJSON::isBackgroundSpecies ( const std::string &  a_name) const
protectedvirtualnoexcept

Return true if species is a background species.

Parameters
[in]a_nameSpecies name

◆ isBracketed()

bool ItoKMCJSON::isBracketed ( const std::string  a_str) const
protectedvirtualnoexcept

Check if a string contains starts with '(' and ends with ')'.

Parameters
[in]a_strInput string

◆ isPhotonSpecies()

bool ItoKMCJSON::isPhotonSpecies ( const std::string &  a_name) const
protectedvirtualnoexcept

Return true if species is a photon species.

Parameters
[in]a_nameSpecies name

◆ isPlasmaSpecies()

bool ItoKMCJSON::isPlasmaSpecies ( const std::string &  a_name) const
protectedvirtualnoexcept

Return true if species is a plasma species.

Parameters
[in]a_nameSpecies name

◆ multinomial()

std::vector< size_t > ItoKMCJSON::multinomial ( const size_t  N,
const std::discrete_distribution< size_t > &  a_distribution 
) const
protectednoexcept

Sample a multinomial distribution with N samples.

Parameters
[in]a_NNumber of samples
[in]a_distributionDiscrete distribution

◆ parsePlasmaReactionGradientCorrection()

std::pair< bool, std::string > ItoKMCJSON::parsePlasmaReactionGradientCorrection ( const nlohmann::json &  a_reactionJSON) const
protectedvirtual

Parse whether or not a reaction uses a gradient correction for the rate.

Parameters
[in]a_reactionJSONReaction entry in JSON file

◆ parsePlasmaReactionPlot()

std::pair< bool, std::string > ItoKMCJSON::parsePlasmaReactionPlot ( const nlohmann::json &  a_reactionJSON) const
protectedvirtual

Parse whether or not a reaction rate should be plotted.

Parameters
[in]a_reactionJSONReaction entry in JSON file

◆ parsePlasmaReactionRate()

std::pair< std::function< Real(const Real E, const Real V, const RealVect x)>, std::function< Real(const Real E, const RealVect x)> > ItoKMCJSON::parsePlasmaReactionRate ( const nlohmann::json &  a_reactionJSON,
const std::list< size_t > &  a_backgroundReactants,
const std::list< size_t > &  a_plasmaReactants 
) const
protectedvirtual

Parse a plasma reaction rate and turn it into a function.

Parameters
[in]a_reactionJSONReaction entry in JSON file
[in]a_backgroundReactantsList of background species appearing on the left hand side of the reaction
[in]a_plasmaReactantsList of plasma species appearing on the left-hand side of the reaction
Returns
This should return a tuple of KMC and fluid rates. The KMC rate will also be multiplied by background species on the left hand side of the reaction.

◆ parseReactionString()

void ItoKMCJSON::parseReactionString ( std::vector< std::string > &  a_reactants,
std::vector< std::string > &  a_products,
const std::string &  a_reaction 
) const
protectedvirtualnoexcept

Parses a reaction string into reactangs and products.

Parameters
[out]a_reactantsLeft-hand side of reaction
[out]a_productsRight-hand side of reaction
[in]a_reactionReaction string. Must be in format "a + b + c -> e + f + g".

◆ parseReactionWildcards()

std::vector< std::tuple< std::string, std::vector< std::string >, std::vector< std::string > > > ItoKMCJSON::parseReactionWildcards ( const std::vector< std::string > &  a_reactants,
const std::vector< std::string > &  a_products,
const nlohmann::json &  a_reactionJSON 
) const
protectedvirtualnoexcept

Make a reaction set into a superset. This parses wildcards '@' in reaction string.

Parameters
[in]a_reactantsList of reactants. Can contain wildcard.
[in]a_productsList of products. Can contain wildcard.
[in]a_reactionJSONJSON reaction entry.
Returns
Returns a list of reactants and products with wilcards replaced. The tuple entries are: <wildcard, reactants, products>

◆ parseTableEByN()

LookupTable1D< Real, 1 > ItoKMCJSON::parseTableEByN ( const nlohmann::json &  a_tableEntry,
const std::string &  a_dataID 
) const
protectedvirtual

Parse a table which is stored in E/N format.

Parameters
[in]a_tableEntryTable entry in JSON format.
[in]a_dataIDData identifier

◆ previewFunctionEX()

void ItoKMCJSON::previewFunctionEX ( const nlohmann::json &  a_json,
const FunctionEX a_function 
) const
protectedvirtual

Simple function for previewing a rate/coefficient defined as a function f = f(E,x)

Parameters
[in]a_jsonJSON entry containing the previewing information.
[in]a_functionFunction to be previewed.

◆ sanctifyPhotoReaction()

void ItoKMCJSON::sanctifyPhotoReaction ( const std::vector< std::string > &  a_reactants,
const std::vector< std::string > &  a_products,
const std::string &  a_reaction 
) const
protectedvirtualnoexcept

Check that a photo-reaction makes sense. I.e. that all species are properly defined and that it conserves charge.

Parameters
[in]a_reactantsReactants
[in]a_productsReaction products
[in]a_reactionReaction string

◆ sanctifyPlasmaReaction()

void ItoKMCJSON::sanctifyPlasmaReaction ( const std::vector< std::string > &  a_reactants,
const std::vector< std::string > &  a_products,
const std::string &  a_reaction 
) const
protectedvirtualnoexcept

Check that a plasma reaction makes sense. I.e. that all species are properly defined and that it conserves charge.

Parameters
[in]a_reactantsReactants
[in]a_productsReaction products
[in]a_reactionReaction string

◆ secondaryEmissionEB()

void ItoKMCJSON::secondaryEmissionEB ( Vector< List< ItoParticle >> &  a_secondaryParticles,
Vector< Real > &  a_secondaryCDRFluxes,
Vector< List< Photon >> &  a_secondaryPhotons,
const Vector< List< ItoParticle >> &  a_primaryParticles,
const Vector< Real > &  a_primaryCDRFluxes,
const Vector< List< Photon >> &  a_primaryPhotons,
const RealVect &  a_E,
const RealVect &  a_cellCenter,
const RealVect &  a_cellCentroid,
const RealVect &  a_bndryCentroid,
const RealVect &  a_bndryNormal,
const Real  a_bndryArea,
const Real  a_dx,
const Real  a_dt,
const bool  a_isDielectric,
const int  a_matIndex 
) const
overridevirtualnoexcept

Resolve secondary emission at the EB.

Routine is here to handle charge injection, secondary emission etc.

Parameters
[out]a_secondaryParticlesOutgoing plasma species particles.
[out]a_secondaryCDRFluxesOutgoing plasma species CDR fluxes
[out]a_secondaryPhotonsPhotons injected through the EB
[in]a_primaryParticlesParticles that left the computational domain through the EB
[in]a_primaryCDRFluxesCDR fluxes leaving the computational domain through the EB
[in]a_primaryPhotonsPhotons that left the computational domain through the EB
[in]a_newNumParticlesTotal number of particles in the cut-cell AFTER the transport step
[in]a_oldNumParticlesTotal number of particles in the cut-cell BEFORE the transport step
[in]a_electricFieldElectric field
[in]a_cellCenterPhysical position of the cell center.
[in]a_cellCentroidCell centroid relative to the cell center (not multiplied by dx)
[in]a_bndryCentroidEB face centroid relative to the cell center (not multiplied by dx)
[in]a_bndryNormalCut-cell normal vector.
[in]a_bndryAreaCut-cell boundary area - not multiplied by dx (2D) or dx^2 (3D)
[in]a_dxGrid resolution on this level.
[in]a_dtTime step
[in]a_isDielectricDielectric or electrode.
[in]a_matIndexMaterial index (taken from computationalGeometry)

Implements Physics::ItoKMC::ItoKMCPhysics.

◆ throwParserError()

void ItoKMCJSON::throwParserError ( const std::string  a_error) const
protectedvirtualnoexcept

Throw a parser error.

Parameters
[in]a_errorError code.

◆ throwParserWarning()

void ItoKMCJSON::throwParserWarning ( const std::string  a_warning) const
protectedvirtualnoexcept

Throw a parser wearning.

Parameters
[in]a_errorWarning

◆ trim()

std::string ItoKMCJSON::trim ( const std::string &  a_string) const
protectedvirtualnoexcept

Trim a string. This removes whitespace before/after.

Parameters
[in]a_stringString to be trimmed

◆ updateReactionRates()

void ItoKMCJSON::updateReactionRates ( std::vector< std::shared_ptr< const KMCReaction >> &  a_kmcReactions,
const RealVect  a_E,
const RealVect  a_pos,
const Vector< Real > &  a_phi,
const Vector< RealVect > &  a_gradPhi,
const Real  a_dx,
const Real  a_kappa 
) const
overrideprotectedvirtualnoexcept

Update reaction rates.

Parameters
[out]a_kmcReactionsReaction rates to be set.
[in]a_EElectric field
[in]a_posPhysical position
[in]a_phiPlasma species densities
[in]a_gradPhiDensity gradients for plasma species.
[in]a_dxGrid resolution
[in]a_kappaCut-cell volume fraction

Implements Physics::ItoKMC::ItoKMCPhysics.

Member Data Documentation

◆ m_allSpecies

std::set<std::string> Physics::ItoKMC::ItoKMCJSON::m_allSpecies
protected

All species that have been defined.

Only used to make sure we're not doubly defining some species

◆ m_backgroundSpecies

std::vector<ItoKMCBackgroundSpecies> Physics::ItoKMC::ItoKMCJSON::m_backgroundSpecies
protected

Map of background species.

Built in initialization order but can look up arbitrary species name but using the maps.

◆ m_backgroundSpeciesPlot

std::vector<bool> Physics::ItoKMC::ItoKMCJSON::m_backgroundSpeciesPlot
protected

Plot background species or not.

Built in initialization order but can look up arbitrary species name but using the maps.

◆ m_fluidRates

std::vector<FunctionEX> Physics::ItoKMC::ItoKMCJSON::m_fluidRates
protected

Function-based plasma reaction rates as if they appeared in the reaction rate equation. Same index as actual reactions.

If S = k * n_1 * n_2 * n_3 where n_1, n_2, n_3 is any species, then this contains 'k'.


The documentation for this class was generated from the following files: