chombo-discharge
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TracerParticleSolver< P > Class Template Reference

Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity field. More...

#include <CD_TracerParticleSolver.H>

Collaboration diagram for TracerParticleSolver< P >:
Collaboration graph
[legend]

Public Member Functions

 TracerParticleSolver ()
 Default constructor.
 
 TracerParticleSolver (const TracerParticleSolver &a_other)=delete
 Disallowed constructor. More...
 
 TracerParticleSolver (const TracerParticleSolver &&a_other)=delete
 Disallowed move constructor. More...
 
 TracerParticleSolver (const RefCountedPtr< AmrMesh > &a_amr, const RefCountedPtr< ComputationalGeometry > a_compGeom)
 Full contructor. More...
 
TracerParticleSolveroperator= (const TracerParticleSolver &a_other)=delete
 Disallowed assignment operator. More...
 
TracerParticleSolveroperator= (const TracerParticleSolver &&a_other)=delete
 Disallowed move assignment operator. More...
 
virtual ~TracerParticleSolver ()
 Destructor.
 
virtual void allocate ()
 Allocate storage for this solver.
 
virtual void registerOperators () const
 Register operators needed for AMR core functionality.
 
virtual void setAmr (const RefCountedPtr< AmrMesh > &a_amrMesh)
 Set AmrMesh. More...
 
virtual void setComputationalGeometry (const RefCountedPtr< ComputationalGeometry > &a_compGeom)
 Set the computational geometry. More...
 
virtual void setName (const std::string &a_name) noexcept
 Set the solver name. More...
 
virtual void setVolumeScale (const bool a_scale) noexcept
 Turn on/off volume scaling. More...
 
virtual void setRealm (const std::string &a_realm)
 Set the solver realm. More...
 
virtual void setPhase (const phase::which_phase &a_phase)
 Set the solver phase. More...
 
virtual void setTime (const int a_step, const Real a_time, const Real a_dt)
 Set the time for this solver. More...
 
virtual void setVelocity (const EBAMRCellData &a_velocityField)
 Set the tracer particle velocity field. More...
 
virtual void preRegrid (const int a_lbase, const int a_oldFinestLevel)
 Perform pre-regrid operations. More...
 
virtual void regrid (const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel)
 Regrid this solver. More...
 
virtual void remap ()
 Remap particles.
 
virtual void setDeposition (const DepositionType a_deposition) noexcept
 Set deposition method. More...
 
virtual void deposit (EBAMRCellData &a_phi) const noexcept
 Deposit particle weight on mesh. More...
 
virtual void interpolateWeight (const EBAMRCellData &a_scalar) noexcept
 Interpolate a scalar field onto the particle weight.
 
virtual void interpolateVelocities ()
 Interpolate particles velocities.
 
virtual void parseOptions ()
 Parse solver options.
 
virtual void parseRuntimeOptions ()
 Parse solver run-time options.
 
virtual void writePlotFile ()
 Write plot file. More...
 
virtual int getNumberOfPlotVariables () const
 Get the number of plot variables. More...
 
virtual Vector< std::string > getPlotVariableNames () const
 Get plot variable names. More...
 
virtual void writePlotData (LevelData< EBCellFAB > &a_output, int &a_comp, const std::string a_outputRealm, const int a_level) const noexcept
 Write plot data. More...
 
virtual Real computeDt () const
 Write checkpoint data into HDF5 file. @paramo[out] a_handle HDF5 file. More...
 
virtual ParticleContainer< P > & getParticles ()
 Get all particles. More...
 
virtual const ParticleContainer< P > & getParticles () const
 Get all particles. Const version. More...
 
const EBAMRCellDatagetVelocityField () const
 Return the velocity field. More...
 

Protected Member Functions

void parseDeposition ()
 Parse deposition method.
 
void parsePlotVariables ()
 Parse plot variables.
 
void parseVerbosity ()
 Parse solver verbosity.
 
template<typename T , const Real &(T::*)() const particleScalarFunction>
void depositParticles (EBAMRCellData &a_phi, const ParticleContainer< T > &a_particles, const DepositionType a_baseDeposition, const CoarseFineDeposition a_coarseFineDeposition) const noexcept
 Generic particle deposition method for putting a scalar field onto the mesh. More...
 
virtual void writeData (LevelData< EBCellFAB > &a_output, int &a_comp, const EBAMRCellData &a_data, const std::string a_outputRealm, const int a_level, const bool a_interpToCentroids, const bool a_interpGhost) const noexcept
 Write data to output. Convenience function. More...
 

Protected Attributes

RefCountedPtr< AmrMeshm_amr
 Handle to AMR mesh.
 
RefCountedPtr< ComputationalGeometrym_computationalGeometry
 Handle to computational geometry.
 
DepositionType m_deposition
 Deposition type when depositing particles to grid.
 
DepositionType m_interpolation
 Deposition type when interpolating to particles.
 
CoarseFineDeposition m_coarseFineDeposition
 Coarse-fine deposition strategy.
 
std::string m_realm
 Realm where this solver lives.
 
