1 /* 2 Objects which encapsulate finite volume spaces and operations 3 */ 4 #if !defined(__PETSCFV_H) 5 #define __PETSCFV_H 6 #include <petscdm.h> 7 #include <petscdt.h> 8 #include <petscfvtypes.h> 9 10 PETSC_EXTERN PetscErrorCode PetscFVInitializePackage(void); 11 12 PETSC_EXTERN PetscClassId PETSCFV_CLASSID; 13 14 /*J 15 PetscFVType - String with the name of a PETSc finite volume discretization 16 17 Level: beginner 18 19 .seealso: PetscFVSetType(), PetscFV 20 J*/ 21 typedef const char *PetscFVType; 22 #define PETSCFVUPWIND "upwind" 23 #define PETSCFVLEASTSQUARES "leastsquares" 24 25 PETSC_EXTERN PetscFunctionList PetscFVList; 26 PETSC_EXTERN PetscBool PetscFVRegisterAllCalled; 27 PETSC_EXTERN PetscErrorCode PetscFVCreate(MPI_Comm, PetscFV *); 28 PETSC_EXTERN PetscErrorCode PetscFVDestroy(PetscFV *); 29 PETSC_EXTERN PetscErrorCode PetscFVSetType(PetscFV, PetscFVType); 30 PETSC_EXTERN PetscErrorCode PetscFVGetType(PetscFV, PetscFVType *); 31 PETSC_EXTERN PetscErrorCode PetscFVSetUp(PetscFV); 32 PETSC_EXTERN PetscErrorCode PetscFVSetFromOptions(PetscFV); 33 PETSC_EXTERN PetscErrorCode PetscFVViewFromOptions(PetscFV, const char[], const char[]); 34 PETSC_EXTERN PetscErrorCode PetscFVView(PetscFV, PetscViewer); 35 PETSC_EXTERN PetscErrorCode PetscFVRegister(const char [], PetscErrorCode (*)(PetscFV)); 36 PETSC_EXTERN PetscErrorCode PetscFVRegisterAll(void); 37 PETSC_EXTERN PetscErrorCode PetscFVRegisterDestroy(void); 38 39 PETSC_EXTERN PetscErrorCode PetscFVSetNumComponents(PetscFV, PetscInt); 40 PETSC_EXTERN PetscErrorCode PetscFVGetNumComponents(PetscFV, PetscInt *); 41 PETSC_EXTERN PetscErrorCode PetscFVSetSpatialDimension(PetscFV, PetscInt); 42 PETSC_EXTERN PetscErrorCode PetscFVGetSpatialDimension(PetscFV, PetscInt *); 43 44 PETSC_EXTERN PetscErrorCode PetscFVIntegrateRHSFunction(PetscFV, PetscInt, PetscInt, PetscFV[], PetscInt, PetscCellGeometry, PetscCellGeometry, PetscScalar[], PetscScalar[], 45 void (*)(const PetscReal[], const PetscReal[], const PetscScalar[], const PetscScalar[], PetscScalar[], void *), 46 PetscScalar[], PetscScalar[], void *); 47 48 /* Assuming dim == 3 */ 49 typedef struct { 50 PetscScalar normal[3]; /* Area-scaled normals */ 51 PetscScalar centroid[3]; /* Location of centroid (quadrature point) */ 52 PetscScalar grad[2][3]; /* Face contribution to gradient in left and right cell */ 53 } FaceGeom; 54 55 typedef struct { 56 PetscScalar centroid[3]; 57 PetscScalar volume; 58 } CellGeom; 59 60 #endif 61