xref: /petsc/include/petscfv.h (revision 879707a147ef89d464bd014c0b087231838c1f27)
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>
9*879707a1SMatthew G. Knepley #include <petscdstypes.h>
10f62f30faSMatthew G. Knepley 
11b6aca0f9SMatthew G. Knepley /* Assuming dim <= 3 */
12b6aca0f9SMatthew G. Knepley typedef struct {
13b6aca0f9SMatthew G. Knepley   PetscReal   normal[3];   /* Area-scaled normals */
14b6aca0f9SMatthew G. Knepley   PetscReal   centroid[3]; /* Location of centroid (quadrature point) */
15b6aca0f9SMatthew G. Knepley   PetscScalar grad[2][3];  /* Face contribution to gradient in left and right cell */
16b6aca0f9SMatthew G. Knepley } PetscFVFaceGeom;
17b6aca0f9SMatthew G. Knepley 
18b6aca0f9SMatthew G. Knepley typedef struct {
19b6aca0f9SMatthew G. Knepley   PetscReal centroid[3];
20b6aca0f9SMatthew G. Knepley   PetscReal volume;
21b6aca0f9SMatthew G. Knepley } PetscFVCellGeom;
22b6aca0f9SMatthew G. Knepley 
23ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscClassId PETSCLIMITER_CLASSID;
24ab2453f0SMatthew G. Knepley 
25ab2453f0SMatthew G. Knepley /*J
26ab2453f0SMatthew G. Knepley   PetscLimiterType - String with the name of a PETSc finite volume slope limiter
27ab2453f0SMatthew G. Knepley 
28ab2453f0SMatthew G. Knepley   Level: beginner
29ab2453f0SMatthew G. Knepley 
30ab2453f0SMatthew G. Knepley .seealso: PetscLimiterSetType(), PetscLimiter
31ab2453f0SMatthew G. Knepley J*/
32ab2453f0SMatthew G. Knepley typedef const char *PetscLimiterType;
33ab2453f0SMatthew G. Knepley #define PETSCLIMITERSIN       "sin"
349347ee04SMatthew G. Knepley #define PETSCLIMITERZERO      "zero"
359347ee04SMatthew G. Knepley #define PETSCLIMITERNONE      "none"
369347ee04SMatthew G. Knepley #define PETSCLIMITERMINMOD    "minmod"
379347ee04SMatthew G. Knepley #define PETSCLIMITERVANLEER   "vanleer"
389347ee04SMatthew G. Knepley #define PETSCLIMITERVANALBADA "vanalbada"
399347ee04SMatthew G. Knepley #define PETSCLIMITERSUPERBEE  "superbee"
409347ee04SMatthew G. Knepley #define PETSCLIMITERMC        "mc"
41ab2453f0SMatthew G. Knepley 
42ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscFunctionList PetscLimiterList;
43ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscBool         PetscLimiterRegisterAllCalled;
44ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterCreate(MPI_Comm, PetscLimiter *);
45ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterDestroy(PetscLimiter *);
46ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterSetType(PetscLimiter, PetscLimiterType);
47ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterGetType(PetscLimiter, PetscLimiterType *);
48ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterSetUp(PetscLimiter);
49ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterSetFromOptions(PetscLimiter);
50ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterViewFromOptions(PetscLimiter, const char[], const char[]);
51ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterView(PetscLimiter, PetscViewer);
52ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterRegister(const char [], PetscErrorCode (*)(PetscLimiter));
53ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterRegisterAll(void);
54ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterRegisterDestroy(void);
55ab2453f0SMatthew G. Knepley 
561475bf87SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscLimiterLimit(PetscLimiter, PetscReal, PetscReal *);
57ab2453f0SMatthew G. Knepley 
58ab2453f0SMatthew G. Knepley 
59f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVInitializePackage(void);
60f62f30faSMatthew G. Knepley 
61f62f30faSMatthew G. Knepley PETSC_EXTERN PetscClassId PETSCFV_CLASSID;
62f62f30faSMatthew G. Knepley 
63f62f30faSMatthew G. Knepley /*J
64f62f30faSMatthew G. Knepley   PetscFVType - String with the name of a PETSc finite volume discretization
65f62f30faSMatthew G. Knepley 
66f62f30faSMatthew G. Knepley   Level: beginner
67f62f30faSMatthew G. Knepley 
68f62f30faSMatthew G. Knepley .seealso: PetscFVSetType(), PetscFV
69f62f30faSMatthew G. Knepley J*/
70f62f30faSMatthew G. Knepley typedef const char *PetscFVType;
71f62f30faSMatthew G. Knepley #define PETSCFVUPWIND       "upwind"
72f62f30faSMatthew G. Knepley #define PETSCFVLEASTSQUARES "leastsquares"
73f62f30faSMatthew G. Knepley 
74f62f30faSMatthew G. Knepley PETSC_EXTERN PetscFunctionList PetscFVList;
75f62f30faSMatthew G. Knepley PETSC_EXTERN PetscBool         PetscFVRegisterAllCalled;
76f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVCreate(MPI_Comm, PetscFV *);
77f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVDestroy(PetscFV *);
78f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetType(PetscFV, PetscFVType);
79f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetType(PetscFV, PetscFVType *);
80f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetUp(PetscFV);
81f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetFromOptions(PetscFV);
82f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVViewFromOptions(PetscFV, const char[], const char[]);
83f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVView(PetscFV, PetscViewer);
84f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVRegister(const char [], PetscErrorCode (*)(PetscFV));
85f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVRegisterAll(void);
86f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVRegisterDestroy(void);
87f62f30faSMatthew G. Knepley 
88ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetLimiter(PetscFV, PetscLimiter);
89ab2453f0SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetLimiter(PetscFV, PetscLimiter *);
90f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetNumComponents(PetscFV, PetscInt);
91f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetNumComponents(PetscFV, PetscInt *);
92f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetSpatialDimension(PetscFV, PetscInt);
93f62f30faSMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetSpatialDimension(PetscFV, PetscInt *);
94eb4d80e8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetComputeGradients(PetscFV, PetscBool);
95eb4d80e8SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetComputeGradients(PetscFV, PetscBool *);
96ce379721SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVSetQuadrature(PetscFV, PetscQuadrature);
97ce379721SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVGetQuadrature(PetscFV, PetscQuadrature *);
98f62f30faSMatthew G. Knepley 
99c5148223SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVComputeGradient(PetscFV, PetscInt, PetscScalar[], PetscScalar[]);
100*879707a1SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVIntegrateRHSFunction(PetscFV, PetscDS, PetscInt, PetscInt, PetscFVFaceGeom *, PetscReal *, PetscScalar[], PetscScalar[], PetscScalar[], PetscScalar[]);
101f62f30faSMatthew G. Knepley 
102c5148223SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscFVLeastSquaresSetMaxFaces(PetscFV, PetscInt);
103c5148223SMatthew G. Knepley 
104f62f30faSMatthew G. Knepley #endif
105