std::string m_name
 Solver name.
 
std::string m_className
 Class name.
 
phase::which_phase m_phase
 Phase where this solver lives.
 
Real m_dt
 Time step.
 
Real m_time
 Time.
 
int m_timeStep
 Time step.
 
int m_verbosity
 Verbosity level.
 
int m_haloBuffer
 Halo buffer for particle deposition. More...
 
bool m_plotWeight
 Hook for adding weight to plot file.
 
bool m_plotVelocity
 Hook for adding velocity field to plot file.
 
bool m_volumeScale
 Do volumetric scaling when depositing (or not).
 
EBAMRCellData m_velocityField
 Mesh-based velocity field. Must be set through setVelocity.
 
ParticleContainer< P > m_particles
 Computational particles.
 

Detailed Description

template<typename P>
class TracerParticleSolver< P >

Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity field.

The user can set the velocity field through public member functions. This class is templated so the user can switch tracer particle implementations.

This is a single-phase solver – i.e. the particles only live on one of the phases. Extensions to multiphase is certainly possible.

The template requirements on the particle type P are: 1) It must contain a function RealVect& position() (derived from BinItem) 2) It must contain a function const Real& weight() const. 3) It must contain a function RealVect& velocity().

Constructor & Destructor Documentation

◆ TracerParticleSolver() [1/3]

template<typename P >
TracerParticleSolver< P >::TracerParticleSolver ( const TracerParticleSolver< P > &  a_other)
delete

Disallowed constructor.

Parameters
[in]a_otherOther solver.

◆ TracerParticleSolver() [2/3]

template<typename P >
TracerParticleSolver< P >::TracerParticleSolver ( const TracerParticleSolver< P > &&  a_other)
delete

Disallowed move constructor.

Parameters
[in]a_otherOther solver.

◆ TracerParticleSolver() [3/3]

template<typename P >
TracerParticleSolver< P >::TracerParticleSolver ( const RefCountedPtr< AmrMesh > &  a_amr,
const RefCountedPtr< ComputationalGeometry a_compGeom 
)
inline

Full contructor.

Parameters
[in]a_amrHandle to AmrMesh.
[in]a_compGeomComputational geometry.

Member Function Documentation

◆ computeDt()

template<typename P >
Real TracerParticleSolver< P >::computeDt
virtual

Write checkpoint data into HDF5 file. @paramo[out] a_handle HDF5 file.

Parameters
[in]a_levelGrid level

Read checkpoint data from HDF5 file.

Parameters
[in]a_handleHDF5 handle.
[in]constint a_level Grid level

Compute dt = dx/max(v_x,v_y, v_z) minimized over all particles

◆ deposit()

template<typename P >
void TracerParticleSolver< P >::deposit ( EBAMRCellData a_phi) const
inlinevirtualnoexcept

Deposit particle weight on mesh.

Parameters
[out]a_phiDeposited weight.

◆ depositParticles()

template<typename P >
template<typename T , const Real &(T::*)() const particleScalarFunction>
void TracerParticleSolver< P >::depositParticles ( EBAMRCellData a_phi,
const ParticleContainer< T > &  a_particles,
const DepositionType  a_baseDeposition,
const CoarseFineDeposition  a_coarseFineDeposition 
) const
protectednoexcept

Generic particle deposition method for putting a scalar field onto the mesh.

Parameters
[out]a_phiDeposited quantity.
[out]a_particlesParticles to be deposited.
[in]a_baseDepositionBase deposition method.
[in]a_coarseFineDepositionCoarse-fine deposition strategy.

◆ getNumberOfPlotVariables()

template<typename P >
int TracerParticleSolver< P >::getNumberOfPlotVariables
inlinevirtual

Get the number of plot variables.

Returns
Returns number of plot variables.

◆ getParticles() [1/2]

template<typename P >
ParticleContainer< P > & TracerParticleSolver< P >::getParticles
inlinevirtual

Get all particles.

Returns
m_particles

◆ getParticles() [2/2]

template<typename P >
const ParticleContainer< P > & TracerParticleSolver< P >::getParticles
inlinevirtual

Get all particles. Const version.

Returns
m_particles

◆ getPlotVariableNames()

template<typename P >
Vector< std::string > TracerParticleSolver< P >::getPlotVariableNames
inlinevirtual

Get plot variable names.

Returns
List of plot variable names.

◆ getVelocityField()

template<typename P >
const EBAMRCellData & TracerParticleSolver< P >::getVelocityField
inline

Return the velocity field.

Returns
*m_velocityField

◆ operator=() [1/2]

template<typename P >
TracerParticleSolver& TracerParticleSolver< P >::operator= ( const TracerParticleSolver< P > &&  a_other)
delete

Disallowed move assignment operator.

Parameters
[in]a_otherOther solver.

◆ operator=() [2/2]

template<typename P >
TracerParticleSolver& TracerParticleSolver< P >::operator= ( const TracerParticleSolver< P > &  a_other)
delete

Disallowed assignment operator.

Parameters
[in]a_otherOther solver.

