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: /* MANSEC = DM */
     14: /* SUBMANSEC = FV */

     16: PETSC_EXTERN PetscClassId PETSCLIMITER_CLASSID;

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

     21:   Level: beginner

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

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

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

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

     52: PETSC_EXTERN PetscClassId PETSCFV_CLASSID;

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

     57:   Level: beginner

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

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

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

     93: PETSC_EXTERN PetscErrorCode PetscFVClone(PetscFV, PetscFV *);
     94: PETSC_EXTERN PetscErrorCode PetscFVRefine(PetscFV, PetscFV *);

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

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

    102: PETSC_EXTERN PetscErrorCode PetscFVLeastSquaresSetMaxFaces(PetscFV, PetscInt);

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