ABLATE Source Documentation  0.12.33
ablate::particles::CoupledParticleSolver Class Reference

#include <coupledParticleSolver.hpp>

+ Inheritance diagram for ablate::particles::CoupledParticleSolver:

Public Member Functions

 CoupledParticleSolver (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={}, const std::vector< std::string > &coupledFields={})
 
 CoupledParticleSolver (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={}, const std::vector< std::string > &={})
 
 ~CoupledParticleSolver () override
 cleanup any petsc objects
 
void Setup () override
 
void Initialize () override
 
PetscErrorCode PreRHSFunction (TS ts, PetscReal time, bool initialStage, Vec locX) override
 
PetscErrorCode ComputeRHSFunction (PetscReal time, Vec locX, Vec locF) override
 
- Public Member Functions inherited from ablate::particles::ParticleSolver
 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
 

Protected Member Functions

void MacroStepParticles (TS macroTS, bool swarmMigrate) override
 
- Protected Member Functions inherited from ablate::particles::ParticleSolver
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)
 

Additional Inherited Members

- Public Types inherited from ablate::io::Serializable
enum class  SerializerType { none , collective , serial }
 
- Static Public Member Functions inherited from ablate::particles::ParticleSolver
static PetscErrorCode ComputeParticleExactSolution (TS particleTS, Vec)
 
- Static Public Attributes inherited from ablate::particles::ParticleSolver
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.
 
- Static Protected Member Functions inherited from ablate::particles::ParticleSolver
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 inherited from ablate::particles::ParticleSolver
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
 

Detailed Description

This is an extension of the particle solver that allows for fully coupled simulations. The class implements the RHSFunction to allow inserting source terms back to main TS/flowfield

Constructor & Destructor Documentation

◆ CoupledParticleSolver() [1/2]

ablate::particles::CoupledParticleSolver::CoupledParticleSolver ( 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 = {},
const std::vector< std::string > &  coupledFields = {} 
)

default constructor

Parameters
solverId
options
fields
processes
initializer
fieldInitialization
exactSolutions
coupledFieldsthe fields to couple to the flow solver. If not specified all solution fields will be coupled

◆ CoupledParticleSolver() [2/2]

ablate::particles::CoupledParticleSolver::CoupledParticleSolver ( 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 = {},
const std::vector< std::string > &  coupledFields = {} 
)

shared pointer version of the constructor

Parameters
solverId
options
fields
processes
initializer
fieldInitialization
exactSolutions
coupledFieldsthe fields to couple to the flow solver. If not specified all solution fields will be coupled

Member Function Documentation

◆ ComputeRHSFunction()

PetscErrorCode ablate::particles::CoupledParticleSolver::ComputeRHSFunction ( PetscReal  time,
Vec  locX,
Vec  locF 
)
overridevirtual

Called to compute the RHS source term for the flow/macro TS

Parameters
time
locXThe locX vector includes boundary conditions
F
Returns

Called to compute the RHS source term for the flow/macro TS

Parameters
time
locX
locF
Returns

Implements ablate::solver::RHSFunction.

◆ Initialize()

void ablate::particles::CoupledParticleSolver::Initialize ( )
overridevirtual

Override the Initialize call to set up localEulerianSourceVec

Implements ablate::solver::Solver.

◆ MacroStepParticles()

void ablate::particles::CoupledParticleSolver::MacroStepParticles ( TS  macroTS,
bool  swarmMigrate 
)
overrideprotectedvirtual

Override the macroStep for particles to enable coupling with the eulerian fields

Reimplemented from ablate::particles::ParticleSolver.

◆ PreRHSFunction()

PetscErrorCode ablate::particles::CoupledParticleSolver::PreRHSFunction ( TS  ts,
PetscReal  time,
bool  initialStage,
Vec  locX 
)
overridevirtual

Map the source terms into the flow field once per time step (They are constant during the time step)

Parameters
time
locX
Returns

Reimplemented from ablate::solver::RHSFunction.

◆ Setup()

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

Override the Setup call in the subdomain to allow creating a new aux field that matches solution field in the domain

Implements ablate::solver::Solver.


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