27#include <CD_NamespaceHeader.H>
519 virtual unsigned long long
613 template <ItoSolver::WhichContainer C = WhichContainer::Bulk>
853 int a_ppc)
const noexcept;
1446 template <
class P,
class Ret, Ret (P ::*MemberFunc)() const>
1555#include <CD_NamespaceFooter.H>
Declaration of core class for handling AMR-related operations (with embedded boundaries)
Simple class for holding some quantities relevant in a grid cell.
CoarseFineDeposition
Coarse-fine deposition types (see CD_EBAMRParticleMesh for how these are handled).
Definition CD_CoarseFineDeposition.H:27
Declaration of base class for defining geometries.
DepositionType
Deposition types.
Definition CD_DepositionType.H:24
Enum for putting some logic into EB intersection tests.
EBIntersection
Enum for putting some logic into how we think about intersection between particles and EBs.
Definition CD_EBIntersection.H:22
Declaration of a class for handling particle-mesh interpolation and deposition.
Enum for putting some logic into EB intersection tests.
EBRepresentation
Enum for putting some logic into how we think about EBs. This is just a simply supporting class for v...
Definition CD_EBRepresentation.H:23
Declaration of a particle class for Ito diffusion.
Implementation of CD_ItoSolver.H.
Declaration of an ItoSpecies class that passes in names and initial data to ItoSolvers.
Declaration of a class for holding particles on an AMR hierarchy.
Vector< RefCountedPtr< ParticleData< P > > > AMRParticles
Alias for ParticleData on each AMR level.
Definition CD_ParticleContainer.H:36
Namespace containing various particle management utilities.
Class for the cell-information that is often queried when merging particles inside a cell.
Definition CD_CellInfo.H:26
A particle class for use with ItoSolvers, i.e. drifting Brownian walkers.
Definition CD_ItoParticle.H:41
Base class for Ito diffusion particle models.
Definition CD_ItoSolver.H:36
virtual void computeAverageEnergy(EBAMRCellData &a_phi, ParticleContainer< ItoParticle > &a_particles) const
Compute average particle energy..
Definition CD_ItoSolver.cpp:1801
RealVect randomDirection() const
Draw a random direction in N-dimensional space.
virtual Real computeHopDt(Real a_maxCellsToMove) const
Compute the largest possible time step such that the particles does not move more than a specified nu...
Definition CD_ItoSolver.cpp:2641
virtual void interpolateMobilities()
Interpolate mobilities.
Definition CD_ItoSolver.cpp:2213
WhichContainer
Enum class for distinguishing various types of particle containers.
Definition CD_ItoSolver.H:50
phase::which_phase getPhase() const
Return phase.
Definition CD_ItoSolver.cpp:3024
void parseDiffusionHop()
Parse diffusion hop.
virtual void writeData(LevelData< EBCellFAB > &a_output, int &a_comp, const EBAMRCellData &a_data, const std::string &a_outputRealm, int a_level, bool a_interpToCentroids, bool a_interpGhost) const noexcept
Write data to output. Convenience function.
Definition CD_ItoSolver.cpp:1575
CoarseFineDeposition m_coarseFineDeposition
Coarse-fine deposition strategy.
Definition CD_ItoSolver.H:1267
bool m_plotPhi
Flag for outputting m_phi to plot files.
Definition CD_ItoSolver.H:1212
virtual Vector< std::string > getPlotVariableNames() const
Get output plot names.
Definition CD_ItoSolver.cpp:1406
virtual void setSpecies(const RefCountedPtr< ItoSpecies > &a_species)
Set the species.
Definition CD_ItoSolver.cpp:984
void depositKappaConservative(EBAMRCellData &a_phi, ParticleContainer< P > &a_particles, DepositionType a_deposition, CoarseFineDeposition a_coarseFineDeposition) const
Compute the cell-centered deposition – this is the main deposition function.
Definition CD_ItoSolverImplem.H:154
EBAMRCellData m_diffusionFunction
Diffusion-centerer field used for interpolating diffusion coefficients.
Definition CD_ItoSolver.H:1292
virtual void registerOperators() const
Register operators.
Definition CD_ItoSolver.cpp:494
virtual void depositParticles()
Deposit particles onto mesh.
Definition CD_ItoSolver.cpp:1833
CoarseFineDeposition getCoarseFineDeposition() const
Get the coarse-fine deposition strategy.
Definition CD_ItoSolver.cpp:3018
bool m_plotEnergyDensity
Flag for plotting the energy density on the mesh.
Definition CD_ItoSolver.H:1252
virtual void depositNonConservative(EBAMRIVData &a_depositionNC, const EBAMRCellData &a_depositionKappaC) const
Make the "non-conservative" kappa deposition – computing depositionNC = sum(kappa*depositionC)/sum(ka...
Definition CD_ItoSolver.cpp:1901
Real m_bisectionStep
Bisection step size to use for particle intersection tests with EBs.
Definition CD_ItoSolver.H:1152
void depositParticlesNGP(LevelData< EBCellFAB > &a_output, const ParticleContainer< P > &a_particles, int a_level) const noexcept
Do an NGP deposit on a specific grid level. Used for IO.
Definition CD_ItoSolverImplem.H:86
int m_restartPPC
Number of particles used when restarting a simulation – this is relevant only when restarting from a ...
Definition CD_ItoSolver.H:1105
virtual void intersectParticles(const EBIntersection a_ebIntersection, const bool a_deleteParticles, const std::function< void(ItoParticle &)> &a_nonDeletionModifier=[](ItoParticle &) -> void { return;})
Do boundary intersection tests.
Definition CD_ItoSolver.cpp:844
virtual void setComputationalGeometry(const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry)
Set computational geometry.
Definition CD_ItoSolver.cpp:468
void parseIntersectionEB()
Parse EB intersection algorithms.
Definition CD_ItoSolver.cpp:320
virtual void makeSuperparticlesBVHReinitialize(List< ItoParticle > &a_particles, const CellInfo &a_cellInfo, int a_ppc) const noexcept
Superparticle merging with BVH trees. This reinitializes particles within each BVH node.
Definition CD_ItoSolver.cpp:3258
virtual void setAmr(const RefCountedPtr< AmrMesh > &a_amr)
Set the AmrMesh object.
Definition CD_ItoSolver.cpp:481
bool m_forceHaloNGP
Force usage of NGP when depositing "halo" particles.
Definition CD_ItoSolver.H:1187
virtual std::string getRealm() const
Get the realm where this solver is registered.
Definition CD_ItoSolver.cpp:72
static constexpr int m_nComp
Default number of component in data holders (do not touch).
Definition CD_ItoSolver.H:1064
void parseRedistribution()
Parse whether or not to use redistribution.
Definition CD_ItoSolver.cpp:346
bool m_forceIrregInterpolationNGP
NGP interpolation in cut cells or not.
Definition CD_ItoSolver.H:1182
EBAMRIVData m_depositionNC
Scratch storage for holding the non-conservative deposition.
Definition CD_ItoSolver.H:1297
virtual void reinitializeParticles(List< ItoParticle > &a_particles, const CellInfo &a_cellInfo, int a_ppc) const noexcept
Particle re-initialization algorithm.
Definition CD_ItoSolver.cpp:3368
virtual Real computeDiffusiveDt() const
Compute the diffusive dt. This computes dt = dx*dx/(2*SpaceDim*D) for all particles.
Definition CD_ItoSolver.cpp:2888
void parseParticleMerger()
Parse the super-particle merger.
Definition CD_ItoSolver.cpp:396
std::string m_className
Class name.
Definition CD_ItoSolver.H:1141
virtual void updateDiffusion()
Update mobilities parametrically from the particle energy.
Definition CD_ItoSolver.cpp:2468
bool m_plotParticles
Flag for depositing and plotting the bulk particles on the mesh.
Definition CD_ItoSolver.H:1227
int m_timeStep
Time step.
Definition CD_ItoSolver.H:1162
virtual EBAMRCellData & getVelocityFunction()
Get cell-centered velocity mesh data.
Definition CD_ItoSolver.cpp:2039
virtual void interpolateMobilitiesDirect(int a_lvl, const DataIndex &a_dit) noexcept
Directly interpolate mobilities. Interpolates for all particles in the specified grid patch.
Definition CD_ItoSolver.cpp:2289
bool m_forceIrregDepositionNGP
NGP deposition in cut cells or not.
Definition CD_ItoSolver.H:1177
std::string m_realm
Realm where this solve lives.
Definition CD_ItoSolver.H:1110
virtual void depositConductivity(EBAMRCellData &a_phi, ParticleContainer< ItoParticle > &a_particles) const
Deposit conductivities (i.e. mass*mobility / volume)
Definition CD_ItoSolver.cpp:1641
virtual void interpolateVelocities()
Interpolate the particle velocities.
Definition CD_ItoSolver.cpp:2155
virtual void interpolateMobilitiesVelocity(int a_lvl, const DataIndex &a_dit, const EBCellFAB &a_velocityMagnitude) noexcept
Interpolate mobilities through the velocity. Interpolates for all particles in the specified grid pat...
Definition CD_ItoSolver.cpp:2319
virtual void parseOptions()
Parse class options.
Definition CD_ItoSolver.cpp:109
bool m_plotParticlesSource
Flag for depositing and plotting the source particles on the mesh.
Definition CD_ItoSolver.H:1242
virtual Real computeDt() const
Compute a time step for the advance – this calls the level function.
Definition CD_ItoSolver.cpp:2517
RefCountedPtr< ItoSpecies > m_species
Species that this solver solves for.
Definition CD_ItoSolver.H:1125
DepositionType m_deposition
Deposition method when depositing particles to the mesh.
Definition CD_ItoSolver.H:1262
virtual void interpolateDiffusion()
Interpolate the diffusion field to the particle positions.
Definition CD_ItoSolver.cpp:2414
virtual void computeAverageMobility(EBAMRCellData &a_phi, ParticleContainer< ItoParticle > &a_particles) const
Compute average mobility.
Definition CD_ItoSolver.cpp:1739
virtual void generateParticlesFromDensity(ParticleContainer< ItoParticle > &a_particles, const std::function< Real(const RealVect x)> &a_densityFunc, int a_maxParticlesPerCell) const noexcept
Fill a particle container randomly with particles such that we obtain the target uniform density.
Definition CD_ItoSolver.cpp:591
Real m_dt
Time step.
Definition CD_ItoSolver.H:1172
ItoSolver()
Constructor – user must subsequently set the realm and, parse class options, set the species etc.
Definition CD_ItoSolver.cpp:36
std::string m_name
Solver name.
Definition CD_ItoSolver.H:1135
virtual void makeSuperparticlesEqualWeightKD(List< ItoParticle > &a_particles, const CellInfo &a_cellInfo, int a_ppc) const noexcept
Superparticle merging with KD/BVH trees.
Definition CD_ItoSolver.cpp:3182
virtual std::string getName() const
Get this solver's name.
Definition CD_ItoSolver.cpp:64
ItoSolver & operator=(const ItoSolver &)=delete
Deleted copy assignment operator.
EBAMRCellData m_velocityFunction
Cell-centered field used for interpolating velocities.
Definition CD_ItoSolver.H:1287
virtual void removeCoveredParticles(EBRepresentation a_representation, Real a_tol)
Remove particles that are inside the EB.
Definition CD_ItoSolver.cpp:720
WhichCheckpoint m_checkpointing
How to checkpoint files. particles => write particles to HDF5. numbers => write numbers to HDF5.
Definition CD_ItoSolver.H:1090
virtual ~ItoSolver()
Destructor (does nothing).
Definition CD_ItoSolver.cpp:58
void parseCheckpointing()
Parse checkpointing method.
Definition CD_ItoSolver.cpp:372
bool m_isDiffusive
If true, solver is diffusive.
Definition CD_ItoSolver.H:1202
bool m_plotAverageEnergy
Flag for plotting the average particle energy on the mesh.
Definition CD_ItoSolver.H:1257
DepositionType m_plotDeposition
Deposition method when depositing particles to mesh during plotting.
Definition CD_ItoSolver.H:1272
RealVect randomGaussian() const
Draw a random N-dimensional Gaussian number from a normal distribution with zero with and unit standa...
Definition CD_ItoSolverImplem.H:31
virtual ParticleContainer< ItoParticle > & getParticles(WhichContainer a_container)
Get a general particle container.
Definition CD_ItoSolver.cpp:2006
virtual void setPhase(phase::which_phase a_phase)
Set phase where the particles will live.
Definition CD_ItoSolver.cpp:517
virtual unsigned long long getNumParticles(WhichContainer a_whichContainer, bool a_localOnly) const
Get number of particles in a specified particle container.
Definition CD_ItoSolver.cpp:447
virtual void remap()
Remap the bulk particle container.
Definition CD_ItoSolver.cpp:2988
virtual void organizeParticlesByCell(WhichContainer a_container)
Sort the input particle container by cell.
Definition CD_ItoSolver.cpp:3030
virtual void computeLoads(Vector< long int > &a_loads, const DisjointBoxLayout &a_dbl, int a_level)
Compute particle load on a specific grid level – this will compute the number of particles in each bo...
Definition CD_ItoSolver.cpp:691
virtual void setRealm(const std::string &a_realm)
Set the realm where this solver will live.
Definition CD_ItoSolver.cpp:80
bool m_useRedistribution
Use mass redistribution or not.
Definition CD_ItoSolver.H:1192
EBAMRCellData m_mobilityFunction
Mobility function – used when interpolating particle mobilities.
Definition CD_ItoSolver.H:1282
virtual void updateMobilities()
Update mobilities parametrically from the particle energy.
Definition CD_ItoSolver.cpp:2367
std::map< WhichContainer, ParticleContainer< ItoParticle > > m_particleContainers
Various particle containers with identifiers.
Definition CD_ItoSolver.H:1307
virtual bool isMobile() const
Check if solver is mobile.
Definition CD_ItoSolver.cpp:1966
virtual EBAMRCellData & getDiffusionFunction()
Get the diffusion function.
Definition CD_ItoSolver.cpp:2061
int m_verbosity
Verbosity level for this solver.
Definition CD_ItoSolver.H:1157
ItoSolver(const ItoSolver &)=delete
Deleted copy constructor.
virtual void setParticleDiffusion(Real a_diffCo)
Sets diffusion coefficient for all particles.
Definition CD_ItoSolver.cpp:2142
virtual void depositDiffusivity(EBAMRCellData &a_phi, ParticleContainer< ItoParticle > &a_particles) const
Deposit diffusivity (i.e. mass*D/volume)
Definition CD_ItoSolver.cpp:1677
WhichCheckpoint
How to checkpoint files.
Definition CD_ItoSolver.H:1071
Real m_normalDistributionTruncation
Truncation value for normal distribution.
Definition CD_ItoSolver.H:1147
void drawNewParticles(const LevelData< EBCellFAB > &a_particlesPerCell, int a_level, int a_newPPC)
Restart particles from a specified number of particles in the grid cell.
Definition CD_ItoSolver.cpp:1255
bool m_plotParticlesEB
Flag for depositing and plotting the EB particles on the mesh.
Definition CD_ItoSolver.H:1232
bool m_blendConservation
Flag for blending the deposition clouds with the "non-conservative" divergence.
Definition CD_ItoSolver.H:1197
virtual EBAMRCellData & getPhi()
Get the mesh data.
Definition CD_ItoSolver.cpp:2028
virtual void allocate()
Allocate internal storage.
Definition CD_ItoSolver.cpp:998
virtual void setVelocityFunction(const RealVect &a_velocity)
Utility function – set a constant velocity.
Definition CD_ItoSolver.cpp:2116
WhichMobilityInterpolation m_mobilityInterp
Switch for deciding how to interpolate mobilities, i.e. interpolating either mu*E or just mu (to the ...
Definition CD_ItoSolver.H:1095
void parseVerbosity()
Parse class verbosity.
Definition CD_ItoSolver.cpp:148
static constexpr int m_comp
Default component in data holders (do not touch).
Definition CD_ItoSolver.H:1059
virtual void depositHybrid(EBAMRCellData &a_depositionH, EBAMRIVData &a_massDifference, const EBAMRIVData &a_depositionNC) const
Make the "hybrid" deposition phiH = kappa*phiC + (1-kappa)*phiNC. On input, a_depositionH should cont...
Definition CD_ItoSolver.cpp:1917
void parseDivergenceComputation()
Parse whether or not to compute a "non-conservative" divergence when redistributing mass.
Definition CD_ItoSolver.cpp:359
RefCountedPtr< AmrMesh > m_amr
AMR; needed for grid stuff.
Definition CD_ItoSolver.H:1120
ItoSolver(ItoSolver &&)=default
Default move constructor.
virtual void depositEnergyDensity(EBAMRCellData &a_phi, ParticleContainer< ItoParticle > &a_particles) const
Deposit energy densities (i.e. mass*energy/volume => total energy per unit volume)
Definition CD_ItoSolver.cpp:1708
void parseRNG()
Parse RNG options – this parses the RNG seed and instantiates the distributions.
Definition CD_ItoSolver.cpp:161
DepositionType getDeposition() const
Get deposition method.
Definition CD_ItoSolver.cpp:3012
void parseTruncation()
Parse the normal distribution truncation level.
Definition CD_ItoSolver.cpp:175
EBAMRIVData m_massDiff
Scratch storage for holding the mass difference when using hybrid deposition.
Definition CD_ItoSolver.H:1302
virtual void setParticleMobility(Real a_mobility)
Sets mobility coefficient for all particles.
Definition CD_ItoSolver.cpp:2129
EBAMRCellData m_phi
Storage for particle mesh data.
Definition CD_ItoSolver.H:1277
virtual void initialData()
Set the initial data.
Definition CD_ItoSolver.cpp:553
virtual void computeAverageDiffusion(EBAMRCellData &a_phi, ParticleContainer< ItoParticle > &a_particles) const
Compute average diffusion coefficient.
Definition CD_ItoSolver.cpp:1770
virtual void parseRuntimeOptions()
Parse class runtime configurable options.
Definition CD_ItoSolver.cpp:129
bool m_plotDiffCo
Flag for outputting m_diffusionFunction to plot files.
Definition CD_ItoSolver.H:1222
virtual void mergeParticles(List< ItoParticle > &a_particles, const CellInfo &a_cellInfo, int a_ppc) const noexcept
General superparticle merging with underlying algorithm through m_particleMerger.
Definition CD_ItoSolver.cpp:3174
virtual void setTime(int a_step, Real a_time, Real a_dt)
Set the time for this solver.
Definition CD_ItoSolver.cpp:540
virtual void transferCoveredParticles(EBRepresentation a_representation, Real a_tol)
Transfer particles that are covered (within a_tol distance from EB) to another container.
Definition CD_ItoSolver.cpp:780
virtual void remapAll()
Remap all particle containers.
Definition CD_ItoSolver.cpp:2975
WhichMobilityInterpolation
Enum for deciding how to interpolate particle mobilities.
Definition CD_ItoSolver.H:1082
virtual const RefCountedPtr< ItoSpecies > & getSpecies() const
Get the species.
Definition CD_ItoSolver.cpp:96
virtual void makeSuperparticles(WhichContainer a_container, int a_particlesPerCell)
Make superparticles for a full container – this is the AMR version that users will usually call.
Definition CD_ItoSolver.cpp:3056
bool m_isMobile
If true, solver is mobile, i.e. advection is turned on.
Definition CD_ItoSolver.H:1207
virtual int getNumberOfPlotVariables() const
Get number of plot variables.
Definition CD_ItoSolver.cpp:1362
virtual void preRegrid(int a_lbase, int a_oldFinestLevel)
Perform pre-regrid operations.
Definition CD_ItoSolver.cpp:1982
virtual void writePlotData(LevelData< EBCellFAB > &a_output, int &a_comp, const std::string &a_outputRealm, int a_level) const noexcept
Write plot data.
Definition CD_ItoSolver.cpp:1454
virtual void redistributeAMR(EBAMRCellData &a_phi) const
Redistribute mass in an AMR context.
Definition CD_ItoSolver.cpp:1858
bool m_plotParticlesCovered
Flag for depositing and plotting the covered particles on the mesh.
Definition CD_ItoSolver.H:1247
EBIntersection m_intersectionAlg
Algorithm for EB intersection.
Definition CD_ItoSolver.H:1312
Real m_time
Current time.
Definition CD_ItoSolver.H:1167
ParticleManagement::ParticleMerger< ItoParticle > m_particleMerger
Particle merger.
Definition CD_ItoSolver.H:1100
virtual void regrid(int a_lmin, int a_oldFinestLevel, int a_newFinestLevel)
Regrid this solver.
Definition CD_ItoSolver.cpp:937
virtual void clear(WhichContainer a_container)
Clear a particle container – this will delete all the particles in the input container.
Definition CD_ItoSolver.cpp:3415
virtual void setParticleMerger(const ParticleManagement::ParticleMerger< ItoParticle > &a_particleMerger) noexcept
Set the particle merger. This will get called when merging particles using makeSuperparticles.
Definition CD_ItoSolver.cpp:88
phase::which_phase m_phase
Phase where this solver lives.
Definition CD_ItoSolver.H:1130
virtual bool isDiffusive() const
Check if solver is diffusive.
Definition CD_ItoSolver.cpp:1974
virtual EBIntersection getIntersectionAlgorithm() const noexcept
Get the EB-particle intersection algorithm.
Definition CD_ItoSolver.cpp:436
virtual EBAMRCellData & getMobilityFunction()
Get mobility function.
Definition CD_ItoSolver.cpp:2083
void addParticles(ListBox< ItoParticle > &a_inputParticles, int a_lvl, const DataIndex &a_dit, bool a_destructive)
Add particles to a contain. This adds into a specific grid level and patch. The user can delete the i...
Definition CD_ItoSolverImplem.H:51
void parseDeposition()
Parse particle deposition methods.
Definition CD_ItoSolver.cpp:247
RefCountedPtr< ComputationalGeometry > m_computationalGeometry
Computational geometry.
Definition CD_ItoSolver.H:1115
virtual void setDiffusionFunction(Real a_diffusionCoefficient)
Utility function – set a constant diffusion coefficient.
Definition CD_ItoSolver.cpp:2105
ItoSolver & operator=(ItoSolver &&)=default
Default move assignment operator.
virtual Real computeAdvectiveDt() const
Compute advection time step dt = dx/vMax where vMax is the largest velocity component of the particle...
Definition CD_ItoSolver.cpp:2800
virtual void organizeParticlesByPatch(WhichContainer a_container)
Sort the input particle container by patch.
Definition CD_ItoSolver.cpp:3043
virtual void setVerbosity(int a_verbosity)
Set verbosity level for this solver.
Definition CD_ItoSolver.cpp:528
void parsePlotVariables()
Parse plot variables.
Definition CD_ItoSolver.cpp:188
bool m_plotParticlesDomain
Flag for depositing and plotting the domain particles on the mesh.
Definition CD_ItoSolver.H:1237
bool m_plotVelocity
Flag for outputting m_velocityFunction to plot files.
Definition CD_ItoSolver.H:1217
Templated class for holding particles on an AMR hierarchy with particle remapping.
Definition CD_ParticleContainer.H:52
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:38
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:26
std::function< void(List< P > &a_particles, const CellInfo &a_cellInfo, const int a_numTargetParticles)> ParticleMerger
Concept for splitting/merging particles.
Definition CD_ParticleManagement.H:42
which_phase
Enumeration of supported phases.
Definition CD_MultiFluidIndexSpace.H:38