1 #ifndef ABLATELIBRARY_CELLSOLVER_HPP
2 #define ABLATELIBRARY_CELLSOLVER_HPP
9 namespace ablate::solver {
14 using AuxFieldUpdateFunction = PetscErrorCode (*)(PetscReal time, PetscInt dim,
const PetscFVCellGeom* cellGeom,
const PetscInt uOff[],
const PetscScalar* u,
const PetscInt aOff[],
15 PetscScalar* auxField,
void* ctx);
18 using SolutionFieldUpdateFunction = PetscErrorCode (*)(PetscReal time, PetscInt dim,
const PetscFVCellGeom* cellGeom,
const PetscInt uOff[], PetscScalar* u,
void* ctx);
24 struct AuxFieldUpdateFunctionDescription {
27 std::vector<PetscInt> inputFields;
28 std::vector<PetscInt> auxFields;
32 std::vector<AuxFieldUpdateFunctionDescription> auxFieldUpdateFunctionDescriptions;
37 struct SolutionFieldUpdateFunctionDescription {
40 std::vector<PetscInt> inputFieldsOffsets;
44 std::vector<SolutionFieldUpdateFunctionDescription> solutionFieldUpdateFunctionDescriptions;
59 explicit CellSolver(std::string solverId, std::shared_ptr<domain::Region> = {}, std::shared_ptr<parameters::Parameters> options =
nullptr);
100 void Setup()
override;
Definition: cellSolver.hpp:11
void RegisterAuxFieldUpdate(AuxFieldUpdateFunction function, void *context, const std::vector< std::string > &auxField, const std::vector< std::string > &inputFields)
Definition: cellSolver.cpp:16
Vec faceGeomVec
Vector used to describe the entire face geom of the dm. This is constant and does not depend upon reg...
Definition: cellSolver.hpp:51
Vec cellGeomVec
Vector used to describe the entire cell geom of the dm. This is constant and does not depend upon reg...
Definition: cellSolver.hpp:48
void UpdateAuxFields(PetscReal time, Vec locXVec, Vec locAuxField)
Definition: cellSolver.cpp:62
PetscErrorCode(*)(PetscReal time, PetscInt dim, const PetscFVCellGeom *cellGeom, const PetscInt uOff[], const PetscScalar *u, const PetscInt aOff[], PetscScalar *auxField, void *ctx) AuxFieldUpdateFunction
function template for updating the aux field
Definition: cellSolver.hpp:15
CellSolver(std::string solverId, std::shared_ptr< domain::Region >={}, std::shared_ptr< parameters::Parameters > options=nullptr)
Definition: cellSolver.cpp:4
PetscErrorCode(*)(PetscReal time, PetscInt dim, const PetscFVCellGeom *cellGeom, const PetscInt uOff[], PetscScalar *u, void *ctx) SolutionFieldUpdateFunction
function template for updating the solution field
Definition: cellSolver.hpp:18
void Initialize() override
Definition: cellSolver.cpp:198
void RegisterSolutionFieldUpdate(SolutionFieldUpdateFunction function, void *context, const std::vector< std::string > &inputFields)
Definition: cellSolver.cpp:42
void Setup() override
Definition: cellSolver.cpp:193
void UpdateSolutionFields(PetscReal time, Vec globXVec)
Definition: cellSolver.cpp:141
Definition: solver.hpp:17