Tracer particles
Tracer particles are particles that move along a velocity field
where \(\mathbf{V}\) is the particle velocity. This is interpolated from a mesh-based field as
where \(\mathbf{v}\) is a velocity field defined on the mesh. Such particles are useful, for example, for numerical integration along field lines.
chombo-discharge
defines AMR-ready tracer particle solvers in $DISCHARGE_HOME/Source/TracerParticles
.
TracerParticleSolver
The tracer particle solver is templated as
template <typename P>
class TracerParticleSolver;
where P
is the particle type used for the solver.
The template constraints on P
are
It must contain a function
RealVect& position()
It must contain a function
const Real& weight() const
It must contain a function
RealVect& velocity()
.
Users are free to provide their own particle type provided that it meets these template constraints. However, we also define a plug-and-play particle class that meets these requirements, see TracerParticle.
Note
The TracerParticleSolver
API is available at https://chombo-discharge.github.io/chombo-discharge/doxygen/html/classTracerParticleSolver.html.
TracerParticle
The TracerParticle
type inherits from the GenericParticle
particle class and is templated as
template <size_t M, size_t N>
class TracerParticle<M,N> : public GenericParticle<M, N>
and also defines two more members: A particle weight and a particle velocity. These are accesible as
template <size_t M, size_t N>
Real&
TracerParticle<M, N>::weight();
template <size_t M, size_t N>
RealVect&
TracerParticle<M, N>::velocity();
Note that, just as for GenericParticle
, the template arguments M
and N
indicates the number of scalars and vectors allocated to the particle.
See GenericParticle.
Note
The TracerParticleSolver
API is available at https://chombo-discharge.github.io/chombo-discharge/doxygen/html/classTracerParticle.html.
Initialization
To initialize the solver, one can use the full constructor
template <typename P>
TracerParticleSolver<P>::TracerParticleSolver(const RefCountedPtr<AmrMesh>& a_amr,
const RefCountedPtr<ComputationalGeometry> a_compGeom);
Getting the particles
To obtain the solver particles simply call
template <typename P>
ParticleContainer<P>&
TracerParticleSolver<P>::getParticles();
This returns the ParticleContainer
holding the particles, see ParticleContainer.
Setting \(\mathbf{v}\)
To set the velocity use
template <typename P>
void
TracerParticleSolver<P>::setVelocity(const EBAMRCellData& a_velocityField)
This will associate the input velocity a_velocityField
with \(\mathbf{v}\).
Interpolating velocities
To compute \(\mathbf{V} = \mathbf{v}\left(\mathbf{X}\right)\) use
template <typename P>
void
TracerParticleSolver<P>::interpolateVelocities();
This will interpolate the velocities to the particle positions using the user-defined interpolation method (see Input options).
One can also interpolate a scalar field defined on the mesh onto the particle weight by calling
template <typename P>
void
TracerParticleSolver<P>::interpolateWeight(const EBAMRCellData& a_scalar) noexcept;
Letting \(f\) define the input field a_scalar
, this performs the operation \(w = f\left(\mathbf{X}\right)\).
Deposit particles
To deposit the particles call
template <typename P>
void
TracerParticleSolver<P>::deposit(EBAMRCellData& a_phi)
This will deposit the particle weights onto the input data holder.
Input options
Available input options for the tracer particle solver are
# ====================================================================================================
# TracerParticleSolver class options
# ====================================================================================================
TracerParticleSolver.verbosity = -1 # Solver verbosity level.
TracerParticleSolver.deposition = cic # Deposition method. Must be 'ngp' or 'cic'
TracerParticleSolver.interpolation = cic # Interpolation method. Must be 'ngp' or 'cic'
TracerParticleSolver.deposition_cf = halo # Coarse-fine deposition. Must be interp or halo
TracerParticleSolver.plot_weight = true # Turn on/off plotting of the particle weight.
TracerParticleSolver.plot_velocity = true # Turn on/off plotting of the particle velocities.
TracerParticleSolver.volume_scale = false # If true, depositions yield density * volume instead of just volume
The flags deposition
and interpolation
indicates which deposition and interpolation methods will be used.
Likewise, deposition_cf
indicates the coarse-fine deposition strategy, see Particles.
The flags plot_weight
and plot_velocity
indicates whether or not to include the particle weights and velocities in plot files.