chombo-discharge
Loading...
Searching...
No Matches
CD_ParticleOps.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
14#ifndef CD_PARTICLEOPS_H
15#define CD_PARTICLEOPS_H
16
17// Chombo includes
18#include <RefCountedPtr.H>
19#include <BaseIF.H>
20#include <RealVect.H>
21
22// Our includes
23#include <CD_EBAMRData.H>
24#include <CD_ParticleMap.H>
25#include <CD_NamespaceHeader.H>
26
27template <typename P>
29
34{
35public:
43 static inline IntVect
45
53 static inline IntVect
55
65 template <typename P, const Real& (P::*weight)() const>
66 static inline void
68
74 template <typename P>
75 static inline void
77
85 static inline IntVect
87
99 static inline bool
101 const RealVect& a_newPos,
102 const RealVect& a_probLo,
103 const RealVect& a_probHi,
104 Real& a_s);
105
118 static inline bool
120 const RealVect& a_oldPos,
121 const RealVect& a_newPos,
122 const Real& a_bisectStep,
123 Real& a_s);
124
138 static inline bool
140 const RealVect& a_oldPos,
141 const RealVect& a_newPos,
142 const Real& a_tolerance,
143 Real& a_s);
144
150 template <typename P>
151 static inline void
153
159 template <typename P>
160 static inline void
162
168 template <typename P, const Real& (P::*scalarQuantity)() const>
169 static inline Real
170 sum(const ParticleContainer<P>& a_particles) noexcept;
171
178 template <typename P, Real (P::*scalarQuantity)()>
179 static inline Real
181
187 template <typename P>
188 static inline void
190
197 template <typename P>
198 static inline void
201 const std::function<bool(const P&)>& a_transferCrit) noexcept;
202
208 template <typename P>
209 static inline void
211
217 template <typename P, Real& (P::*particleScalarField)()>
218 static inline void
220
226 template <typename P, RealVect& (P::*particleVectorField)()>
227 static inline void
229
230#ifdef CH_MPI
240 template <typename P>
241 static inline void
244
245#endif
246};
247
248#include <CD_NamespaceFooter.H>
249
250#include <CD_ParticleOpsImplem.H>
251
252#endif
Class for holding data across EBAMR hierarchies.
Implementation of CD_ParticleOps.H.
std::unordered_map< std::pair< uint32_t, uint32_t >, T, PairHash > ParticleMap
Underlying particle map when gathering/scattering particles.
Definition CD_ParticleMap.H:75
Implementation of CD_ParticleOps.H.
Templated class for holding particles on an AMR hierarchy with particle remapping.
Definition CD_ParticleContainer.H:52
A shallow static class for doing various kinds of particle-related operations.
Definition CD_ParticleOps.H:34
static void copy(ParticleContainer< P > &a_dst, const ParticleContainer< P > &a_src) noexcept
Copy all the particles from the a_src to a_dst.
Definition CD_ParticleOpsImplem.H:273
static Real sum(const ParticleContainer< P > &a_particles) noexcept
Perform a sum of some particle quantity.
Definition CD_ParticleOpsImplem.H:321
static void getComputationalParticlesPerCell(EBAMRCellData &a_ppc, const ParticleContainer< P > &a_src) noexcept
Get the number of computational particles per cell.
Definition CD_ParticleOpsImplem.H:88
static void transferParticles(ParticleContainer< P > &a_dstParticles, ParticleContainer< P > &a_srcParticles, const std::function< bool(const P &)> &a_transferCrit) noexcept
Transfer particles if they fulfill a certain removal criterion. Takes particles from a_srcParticles a...
Definition CD_ParticleOpsImplem.H:410
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 void setValue(ParticleContainer< P > &a_particles, const Real a_value) noexcept
Set value function. Lets the user set scalar particle quantity. Use with e.g. setValue<P,...
Definition CD_ParticleOpsImplem.H:471
static void removeParticles(ParticleContainer< P > &a_particles, const std::function< bool(const P &)> &a_removeCriterion) noexcept
Remove particles if they fulfill certain removal criterion.
Definition CD_ParticleOpsImplem.H:379
static Real sum(const ParticleContainer< P > &a_particles) noexcept
Perform a sum of some particle quantity.
static void getPhysicalParticlesPerCell(EBAMRCellData &a_ppc, const ParticleContainer< P > &a_src) noexcept
Get the number of physical particles per cell.
Definition CD_ParticleOpsImplem.H:52
static void copyDestructive(ParticleContainer< P > &a_dst, ParticleContainer< P > &a_src) noexcept
Copy all the particles from the a_src to a_dst. This destroys the source particles.
Definition CD_ParticleOpsImplem.H:296
static IntVect getParticleGridCell(const RealVect &a_particlePosition, const RealVect &a_probLo, const RealVect &a_dx) noexcept
Get the grid cell where the particle lives.
Definition CD_ParticleOpsImplem.H:122
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 void setData(ParticleContainer< P > &a_particles, const std::function< void(P &)> &a_functor) noexcept
Set value function. Lets the user set particle parameters.
Definition CD_ParticleOpsImplem.H:446
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
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:26