chombo-discharge
|
Radiative tranfer equation solver using Monte-Carlo simulation. More...
#include <CD_McPhoto.H>
Public Types | |
enum class | WhichContainer { Photons , Bulk , EB , Domain , Source } |
Enum class for identifying various containers. Only used for interface reasons. | |
Public Member Functions | |
McPhoto () | |
Constructor. | |
McPhoto (const McPhoto &a_other) | |
Disallowed copy constructor. | |
McPhoto (const McPhoto &&a_other) | |
Disallowed move constructor. | |
McPhoto & | operator= (const McPhoto &a_other) |
Disallowed assignment operator. | |
McPhoto & | operator= (const McPhoto &&a_other) |
Disallowed move assignement operator. | |
virtual | ~McPhoto () |
Destructor. | |
virtual bool | advance (const Real a_dt, EBAMRCellData &a_phi, const EBAMRCellData &a_source, const bool a_zeroPhi=false) override |
Advance RTE and deposit photon particles on the mesh. More... | |
virtual bool | isInstantaneous () |
Instantaneous solver or not. | |
virtual void | advancePhotonsInstantaneous (ParticleContainer< Photon > &a_bulkPhotons, ParticleContainer< Photon > &a_ebPhotons, ParticleContainer< Photon > &a_domainPhotons, ParticleContainer< Photon > &a_photons) |
Move photons and absorb them on various objects. More... | |
virtual void | advancePhotonsTransient (ParticleContainer< Photon > &a_bulkPhotons, ParticleContainer< Photon > &a_ebPhotons, ParticleContainer< Photon > &a_domainPhotons, ParticleContainer< Photon > &a_photons, const Real a_dt) |
Move photons and absorb them on various objects. More... | |
virtual void | computeNumPhysicalPhotons (EBAMRCellData &a_numPhysPhotonsTotal, EBAMRCellData &a_numPhysPhotonsPerPacket, const EBAMRCellData &a_source, const Real a_dt) const noexcept |
Compute the number of physical photons in each grid cell. More... | |
virtual void | generateComputationalPhotons (ParticleContainer< Photon > &a_photons, const EBAMRCellData &a_numPhysicalPhotons, const size_t a_maxPhotonsPerCell) const noexcept |
Generate computational photons. More... | |
virtual void | dirtySamplePhotons (ParticleContainer< PointParticle > &a_photons, EBAMRCellData &a_phi, const EBAMRCellData &a_numPhysicalPhotons, const size_t a_maxPhotonsPerCell) const noexcept |
Dirty-sampling method for photons. More... | |
virtual void | remap () |
Remap computational particles. This remaps m_photons. | |
virtual void | remap (ParticleContainer< Photon > &a_photons) |
Remap computational particles. More... | |
virtual void | depositPhotons () |
Deposit photons on the mesh. More... | |
template<class P , const Real &(P::*)() const particleScalarField> | |
void | depositPhotons (EBAMRCellData &a_phi, ParticleContainer< P > &a_particles, const DepositionType &a_deposition) const noexcept |
Deposit photons. More... | |
virtual void | sortPhotonsByCell (const WhichContainer &a_which) |
Sort container by cell. More... | |
virtual void | sortPhotonsByPatch (const WhichContainer &a_which) |
Sort container by patch. More... | |
virtual void | parseOptions () override |
Parse class options. | |
virtual void | parseRuntimeOptions () override |
Parse runtime options. | |
virtual void | allocate () override |
Allocate internal storage. | |
virtual void | preRegrid (const int a_base, const int a_oldFinestLevel) override |
preRegrid operations More... | |
virtual void | deallocate () override |
Deallocate internal storage. | |
virtual void | regrid (const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override |
Regrid function for this class. More... | |
virtual void | registerOperators () override |
Register operators that this solver needs. | |
virtual void | computeBoundaryFlux (EBAMRIVData &a_ebFlux, const EBAMRCellData &a_phi) override |
Compute the boundary flux. More... | |
virtual void | computeDomainFlux (EBAMRIFData &a_domainFlux, const EBAMRCellData &a_phi) override |
Compute the domain flux. More... | |
virtual void | computeFlux (EBAMRCellData &a_flux, const EBAMRCellData &a_phi) override |
Compute the flux. More... | |
virtual void | computeDensity (EBAMRCellData &a_isotropic, const EBAMRCellData &a_phi) override |
Compute isotropic radiative density from mesh solution. More... | |
virtual void | clear (const WhichContainer &a_which) |
Clear data holder. More... | |
virtual void | clear () |
Clear data holder. | |
virtual void | clear (ParticleContainer< Photon > &a_photons) |
Clear data holder. More... | |
virtual void | clear (AMRParticles< Photon > &a_photons) |
Clear data holder. More... | |
virtual void | writePlotFile () override |
Write plot file. More... | |
virtual void | writePlotData (LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string a_outputRealm, const int a_level) const noexcept override |
Write plot data. More... | |
virtual Vector< std::string > | getPlotVariableNames () const override |
Write checkpoint data into handle. More... | |
virtual int | getNumberOfPlotVariables () const override |
Get number of output variables. More... | |
virtual int | countPhotons (const AMRParticles< Photon > &a_photons) const |
Count number of photons in particle list. More... | |
virtual ParticleContainer< Photon > & | getPhotons () |
Get m_photons. More... | |
virtual ParticleContainer< Photon > & | getBulkPhotons () |
Get bulk photons, i.e. photons absorbed on the mesh. More... | |
virtual ParticleContainer< Photon > & | getEbPhotons () |
Get eb Photons, i.e. photons absorbed on the EB. More... | |
virtual ParticleContainer< Photon > & | getDomainPhotons () |
Get domain photons, i.e. photons absorbed on domain edges/faces. More... | |
virtual ParticleContainer< Photon > & | getSourcePhotons () |
Get source photons. More... | |
virtual int | getMaxPhotonsPerCell () const noexcept |
Get maximum number of photons generated per cell. | |
virtual int | getNumSamplingPackets () const noexcept |
Get maximum number of photons generated per cell. | |
virtual void | computeLoads (Vector< long long > &a_loads, const DisjointBoxLayout &a_dbl, const int a_level) const noexcept override |
Get computational loads for a specific grid level. This computes the number of photons in the bulk data holder. More... | |
Public Member Functions inherited from RtSolver | |
RtSolver () | |
Constructor. | |
virtual | ~RtSolver () |
Constructor (does nothing) | |
virtual std::string | getName () |
Get solver name. | |
virtual const std::string | getRealm () const |
Get the realm where the solver lives. | |
virtual bool | advance (const Real a_dt, const bool a_zeroPhi=false) |
Advance equation one time step. More... | |
virtual bool | advance (const Real a_dt, EBAMRCellData &a_phi, const bool a_zeroPhi=false) |
Advance method. Advances one time step. More... | |
virtual void | setRealm (const std::string a_realm) |
Set realm where this solver lives. More... | |
virtual void | setRtSpecies (const RefCountedPtr< RtSpecies > &a_species) |
Set the radiative transfer species (RtSpecies) More... | |
virtual void | setComputationalGeometry (const RefCountedPtr< ComputationalGeometry > a_computationalGeometry) |
Set computational geometry. More... | |
virtual void | setAmr (const RefCountedPtr< AmrMesh > &a_amr) |
Set the amr object. More... | |
virtual void | setPhase (phase::which_phase a_phase=phase::gas) |
Set phase. More... | |
virtual void | setVerbosity (const int a_verbosity) |
Set verbosity. More... | |
virtual void | setTime (const int a_step, const Real a_time, const Real a_dt) |
Set the time for this solver. More... | |
virtual void | setStationary (const bool a_stationary) |
Set stationary solver or not. More... | |
virtual void | sanityCheck () |
Sanity check. | |
virtual bool | isStationary () |
Check if solver is stationary. | |
virtual void | initialData () |
Fill solver with initial data. By default, this sets internal data to zero. More... | |
virtual void | setSource (const EBAMRCellData &a_source) |
Set source term. More... | |
virtual void | setSource (const Real a_source) |
Set source. More... | |
virtual void | setSource (const std::function< Real(const RealVect a_pos)> a_source) |
Set source. More... | |
virtual Real | getTime () const |
Get current time. More... | |
virtual phase::which_phase | getPhase () |
Get the RTE phase. More... | |
virtual EBAMRCellData & | getPhi () |
Get solver state. More... | |
virtual EBAMRCellData & | getSource () |
Get multifluid source. More... | |
virtual EBAMRFluxData & | getKappa () |
Get the absorption length. More... | |
virtual EBAMRIVData & | getKappaEb () |
Get the absorption coefficient on irregular EB faces. More... | |
virtual RefCountedPtr< RtSpecies > & | getSpecies () |
Get species. | |
Protected Types | |
enum class | PhotonGeneration { Deterministic , Stochastic } |
Enum for interpreting how photons are generated when using fluid codes. | |
enum class | SourceType { Number , PerVol , PerVolSecond , PerSecond } |
Enum for adding flexibility in what the fluid source term contains. | |
enum class | IntersectionEB { Raycast , Bisection } |
An enum for switching between various types of EB intersection algorithms when intersecting photons with the EB. More... | |
Protected Member Functions | |
size_t | drawPhotons (const Real a_source, const Real a_volume, const Real a_dt) const noexcept |
Draw photons in a cell and volume. More... | |
int | domainBcMap (const int a_dir, const Side::LoHiSide a_side) |
Mapping function for domain boundary conditions. More... | |
Real | randomExponential (const Real a_mean) const noexcept |
Random exponential trial. More... | |
template<class P , const Real &(P::*)() const particleScalarField> | |
void | depositKappaConservative (EBAMRCellData &a_phi, ParticleContainer< P > &a_particles, const DepositionType a_deposition, const CoarseFineDeposition a_coarseFineDeposition) const noexcept |
This computes the "conservative" deposition, multiplied by kappa. More... | |
void | depositNonConservative (EBAMRIVData &a_depositionNC, const EBAMRCellData &a_depositionKappaC) const noexcept |
Make the "non-conservative" kappa deposition. More... | |
void | depositHybrid (EBAMRCellData &a_depositionH, EBAMRIVData &a_massDifference, const EBAMRIVData &a_depositionNC) const noexcept |
Make the hybrid deposition. Also compute the mass difference. More... | |
void | parseTransparentBoundaries () |
Turn on/off transparent boundaries. | |
void | parseDirtySampling () |
Parse dirty sampling for photons. More... | |
void | parseDivergenceComputation () |
Parse the divergence computation, i.e. if we blend with non-conservative divergence or not. | |
void | parsePseudoPhotons () |
Parse pseudophotons, i.e. parse how many photons can be generated per cell. | |
void | parsePhotoGeneration () |
Parse photogeneration type. | |
void | parseInstantaneous () |
Parse whether instantaneous propagation or not. | |
void | parseSourceType () |
Parse source term type. | |
void | parseIntersectionEB () |
Parse EB intersection algorithm. | |
void | parseDeposition () |
Parse deposition method. | |
void | parsePlotVariables () |
Parse plot variables. | |
virtual void | depositPhotonsNGP (LevelData< EBCellFAB > &a_output, const ParticleContainer< Photon > &a_particles, const int a_level) const noexcept |
Do an NGP deposit on a specific grid level. Used for IO. More... | |
Protected Member Functions inherited from RtSolver | |
void | setEbIndexSpace (const RefCountedPtr< EBIndexSpace > &a_ebis) |
Set ebis. | |
void | parseVerbosity () noexcept |
Parse verbosity. | |
virtual void | writeData (LevelData< EBCellFAB > &a_output, int &a_comp, const EBAMRCellData &a_data, const std::string a_outputRealm, const int a_level, const bool a_interpToCentroids, const bool a_interpGhost) const noexcept |
Write data to output. Convenience function. More... | |
Protected Attributes | |
bool | m_transparentEB |
Turn on/off transparent boundaries. | |
bool | m_instantaneous |
Instantaneous transport or not. | |
bool | m_blendConservation |
Flag for blending the deposition clouds with the nonconservative divergence. | |
bool | m_depositNumber |
If true, the NUMBER of of Photons will be deposited in each cell. | |
bool | m_plotNumbers |
Switch for plotting numbers or densities. | |
bool | m_plotPhotons |
Check if m_photons should be plotted. | |
bool | m_plotBulkPhotons |
Check if m_bulkPhotons should be plotted. | |
bool | m_plotSourcePhotons |
Check if source_bulkPhotons should be plotted. | |
bool | m_plotEBPhotons |
Check if m_ebPhotons should be plotted. | |
bool | m_plotDomainPhotons |
Check if m_ebPhotons should be plotted. | |
bool | m_dirtySampling |
Dirty sampling or not. | |
size_t | m_maxPhotonsGeneratedPerCell |
Number of computational photons generated per cell. | |
int | m_numSamplingPackets |
int | m_seed |
RNG seed. | |
int | m_haloBuffer |
Halo size for particles. | |
Real | m_bisectStep |
Bisection step for when we use the bisection intersection algorithm. | |
PhotonGeneration | m_photoGenerationMethod |
Photon generation type. | |
SourceType | m_sourceType |
Source type. | |
IntersectionEB | m_intersectionEB |
DepositionType | m_deposition |
Deposition type. | |
CoarseFineDeposition | m_coarseFineDeposition |
Coarse-fine deposition strategy. | |
EBAMRCellData | m_scratch |
Coarse data for interpolation of deposition clouds. | |
EBAMRIVData | m_depositionNC |
Scratch storage for holding the non-conservative deposition. | |
EBAMRIVData | m_massDiff |
Scratch storage for holding the mass difference when using hybrid deposition. | |
ParticleContainer< Photon > | m_photons |
All particles. | |
ParticleContainer< Photon > | m_bulkPhotons |
Photons absorbed in the volume. | |
ParticleContainer< Photon > | m_ebPhotons |
This is a particle container for Photons that crossed EBs. It is filled during the advance step. | |
ParticleContainer< Photon > | m_domainPhotons |
This is a particle container for Photons that crossed boundaries. It is filled during the advance step. | |
ParticleContainer< Photon > | m_sourcePhotons |
This is a particle container that can be used to add Photons directly. | |
Protected Attributes inherited from RtSolver | |
Location::Cell | m_dataLocation |
Data location. | |
std::string | m_realm |
Realm where this solver lives. | |
RefCountedPtr< EBIndexSpace > | m_ebis |
EBIndexSpace for this solver. | |
RefCountedPtr< RtSpecies > | m_rtSpecies |
Radiative transfer species (contains meta-information like initial conditions) | |
RefCountedPtr< ComputationalGeometry > | m_computationalGeometry |
Computational geometry. | |
RefCountedPtr< AmrMesh > | m_amr |
AMR; needed for grid stuff. | |
phase::which_phase | m_phase |
Phase. | |
std::string | m_name |
Name for this solver. | |
std::string | m_className |
Class name – needed because inherited classes will be named different. | |
EBAMRCellData | m_cachePhi |
Cached state used for regridding. | |
EBAMRCellData | m_phi |
Internal state. More... | |
EBAMRCellData | m_source |
Source term. More... | |
EBAMRFluxData | m_kappa |
Absorption coefficient. | |
EBAMRIVData | m_kappaEB |
Absorption coefficient on EB faces. | |
Real | m_time |
Time. | |
Real | m_dt |
Time increment. | |
bool | m_stationary |
Stationary solver or not. | |
bool | m_plotPhi |
Output state. | |
bool | m_plotSource |
Output source term. | |
int | m_verbosity |
int | m_timeStep |
Time step. | |
Additional Inherited Members | |
Static Protected Attributes inherited from RtSolver | |
static constexpr int | m_comp = 0 |
Default component that we solve for. | |
static constexpr int | m_nComp = 1 |
Default number of components. | |
Radiative tranfer equation solver using Monte-Carlo simulation.
This class is, by default, a non-stationary radiative transfer solver which simulates computational photons that can also be deposited on the mesh. Various options are available for specifying how the photons are generated, and how they are propagated (e.g. with speed of light or instantaneously). Note that this solver runs its own intersection tests with the EB due to dependencies on how the photons are moved (we store free-flight photons, absorbed photons, intersected photons, etc).
|
strongprotected |
An enum for switching between various types of EB intersection algorithms when intersecting photons with the EB.
Raycast means ray-casting algorithm. Bisection means that the traveled path is divided into intervals and we apply a bisection algorithm for computing the intersection point. LSF is just ray-casting, but it uses the implicit function on the mesh rather than calling it directly.
|
overridevirtual |
Advance RTE and deposit photon particles on the mesh.
[in] | a_dt | Time step |
[out] | a_phi | Photon density on the mesh |
[in] | a_source | Source term, i.e. number of photons produced per unit time. The photons will be generated based on what the user specifies in the input parameters for this class. I.e., whether or not a_source will generate stochastic or deterministic photons, and scaled based on what a_source actually contains (number of photons, number/volume, number/second, number/(volume*second)). |
[in] | a_zeroPhi | Dead parameter not used in this implementation. |
This routine switches between stationary and transient solvers depending on whether or not the solver is stationary.
Implements RtSolver.
|
virtual |
Move photons and absorb them on various objects.
[out] | a_bulkPhotons | Photons absorbed on the mesh |
[out] | a_ebPhotons | Photons absorbed on the EB |
[out] | a_domainPhotons | Photons absorbed on the domain edges (faces) |
[in,out] | a_photons | Original photons |
|
virtual |
Move photons and absorb them on various objects.
[out] | a_bulkPhotons | Photons absorbed on the mesh |
[out] | a_ebPhotons | Photons absorbed on the EB |
[out] | a_domainPhotons | Photons absorbed on the domain edges (faces) |
[in,out] | a_photons | Original photons |
[in] | a_dt | Time step |
|
virtual |
Clear data holder.
[in] | a_photons | Which container to clear |
|
virtual |
Clear data holder.
[in] | a_which | Which container to clear |
|
virtual |
Clear data holder.
[in] | a_photons | Which container to clear |
|
overridevirtual |
Compute the boundary flux.
[out] | a_ebFlux | Flux on the EB |
[in] | a_phi | RTE solution |
Implements RtSolver.
|
overridevirtual |
Compute isotropic radiative density from mesh solution.
[out] | a_isotropic | Isotropic part of RTE solution |
[in] | a_phi | RTE solution |
Implements RtSolver.
|
overridevirtual |
Compute the domain flux.
[out] | a_domainFlux | Domain flux |
[in] | a_phi | RTE solution |
Implements RtSolver.
|
overridevirtual |
Compute the flux.
[out] | a_flux | Flux |
[in] | a_phi | RTE solution |
Implements RtSolver.
|
overridevirtualnoexcept |
Get computational loads for a specific grid level. This computes the number of photons in the bulk data holder.
[out] | a_loads | Grid loads for this level. |
[in] | a_dbl | Grids on input level |
[in] | a_level | Input level |
The default implementation returns the number of cells in the grid patch as a proxy for the load.
Reimplemented from RtSolver.
|
virtualnoexcept |
Compute the number of physical photons in each grid cell.
[out] | a_numPhysPhotonsTotal | Total number of physical photons to be generated in each grid cell. |
[out] | a_numPhysPhotonsPacket | Number of physical photons to be generated in each packet. Must have a components = m_numSamplingPackets |
[in] | a_source | Source term – the interpretation of this depends on the user-specified interpretation of the source term. |
[in] | a_dt | Time step |
|
virtual |
Count number of photons in particle list.
[in] | a_photons | Particle list |
|
protectednoexcept |
Make the hybrid deposition. Also compute the mass difference.
[in,out] | a_depositionH | On input this should be the conservative deposition |
[out] | a_massDifference | Mass difference between conservative and non-conservative |
[in] | a_depositioNC | Non-conservative deposition |
|
protectednoexcept |
This computes the "conservative" deposition, multiplied by kappa.
[out] | a_phi | Mesh density. |
[in] | a_particles | Particles to be deposited |
[in] | a_deposition | Deposition method |
[in] | a_coarseFineDeposition | Coarse-fine deposition strategy. |
|
protectednoexcept |
Make the "non-conservative" kappa deposition.
[out] | a_depositionNC | Non-conservative deposition in cut-cells |
[in] | a_depositionKappaC | Conservative deposition |
|
virtual |
Deposit photons on the mesh.
This deposits m_photons onto m_phi
|
noexcept |
Deposit photons.
[out] | a_phi | Deposited mesh density |
[in,out] | a_photons | Computational photons to be deposited |
[in] | a_deposition | Deposition method |
|
protectedvirtualnoexcept |
Do an NGP deposit on a specific grid level. Used for IO.
[out] | a_output | Contains NGP deposition of photons. Ignores cut-cells. |
[in] | a_photons | photons |
[in] | a_level | Grid level |
|
virtualnoexcept |
Dirty-sampling method for photons.
This is a "dirty" routine in the sense that it does not respect the EB and avoids filling m_bulkParticles. If you also use an NGP scheme this avoids communication between sampling buckets. But this is not something that we recommend using, unless you have a geometry-less domain. If those are good for you, feel free to use this routine.
[in,out] | a_photons | Computational photons. Will be populated and depleted inside the routine. |
[in,out] | a_phi | Mesh-based density. Will be incremented by the generated photons. |
[in] | a_numPhysicalPhotons | Number of physical photons to add to a_photons |
[in] | a_maxPhotonsPerCell | Maximum number of photons generated per cell. |
|
protected |
Mapping function for domain boundary conditions.
[in] | a_dir | Coordinate direction |
[in] | a_side | Coordinate side |
|
protectednoexcept |
Draw photons in a cell and volume.
[in] | a_source | Source term, i.e. number of photons generated/x |
[in] | a_volume | Grid cell volume |
[in] | a_dt | Time step |
The return result of this function depends on the input parameters to this class.
|
virtualnoexcept |
Generate computational photons.
[in,out] | a_photons | Computational photons |
[in] | a_numPhysicalPhotons | Number of physical photons to add to a_photons |
[in] | a_maxPhotonsPerCell | Maximum number of photons generated per cell. |
|
virtual |
Get bulk photons, i.e. photons absorbed on the mesh.
|
virtual |
Get domain photons, i.e. photons absorbed on domain edges/faces.
|
virtual |
Get eb Photons, i.e. photons absorbed on the EB.
|
overridevirtual |
Get number of output variables.
Reimplemented from RtSolver.
|
virtual |
Get m_photons.
|
overridevirtual |
Write checkpoint data into handle.
[in,out] | a_handle | HDF5 file |
[in] | a_level | Grid level |
Read checkpoint data from handle
[in,out] | a_handle | HDF5 file |
[in] | a_level | Grid level |
Get output plot names
Reimplemented from RtSolver.
|
virtual |
Get source photons.
|
protected |
Parse dirty sampling for photons.
This is a hidden option – I really don't want it to be part of the regular user interface because the code is not general (only works for instantaneous, non-EB cases where photons aren't even absorbed on the domain boundaries)
|
overridevirtual |
preRegrid operations
[in] | a_base | Coarsest level which changes during regrid |
[in] | a_oldFinestLevel | Finest grid level before regrid |
Implements RtSolver.
|
protectednoexcept |
Random exponential trial.
[in] | a_mean | Mean value in exponential distribution. |
|
overridevirtual |
Regrid function for this class.
[in] | a_lmin | Coarsest level that changed during regrid |
[i] | a_oldFinestLevel Finest grid level before the regrid | |
[i] | a_newFinestLevel Finest grid level after the regrid |
Implements RtSolver.
|
virtual |
Remap computational particles.
[in] | a_photons | Computational particles to be remapped. |
|
virtual |
Sort container by cell.
WhichContainer::Photon = m_photons, WhichContainer::EB = m_ebPhotons and so on.
[in] | a_which | Which container to sort. |
|
virtual |
Sort container by patch.
WhichContainer::Photon = m_photons, WhichContainer::EB = m_ebPhotons and so on.
[in] | a_which | Which container to sort. |
|
overridevirtualnoexcept |
|
overridevirtual |