1 #ifndef ABLATELIBRARY_FACEINTERPOLANT_HPP
2 #define ABLATELIBRARY_FACEINTERPOLANT_HPP
5 #include "domain/range.hpp"
6 #include "domain/subDomain.hpp"
7 #include "stencils/stencil.hpp"
9 namespace ablate::finiteVolume {
14 std::shared_ptr<ablate::domain::SubDomain> subDomain;
17 PetscInt solTotalSize = 0;
20 PetscInt auxTotalSize = 0;
23 PetscInt globalFaceStart = -1;
28 DM faceSolutionDm =
nullptr;
33 DM faceSolutionGradDm =
nullptr;
38 DM faceAuxDm =
nullptr;
43 DM faceAuxGradDm =
nullptr;
51 static void CreateFaceDm(PetscInt totalDim, DM dm, DM& newDm);
56 std::vector<stencil::Stencil> stencils;
58 template <
class I,
class T>
59 static inline void AddToArray(I size,
const T* input, T* sum, T factor) {
60 for (I d = 0; d < size; d++) {
61 sum[d] += factor * input[d];
72 FaceInterpolant(
const std::shared_ptr<ablate::domain::SubDomain>& subDomain,
const std::shared_ptr<domain::Region> solverRegion, Vec faceGeomVec, Vec cellGeomVec);
78 using ContinuousFluxFunction = PetscErrorCode (*)(PetscInt dim,
const PetscFVFaceGeom* fg,
const PetscInt uOff[],
const PetscInt uOff_x[],
const PetscScalar field[],
const PetscScalar grad[],
79 const PetscInt aOff[],
const PetscInt aOff_x[],
const PetscScalar aux[],
const PetscScalar gradAux[], PetscScalar flux[],
void* ctx);
89 std::vector<PetscInt> inputFields;
90 std::vector<PetscInt> auxFields;
99 void ComputeRHS(PetscReal time, Vec locXVec, Vec locAuxVec, Vec locFVec,
const std::shared_ptr<domain::Region>& solverRegion,
100 std::vector<FaceInterpolant::ContinuousFluxFunctionDescription>& rhsFunctions,
const ablate::domain::Range& faceRange, Vec cellGeomVec, Vec faceGeomVec);
111 void GetInterpolatedFaceVectors(Vec solutionVec, Vec auxVec, Vec& faceSolutionVec, Vec& faceAuxVec, Vec& faceSolutionGradVec, Vec& faceAuxGradVec);
122 void RestoreInterpolatedFaceVectors(Vec solutionVec, Vec auxVec, Vec& faceSolutionVec, Vec& faceAuxVec, Vec& faceSolutionGradVec, Vec& faceAuxGradVec);
Definition: faceInterpolant.hpp:11
FaceInterpolant(const std::shared_ptr< ablate::domain::SubDomain > &subDomain, const std::shared_ptr< domain::Region > solverRegion, Vec faceGeomVec, Vec cellGeomVec)
Definition: faceInterpolant.cpp:7
void GetInterpolatedFaceVectors(Vec solutionVec, Vec auxVec, Vec &faceSolutionVec, Vec &faceAuxVec, Vec &faceSolutionGradVec, Vec &faceAuxGradVec)
Definition: faceInterpolant.cpp:109
void RestoreInterpolatedFaceVectors(Vec solutionVec, Vec auxVec, Vec &faceSolutionVec, Vec &faceAuxVec, Vec &faceSolutionGradVec, Vec &faceAuxGradVec)
Definition: faceInterpolant.cpp:251
void ComputeRHS(PetscReal time, Vec locXVec, Vec locAuxVec, Vec locFVec, const std::shared_ptr< domain::Region > &solverRegion, std::vector< FaceInterpolant::ContinuousFluxFunctionDescription > &rhsFunctions, const ablate::domain::Range &faceRange, Vec cellGeomVec, Vec faceGeomVec)
Definition: faceInterpolant.cpp:262
PetscErrorCode(*)(PetscInt dim, const PetscFVFaceGeom *fg, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar field[], const PetscScalar grad[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar aux[], const PetscScalar gradAux[], PetscScalar flux[], void *ctx) ContinuousFluxFunction
Definition: faceInterpolant.hpp:79
Definition: faceInterpolant.hpp:84