1f62f30faSMatthew G. Knepley /* 2f62f30faSMatthew G. Knepley Objects which encapsulate finite volume spaces and operations 3f62f30faSMatthew G. Knepley */ 4f62f30faSMatthew G. Knepley #if !defined(__PETSCFV_H) 5f62f30faSMatthew G. Knepley #define __PETSCFV_H 6f62f30faSMatthew G. Knepley #include <petscdm.h> 7f62f30faSMatthew G. Knepley #include <petscdt.h> 8f62f30faSMatthew G. Knepley #include <petscfvtypes.h> 9f62f30faSMatthew G. Knepley 10*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscClassId PETSCLIMITER_CLASSID; 11*ab2453f0SMatthew G. Knepley 12*ab2453f0SMatthew G. Knepley /*J 13*ab2453f0SMatthew G. Knepley PetscLimiterType - String with the name of a PETSc finite volume slope limiter 14*ab2453f0SMatthew G. Knepley 15*ab2453f0SMatthew G. Knepley Level: beginner 16*ab2453f0SMatthew G. Knepley 17*ab2453f0SMatthew G. Knepley .seealso: PetscLimiterSetType(), PetscLimiter 18*ab2453f0SMatthew G. Knepley J*/ 19*ab2453f0SMatthew G. Knepley typedef const char *PetscLimiterType; 20*ab2453f0SMatthew G. Knepley #define PETSCLIMITERSIN "sin" 21*ab2453f0SMatthew G. Knepley 22*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscFunctionList PetscLimiterList; 23*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscBool PetscLimiterRegisterAllCalled; 24*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterCreate(MPI_Comm, PetscLimiter *); 25*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterDestroy(PetscLimiter *); 26*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterSetType(PetscLimiter, PetscLimiterType); 27*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterGetType(PetscLimiter, PetscLimiterType *); 28*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterSetUp(PetscLimiter); 29*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterSetFromOptions(PetscLimiter); 30*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterViewFromOptions(PetscLimiter, const char[], const char[]); 31*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterView(PetscLimiter, PetscViewer); 32*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterRegister(const char [], PetscErrorCode (*)(PetscLimiter)); 33*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterRegisterAll(void); 34*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterRegisterDestroy(void); 35*ab2453f0SMatthew G. Knepley 36*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterLimit(PetscLimiter, PetscScalar, PetscScalar *); 37*ab2453f0SMatthew G. Knepley 38*ab2453f0SMatthew G. Knepley 39f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVInitializePackage(void); 40f62f30faSMatthew G. Knepley 41f62f30faSMatthew G. Knepley PETSC_EXTERN PetscClassId PETSCFV_CLASSID; 42f62f30faSMatthew G. Knepley 43f62f30faSMatthew G. Knepley /*J 44f62f30faSMatthew G. Knepley PetscFVType - String with the name of a PETSc finite volume discretization 45f62f30faSMatthew G. Knepley 46f62f30faSMatthew G. Knepley Level: beginner 47f62f30faSMatthew G. Knepley 48f62f30faSMatthew G. Knepley .seealso: PetscFVSetType(), PetscFV 49f62f30faSMatthew G. Knepley J*/ 50f62f30faSMatthew G. Knepley typedef const char *PetscFVType; 51f62f30faSMatthew G. Knepley #define PETSCFVUPWIND "upwind" 52f62f30faSMatthew G. Knepley #define PETSCFVLEASTSQUARES "leastsquares" 53f62f30faSMatthew G. Knepley 54f62f30faSMatthew G. Knepley PETSC_EXTERN PetscFunctionList PetscFVList; 55f62f30faSMatthew G. Knepley PETSC_EXTERN PetscBool PetscFVRegisterAllCalled; 56f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVCreate(MPI_Comm, PetscFV *); 57f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVDestroy(PetscFV *); 58f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetType(PetscFV, PetscFVType); 59f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetType(PetscFV, PetscFVType *); 60f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetUp(PetscFV); 61f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetFromOptions(PetscFV); 62f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVViewFromOptions(PetscFV, const char[], const char[]); 63f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVView(PetscFV, PetscViewer); 64f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVRegister(const char [], PetscErrorCode (*)(PetscFV)); 65f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVRegisterAll(void); 66f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVRegisterDestroy(void); 67f62f30faSMatthew G. Knepley 68*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetLimiter(PetscFV, PetscLimiter); 69*ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetLimiter(PetscFV, PetscLimiter *); 70f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetNumComponents(PetscFV, PetscInt); 71f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetNumComponents(PetscFV, PetscInt *); 72f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetSpatialDimension(PetscFV, PetscInt); 73f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetSpatialDimension(PetscFV, PetscInt *); 74f62f30faSMatthew G. Knepley 75f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVIntegrateRHSFunction(PetscFV, PetscInt, PetscInt, PetscFV[], PetscInt, PetscCellGeometry, PetscCellGeometry, PetscScalar[], PetscScalar[], 76f62f30faSMatthew G. Knepley void (*)(const PetscReal[], const PetscReal[], const PetscScalar[], const PetscScalar[], PetscScalar[], void *), 77f62f30faSMatthew G. Knepley PetscScalar[], PetscScalar[], void *); 78f62f30faSMatthew G. Knepley 79f62f30faSMatthew G. Knepley /* Assuming dim == 3 */ 80f62f30faSMatthew G. Knepley typedef struct { 81f62f30faSMatthew G. Knepley PetscScalar normal[3]; /* Area-scaled normals */ 82f62f30faSMatthew G. Knepley PetscScalar centroid[3]; /* Location of centroid (quadrature point) */ 83f62f30faSMatthew G. Knepley PetscScalar grad[2][3]; /* Face contribution to gradient in left and right cell */ 84f62f30faSMatthew G. Knepley } FaceGeom; 85f62f30faSMatthew G. Knepley 86f62f30faSMatthew G. Knepley typedef struct { 87f62f30faSMatthew G. Knepley PetscScalar centroid[3]; 88f62f30faSMatthew G. Knepley PetscScalar volume; 89f62f30faSMatthew G. Knepley } CellGeom; 90f62f30faSMatthew G. Knepley 91f62f30faSMatthew G. Knepley #endif 92