ABLATE Source Documentation  0.12.33
ablate::particles::ParticleSolver Class Reference
+ Inheritance diagram for ablate::particles::ParticleSolver:

Public Member Functions

 ParticleSolver (std::string solverId, std::shared_ptr< domain::Region >, std::shared_ptr< parameters::Parameters > options, std::vector< FieldDescription > fields, std::vector< std::shared_ptr< processes::Process >> processes, std::shared_ptr< initializers::Initializer > initializer, std::vector< std::shared_ptr< mathFunctions::FieldFunction >> fieldInitialization, std::vector< std::shared_ptr< mathFunctions::FieldFunction >> exactSolutions={})
 
 ParticleSolver (std::string solverId, std::shared_ptr< domain::Region >, std::shared_ptr< parameters::Parameters > options, const std::vector< std::shared_ptr< FieldDescription >> &fields, std::vector< std::shared_ptr< processes::Process >> processes, std::shared_ptr< initializers::Initializer > initializer, std::vector< std::shared_ptr< mathFunctions::FieldFunction >> fieldInitialization, std::vector< std::shared_ptr< mathFunctions::FieldFunction >> exactSolutions={})
 
void Setup () override
 
void Initialize () override
 
DM GetParticleDM ()
 
TS GetParticleTS ()
 
const std::string & GetId () const override
 
PetscErrorCode Save (PetscViewer viewer, PetscInt steps, PetscReal time) override
 
PetscErrorCode Restore (PetscViewer viewer, PetscInt steps, PetscReal time) override
 
- Public Member Functions inherited from ablate::solver::Solver
virtual void Register (std::shared_ptr< ablate::domain::SubDomain > subDomain)
 
const std::string & GetSolverId () const
 
ablate::domain::SubDomainGetSubDomain () noexcept
 
const ablate::domain::SubDomainGetSubDomain () const noexcept
 
std::shared_ptr< domain::RegionGetRegion () const noexcept
 
void PreStage (TS ts, PetscReal stagetime)
 
void PreStep (TS ts)
 
void PostStep (TS ts)
 
void PostEvaluate (TS ts)
 
void RegisterPreStep (const std::function< void(TS ts, Solver &)> &preStep)
 
void RegisterPreStage (const std::function< void(TS ts, Solver &, PetscReal)> &preStage)
 
void RegisterPostStep (const std::function< void(TS ts, Solver &)> &postStep)
 
void RegisterPostEvaluate (const std::function< void(TS ts, Solver &)> &postEval)
 
void GetCellRange (ablate::domain::Range &cellRange) const
 
void GetFaceRange (ablate::domain::Range &faceRange) const
 
void GetRange (PetscInt depth, ablate::domain::Range &range) const
 
void RestoreRange (ablate::domain::Range &range) const
 
- Public Member Functions inherited from ablate::io::Serializable
virtual SerializerType Serialize () const
 

Static Public Member Functions

static PetscErrorCode ComputeParticleExactSolution (TS particleTS, Vec)
 

Static Public Attributes

static const char ParticleVelocity [] = "ParticleVelocity"
 
static const char ParticleDiameter [] = "ParticleDiameter"
 
static const char ParticleDensity [] = "ParticleDensity"
 
static const char PackedSolution [] = "PackedSolution"
 
static const char ParticleInitialLocation [] = "InitialLocation"
 
static const char ParticleCoordinates [] = "coordinates"
 These coordinates are part of the solution vector.
 

Protected Member Functions

virtual void MacroStepParticles (TS macroTS, bool swarmMigrate)
 
void RegisterParticleField (const FieldDescription &fieldDescriptor)
 
void StoreInitialParticleLocations ()
 
void ProjectFunction (const std::shared_ptr< mathFunctions::FieldFunction > &fieldFunction, PetscReal time=0.0)
 
void SwarmMigrate ()
 
void CoordinatesToSolutionVector ()
 
void CoordinatesFromSolutionVector ()
 
template<class T >
void GetField (const Field &field, T **values)
 
template<class T >
void RestoreField (const Field &field, T **values)
 
template<class T >
const FieldGetField (const std::string &fieldName, T **values)
 
template<class T >
void RestoreField (const std::string &fieldName, T **values)
 
const FieldGetField (const std::string &fieldName) const
 
- Protected Member Functions inherited from ablate::solver::Solver
 Solver (std::string solverId, std::shared_ptr< domain::Region >={}, std::shared_ptr< parameters::Parameters > options=nullptr)
 

Static Protected Member Functions

static PetscErrorCode ComputeParticleError (TS particleTS, Vec u, Vec e)
 
static PetscErrorCode ComputeParticleRHS (TS ts, PetscReal t, Vec X, Vec F, void *ctx)
 
