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