ABLATE Source Documentation  0.12.34
coupledParticleSolver.hpp
1 #ifndef ABLATELIBRARY_COUPLEDPARTICLESOLVER_HPP
2 #define ABLATELIBRARY_COUPLEDPARTICLESOLVER_HPP
3 
4 #include "particleSolver.hpp"
5 #include "processes/coupledProcess.hpp"
6 #include "solver/rhsFunction.hpp"
7 
8 namespace ablate::particles {
9 
15  // A string to hold the previous source term name name
16  inline static const char PreviousPackedSolution[] = "PreviousPackedSolution";
17 
18  public:
30  CoupledParticleSolver(std::string solverId, std::shared_ptr<domain::Region>, std::shared_ptr<parameters::Parameters> options, std::vector<FieldDescription> fields,
31  std::vector<std::shared_ptr<processes::Process>> processes, std::shared_ptr<initializers::Initializer> initializer,
32  std::vector<std::shared_ptr<mathFunctions::FieldFunction>> fieldInitialization, std::vector<std::shared_ptr<mathFunctions::FieldFunction>> exactSolutions = {},
33  const std::vector<std::string>& coupledFields = {});
34 
46  CoupledParticleSolver(std::string solverId, std::shared_ptr<domain::Region>, std::shared_ptr<parameters::Parameters> options, const std::vector<std::shared_ptr<FieldDescription>>& fields,
47  std::vector<std::shared_ptr<processes::Process>> processes, std::shared_ptr<initializers::Initializer> initializer,
48  std::vector<std::shared_ptr<mathFunctions::FieldFunction>> fieldInitialization, std::vector<std::shared_ptr<mathFunctions::FieldFunction>> exactSolutions = {},
49  const std::vector<std::string>& = {});
50 
52  ~CoupledParticleSolver() override;
53 
55  void Setup() override;
56 
58  void Initialize() override;
59 
66  PetscErrorCode PreRHSFunction(TS ts, PetscReal time, bool initialStage, Vec locX) override;
67 
75  PetscErrorCode ComputeRHSFunction(PetscReal time, Vec locX, Vec locF) override;
76 
77  protected:
81  void MacroStepParticles(TS macroTS, bool swarmMigrate) override;
82 
83  private:
85  std::vector<std::shared_ptr<processes::CoupledProcess>> coupledProcesses;
86 
88  std::vector<std::string> coupledFieldsNames;
89 
91  std::vector<std::string> coupledParticleFieldsNames;
92 
94  std::vector<ablate::domain::Field> coupledFields;
95 
97  Vec localEulerianSourceVec{};
98 
100  Vec localEulerianVolumeFactor{};
101 
103  void ComputeEulerianSource(PetscReal startTime, PetscReal endTime);
104 };
105 
106 } // namespace ablate::particles
107 #endif // ABLATELIBRARY_COUPLEDPARTICLESOLVER_HPP
Definition: coupledParticleSolver.hpp:14
void MacroStepParticles(TS macroTS, bool swarmMigrate) override
Definition: coupledParticleSolver.cpp:184
PetscErrorCode ComputeRHSFunction(PetscReal time, Vec locX, Vec locF) override
Definition: coupledParticleSolver.cpp:90
~CoupledParticleSolver() override
cleanup any petsc objects
Definition: coupledParticleSolver.cpp:25
void Setup() override
Definition: coupledParticleSolver.cpp:97
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={})
Definition: coupledParticleSolver.cpp:7
PetscErrorCode PreRHSFunction(TS ts, PetscReal time, bool initialStage, Vec locX) override
Definition: coupledParticleSolver.cpp:40
void Initialize() override
Definition: coupledParticleSolver.cpp:136
Definition: particleSolver.hpp:12
std::vector< std::shared_ptr< processes::Process > > processes
the processes that add source terms to the particle and domain ts
Definition: particleSolver.hpp:53
std::vector< Field > fields
all fields in the particle solver
Definition: particleSolver.hpp:47
const std::vector< std::shared_ptr< mathFunctions::FieldFunction > > exactSolutions
store the exact solution if provided
Definition: particleSolver.hpp:62
const std::vector< std::shared_ptr< mathFunctions::FieldFunction > > fieldInitialization
initialize other particle variables
Definition: particleSolver.hpp:59
std::shared_ptr< particles::initializers::Initializer > initializer
Store the particle location and field initialization.
Definition: particleSolver.hpp:56
Definition: rhsFunction.hpp:7