- Static Protected Member Functions inherited from ablate::solver::Solver
static PetscErrorCode DMPlexInsertBoundaryValues_Plex (DM dm, PetscDS ds, PetscBool insertEssential, Vec locX, PetscReal time, Vec faceGeomFVM, Vec cellGeomFVM, Vec gradFVM)
 
static PetscErrorCode DMPlexInsertTimeDerivativeBoundaryValues_Plex (DM dm, PetscDS ds, PetscBool insertEssential, Vec locX, PetscReal time, Vec faceGeomFVM, Vec cellGeomFVM, Vec gradFVM)
 
- Static Protected Member Functions inherited from ablate::io::Serializable
static PetscErrorCode SaveKeyValue (PetscViewer viewer, const char *name, PetscScalar value)
 
static PetscErrorCode RestoreKeyValue (PetscViewer viewer, const char *name, PetscScalar &value)
 
template<class T >
static PetscErrorCode SaveKeyValue (PetscViewer viewer, const char *name, T value)
 
template<class T >
static PetscErrorCode RestoreKeyValue (PetscViewer viewer, const char *name, T &value)
 
template<class T >
static SerializerType DetermineSerializerType (const T &types)
 

Protected Attributes

DM swarmDm = nullptr
 particle dm, this is a swarm
 
TS particleTs = nullptr
 time integration data
 
PetscReal timeInitial = 0.0
 The time for ui, at the beginning of the advection solve.
 
PetscReal timeFinal = 0.0
 The time for uf, at the end of the advection solve.
 
PetscInt ndims = 0
 the dims from the subdomain
 
bool dmChanged = false
 store a boolean to state if a dmChanged (number of particles local/global changed)
 
std::vector< FieldDescriptionfieldsDescriptions
 the fields specific to be created to create in the particle solver
 
std::vector< Fieldfields
 all fields in the particle solver
 
std::map< std::string, FieldfieldsMap
 a map of fields for easy field lookup
 
std::vector< std::shared_ptr< processes::Process > > processes
 the processes that add source terms to the particle and domain ts
 
std::shared_ptr< particles::initializers::Initializerinitializer = nullptr
 Store the particle location and field initialization.
 
const std::vector< std::shared_ptr< mathFunctions::FieldFunction > > fieldInitialization
 initialize other particle variables
 
const std::vector< std::shared_ptr< mathFunctions::FieldFunction > > exactSolutions
 store the exact solution if provided
 
- Protected Attributes inherited from ablate::solver::Solver
PetscOptions petscOptions
 
std::shared_ptr< ablate::domain::SubDomainsubDomain
 

Additional Inherited Members

- Public Types inherited from ablate::io::Serializable
enum class  SerializerType { none , collective , serial }
 

Constructor & Destructor Documentation

◆ ParticleSolver() [1/2]

ablate::particles::ParticleSolver::ParticleSolver ( std::string  solverId,
std::shared_ptr< domain::Region region,
std::shared_ptr< parameters::Parameters options,
std::vector< FieldDescription fields,
std::vector< std::shared_ptr< processes::Process >>  processes,
std::shared_ptr< initializers::Initializer initializer,
std::vector< std::shared_ptr< mathFunctions::FieldFunction >>  fieldInitialization,
std::vector< std::shared_ptr< mathFunctions::FieldFunction >>  exactSolutions = {} 
)

default constructor

Parameters
solverId
options
fields
processes
initializer
fieldInitialization
exactSolutions

◆ ParticleSolver() [2/2]

ablate::particles::ParticleSolver::ParticleSolver ( std::string  solverId,
std::shared_ptr< domain::Region region,
std::shared_ptr< parameters::Parameters options,
const std::vector< std::shared_ptr< FieldDescription >> &  fields,
std::vector< std::shared_ptr< processes::Process >>  processes,
std::shared_ptr< initializers::Initializer initializer,
std::vector< std::shared_ptr< mathFunctions::FieldFunction >>  fieldInitialization,
std::vector< std::shared_ptr< mathFunctions::FieldFunction >>  exactSolutions = {} 
)

shared pointer version of the constructor

Parameters
solverId
options
fields
processes
initializer
fieldInitialization
exactSolutions

Member Function Documentation

◆ ComputeParticleError()

PetscErrorCode ablate::particles::ParticleSolver::ComputeParticleError ( TS  particleTS,
Vec  u,
Vec  e 
)
staticprotected

computes the error based upon the the specified exact solution and initial particle location

Parameters
particleTS
u
e
Returns

◆ ComputeParticleExactSolution()

PetscErrorCode ablate::particles::ParticleSolver::ComputeParticleExactSolution ( TS  particleTS,
Vec  exactSolutionVec 
)
static

Helper function useful for tests

Parameters
particleTS
Returns

◆ ComputeParticleRHS()

PetscErrorCode ablate::particles::ParticleSolver::ComputeParticleRHS ( TS  ts,
PetscReal  t,
Vec  X,
Vec  F,
void *  ctx 
)
staticprotected

