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 10ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscClassId PETSCLIMITER_CLASSID; 11ab2453f0SMatthew G. Knepley 12ab2453f0SMatthew G. Knepley /*J 13ab2453f0SMatthew G. Knepley PetscLimiterType - String with the name of a PETSc finite volume slope limiter 14ab2453f0SMatthew G. Knepley 15ab2453f0SMatthew G. Knepley Level: beginner 16ab2453f0SMatthew G. Knepley 17ab2453f0SMatthew G. Knepley .seealso: PetscLimiterSetType(), PetscLimiter 18ab2453f0SMatthew G. Knepley J*/ 19ab2453f0SMatthew G. Knepley typedef const char *PetscLimiterType; 20ab2453f0SMatthew G. Knepley #define PETSCLIMITERSIN "sin" 21ab2453f0SMatthew G. Knepley 22ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscFunctionList PetscLimiterList; 23ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscBool PetscLimiterRegisterAllCalled; 24ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterCreate(MPI_Comm, PetscLimiter *); 25ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterDestroy(PetscLimiter *); 26ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterSetType(PetscLimiter, PetscLimiterType); 27ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterGetType(PetscLimiter, PetscLimiterType *); 28ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterSetUp(PetscLimiter); 29ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterSetFromOptions(PetscLimiter); 30ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterViewFromOptions(PetscLimiter, const char[], const char[]); 31ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterView(PetscLimiter, PetscViewer); 32ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterRegister(const char [], PetscErrorCode (*)(PetscLimiter)); 33ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterRegisterAll(void); 34ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterRegisterDestroy(void); 35ab2453f0SMatthew G. Knepley 36*1475bf87SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterLimit(PetscLimiter, PetscReal, PetscReal *); 37ab2453f0SMatthew G. Knepley 38ab2453f0SMatthew 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 68ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetLimiter(PetscFV, PetscLimiter); 69ab2453f0SMatthew 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 *); 74eb4d80e8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetComputeGradients(PetscFV, PetscBool); 75eb4d80e8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetComputeGradients(PetscFV, PetscBool *); 76f62f30faSMatthew G. Knepley 77c5148223SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVComputeGradient(PetscFV, PetscInt, PetscScalar[], PetscScalar[]); 78f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVIntegrateRHSFunction(PetscFV, PetscInt, PetscInt, PetscFV[], PetscInt, PetscCellGeometry, PetscCellGeometry, PetscScalar[], PetscScalar[], 79f62f30faSMatthew G. Knepley void (*)(const PetscReal[], const PetscReal[], const PetscScalar[], const PetscScalar[], PetscScalar[], void *), 80f62f30faSMatthew G. Knepley PetscScalar[], PetscScalar[], void *); 81f62f30faSMatthew G. Knepley 82c5148223SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVLeastSquaresSetMaxFaces(PetscFV, PetscInt); 83c5148223SMatthew G. Knepley 84f62f30faSMatthew G. Knepley /* Assuming dim == 3 */ 85f62f30faSMatthew G. Knepley typedef struct { 86*1475bf87SMatthew G. Knepley PetscReal normal[3]; /* Area-scaled normals */ 87*1475bf87SMatthew G. Knepley PetscReal centroid[3]; /* Location of centroid (quadrature point) */ 88f62f30faSMatthew G. Knepley PetscScalar grad[2][3]; /* Face contribution to gradient in left and right cell */ 89f62f30faSMatthew G. Knepley } FaceGeom; 90f62f30faSMatthew G. Knepley 91f62f30faSMatthew G. Knepley typedef struct { 92*1475bf87SMatthew G. Knepley PetscReal centroid[3]; 93*1475bf87SMatthew G. Knepley PetscReal volume; 94f62f30faSMatthew G. Knepley } CellGeom; 95f62f30faSMatthew G. Knepley 96f62f30faSMatthew G. Knepley #endif 97