◆ preRegrid()

template<typename P >
void TracerParticleSolver< P >::preRegrid ( const int  a_lbase,
const int  a_oldFinestLevel 
)
inlinevirtual

Perform pre-regrid operations.

Parameters
[in]a_lbaseCoarsest level that changed during regrid.
[in]a_oldFinestLevelFinest grid level before the regrid operation.
Note
This stores m_phi and m_source.

◆ regrid()

template<typename P >
void TracerParticleSolver< P >::regrid ( const int  a_lmin,
const int  a_oldFinestLevel,
const int  a_newFinestLevel 
)
inlinevirtual

Regrid this solver.

Parameters
[in]a_lminCoarsest level where grids did not change.
[in]a_oldFinestLevelFinest AMR level before the regrid.
[in]a_newFinestLevelFinest AMR level after the regrid.
Note
The velocity is NOT remeshed – the user is responsible for setting this after the regrid.

◆ setAmr()

template<typename P >
void TracerParticleSolver< P >::setAmr ( const RefCountedPtr< AmrMesh > &  a_amrMesh)
inlinevirtual

Set AmrMesh.

Parameters
[in]a_amrMeshAmrMesh

◆ setComputationalGeometry()

template<typename P >
void TracerParticleSolver< P >::setComputationalGeometry ( const RefCountedPtr< ComputationalGeometry > &  a_compGeom)
inlinevirtual

Set the computational geometry.

Parameters
[in]a_compGeomComputational geometry

◆ setDeposition()

template<typename P >
void TracerParticleSolver< P >::setDeposition ( const DepositionType  a_deposition)
inlinevirtualnoexcept

Set deposition method.

Parameters
[in]a_depositionDeposition method

◆ setName()

template<typename P >
void TracerParticleSolver< P >::setName ( const std::string &  a_name)
inlinevirtualnoexcept

Set the solver name.

Parameters
[in]a_nameSolver name

◆ setPhase()

template<typename P >
void TracerParticleSolver< P >::setPhase ( const phase::which_phase &  a_phase)
inlinevirtual

Set the solver phase.

Parameters
[in]a_phasePhase

◆ setRealm()

template<typename P >
void TracerParticleSolver< P >::setRealm ( const std::string &  a_realm)
inlinevirtual

Set the solver realm.

Parameters
[in]a_realmRealm name.

◆ setTime()

template<typename P >
void TracerParticleSolver< P >::setTime ( const int  a_step,
const Real  a_time,
const Real  a_dt 
)
virtual

Set the time for this solver.

Parameters
[in]a_stepTime step number
[in]a_timeTime (in seconds)
[in]a_dtTime step increment
Note
This sets m_step=a_step, m_time=a_time, m_dt=a_dt

◆ setVelocity()

template<typename P >
void TracerParticleSolver< P >::setVelocity ( const EBAMRCellData a_velocityField)
inlinevirtual

Set the tracer particle velocity field.

Parameters
[in]a_velocityFieldVelocity field.

◆ setVolumeScale()

template<typename P >
void TracerParticleSolver< P >::setVolumeScale ( const bool  a_scale)
inlinevirtualnoexcept

Turn on/off volume scaling.

Parameters
[in]a_scaleVolume scale or not.

◆ writeData()

template<typename P >
void TracerParticleSolver< P >::writeData ( LevelData< EBCellFAB > &  a_output,
int &  a_comp,
const EBAMRCellData a_data,
const std::string  a_outputRealm,
const int  a_level,
const bool  a_interpToCentroids,
const bool  a_interpGhost 
) const
protectedvirtualnoexcept

Write data to output. Convenience function.

Parameters
[in,out]a_outputOutput data holder.
[in,out]a_icompStarting component where this solver begins writing the output.
[in]a_dataData to write.
[in]a_outputRealmRealm where a_output belongs
[in]a_levelGrid level
[in]a_interpToCentroidsIf true, a_data will be interpolated to cell centroids before writing to a_output.
[in]a_interpGhostIf true, interpolate ghost cells

◆ writePlotData()

template<typename P >
void TracerParticleSolver< P >::writePlotData ( LevelData< EBCellFAB > &  a_output,
int &  a_comp,
const std::string  a_outputRealm,
const int  a_level 
) const
inlinevirtualnoexcept

Write plot data.

Parameters
[in,out]a_outputOutput data holder.
[in,out]a_icompStarting component where this solver begins writing the output.
[in]a_outputRealmRealm where a_output belongs
[in]a_levelGrid level
Note
This will write the plot data in this solver to a_output, starting on a_comp

◆ writePlotFile()

template<typename P >
void TracerParticleSolver< P >::writePlotFile
inlinevirtual

Write plot file.

The name of the plot file is m_name.stepXXXXX.DIM.hdf5

Note
This calls writePlotData(...)

Member Data Documentation

◆ m_haloBuffer

template<typename P >
int TracerParticleSolver< P >::m_haloBuffer
protected

Halo buffer for particle deposition.

Used when fetching particles around the refinement boundary.


The documentation for this class was generated from the following files: