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" 219347ee04SMatthew G. Knepley #define PETSCLIMITERZERO "zero" 229347ee04SMatthew G. Knepley #define PETSCLIMITERNONE "none" 239347ee04SMatthew G. Knepley #define PETSCLIMITERMINMOD "minmod" 249347ee04SMatthew G. Knepley #define PETSCLIMITERVANLEER "vanleer" 259347ee04SMatthew G. Knepley #define PETSCLIMITERVANALBADA "vanalbada" 269347ee04SMatthew G. Knepley #define PETSCLIMITERSUPERBEE "superbee" 279347ee04SMatthew G. Knepley #define PETSCLIMITERMC "mc" 28ab2453f0SMatthew G. Knepley 29ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscFunctionList PetscLimiterList; 30ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscBool PetscLimiterRegisterAllCalled; 31ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterCreate(MPI_Comm, PetscLimiter *); 32ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterDestroy(PetscLimiter *); 33ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterSetType(PetscLimiter, PetscLimiterType); 34ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterGetType(PetscLimiter, PetscLimiterType *); 35ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterSetUp(PetscLimiter); 36ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterSetFromOptions(PetscLimiter); 37ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterViewFromOptions(PetscLimiter, const char[], const char[]); 38ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterView(PetscLimiter, PetscViewer); 39ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterRegister(const char [], PetscErrorCode (*)(PetscLimiter)); 40ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterRegisterAll(void); 41ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterRegisterDestroy(void); 42ab2453f0SMatthew G. Knepley 431475bf87SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterLimit(PetscLimiter, PetscReal, PetscReal *); 44ab2453f0SMatthew G. Knepley 45ab2453f0SMatthew G. Knepley 46f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVInitializePackage(void); 47f62f30faSMatthew G. Knepley 48f62f30faSMatthew G. Knepley PETSC_EXTERN PetscClassId PETSCFV_CLASSID; 49f62f30faSMatthew G. Knepley 50f62f30faSMatthew G. Knepley /*J 51f62f30faSMatthew G. Knepley PetscFVType - String with the name of a PETSc finite volume discretization 52f62f30faSMatthew G. Knepley 53f62f30faSMatthew G. Knepley Level: beginner 54f62f30faSMatthew G. Knepley 55f62f30faSMatthew G. Knepley .seealso: PetscFVSetType(), PetscFV 56f62f30faSMatthew G. Knepley J*/ 57f62f30faSMatthew G. Knepley typedef const char *PetscFVType; 58f62f30faSMatthew G. Knepley #define PETSCFVUPWIND "upwind" 59f62f30faSMatthew G. Knepley #define PETSCFVLEASTSQUARES "leastsquares" 60f62f30faSMatthew G. Knepley 61f62f30faSMatthew G. Knepley PETSC_EXTERN PetscFunctionList PetscFVList; 62f62f30faSMatthew G. Knepley PETSC_EXTERN PetscBool PetscFVRegisterAllCalled; 63f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVCreate(MPI_Comm, PetscFV *); 64f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVDestroy(PetscFV *); 65f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetType(PetscFV, PetscFVType); 66f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetType(PetscFV, PetscFVType *); 67f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetUp(PetscFV); 68f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetFromOptions(PetscFV); 69f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVViewFromOptions(PetscFV, const char[], const char[]); 70f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVView(PetscFV, PetscViewer); 71f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVRegister(const char [], PetscErrorCode (*)(PetscFV)); 72f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVRegisterAll(void); 73f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVRegisterDestroy(void); 74f62f30faSMatthew G. Knepley 75ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetLimiter(PetscFV, PetscLimiter); 76ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetLimiter(PetscFV, PetscLimiter *); 77f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetNumComponents(PetscFV, PetscInt); 78f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetNumComponents(PetscFV, PetscInt *); 79f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetSpatialDimension(PetscFV, PetscInt); 80f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetSpatialDimension(PetscFV, PetscInt *); 81eb4d80e8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetComputeGradients(PetscFV, PetscBool); 82eb4d80e8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetComputeGradients(PetscFV, PetscBool *); 83*ce379721SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetQuadrature(PetscFV, PetscQuadrature); 84*ce379721SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetQuadrature(PetscFV, PetscQuadrature *); 85f62f30faSMatthew G. Knepley 86c5148223SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVComputeGradient(PetscFV, PetscInt, PetscScalar[], PetscScalar[]); 87f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVIntegrateRHSFunction(PetscFV, PetscInt, PetscInt, PetscFV[], PetscInt, PetscCellGeometry, PetscCellGeometry, PetscScalar[], PetscScalar[], 88f62f30faSMatthew G. Knepley void (*)(const PetscReal[], const PetscReal[], const PetscScalar[], const PetscScalar[], PetscScalar[], void *), 89f62f30faSMatthew G. Knepley PetscScalar[], PetscScalar[], void *); 90f62f30faSMatthew G. Knepley 91c5148223SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVLeastSquaresSetMaxFaces(PetscFV, PetscInt); 92c5148223SMatthew G. Knepley 93f62f30faSMatthew G. Knepley /* Assuming dim == 3 */ 94f62f30faSMatthew G. Knepley typedef struct { 951475bf87SMatthew G. Knepley PetscReal normal[3]; /* Area-scaled normals */ 961475bf87SMatthew G. Knepley PetscReal centroid[3]; /* Location of centroid (quadrature point) */ 97f62f30faSMatthew G. Knepley PetscScalar grad[2][3]; /* Face contribution to gradient in left and right cell */ 98f62f30faSMatthew G. Knepley } FaceGeom; 99f62f30faSMatthew G. Knepley 100f62f30faSMatthew G. Knepley typedef struct { 1011475bf87SMatthew G. Knepley PetscReal centroid[3]; 1021475bf87SMatthew G. Knepley PetscReal volume; 103f62f30faSMatthew G. Knepley } CellGeom; 104f62f30faSMatthew G. Knepley 105f62f30faSMatthew G. Knepley #endif 106