computes the particle rhs for the particle TS

Parameters
ts
t
X
F
ctx
Returns

◆ CoordinatesFromSolutionVector()

void ablate::particles::ParticleSolver::CoordinatesFromSolutionVector ( )
protected

map the solution vector coordinates to the particle coordinates

◆ CoordinatesToSolutionVector()

void ablate::particles::ParticleSolver::CoordinatesToSolutionVector ( )
protected

map the coordinates to the solution vector

◆ GetField() [1/3]

template<class T >
void ablate::particles::ParticleSolver::GetField ( const Field field,
T **  values 
)
inlineprotected

Get the array based upon field

◆ GetField() [2/3]

const Field& ablate::particles::ParticleSolver::GetField ( const std::string &  fieldName) const
inlineprotected

Get field information based upon field name

◆ GetField() [3/3]

template<class T >
const Field& ablate::particles::ParticleSolver::GetField ( const std::string &  fieldName,
T **  values 
)
inlineprotected

Get the array and field information based upon field name

◆ GetId()

const std::string& ablate::particles::ParticleSolver::GetId ( ) const
inlineoverridevirtual

only required function, returns the id of the object. Should be unique for the simulation

Returns

Implements ablate::io::Serializable.

◆ GetParticleDM()

DM ablate::particles::ParticleSolver::GetParticleDM ( )
inline

return access to the particle dm

Returns
the swamParticle dm

◆ GetParticleTS()

TS ablate::particles::ParticleSolver::GetParticleTS ( )
inline

return access to the particle dm

Returns
the swamParticle dm

◆ MacroStepParticles()

void ablate::particles::ParticleSolver::MacroStepParticles ( TS  macroTS,
bool  swarmMigrate 
)
protectedvirtual

Function to be be called after each flow time step

Reimplemented in ablate::particles::CoupledParticleSolver.

◆ ProjectFunction()

void ablate::particles::ParticleSolver::ProjectFunction ( const std::shared_ptr< mathFunctions::FieldFunction > &  fieldFunction,
PetscReal  time = 0.0 
)
protected

Project the field function to the particle field

◆ RegisterParticleField()

void ablate::particles::ParticleSolver::RegisterParticleField ( const FieldDescription fieldDescriptor)
protected

The register fields adds the field to the swarm

Parameters
fieldDescriptor

The unique name of the particle field

The name of the components

The name of the components

The field type (sol or aux)

The type of field

The offset in the local array, 0 for aux, computed for sol

The size of the component for this data

◆ Restore()

PetscErrorCode ablate::particles::ParticleSolver::Restore ( PetscViewer  viewer,
PetscInt  steps,
PetscReal  time 
)
overridevirtual

shared function to view all particles;

Parameters
viewer
steps
time
u

Implements ablate::io::Serializable.

◆ RestoreField() [1/2]

template<class T >
void ablate::particles::ParticleSolver::RestoreField ( const Field field,
T **  values 
)
inlineprotected

Restore the array and field information based upon field name

◆ RestoreField() [2/2]

template<class T >
void ablate::particles::ParticleSolver::RestoreField ( const std::string &  fieldName,
T **  values 
)
inlineprotected

Restore the array and field information based upon field name

◆ Save()

PetscErrorCode ablate::particles::ParticleSolver::Save ( PetscViewer  viewer,
PetscInt  steps,
PetscReal  time 
)
overridevirtual

shared function to view all particles;

Parameters
viewer
steps
time
u

Implements ablate::io::Serializable.

◆ Setup()

void ablate::particles::ParticleSolver::Setup ( )
overridevirtual

Setup and size the subDomain with the subDomain

DMSWARM_PIC is suitable for particle-in-cell methods. Configured as DMSWARM_PIC, the swarm will be aware of, another DM which serves as the background mesh. Fields specific to particle-in-cell methods are registered by default. These include spatial coordinates, a unique identifier, a cell index and an index for the owning rank. The background mesh will (by default) define the spatial decomposition of the points defined in the swarm. DMSWARM_PIC provides support for particle-in-cell operations such as defining initial point coordinates, communicating particles between sub-domains, projecting particle data fields on to the mesh.

Implements ablate::solver::Solver.

◆ StoreInitialParticleLocations()

void ablate::particles::ParticleSolver::StoreInitialParticleLocations ( )
protected

stores the initial particle locations in the ParticleInitialLocation field

◆ SwarmMigrate()

void ablate::particles::ParticleSolver::SwarmMigrate ( )
protected

Migrate the particle between ranks based upon the background mesh

Member Data Documentation

◆ ParticleVelocity

const char ablate::particles::ParticleSolver::ParticleVelocity[] = "ParticleVelocity"
inlinestatic

common field names for particles


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