13#ifndef CD_EBPARTICLEMESHIMPLEM_H
14#define CD_EBPARTICLEMESHIMPLEM_H
23#include <CD_NamespaceHeader.H>
25template <
class P,
class Ret, Ret (P::*MemberFunc)() const>
33 CH_TIME(
"EBParticleMesh::deposit");
35 pout() <<
"EBParticleMesh::deposit" <<
endl;
38 constexpr int numComp = EBParticleMesh::sanitize<Ret>();
64 case DepositionType::NGP: {
73 case DepositionType::CIC: {
82 case DepositionType::TSC: {
99template <
class P,
class Ret, Ret (P::*MemberFunc)()>
106 CH_TIME(
"EBParticleMesh::interpolate(Real)");
108 static_assert(std::is_same<Ret, Real&>::value || std::is_same<Ret, RealVect&>::value,
109 "Ret should be Real& or RealVect&");
111 constexpr int numComp = std::is_same<Ret, Real&>::value ? 1 :
SpaceDim;
126 case DepositionType::NGP: {
132 case DepositionType::CIC: {
138 case DepositionType::TSC: {
145 MayDay::Error(
"EBParticleMesh::interpolate - logic bust");
159 operator()(
Real&
r)
const
175 case DepositionType::NGP: {
179 const auto&
x = p.position();
186 case DepositionType::CIC: {
190 const auto&
x = p.position();
197 case DepositionType::TSC: {
201 const auto&
x = p.position();
223 CH_TIME(
"EBParticleMesh::depositParticleNGP");
246 CH_TIME(
"EBParticleMesh::depositParticleCIC");
269 weight *= std::max(0.0, std::min(
b,
L) - std::max(
a, -
L));
296 CH_TIME(
"EBParticleMesh::depositParticleTSC");
345 CH_TIME(
"EBParticleMesh::interpolateParticleNGP");
365 CH_TIME(
"EBParticleMesh::interpolateParticleCIC");
388 else if (!(m_ebisbox.isCovered(
particleIV))) {
421 CH_TIME(
"EBParticleMesh::interpolateParticleTSC");
444 else if (!(m_ebisbox.isCovered(
particleIV))) {
454 weight *= 0.75 -
l *
l;
457 weight *= 0.5 * (1.5 -
l) * (1.5 -
l);
475#include <CD_NamespaceFooter.H>
Declaration of a namespace for proto-typing grid and EB loops.
DepositionType
Deposition types.
Definition CD_DepositionType.H:24
Declaration of a class for handling particle-mesh interpolation and deposition.
Declaration of a static class containing some common useful particle routines that would otherwise be...
bool m_verbose
Verbose or not.
Definition CD_EBParticleMesh.H:133
void depositParticleCIC(EBCellFAB &a_rho, const RealVect &a_position, const RealVect &a_particleWidth, const Box &a_particleBox, const Real &a_volumeFactor, const Real *a_strength, const int &a_numComp, const bool a_forceIrregNGP) const noexcept
Function for depositing a single particle with a CIC scheme.
Definition CD_EBParticleMeshImplem.H:237
void interpolateParticleNGP(Real *a_particleField, const EBCellFAB &a_meshData, const RealVect &a_position, const int &a_numComp) const noexcept
Particle interpolation function using an NGP scheme.
Definition CD_EBParticleMeshImplem.H:340
void interpolateParticleTSC(Real *a_particleField, const EBCellFAB &a_meshData, const Box &a_validBox, const Box &a_gatherBox, const RealVect &a_position, const int &a_numComp, const bool a_forceIrregNGP) const noexcept
Particle interpolation function using a TSC scheme.
Definition CD_EBParticleMeshImplem.H:413
void depositParticleNGP(EBCellFAB &a_rho, const RealVect &a_position, const Real &a_volumeFactor, const Real *a_strength, const int &a_numComp) const noexcept
Wrapper function for depositing a single particle with a standard NGP scheme.
Definition CD_EBParticleMeshImplem.H:217
void interpolate(List< P > &a_particles, const EBCellFAB &a_meshData, const DepositionType a_interpType, const bool a_forceIrregNGP=false) const
Interpolate mesh data onto a particle.
Definition CD_EBParticleMeshImplem.H:101
void interpolateParticleCIC(Real *a_particleField, const EBCellFAB &a_meshData, const Box &a_validBox, const Box &a_gatherBox, const RealVect &a_position, const int &a_numComp, const bool a_forceIrregNGP) const noexcept
Particle interpolation function using a CIC scheme.
Definition CD_EBParticleMeshImplem.H:357
void depositParticleTSC(EBCellFAB &a_rho, const RealVect &a_position, const RealVect &a_particleWidth, const Box &a_particleBox, const Real &a_volumeFactor, const Real *a_strength, const int &a_numComp, const bool a_forceIrregNGP) const noexcept
Function for depositing a single particle with a TSC scheme.
Definition CD_EBParticleMeshImplem.H:287
RealVect m_dx
Grid resolution.
Definition CD_EBParticleMesh.H:148
ProblemDomain m_domain
Problem domain.
Definition CD_EBParticleMesh.H:128
void deposit(EBCellFAB &a_meshData, const List< P > &a_particles, const DepositionType a_depositionType, const Real a_widthScale, const bool a_forceIrregNGP=false) const
Deposit a particle onto the mesh.
Definition CD_EBParticleMeshImplem.H:27
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
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