13#ifndef CD_AMRMESHIMPLEM_H
14#define CD_AMRMESHIMPLEM_H
19#include <CD_NamespaceHeader.H>
28 CH_TIME(
"AmrMesh::copyData(EBAMRData, simple)");
29 if (m_verbosity > 5) {
30 pout() <<
"AmrMesh::copyData(EBAMRData, simple)" <<
endl;
33 const int nComp =
a_dst[0]->nComp();
40 for (
int lvl = 0;
lvl <= m_finestLevel;
lvl++) {
57 CH_TIME(
"AmrMesh::copyData(EBAMRData, full)");
58 if (m_verbosity > 5) {
59 pout() <<
"AmrMesh::copyData(EBAMRData, full)" <<
endl;
65 for (
int lvl = 0;
lvl <= m_finestLevel;
lvl++) {
83 CH_TIME(
"AmrMesh::copyData(LD<T>_full)");
84 if (m_verbosity > 5) {
85 pout() <<
"AmrMesh::copyData(LD<T>_full)" <<
endl;
106 CH_TIME(
"AmrMesh::copyData(LD<T>_full)");
107 if (m_verbosity > 5) {
108 pout() <<
"AmrMesh::copyData(LD<T>_full)" <<
endl;
131 else if (
a_toRegion == CopyStrategy::ValidGhost) {
142 else if (
a_toRegion == CopyStrategy::ValidGhost) {
143 copier = m_validGhostToValidGhostRealmCopiers.at(
id)[
a_level];
164 CH_TIME(
"AmrMesh::deallocate(Vector<T*>)");
166 pout() <<
"AmrMesh::deallocate(Vector<T*>)" <<
endl;
178 CH_TIME(
"AmrMesh::deallocate(Vector<RefCountedPtr<T>)");
180 pout() <<
"AmrMesh::deallocate(Vector<RefCountedPtr<T>)" <<
endl;
200 CH_TIME(
"AmrMesh::deallocate(EBAMRData<T>)");
202 pout() <<
"AmrMesh::deallocate(EBAMRData<T>)" <<
endl;
212 CH_TIME(
"AmrMesh::alias(Vector<T*>, Vector<RefCountedPtr<T>)");
214 pout() <<
"AmrMesh::alias(Vector<T*>, Vector<RefCountedPtr<T>)" <<
endl;
224template <
typename T,
typename S>
228 CH_TIME(
"AmrMesh::alias(Vector<T*>, EBAMRData<S>)");
230 pout() <<
"AmrMesh::alias(Vector<T*>, EBAMRData<S>" <<
endl;
240 CH_TIME(
"AmrMesh::allocate(Vector<RefCountedPtr<ParticleData<T> > >, string)");
242 pout() <<
"AmrMesh::allocate(Vector<RefCountedPtr<ParticleData<T> > >, string)" <<
endl;
247 str =
"AmrMesh::allocate(Vector<RefCountedPtr<ParticleData<T> > >, string) - could not find Realm '" +
a_realm +
254 "AmrMesh::allocate(Vector<RefCountedPtr<ParticleData<T> > >, string) - only constant box sizes supported for particle methods");
274 CH_TIME(
"AmrMesh::allocate(ParticleContainer<T>, int, string)");
276 pout() <<
"AmrMesh::allocate(ParticleContainer<T>, int, string)" <<
endl;
280 const std::string str =
"AmrMesh::allocate(ParticleContainer<T>, int, string) - could not find Realm '" +
a_realm +
287 "AmrMesh::allocate(ParticleContainer<T>, int, string) - only constant box sizes are supported for particle methods");
306 CH_TIME(
"AmrMesh::allocatePointer(Vector<RefCountedPtr<T> >)");
308 pout() <<
"AmrMesh::allocatePointer(Vector<RefCountedPtr<T> >)" <<
endl;
321 CH_TIME(
"AmrMesh::allocatePointer(Vector<RefCountedPtr<T> >, int)");
323 pout() <<
"AmrMesh::allocatePointer(Vector<RefCountedPtr<T> >, int)" <<
endl;
337 CH_TIME(
"AmrMesh::allocatePointer(EBAMRData<T>, std::string)");
339 pout() <<
"AmrMesh::allocatePointer(EBAMRData<T>, std::string)" <<
endl;
351 CH_TIME(
"AmrMesh::allocatePointer(EBAMRData<T>, std::string, int)");
353 pout() <<
"AmrMesh::allocatePointer(EBAMRData<T>, std::string, int)" <<
endl;
365 CH_TIME(
"AmrMesh::remapToNewGrids");
366 if (m_verbosity > 5) {
367 pout() <<
"AmrMesh::remapToNewGrids" <<
endl;
375 this->getRefinementRatios(),
376 this->getValidCells(
realm),
377 this->getLevelTiles(
realm),
382template <
class P,
class Ret, Ret (P::*MemberFunc)() const>
392 CH_TIME(
"AmrMesh::depositParticles");
394 pout() <<
"AmrMesh::depositParticles" <<
endl;
406template <
class P,
typename Ret, Ret (P::*MemberFunc)() const>
413 CH_TIME(
"AmrMesh::depositParticles(surface)");
414 if (m_verbosity > 5) {
415 pout() <<
"AmrMesh::depositParticles(surface)" <<
endl;
426template <
class P,
class Ret, Ret (P::*MemberFunc)()>
435 CH_TIME(
"AmrMesh::interpolateParticles(scalar)");
437 pout() <<
"AmrMesh::interpolateParticles(scalar)" <<
endl;
454 CH_TIME(
"AmrMesh::removeCoveredParticlesIF");
456 pout() <<
"AmrMesh::removeCoveredParticlesIF" <<
endl;
476 MayDay::Error(
"AmrMesh::removeCoveredParticlesIF - logic bust");
491#pragma omp parallel for schedule(runtime)
520 CH_TIME(
"AmrMesh::removeCoveredParticlesDiscrete");
522 pout() <<
"AmrMesh::removeCoveredParticlesDiscrete" <<
endl;
538#pragma omp parallel for schedule(runtime)
544 const bool isRegular =
ebisBox.isAllRegular();
545 const bool isCovered =
ebisBox.isAllCovered();
608 CH_TIME(
"AmrMesh::removeCoveredParticlesVoxels");
610 pout() <<
"AmrMesh::removeCoveredParticlesVoxels" <<
endl;
625#pragma omp parallel for schedule(runtime)
631 const bool isRegular =
ebisBox.isAllRegular();
632 const bool isCovered =
ebisBox.isAllCovered();
670 CH_TIME(
"AmrMesh::transferCoveredParticlesIF");
672 pout() <<
"AmrMesh::transferCoveredParticlesIF" <<
endl;
693 MayDay::Error(
"AmrMesh::removeCoveredParticlesIF - logic bust");
713#pragma omp parallel for schedule(runtime)
744 CH_TIME(
"AmrMesh::transferCoveredParticlesDiscrete");
746 pout() <<
"AmrMesh::transferCoveredParticlesDiscrete" <<
endl;
766#pragma omp parallel for schedule(runtime)
772 const bool isRegular =
ebisBox.isAllRegular();
773 const bool isCovered =
ebisBox.isAllCovered();
837 CH_TIME(
"AmrMesh::transferCoveredParticlesVoxels");
839 pout() <<
"AmrMesh::transferCoveredParticlesVoxels" <<
endl;
858#pragma omp parallel for schedule(runtime)
864 const bool isRegular =
ebisBox.isAllRegular();
865 const bool isCovered =
ebisBox.isAllCovered();
903 CH_TIME(
"AmrMesh::transferIrregularParticles");
904 if (m_verbosity > 5) {
905 pout() <<
"AmrMesh::transferIrregularParticles" <<
endl;
912 for (
int lvl = 0;
lvl <= m_finestLevel;
lvl++) {
921#pragma omp parallel for schedule(runtime)
937 MayDay::Warning(
"CD_AmrMeshImplem.H in routine 'transferIrregularParticles' - particle not in box!");
953 if ((p.position() -
ebPos).dotProduct(
normal) >= 0.0) {
962 p.position() =
ebPos;
990 CH_TIME(
"AmrMesh::intersectParticlesRaycastIF");
991 if (m_verbosity > 5) {
992 pout() <<
"AmrMesh::intersectParticlesRaycastIF" <<
endl;
1018 MayDay::Error(
"AmrMesh::intersectParticlesRaycastIF - logic bust");
1028 for (
int lvl = 0;
lvl <= m_finestLevel;
lvl++) {
1035#pragma omp parallel for schedule(runtime)
1071 Real sEB = std::numeric_limits<Real>::max();
1162 CH_TIME(
"AmrMesh::intersectParticlesBisectIF");
1163 if (m_verbosity > 5) {
1164 pout() <<
"AmrMesh::intersectParticlesBisectIF" <<
endl;
1193 MayDay::Error(
"AmrMesh::intersectParticlesBisectIF - logic bust");
1203 for (
int lvl = 0;
lvl <= m_finestLevel;
lvl++) {
1210#pragma omp parallel for schedule(runtime)
1246 Real sEB = std::numeric_limits<Real>::max();
1326#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:27
CopyStrategy
Enum for distinguishing how we copy data Valid => valid region ValidGhost => valid+ghost region.
Definition CD_CopyStrategy.H:24
DepositionType
Deposition types.
Definition CD_DepositionType.H:24
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:606
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:739
void allocatePointer(Vector< RefCountedPtr< T > > &a_data) const
Allocate pointer but not any memory blocks.
Definition CD_AmrMeshImplem.H:304
const Vector< RefCountedPtr< LevelTiles > > & getLevelTiles(const std::string &a_realm) const
Get the tiled space representation.
Definition CD_AmrMesh.cpp:3353
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:23
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:665
int m_maxBoxSize
Max box size.
Definition CD_AmrMesh.H:2109
const AMRMask & getValidCells(const std::string &a_realm) const
Get a map of all valid cells on a specified realm.
Definition CD_AmrMesh.cpp:3337
RealVect m_probLo
Domain simulation corner.
Definition CD_AmrMesh.H:2069
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:363
const Vector< DisjointBoxLayout > & getGrids(const std::string &a_realm) const
Get the grids.
Definition CD_AmrMesh.cpp:3185
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:450
int m_verbosity
Verbosity.
Definition CD_AmrMesh.H:2084
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:516
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:1154
Vector< Real > m_dx
Level resolutions.
Definition CD_AmrMesh.H:2189
int m_finestLevel
Finest level.
Definition CD_AmrMesh.H:2089
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:982
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:384
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:898
std::map< phase::which_phase, RefCountedPtr< BaseIF > > m_baseif
Implicit functions.
Definition CD_AmrMesh.H:1988
bool queryRealm(const std::string &a_realm) const
Query if a realm exists.
Definition CD_AmrMesh.cpp:3680
const Vector< Real > & getDx() const
Get spatial resolutions.
Definition CD_AmrMesh.cpp:3129
EBAMRParticleMesh & getParticleMesh(const std::string &a_realm, const phase::which_phase a_phase) const
Get EBAMRParticleMesh operator.
Definition CD_AmrMesh.cpp:3504
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:3201
std::map< std::string, RefCountedPtr< Realm > > m_realms
These are all the Realms.
Definition CD_AmrMesh.H:1983
int m_blockingFactor
Blocking factor.
Definition CD_AmrMesh.H:2124
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:428
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:238
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:833
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:210
void deallocate(Vector< T * > &a_data) const
Deallocate data.
Definition CD_AmrMeshImplem.H:162
const Vector< int > & getRefinementRatios() const
Get refinement ratios.
Definition CD_AmrMesh.cpp:3140
const Vector< ProblemDomain > & getDomains() const
Get domains.
Definition CD_AmrMesh.cpp:3163
Class for handling particle-mesh operations with AMR.
Definition CD_EBAMRParticleMesh.H:53
class for handling surface deposition of particles with EB and AMR.
Definition CD_EBAMRSurfaceDeposition.H:30
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:222
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:178
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:31
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:132
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:38
virtual void remap()
Remap particles.
Definition CD_TracerParticleSolverImplem.H:339
virtual void setRealm(const std::string &a_realm)
Set the solver realm.
Definition CD_TracerParticleSolverImplem.H:233
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:26
virtual void deposit(EBAMRCellData &a_phi) const noexcept
Deposit particle weight on mesh.
Definition CD_TracerParticleSolverImplem.H:363
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel)
Regrid this solver.
Definition CD_TracerParticleSolverImplem.H:322
RealVect position(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:21
which_phase
Enumeration of supported phases.
Definition CD_MultiFluidIndexSpace.H:38
@ solid
Solid (dielectric) phase.
Definition CD_MultiFluidIndexSpace.H:40
@ gas
Gas phase.
Definition CD_MultiFluidIndexSpace.H:39