Actual source code: petscfv.h

  1: /*
  2:       Objects which encapsulate finite volume spaces and operations
  3: */
  4: #pragma once

  6: #include <petscdm.h>
  7: #include <petscdt.h>
  8: #include <petscspace.h>
  9: #include <petscdualspace.h>
 10: #include <petscfvtypes.h>
 11: #include <petscdstypes.h>

 13: /* SUBMANSEC = FV */

 15: PETSC_EXTERN PetscClassId PETSCLIMITER_CLASSID;

 17: /*J
 18:   PetscLimiterType - String with the name of a PETSc finite volume slope limiter

 20:   Level: beginner

 22: .seealso: `PetscLimiterSetType()`, `PetscLimiter`
 23: J*/
 24: typedef const char *PetscLimiterType;
 25: #define PETSCLIMITERSIN       "sin"
 26: #define PETSCLIMITERZERO      "zero"
 27: #define PETSCLIMITERNONE      "none"
 28: #define PETSCLIMITERMINMOD    "minmod"
 29: #define PETSCLIMITERVANLEER   "vanleer"
 30: #define PETSCLIMITERVANALBADA "vanalbada"
 31: #define PETSCLIMITERSUPERBEE  "superbee"
 32: #define PETSCLIMITERMC        "mc"

 34: PETSC_EXTERN PetscFunctionList PetscLimiterList;
 35: PETSC_EXTERN PetscErrorCode    PetscLimiterCreate(MPI_Comm, PetscLimiter *);
 36: PETSC_EXTERN PetscErrorCode    PetscLimiterDestroy(PetscLimiter *);
 37: PETSC_EXTERN PetscErrorCode    PetscLimiterSetType(PetscLimiter, PetscLimiterType);
 38: PETSC_EXTERN PetscErrorCode    PetscLimiterGetType(PetscLimiter, PetscLimiterType *);
 39: PETSC_EXTERN PetscErrorCode    PetscLimiterSetUp(PetscLimiter);
 40: PETSC_EXTERN PetscErrorCode    PetscLimiterSetFromOptions(PetscLimiter);
 41: PETSC_EXTERN PetscErrorCode    PetscLimiterViewFromOptions(PetscLimiter, PetscObject, const char[]);
 42: PETSC_EXTERN PetscErrorCode    PetscLimiterView(PetscLimiter, PetscViewer);
 43: PETSC_EXTERN PetscErrorCode    PetscLimiterRegister(const char[], PetscErrorCode (*)(PetscLimiter));
 44: PETSC_EXTERN PetscErrorCode    PetscLimiterRegisterDestroy(void);

 46: PETSC_EXTERN PetscErrorCode PetscLimiterLimit(PetscLimiter, PetscReal, PetscReal *);

 48: PETSC_EXTERN PetscErrorCode PetscFVInitializePackage(void);
 49: PETSC_EXTERN PetscErrorCode PetscFVFinalizePackage(void);

 51: PETSC_EXTERN PetscClassId PETSCFV_CLASSID;

 53: /*J
 54:   PetscFVType - String with the name of a PETSc finite volume discretization

 56:   Level: beginner

 58: .seealso: `PetscFVSetType()`, `PetscFV`
 59: J*/
 60: typedef const char *PetscFVType;
 61: #define PETSCFVUPWIND       "upwind"
 62: #define PETSCFVLEASTSQUARES "leastsquares"

 64: PETSC_EXTERN PetscFunctionList PetscFVList;
 65: PETSC_EXTERN PetscErrorCode    PetscFVCreate(MPI_Comm, PetscFV *);
 66: PETSC_EXTERN PetscErrorCode    PetscFVDestroy(PetscFV *);
 67: PETSC_EXTERN PetscErrorCode    PetscFVSetType(PetscFV, PetscFVType);
 68: PETSC_EXTERN PetscErrorCode    PetscFVGetType(PetscFV, PetscFVType *);
 69: PETSC_EXTERN PetscErrorCode    PetscFVSetUp(PetscFV);
 70: PETSC_EXTERN PetscErrorCode    PetscFVSetFromOptions(PetscFV);
 71: PETSC_EXTERN PetscErrorCode    PetscFVViewFromOptions(PetscFV, PetscObject, const char[]);
 72: PETSC_EXTERN PetscErrorCode    PetscFVView(PetscFV, PetscViewer);
 73: PETSC_EXTERN PetscErrorCode    PetscFVRegister(const char[], PetscErrorCode (*)(PetscFV));
 74: PETSC_EXTERN PetscErrorCode    PetscFVRegisterDestroy(void);
 75: PETSC_EXTERN PetscErrorCode    PetscFVSetComponentName(PetscFV, PetscInt, const char[]);
 76: PETSC_EXTERN PetscErrorCode    PetscFVGetComponentName(PetscFV, PetscInt, const char *[]);

 78: PETSC_EXTERN PetscErrorCode PetscFVSetLimiter(PetscFV, PetscLimiter);
 79: PETSC_EXTERN PetscErrorCode PetscFVGetLimiter(PetscFV, PetscLimiter *);
 80: PETSC_EXTERN PetscErrorCode PetscFVSetNumComponents(PetscFV, PetscInt);
 81: PETSC_EXTERN PetscErrorCode PetscFVGetNumComponents(PetscFV, PetscInt *);
 82: PETSC_EXTERN PetscErrorCode PetscFVSetSpatialDimension(PetscFV, PetscInt);
 83: PETSC_EXTERN PetscErrorCode PetscFVGetSpatialDimension(PetscFV, PetscInt *);
 84: PETSC_EXTERN PetscErrorCode PetscFVSetComputeGradients(PetscFV, PetscBool);
 85: PETSC_EXTERN PetscErrorCode PetscFVGetComputeGradients(PetscFV, PetscBool *);
 86: PETSC_EXTERN PetscErrorCode PetscFVSetQuadrature(PetscFV, PetscQuadrature);
 87: PETSC_EXTERN PetscErrorCode PetscFVGetQuadrature(PetscFV, PetscQuadrature *);
 88: PETSC_EXTERN PetscErrorCode PetscFVSetDualSpace(PetscFV, PetscDualSpace);
 89: PETSC_EXTERN PetscErrorCode PetscFVGetDualSpace(PetscFV, PetscDualSpace *);

 91: PETSC_EXTERN PetscErrorCode PetscFVRefine(PetscFV, PetscFV *);

 93: PETSC_EXTERN PetscErrorCode PetscFVGetCellTabulation(PetscFV, PetscTabulation *);
 94: PETSC_EXTERN PetscErrorCode PetscFVCreateTabulation(PetscFV, PetscInt, PetscInt, const PetscReal[], PetscInt, PetscTabulation *);

 96: PETSC_EXTERN PetscErrorCode PetscFVComputeGradient(PetscFV, PetscInt, PetscScalar[], PetscScalar[]);
 97: PETSC_EXTERN PetscErrorCode PetscFVIntegrateRHSFunction(PetscFV, PetscDS, PetscInt, PetscInt, PetscFVFaceGeom *, PetscReal *, PetscScalar[], PetscScalar[], PetscScalar[], PetscScalar[]);

 99: PETSC_EXTERN PetscErrorCode PetscFVLeastSquaresSetMaxFaces(PetscFV, PetscInt);

101: PETSC_EXTERN PetscErrorCode PetscDualSpaceApplyFVM(PetscDualSpace, PetscInt, PetscReal, PetscFVCellGeom *, PetscInt, PetscErrorCode (*)(PetscInt, PetscReal, const PetscReal[], PetscInt, PetscScalar *, void *), void *, PetscScalar *);