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