12#ifndef CD_AmrMeshImplem_H
13#define CD_AmrMeshImplem_H
18#include <CD_NamespaceHeader.H>
27 CH_TIME(
"AmrMesh::copyData(EBAMRData, simple)");
28 if (m_verbosity > 5) {
29 pout() <<
"AmrMesh::copyData(EBAMRData, simple)" <<
endl;
32 const int nComp =
a_dst[0]->nComp();
39 for (
int lvl = 0;
lvl <= m_finestLevel;
lvl++) {
56 CH_TIME(
"AmrMesh::copyData(EBAMRData, full)");
57 if (m_verbosity > 5) {
58 pout() <<
"AmrMesh::copyData(EBAMRData, full)" <<
endl;
64 for (
int lvl = 0;
lvl <= m_finestLevel;
lvl++) {
82 CH_TIME(
"AmrMesh::copyData(LD<T>_full)");
83 if (m_verbosity > 5) {
84 pout() <<
"AmrMesh::copyData(LD<T>_full)" <<
endl;
105 CH_TIME(
"AmrMesh::copyData(LD<T>_full)");
106 if (m_verbosity > 5) {
107 pout() <<
"AmrMesh::copyData(LD<T>_full)" <<
endl;
130 else if (
a_toRegion == CopyStrategy::ValidGhost) {
141 else if (
a_toRegion == CopyStrategy::ValidGhost) {
142 copier = m_validGhostToValidGhostRealmCopiers.at(
id)[
a_level];
163 CH_TIME(
"AmrMesh::deallocate(Vector<T*>)");
165 pout() <<
"AmrMesh::deallocate(Vector<T*>)" <<
endl;
177 CH_TIME(
"AmrMesh::deallocate(Vector<RefCountedPtr<T>)");
179 pout() <<
"AmrMesh::deallocate(Vector<RefCountedPtr<T>)" <<
endl;
199 CH_TIME(
"AmrMesh::deallocate(EBAMRData<T>)");
201 pout() <<
"AmrMesh::deallocate(EBAMRData<T>)" <<
endl;
211 CH_TIME(
"AmrMesh::alias(Vector<T*>, Vector<RefCountedPtr<T>)");
213 pout() <<
"AmrMesh::alias(Vector<T*>, Vector<RefCountedPtr<T>)" <<
endl;
223template <
typename T,
typename S>
227 CH_TIME(
"AmrMesh::alias(Vector<T*>, EBAMRData<S>)");
229 pout() <<
"AmrMesh::alias(Vector<T*>, EBAMRData<S>" <<
endl;
239 CH_TIME(
"AmrMesh::allocate(Vector<RefCountedPtr<ParticleData<T> > >, string)");
241 pout() <<
"AmrMesh::allocate(Vector<RefCountedPtr<ParticleData<T> > >, string)" <<
endl;
246 str =
"AmrMesh::allocate(Vector<RefCountedPtr<ParticleData<T> > >, string) - could not find Realm '" +
a_realm +
253 "AmrMesh::allocate(Vector<RefCountedPtr<ParticleData<T> > >, string) - only constant box sizes supported for particle methods");
273 CH_TIME(
"AmrMesh::allocate(ParticleContainer<T>, int, string)");
275 pout() <<
"AmrMesh::allocate(ParticleContainer<T>, int, string)" <<
endl;
279 const std::string str =
"AmrMesh::allocate(ParticleContainer<T>, int, string) - could not find Realm '" +
a_realm +
286 "AmrMesh::allocate(ParticleContainer<T>, int, string) - only constant box sizes are supported for particle methods");
305 CH_TIME(
"AmrMesh::allocatePointer(Vector<RefCountedPtr<T> >)");
307 pout() <<
"AmrMesh::allocatePointer(Vector<RefCountedPtr<T> >)" <<
endl;
320 CH_TIME(
"AmrMesh::allocatePointer(Vector<RefCountedPtr<T> >, int)");
322 pout() <<
"AmrMesh::allocatePointer(Vector<RefCountedPtr<T> >, int)" <<
endl;
336 CH_TIME(
"AmrMesh::allocatePointer(EBAMRData<T>, std::string)");
338 pout() <<
"AmrMesh::allocatePointer(EBAMRData<T>, std::string)" <<
endl;
350 CH_TIME(
"AmrMesh::allocatePointer(EBAMRData<T>, std::string, int)");
352 pout() <<
"AmrMesh::allocatePointer(EBAMRData<T>, std::string, int)" <<
endl;
364 CH_TIME(
"AmrMesh::remapToNewGrids");
365 if (m_verbosity > 5) {
366 pout() <<
"AmrMesh::remapToNewGrids" <<
endl;
374 this->getRefinementRatios(),
375 this->getValidCells(
realm),
376 this->getLevelTiles(
realm),
381template <
class P,
class Ret, Ret (P::*MemberFunc)() const>
385 const phase::which_phase&
a_phase,
391 CH_TIME(
"AmrMesh::depositParticles");
393 pout() <<
"AmrMesh::depositParticles" <<
endl;
405template <
class P,
typename Ret, Ret (P::*MemberFunc)() const>
409 const phase::which_phase&
a_phase,
412 CH_TIME(
"AmrMesh::depositParticles(surface)");
413 if (m_verbosity > 5) {
414 pout() <<
"AmrMesh::depositParticles(surface)" <<
endl;
425template <
class P,
class Ret, Ret (P::*MemberFunc)()>
429 const phase::which_phase&
a_phase,
434 CH_TIME(
"AmrMesh::interpolateParticles(scalar)");
436 pout() <<
"AmrMesh::interpolateParticles(scalar)" <<
endl;
450 const phase::which_phase&
a_phase,
453 CH_TIME(
"AmrMesh::removeCoveredParticlesIF");
455 pout() <<
"AmrMesh::removeCoveredParticlesIF" <<
endl;
475 MayDay::Error(
"AmrMesh::removeCoveredParticlesIF - logic bust");
490#pragma omp parallel for schedule(runtime)
516 const phase::which_phase&
a_phase,
519 CH_TIME(
"AmrMesh::removeCoveredParticlesDiscrete");
521 pout() <<
"AmrMesh::removeCoveredParticlesDiscrete" <<
endl;
537#pragma omp parallel for schedule(runtime)
543 const bool isRegular =
ebisBox.isAllRegular();
544 const bool isCovered =
ebisBox.isAllCovered();
607 CH_TIME(
"AmrMesh::removeCoveredParticlesVoxels");
609 pout() <<
"AmrMesh::removeCoveredParticlesVoxels" <<
endl;
624#pragma omp parallel for schedule(runtime)
630 const bool isRegular =
ebisBox.isAllRegular();
631 const bool isCovered =
ebisBox.isAllCovered();
666 const phase::which_phase&
a_phase,
669 CH_TIME(
"AmrMesh::transferCoveredParticlesIF");
671 pout() <<
"AmrMesh::transferCoveredParticlesIF" <<
endl;
692 MayDay::Error(
"AmrMesh::removeCoveredParticlesIF - logic bust");
712#pragma omp parallel for schedule(runtime)
740 const phase::which_phase&
a_phase,
743 CH_TIME(
"AmrMesh::transferCoveredParticlesDiscrete");
745 pout() <<
"AmrMesh::transferCoveredParticlesDiscrete" <<
endl;
765#pragma omp parallel for schedule(runtime)
771 const bool isRegular =
ebisBox.isAllRegular();
772 const bool isCovered =
ebisBox.isAllCovered();
834 const phase::which_phase&
a_phase)
const
836 CH_TIME(
"AmrMesh::transferCoveredParticlesVoxels");
838 pout() <<
"AmrMesh::transferCoveredParticlesVoxels" <<
endl;
857#pragma omp parallel for schedule(runtime)
863 const bool isRegular =
ebisBox.isAllRegular();
864 const bool isCovered =
ebisBox.isAllCovered();
899 const phase::which_phase
a_phase,
902 CH_TIME(
"AmrMesh::transferIrregularParticles");
903 if (m_verbosity > 5) {
904 pout() <<
"AmrMesh::transferIrregularParticles" <<
endl;
911 for (
int lvl = 0;
lvl <= m_finestLevel;
lvl++) {
920#pragma omp parallel for schedule(runtime)
936 MayDay::Warning(
"CD_AmrMeshImplem.H in routine 'transferIrregularParticles' - particle not in box!");
952 if ((p.position() -
ebPos).dotProduct(
normal) >= 0.0) {
961 p.position() =
ebPos;
984 const phase::which_phase
a_phase,
989 CH_TIME(
"AmrMesh::intersectParticlesRaycastIF");
990 if (m_verbosity > 5) {
991 pout() <<
"AmrMesh::intersectParticlesRaycastIF" <<
endl;
1011 case phase::solid: {
1017 MayDay::Error(
"AmrMesh::intersectParticlesRaycastIF - logic bust");
1027 for (
int lvl = 0;
lvl <= m_finestLevel;
lvl++) {
1034#pragma omp parallel for schedule(runtime)
1070 Real sEB = std::numeric_limits<Real>::max();
1156 const phase::which_phase
a_phase,
1161 CH_TIME(
"AmrMesh::intersectParticlesBisectIF");
1162 if (m_verbosity > 5) {
1163 pout() <<
"AmrMesh::intersectParticlesBisectIF" <<
endl;
1186 case phase::solid: {
1192 MayDay::Error(
"AmrMesh::intersectParticlesBisectIF - logic bust");
1202 for (
int lvl = 0;
lvl <= m_finestLevel;
lvl++) {
1209#pragma omp parallel for schedule(runtime)
1245 Real sEB = std::numeric_limits<Real>::max();
1325#include <CD_NamespaceFooter.H>
Declaration of core class for handling AMR-related operations (with embedded boundaries)
CoarseFineDeposition
Coarse-fine deposition types (see CD_EBAMRParticleMesh for how these are handled).
Definition CD_CoarseFineDeposition.H:26
CopyStrategy
Enum for distinguishing how we copy data Valid => valid region ValidGhost => valid+ghost region.
Definition CD_CopyStrategy.H:23
DepositionType
Deposition types.
Definition CD_DepositionType.H:23
Declaration of a static class containing some common useful particle routines that would otherwise be...
void removeCoveredParticlesVoxels(ParticleContainer< P > &a_particles, const phase::which_phase &a_phase) const
Function which removes particles from the domain if they fall inside the EB.
Definition CD_AmrMeshImplem.H:605
void transferCoveredParticlesDiscrete(ParticleContainer< P > &a_particlesFrom, ParticleContainer< P > &a_particlesTo, const phase::which_phase &a_phase, const Real a_tolerance=0.0) const
Function which transferse particles from one particle container to another if they fall inside the EB...
Definition CD_AmrMeshImplem.H:738
void allocatePointer(Vector< RefCountedPtr< T > > &a_data) const
Allocate pointer but not any memory blocks.
Definition CD_AmrMeshImplem.H:303
const AMRMask & getValidCells(const std::string a_realm) const
Get a map of all valid cells on a specified realm.
Definition CD_AmrMesh.cpp:3225
void copyData(EBAMRData< T > &a_dst, const EBAMRData< T > &a_src, const CopyStrategy &a_toRegion=CopyStrategy::Valid, const CopyStrategy &a_fromRegion=CopyStrategy::Valid) const noexcept
Method for copying from a source container to a destination container. User supplies information abou...
Definition CD_AmrMeshImplem.H:22
void transferCoveredParticlesIF(ParticleContainer< P > &a_particlesFrom, ParticleContainer< P > &a_particlesTo, const phase::which_phase &a_phase, const Real a_tolerance=0.0) const
Function which transferse particles from one particle container to another if they fall inside the EB...
Definition CD_AmrMeshImplem.H:664
int m_maxBoxSize
Max box size.
Definition CD_AmrMesh.H:1966
RealVect m_probLo
Domain simulation corner.
Definition CD_AmrMesh.H:1926
void remapToNewGrids(ParticleContainer< P > &a_particles, const int a_lmin, const int a_newFinestLevel) const noexcept
Regrid particle to new grids.
Definition CD_AmrMeshImplem.H:362
void transferIrregularParticles(ParticleContainer< P > &a_dstParticles, ParticleContainer< P > &a_srcParticles, const phase::which_phase a_phase, const std::function< void(P &)> a_transferModifier=[](P &) -> void { return;}) const noexcept
Transfer particles that are on the wrong side of the EB to a different container.
Definition CD_AmrMeshImplem.H:897
bool queryRealm(const std::string a_realm) const
Query if a realm exists.
Definition CD_AmrMesh.cpp:3500
void removeCoveredParticlesIF(ParticleContainer< P > &a_particles, const phase::which_phase &a_phase, const Real a_tolerance=0.0) const
Function which removes particles from the domain if they fall inside the EB.
Definition CD_AmrMeshImplem.H:449
int m_verbosity
Verbosity.
Definition CD_AmrMesh.H:1941
void intersectParticlesRaycastIF(ParticleContainer< P > &a_activeParticles, ParticleContainer< P > &a_ebParticles, ParticleContainer< P > &a_domainParticles, const phase::which_phase a_phase, const Real a_tolerance, const bool a_deleteParticles, const std::function< void(P &)> a_nonDeletionModifier=[](P &) -> void { return;}) const noexcept
Particle intersection algorithm based on ray-casting.
Definition CD_AmrMeshImplem.H:981
void removeCoveredParticlesDiscrete(ParticleContainer< P > &a_particles, const phase::which_phase &a_phase, const Real a_tolerance=0.0) const
Function which removes particles from the domain if they fall inside the EB.
Definition CD_AmrMeshImplem.H:515
Vector< Real > m_dx
Level resolutions.
Definition CD_AmrMesh.H:2046
const Vector< DisjointBoxLayout > & getGrids(const std::string a_realm) const
Get the grids.
Definition CD_AmrMesh.cpp:3159
void intersectParticlesBisectIF(ParticleContainer< P > &a_activeParticles, ParticleContainer< P > &a_ebParticles, ParticleContainer< P > &a_domainParticles, const phase::which_phase a_phase, const Real a_bisectionStep, const bool a_deleteParticles, const std::function< void(P &)> a_nonDeletionModifier=[](P &) -> void { return;}) const noexcept
Particle intersection algorithm based on bisection.
Definition CD_AmrMeshImplem.H:1153
int m_finestLevel
Finest level.
Definition CD_AmrMesh.H:1946
const Vector< EBISLayout > & getEBISLayout(const std::string a_realm, const phase::which_phase a_phase) const
Get EBISLayouts for a Realm and phase.
Definition CD_AmrMesh.cpp:3175
void depositParticles(EBAMRCellData &a_meshData, const std::string &a_realm, const phase::which_phase &a_phase, const ParticleContainer< P > &a_particles, const DepositionType a_depositionType, const CoarseFineDeposition a_coarseFineDeposition, const bool a_forceIrregNGP=false)
Deposit scalar particle quantities on the mesh.
Definition CD_AmrMeshImplem.H:383
std::map< phase::which_phase, RefCountedPtr< BaseIF > > m_baseif
Implicit functions.
Definition CD_AmrMesh.H:1845
void allocate(Vector< RefCountedPtr< ParticleData< T > > > &a_particles, const std::string a_realm) const
Template class for generic allocation of particle data.
Definition CD_AmrMeshImplem.H:237
const Vector< Real > & getDx() const
Get spatial resolutions.
Definition CD_AmrMesh.cpp:3104
std::map< std::string, RefCountedPtr< Realm > > m_realms
These are all the Realms.
Definition CD_AmrMesh.H:1840
int m_blockingFactor
Blocking factor.
Definition CD_AmrMesh.H:1981
void interpolateParticles(ParticleContainer< P > &a_particles, const std::string &a_realm, const phase::which_phase &a_phase, const EBAMRCellData &a_meshScalarField, const DepositionType a_interpType, const bool a_forceIrregNGP=false) const
Interpolate mesh data onto a particle position.
Definition CD_AmrMeshImplem.H:427
void transferCoveredParticlesVoxels(ParticleContainer< P > &a_particlesFrom, ParticleContainer< P > &a_particlesTo, const phase::which_phase &a_phase) const
Function which transferse particles from one particle container to another if they fall inside the EB...
Definition CD_AmrMeshImplem.H:832
void alias(Vector< T * > &a_alias, const Vector< RefCountedPtr< T > > &a_data) const
Turn smart-pointer data structure into regular-pointer data structure.
Definition CD_AmrMeshImplem.H:209
EBAMRParticleMesh & getParticleMesh(const std::string a_realm, const phase::which_phase a_phase) const
Get EBAMRParticleMesh operator.
Definition CD_AmrMesh.cpp:3324
void deallocate(Vector< T * > &a_data) const
Deallocate data.
Definition CD_AmrMeshImplem.H:161
const Vector< int > & getRefinementRatios() const
Get refinement ratios.
Definition CD_AmrMesh.cpp:3115
const Vector< RefCountedPtr< LevelTiles > > & getLevelTiles(const std::string a_realm) const
Get the tiled space representation.
Definition CD_AmrMesh.cpp:3241
const Vector< ProblemDomain > & getDomains() const
Get domains.
Definition CD_AmrMesh.cpp:3137
Class for handling particle-mesh operations with AMR.
Definition CD_EBAMRParticleMesh.H:52
class for handling surface deposition of particles with EB and AMR.
Definition CD_EBAMRSurfaceDeposition.H:29
static bool ebIntersectionRaycast(const RefCountedPtr< BaseIF > &a_impFunc, const RealVect &a_oldPos, const RealVect &a_newPos, const Real &a_tolerance, Real &a_s)
Compute the intersection point between a particle path and an implicit function using a ray-casting a...
Definition CD_ParticleOpsImplem.H:221
static bool ebIntersectionBisect(const RefCountedPtr< BaseIF > &a_impFunc, const RealVect &a_oldPos, const RealVect &a_newPos, const Real &a_bisectStep, Real &a_s)
Compute the intersection point between a particle path and an implicit function using a bisection alg...
Definition CD_ParticleOpsImplem.H:177
static IntVect getParticleCellIndex(const RealVect &a_particlePosition, const RealVect &a_probLo, const Real &a_dx) noexcept
Get the cell index corresponding to the particle position.
Definition CD_ParticleOpsImplem.H:30
static bool domainIntersection(const RealVect &a_oldPos, const RealVect &a_newPos, const RealVect &a_probLo, const RealVect &a_probHi, Real &a_s)
Compute the intersection point between a particle path and a domain side.
Definition CD_ParticleOpsImplem.H:131
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:37
virtual void remap()
Remap particles.
Definition CD_TracerParticleSolverImplem.H:338
virtual void setRealm(const std::string &a_realm)
Set the solver realm.
Definition CD_TracerParticleSolverImplem.H:232
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:25
virtual void deposit(EBAMRCellData &a_phi) const noexcept
Deposit particle weight on mesh.
Definition CD_TracerParticleSolverImplem.H:362
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel)
Regrid this solver.
Definition CD_TracerParticleSolverImplem.H:321
RealVect position(const Location::Cell a_location, const VolIndex &a_vof, const EBISBox &a_ebisbox, const Real &a_dx)
Compute the position (ignoring the "origin) of a Vof.
Definition CD_LocationImplem.H:20