diff --git a/dumux/assembly/staggeredlocalassembler.hh b/dumux/assembly/staggeredlocalassembler.hh index e01adc4ac0451f7aa29b6ee550eb9c78bb56a460..d5d6bab9b809d0b5e8f349fd74e56c3e0824910c 100644 --- a/dumux/assembly/staggeredlocalassembler.hh +++ b/dumux/assembly/staggeredlocalassembler.hh @@ -70,7 +70,7 @@ class StaggeredLocalAssembler<TypeTag, using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using GlobalFaceVars = typename GET_PROP_TYPE(TypeTag, GlobalFaceVars); + using GridFaceVariables = typename GET_PROP_TYPE(TypeTag, GridFaceVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); @@ -649,14 +649,14 @@ private: { return gridVolVars.volVars(scv); } template<class T = TypeTag> - static typename std::enable_if<!GET_PROP_VALUE(T, EnableGlobalFaceVariablesCache), FaceVariables&>::type - getFaceVarAccess(GlobalFaceVars& gridFaceVars, ElementFaceVariables& elemFaceVars, const SubControlVolumeFace& scvf) + static typename std::enable_if<!GET_PROP_VALUE(T, EnableGridFaceVariablesCache), FaceVariables&>::type + getFaceVarAccess(GridFaceVariables& GridFaceVariables, ElementFaceVariables& elemFaceVars, const SubControlVolumeFace& scvf) { return elemFaceVars[scvf]; } template<class T = TypeTag> - static typename std::enable_if<GET_PROP_VALUE(T, EnableGlobalFaceVariablesCache), FaceVariables&>::type - getFaceVarAccess(GlobalFaceVars& gridFaceVars, ElementFaceVariables& elemFaceVars, const SubControlVolumeFace& scvf) - { return gridFaceVars.faceVars(scvf.index()); } + static typename std::enable_if<GET_PROP_VALUE(T, EnableGridFaceVariablesCache), FaceVariables&>::type + getFaceVarAccess(GridFaceVariables& GridFaceVariables, ElementFaceVariables& elemFaceVars, const SubControlVolumeFace& scvf) + { return GridFaceVariables.faceVars(scvf.index()); } }; } // end namespace Dumux diff --git a/dumux/common/properties.hh b/dumux/common/properties.hh index 2e6b2c39e6112b9664974f16c537b3eefac39286..2cbc1b8ed7f371161403edffa0f0962cea284e1b 100644 --- a/dumux/common/properties.hh +++ b/dumux/common/properties.hh @@ -186,9 +186,7 @@ NEW_PROP_TAG(NumEqCellCenter); //!< The number of equations NEW_PROP_TAG(NumEqFace); //!< The number of equations for face dofs NEW_PROP_TAG(CellCenterSolutionVector); //!< The solution vector type for cell-centered dofs NEW_PROP_TAG(FaceSolutionVector); //!< The solution vector type for face dofs -NEW_PROP_TAG(StaggeredFaceSolution); //!< The solution on the face -NEW_PROP_TAG(GlobalFaceVars); //!< Class containing face-related data -NEW_PROP_TAG(ElementFaceVariables); //!< Face data per element +NEW_PROP_TAG(GridFaceVariables); //!< Global vector containing face-related data NEW_PROP_TAG(CellCenterPrimaryVariables); //!< The primary variables container type for cell-centered dofs NEW_PROP_TAG(FacePrimaryVariables); //!< The primary variables container type for face dofs NEW_PROP_TAG(IntersectionMapper); //!< Specifies the intersection mapper @@ -198,7 +196,9 @@ NEW_PROP_TAG(StaggeredPrimaryVariables); //!< The hybrid primary varia NEW_PROP_TAG(BaseEpsilon); //!< A base epsilon for numerical differentiation, can contain multiple values NEW_PROP_TAG(FaceVariables); //!< Class containing local face-related data NEW_PROP_TAG(BoundaryValues); //!< Class containing local boundary data -NEW_PROP_TAG(EnableGlobalFaceVariablesCache); //!< If the face variables are cached on the gridview +NEW_PROP_TAG(StaggeredFaceSolution); //!< A vector containing the solution for a face (similar to ElementSolution) +NEW_PROP_TAG(ElementFaceVariables); //!< Face related varibles (similar to volume variables) +NEW_PROP_TAG(EnableGridFaceVariablesCache); //!< Switch on/off caching of face variables ///////////////////////////////////////////////////////////// // Properties used by the mpnc model @@ -225,6 +225,13 @@ NEW_PROP_TAG(AnsSurface); NEW_PROP_TAG(NusseltFormulation); NEW_PROP_TAG(SherwoodFormulation); +///////////////////////////////////////////////////////////// +// Properties used by free flow models +///////////////////////////////////////////////////////////// + +NEW_PROP_TAG(EnableInertiaTerms); //!< Returns whether to include inertia terms in the momentum balance eq or not (Stokes / Navier-Stokes) +NEW_PROP_TAG(NormalizePressure); //!< Returns whether to normalize the pressure term in the momentum balance or not + } // end namespace Properties } // end namespace Dumux diff --git a/dumux/discretization/staggered/elementfacevariables.hh b/dumux/discretization/staggered/elementfacevariables.hh index e080d5e7e7732db41b4ab08722d9ea20348f2e0f..9015c0b959d0104cbb392ee477b672df1fc98ab9 100644 --- a/dumux/discretization/staggered/elementfacevariables.hh +++ b/dumux/discretization/staggered/elementfacevariables.hh @@ -18,7 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief The face variables class for free flow staggered grid models + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredElementFaceVariables */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_ELEMENTFACEVARIABLES_HH #define DUMUX_DISCRETIZATION_STAGGERED_ELEMENTFACEVARIABLES_HH @@ -29,37 +30,41 @@ namespace Dumux { /*! - * \ingroup ImplicitModel + * \ingroup StaggeredDiscretization * \brief Base class for the face variables vector */ -template<class TypeTag, bool enableGlobalFaceVarsCache> +template<class TypeTag, bool enableGridFaceVariablesCache> class StaggeredElementFaceVariables {}; - +/*! + * \ingroup StaggeredDiscretization + * \brief Class for the face variables vector. Specialization for the case of storing the face variables globally. + */ template<class TypeTag> -class StaggeredElementFaceVariables<TypeTag, /*enableGlobalFaceVarsCache*/true> +class StaggeredElementFaceVariables<TypeTag, /*enableGridFaceVariablesCache*/true> { using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using GlobalFaceVars = typename GET_PROP_TYPE(TypeTag, GlobalFaceVars); + using GridFaceVariables = typename GET_PROP_TYPE(TypeTag, GridFaceVariables); using FaceVariables = typename GET_PROP_TYPE(TypeTag, FaceVariables); using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using IndexType = typename GridView::IndexSet::IndexType; public: - StaggeredElementFaceVariables(const GlobalFaceVars& globalFacesVars) : globalFaceVarsPtr_(&globalFacesVars) {} + StaggeredElementFaceVariables(const GridFaceVariables& gridFaceVariables) : gridFaceVariablesPtr_(&gridFaceVariables) {} + //! operator for the access with an scvf const FaceVariables& operator [](const SubControlVolumeFace& scvf) const - { return globalFaceVars().faceVars(scvf.index()); } + { return gridFaceVariables().faceVars(scvf.index()); } - // operator for the access with an index - // needed for cc methods for the access to the boundary volume variables + //! operator for the access with an index + //! needed for cc methods for the access to the boundary volume variables const FaceVariables& operator [](const IndexType scvfIdx) const - { return globalFaceVars().faceVars(scvfIdx); } + { return gridFaceVariables().faceVars(scvfIdx); } //! For compatibility reasons with the case of not storing the face vars. @@ -69,8 +74,8 @@ public: const SolutionVector& sol) {} - // Binding of an element, prepares only the face variables of the element - // specialization for Staggered models + //! Binding of an element, prepares only the face variables of the element + //! specialization for Staggered models void bindElement(const Element& element, const FVElementGeometry& fvGeometry, const SolutionVector& sol) @@ -78,22 +83,26 @@ public: //! The global volume variables object we are a restriction of - const GlobalFaceVars& globalFaceVars() const - { return *globalFaceVarsPtr_; } + const GridFaceVariables& gridFaceVariables() const + { return *gridFaceVariablesPtr_; } private: - const GlobalFaceVars* globalFaceVarsPtr_; + const GridFaceVariables* gridFaceVariablesPtr_; }; +/*! + * \ingroup StaggeredDiscretization + * \brief Class for the face variables vector. Specialization for the case of not storing the face variables globally. + */ template<class TypeTag> -class StaggeredElementFaceVariables<TypeTag, /*enableGlobalFaceVarsCache*/false> +class StaggeredElementFaceVariables<TypeTag, /*enableGridFaceVariablesCache*/false> { using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using GlobalFaceVars = typename GET_PROP_TYPE(TypeTag, GlobalFaceVars); + using GridFaceVariables = typename GET_PROP_TYPE(TypeTag, GridFaceVariables); using FaceVariables = typename GET_PROP_TYPE(TypeTag, FaceVariables); using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using IndexType = typename GridView::IndexSet::IndexType; @@ -104,15 +113,17 @@ class StaggeredElementFaceVariables<TypeTag, /*enableGlobalFaceVarsCache*/false> public: - StaggeredElementFaceVariables(const GlobalFaceVars& globalFacesVars) : globalFaceVarsPtr_(&globalFacesVars) {} + StaggeredElementFaceVariables(const GridFaceVariables& globalFacesVars) : gridFaceVariablesPtr_(&globalFacesVars) {} + //! const operator for the access with an scvf const FaceVariables& operator [](const SubControlVolumeFace& scvf) const { return faceVariables_[scvf.localFaceIdx()]; } - // operator for the access with an index + //! const operator for the access with an index const FaceVariables& operator [](const IndexType scvfIdx) const { return faceVariables_[getLocalIdx_(scvfIdx)]; } + //! operator for the access with an scvf FaceVariables& operator [](const SubControlVolumeFace& scvf) { return faceVariables_[scvf.localFaceIdx()]; } @@ -131,13 +142,13 @@ public: for(auto&& scvf : scvfs(fvGeometry)) { - faceVariables_[scvf.localFaceIdx()].update(sol[faceIdx], globalFaceVars().problem(), element, fvGeometry, scvf); + faceVariables_[scvf.localFaceIdx()].update(sol[faceIdx], GridFaceVariables().problem(), element, fvGeometry, scvf); faceVarIndices_[scvf.localFaceIdx()] = scvf.index(); } } - // Binding of an element, prepares only the face variables of the element - // specialization for Staggered models + //! Binding of an element, prepares only the face variables of the element + //! specialization for Staggered models void bindElement(const Element& element, const FVElementGeometry& fvGeometry, const SolutionVector& sol) @@ -153,8 +164,8 @@ public: } //! The global volume variables object we are a restriction of - const GlobalFaceVars& globalFaceVars() const - { return *globalFaceVarsPtr_; } + const GridFaceVariables& gridFaceVariables() const + { return *gridFaceVariablesPtr_; } private: @@ -165,7 +176,7 @@ private: return std::distance(faceVarIndices_.begin(), it); } - const GlobalFaceVars* globalFaceVarsPtr_; + const GridFaceVariables* gridFaceVariablesPtr_; std::vector<IndexType> faceVarIndices_; std::vector<FaceVariables> faceVariables_; }; diff --git a/dumux/discretization/staggered/elementfluxvariablescache.hh b/dumux/discretization/staggered/elementfluxvariablescache.hh index cd3393d1f8a3110f03f85957eed015053da1c571..c44d93e9461d56564d215205a3bf2fbb4b29b087 100644 --- a/dumux/discretization/staggered/elementfluxvariablescache.hh +++ b/dumux/discretization/staggered/elementfluxvariablescache.hh @@ -18,7 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief The global object of flux var caches + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredElementFluxVariablesCache */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_ELEMENT_FLUXVARSCACHE_HH #define DUMUX_DISCRETIZATION_STAGGERED_ELEMENT_FLUXVARSCACHE_HH @@ -29,15 +30,16 @@ namespace Dumux { /*! - * \ingroup ImplicitModel - * \brief Base class for the stencil local flux variables cache + * \ingroup StaggeredDiscretization + * \brief Base class for the stencil local flux variables cache for the staggered model */ template<class TypeTag, bool EnableGridFluxVariablesCache> class StaggeredElementFluxVariablesCache; /*! - * \ingroup ImplicitModel - * \brief Spezialization when caching globally + * \ingroup StaggeredDiscretization + * \brief Class for the stencil local flux variables cache for the staggered model. + Specialization for the case of storing the fluxvars cache globally. */ template<class TypeTag> class StaggeredElementFluxVariablesCache<TypeTag, true> @@ -56,23 +58,23 @@ public: StaggeredElementFluxVariablesCache(const GridFluxVariablesCache& global) : gridFluxVarsCachePtr_(&global) {} - // Specialization for the global caching being enabled - do nothing here + //! Specialization for the global caching being enabled - do nothing here void bindElement(const Element& element, const FVElementGeometry& fvGeometry, const ElementVolumeVariables& elemVolVars) {} - // Specialization for the global caching being enabled - do nothing here + //! Specialization for the global caching being enabled - do nothing here void bind(const Element& element, const FVElementGeometry& fvGeometry, const ElementVolumeVariables& elemVolVars) {} - // Specialization for the global caching being enabled - do nothing here + //! Specialization for the global caching being enabled - do nothing here void bindScvf(const Element& element, const FVElementGeometry& fvGeometry, const ElementVolumeVariables& elemVolVars, const SubControlVolumeFace& scvf) {} - // aStaggeredess operators in the case of caching + //! operators in the case of caching const FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) const { return (*gridFluxVarsCachePtr_)[scvf.index()]; } @@ -85,8 +87,9 @@ private: }; /*! - * \ingroup ImplicitModel - * \brief Spezialization when not using global caching + * \ingroup StaggeredDiscretization + * \brief Class for the stencil local flux variables cache for the staggered model. + Specialization for the case of not storing the fluxvars cache globally. */ template<class TypeTag> class StaggeredElementFluxVariablesCache<TypeTag, false> @@ -105,8 +108,8 @@ public: StaggeredElementFluxVariablesCache(const GridFluxVariablesCache& global) : gridFluxVarsCachePtr_(&global) {} - // This function has to be called prior to flux calculations on the element. - // Prepares the transmissibilities of the scv faces in an element. The FvGeometry is assumed to be bound. + //! This function has to be called prior to flux calculations on the element. + //! Prepares the transmissibilities of the scv faces in an element. The FvGeometry is assumed to be bound. void bindElement(const Element& element, const FVElementGeometry& fvGeometry, const ElementVolumeVariables& elemVolVars) @@ -126,8 +129,8 @@ public: } } - // This function is called by the StaggeredLocalResidual before flux calculations during assembly. - // Prepares the transmissibilities of the scv faces in the stencil. The FvGeometries are assumed to be bound. + //! This function is called by the StaggeredLocalResidual before flux calculations during assembly. + //! Prepares the transmissibilities of the scv faces in the stencil. The FvGeometries are assumed to be bound. void bind(const Element& element, const FVElementGeometry& fvGeometry, const ElementVolumeVariables& elemVolVars) @@ -183,7 +186,7 @@ public: globalScvfIndices_[0] = scvf.index(); } - // access operators in the case of no caching + //! access operators in the case of no caching const FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) const { return fluxVarsCache_[getLocalScvfIdx_(scvf.index())]; } diff --git a/dumux/discretization/staggered/elementvolumevariables.hh b/dumux/discretization/staggered/elementvolumevariables.hh index 26712c462b1aca7c83b14c29a3c85e8e07624f80..02e16ecd2e4d8deb0edaa798c2112ea78deda70f 100644 --- a/dumux/discretization/staggered/elementvolumevariables.hh +++ b/dumux/discretization/staggered/elementvolumevariables.hh @@ -18,7 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief The local (stencil) volume variables class for cell centered models + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredElementVolumeVariables */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_ELEMENT_VOLUMEVARIABLES_HH #define DUMUX_DISCRETIZATION_STAGGERED_ELEMENT_VOLUMEVARIABLES_HH @@ -30,14 +31,18 @@ namespace Dumux { /*! - * \ingroup ImplicitModel - * \brief Base class for the volume variables vector + * \ingroup StaggeredDiscretization + * \brief Base class for the element volume variables vector for the staggered model */ template<class TypeTag, bool enableGridVolVarsCache> class StaggeredElementVolumeVariables {}; -// specialization in case of storing the volume variables globally +/*! + * \ingroup StaggeredDiscretization + * \brief Class for the element volume variables vector for the staggered model. + Specialization in case the volume variables are stored globally. + */ template<class TypeTag> class StaggeredElementVolumeVariables<TypeTag, /*enableGridVolVarsCache*/true> { @@ -58,22 +63,23 @@ public: StaggeredElementVolumeVariables(const GridVolumeVariables& gridVolVars) : gridVolVarsPtr_(&gridVolVars) {} + //! operator for the access with an scv const VolumeVariables& operator [](const SubControlVolume& scv) const { return gridVolVars().volVars(scv.dofIndex()); } - // operator for the access with an index - // needed for Staggered methods for the access to the boundary volume variables + //! operator for the access with an index + //! needed for Staggered methods for the access to the boundary volume variables const VolumeVariables& operator [](const IndexType scvIdx) const { return gridVolVars().volVars(scvIdx); } - // For compatibility reasons with the case of not storing the vol vars. - // function to be called before assembling an element, preparing the vol vars within the stencil + //! For compatibility reasons with the case of not storing the vol vars. + //! function to be called before assembling an element, preparing the vol vars within the stencil void bind(const Element& element, const FVElementGeometry& fvGeometry, const SolutionVector& sol) {} - // function to prepare the vol vars within the element + //! function to prepare the vol vars within the element void bindElement(const Element& element, const FVElementGeometry& fvGeometry, const SolutionVector& sol) @@ -88,7 +94,11 @@ private: }; -// Specialization when the current volume variables are not stored +/*! + * \ingroup StaggeredDiscretization + * \brief Class for the element volume variables vector for the staggered model. + Specialization in case the volume variables are not stored globally. + */ template<class TypeTag> class StaggeredElementVolumeVariables<TypeTag, /*enableGridVolVarsCache*/false> { @@ -119,8 +129,8 @@ public: StaggeredElementVolumeVariables(const GridVolumeVariables& gridVolVars) : gridVolVarsPtr_(&gridVolVars) {} - // Binding of an element, prepares the volume variables within the element stencil - // called by the local jacobian to prepare element assembly + //! Binding of an element, prepares the volume variables within the element stencil + //! called by the local jacobian to prepare element assembly void bind(const Element& element, const FVElementGeometry& fvGeometry, const SolutionVector& sol) @@ -194,8 +204,8 @@ public: } } - // Binding of an element, prepares only the volume variables of the element - // specialization for Staggered models + //! Binding of an element, prepares only the volume variables of the element. + //! Specialization for Staggered models void bindElement(const Element& element, const FVElementGeometry& fvGeometry, const SolutionVector& sol) @@ -218,15 +228,19 @@ public: volVarIndices_[0] = scv.dofIndex(); } + //! const operator for the access with an scv const VolumeVariables& operator [](const SubControlVolume& scv) const { return volumeVariables_[getLocalIdx_(scv.dofIndex())]; } + //! operator for the access with an scv VolumeVariables& operator [](const SubControlVolume& scv) { return volumeVariables_[getLocalIdx_(scv.dofIndex())]; } + //! const operator for the access with an index const VolumeVariables& operator [](IndexType scvIdx) const { return volumeVariables_[getLocalIdx_(scvIdx)]; } + //! operator for the access with an index VolumeVariables& operator [](IndexType scvIdx) { return volumeVariables_[getLocalIdx_(scvIdx)]; } diff --git a/dumux/discretization/staggered/facesolution.hh b/dumux/discretization/staggered/facesolution.hh index a75139dabd4243fd6a15e6f9082b57b0988a9aad..de1fe872cd4832934072d467098687b16163e1bc 100644 --- a/dumux/discretization/staggered/facesolution.hh +++ b/dumux/discretization/staggered/facesolution.hh @@ -18,7 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief The global volume variables class for cell centered models + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredFaceSolution */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_FACE_SOLUTION_HH #define DUMUX_DISCRETIZATION_STAGGERED_FACE_SOLUTION_HH @@ -31,6 +32,10 @@ namespace Dumux { +/*! + * \ingroup StaggeredDiscretization + * \brief The global face variables class for staggered models + */ template<class TypeTag> class StaggeredFaceSolution { diff --git a/dumux/discretization/staggered/freeflow/boundarytypes.hh b/dumux/discretization/staggered/freeflow/boundarytypes.hh index 1c6cf8f45716a1ad6f37f8bf418f92db8bb5c6b4..6cb1a8bbf813748a66ab5a46b51e176475ccd9f0 100644 --- a/dumux/discretization/staggered/freeflow/boundarytypes.hh +++ b/dumux/discretization/staggered/freeflow/boundarytypes.hh @@ -18,7 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief Class to specify the type of a boundary for the staggered Navier-Stokes model. + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredFreeFlowBoundaryTypes */ #ifndef STAGGERED_FREEFLOW_BOUNDARY_TYPES_HH #define STAGGERED_FREEFLOW_BOUNDARY_TYPES_HH @@ -30,7 +31,7 @@ namespace Dumux { /*! - * \ingroup BC + * \ingroup StaggeredDiscretization * \brief Class to specify the type of a boundary for the staggered Navier-Stokes model. */ template <int numEq> diff --git a/dumux/discretization/staggered/freeflow/connectivitymap.hh b/dumux/discretization/staggered/freeflow/connectivitymap.hh index addeb6b8ca2673a32ce755ab5b42ef4c00a612c8..49f3554bd3c520cc94e09bce96d0ce95085c7b91 100644 --- a/dumux/discretization/staggered/freeflow/connectivitymap.hh +++ b/dumux/discretization/staggered/freeflow/connectivitymap.hh @@ -18,9 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief Stores the face indices corresponding to the neighbors of an element - * that contribute to the derivative calculation. This is used for - * finite-volume schemes with symmetric sparsity pattern in the global matrix. + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredFreeFlowConnectivityMap */ #ifndef DUMUX_STAGGERED_FREEFLOW_CONNECTIVITY_MAP_HH #define DUMUX_STAGGERED_FREEFLOW_CONNECTIVITY_MAP_HH @@ -31,6 +30,11 @@ namespace Dumux { +/*! + * \ingroup StaggeredDiscretization + * \brief Stores the dof indices corresponding to the neighboring cell centers and faces + * that contribute to the derivative calculation. Specialization for the staggered free flow model. + */ template<class TypeTag> class StaggeredFreeFlowConnectivityMap { @@ -58,11 +62,7 @@ class StaggeredFreeFlowConnectivityMap public: - /*! - * \brief Initialize the AssemblyMap object. - * - * \param problem The problem which we want to simulate. - */ + //! Update the map and prepare the stencils void update(const FVGridGeometry& fvGridGeometry) { const auto numDofsCC = fvGridGeometry.gridView().size(0); @@ -98,21 +98,25 @@ public: } } + //! Returns the stencil of a cell center dof w.r.t. other cell center dofs const std::vector<IndexType>& operator() (CellCenterIdxType, CellCenterIdxType, const IndexType globalI) const { return cellCenterToCellCenterMap_[globalI]; } + //! Returns the stencil of a cell center dof w.r.t. face dofs const std::vector<IndexType>& operator() (CellCenterIdxType, FaceIdxType, const IndexType globalI) const { return cellCenterToFaceMap_[globalI]; } + //! Returns the stencil of a face dof w.r.t. cell center dofs const std::vector<IndexType>& operator() (FaceIdxType, CellCenterIdxType, const IndexType globalI) const { return faceToCellCenterMap_[globalI]; } + //! Returns the stencil of a face dof w.r.t. other face dofs const std::vector<IndexType>& operator() (FaceIdxType, FaceIdxType, const IndexType globalI) const { return faceToFaceMap_[globalI]; diff --git a/dumux/discretization/staggered/freeflow/facevariables.hh b/dumux/discretization/staggered/freeflow/facevariables.hh index 898194d697885a9a6f1ac4407ffaaf77cd784ec7..6477e244305c9a7ec38652850ec2f19b9e7b4d9a 100644 --- a/dumux/discretization/staggered/freeflow/facevariables.hh +++ b/dumux/discretization/staggered/freeflow/facevariables.hh @@ -18,8 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief The face variables class for free flow staggered grid models. - * Contains all relevant velocities for the assembly of the momentum balance. + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredFaceVariables */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_FREEFLOW_FACEVARIABLES_HH #define DUMUX_DISCRETIZATION_STAGGERED_FREEFLOW_FACEVARIABLES_HH @@ -27,8 +27,14 @@ #include <dune/common/fvector.hh> #include <dumux/common/properties.hh> -namespace Dumux { +namespace Dumux +{ +/*! + * \ingroup StaggeredDiscretization + * \brief The face variables class for free flow staggered grid models. + * Contains all relevant velocities for the assembly of the momentum balance. + */ template<class TypeTag> class StaggeredFaceVariables { diff --git a/dumux/discretization/staggered/freeflow/fourierslaw.hh b/dumux/discretization/staggered/freeflow/fourierslaw.hh index b97de069c228ed196148bb63b13524da6c062841..4d6b574c959548a44874decb98573f6f777a90cd 100644 --- a/dumux/discretization/staggered/freeflow/fourierslaw.hh +++ b/dumux/discretization/staggered/freeflow/fourierslaw.hh @@ -18,8 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief This file contains the data which is required to calculate - * diffusive mass fluxes due to molecular diffusion with Fourier's law. + * \ingroup StaggeredDiscretization + * \brief Specialization of Fourier's Law for the staggered free flow method. */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_FOURIERS_LAW_HH #define DUMUX_DISCRETIZATION_STAGGERED_FOURIERS_LAW_HH @@ -37,7 +37,7 @@ template<class TypeTag, DiscretizationMethods discMethod> class FouriersLawImplementation; /*! - * \ingroup StaggeredFouriersLaw + * \ingroup StaggeredDiscretization * \brief Specialization of Fourier's Law for the staggered free flow method. */ template <class TypeTag> @@ -63,6 +63,7 @@ public: //! We don't cache anything for this law using Cache = FluxVariablesCaching::EmptyDiffusionCache<TypeTag>; + //! calculate the molecular diffusive fluxes static Scalar diffusiveFluxForCellCenter(const Problem& problem, const Element& element, const FVElementGeometry& fvGeometry, diff --git a/dumux/discretization/staggered/freeflow/maxwellstefanslaw.hh b/dumux/discretization/staggered/freeflow/maxwellstefanslaw.hh index 4f2ce750746abe927d21c05c2a433107d1572d90..b10fa30245fbff360edc98a81cbb2b07c54c7435 100644 --- a/dumux/discretization/staggered/freeflow/maxwellstefanslaw.hh +++ b/dumux/discretization/staggered/freeflow/maxwellstefanslaw.hh @@ -18,8 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief This file contains the data which is required to calculate - * diffusive mass fluxes due to molecular diffusion with Fick's law. + * \ingroup StaggeredDiscretization + * \brief Specialization of Maxwell Stefan's Law for the Staggered method. */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_MAXWELL_STEFAN_LAW_HH #define DUMUX_DISCRETIZATION_STAGGERED_MAXWELL_STEFAN_LAW_HH @@ -39,7 +39,7 @@ template <class TypeTag, DiscretizationMethods DM> class MaxwellStefansLawImplementation; /*! - * \ingroup StaggeredMaxwellStefansLaw + * \ingroup StaggeredDiscretization * \brief Specialization of Maxwell Stefan's Law for the Staggered method. */ template <class TypeTag> diff --git a/dumux/discretization/staggered/freeflow/properties.hh b/dumux/discretization/staggered/freeflow/properties.hh index 6477489b3d0e145aee546228395992261888d59b..dc0367e61f3bdad5645f266b094f4d8461c10f2d 100644 --- a/dumux/discretization/staggered/freeflow/properties.hh +++ b/dumux/discretization/staggered/freeflow/properties.hh @@ -17,10 +17,12 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ /*! - * \ingroup Properties + * \ingroup StaggeredDiscretization * \file * - * \brief Defines a type tag and some properties for free-flow models using the staggered scheme. + * \brief Defines a type tag and some properties for ree-flow models using the staggered scheme. + This scheme features degrees of freedom at the elements' centers and intersections (faces). + * TODO: detailed documentation and figures */ #ifndef DUMUX_STAGGERD_FREE_FLOW_PROPERTIES_HH @@ -109,6 +111,7 @@ public: using type = StaggeredFreeFlowBoundaryTypes<size>; }; +//! The velocity output SET_TYPE_PROP(StaggeredFreeFlowModel, VelocityOutput, StaggeredFreeFlowVelocityOutput<TypeTag>); SET_TYPE_PROP(StaggeredFreeFlowModel, AssemblyMap, StaggeredFreeFlowConnectivityMap<TypeTag>); diff --git a/dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh b/dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh index 9fbadc94a7bccd6c122f952799900d323d54c7b5..891f3e0d5d0ceca7eabee96d8f6e53a82dbd211f 100644 --- a/dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh +++ b/dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh @@ -18,8 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief Helper class constructing the dual grid finite volume geometries - * for the staggered discretization method + * \ingroup StaggeredDiscretization + * \copydoc Dumux::FreeFlowStaggeredGeometryHelper */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_GEOMETRY_HELPER_HH #define DUMUX_DISCRETIZATION_STAGGERED_GEOMETRY_HELPER_HH @@ -35,6 +35,10 @@ namespace Dumux { +/*! + * \ingroup StaggeredDiscretization + * \brief Data stored per sub face + */ template<class Scalar, class GlobalPosition> struct PairData { @@ -48,8 +52,8 @@ struct PairData GlobalPosition virtualOuterParallelFaceDofPos; }; - /*! + * \ingroup StaggeredDiscretization * \brief Returns the dirction index of the facet (0 = x, 1 = y, 2 = z) */ template<class Vector> @@ -60,7 +64,11 @@ inline static int directionIndex(Vector&& vector) return idx; } -//! A class to create face information per intersection +/*! + * \ingroup StaggeredDiscretization + * \brief Helper class constructing the dual grid finite volume geometries + * for the free flow staggered discretization method. + */ template<class GridView> class FreeFlowStaggeredGeometryHelper { @@ -89,6 +97,7 @@ public: FreeFlowStaggeredGeometryHelper(const Element& element, const GridView& gridView) : element_(element), elementGeometry_(element.geometry()), gridView_(gridView) { } + //! update the local face template<class IntersectionMapper> void updateLocalFace(const IntersectionMapper& intersectionMapper_, const Intersection& intersection) { @@ -97,7 +106,7 @@ public: fillPairData_(); } - /*! + /*! * \brief Returns the global dofIdx of the intersection itself */ int dofIndex() const @@ -107,7 +116,7 @@ public: return gridView_.indexSet().subIndex(intersection_.inside(), inIdx, codimIntersection); } - /*! + /*! * \brief Returns the global dofIdx of the opposing intersection */ int dofIndexOpposingFace() const @@ -118,8 +127,8 @@ public: } /*! - * \brief Returns the local index of the face (i.e. the intersection) - */ + * \brief Returns the local index of the face (i.e. the intersection) + */ int localFaceIndex() const { return intersection_.indexInInside(); @@ -136,7 +145,7 @@ public: return (self.geometry().center() - opposite.geometry().center()).two_norm(); } - /*! + /*! * \brief Returns a copy of the pair data */ auto pairData() const diff --git a/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh b/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh index 7c14c1498df0429d913c0e3b1313ec488599ec36..9742c3c12a91186479eb2e85e750a936d0386635 100644 --- a/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh +++ b/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh @@ -18,7 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief Specilialized sub control volume face for free-flow staggered grid models + * \ingroup StaggeredDiscretization + * \copydoc Dumux::FreeFlowStaggeredSubControlVolumeFace */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_FREE_FLOW_SUBCONTROLVOLUMEFACE_HH #define DUMUX_DISCRETIZATION_STAGGERED_FREE_FLOW_SUBCONTROLVOLUMEFACE_HH @@ -37,7 +38,7 @@ namespace Dumux { /*! - * \ingroup Discretization + * \ingroup StaggeredDiscretization * \brief Class for a sub control volume face in the staggered method, i.e a part of the boundary * of a sub control volume we compute fluxes on. This is a specialization for free flow models. */ @@ -57,10 +58,10 @@ class FreeFlowStaggeredSubControlVolumeFace : public SubControlVolumeFaceBase<Fr static constexpr int numPairs = (dimworld == 2) ? 2 : 4; public: - //! state the traits public and thus export all types + //! State the traits public and thus export all types using Traits = ScvfGeometryTraits; - // the default constructor + // The default constructor FreeFlowStaggeredSubControlVolumeFace() = default; //! Constructor with intersection @@ -113,7 +114,7 @@ public: return center_; } - //! The center of the sub control volume face + //! The position of the dof living on the face const GlobalPosition& dofPosition() const { return center_; @@ -132,18 +133,19 @@ public: return area_; } - //! returns bolean if the sub control volume face is on the boundary + //! Returns bolean if the sub control volume face is on the boundary bool boundary() const { return boundary_; } + //! The unit outer normal vector const GlobalPosition& unitOuterNormal() const { return unitOuterNormal_; } - //! index of the inside sub control volume for spatial param evaluation + //! Index of the inside sub control volume for spatial param evaluation GridIndexType insideScvIdx() const { return scvIndices_[0]; @@ -162,6 +164,7 @@ public: return scvfIndex_; } + //! The positions of the corners const GlobalPosition& corner(unsigned int localIdx) const { assert(localIdx < corners_.size() && "provided index exceeds the number of corners"); @@ -198,13 +201,13 @@ public: return dirIdx_; } - //! The global index of this sub control volume face + //! The distance between the position of the dof itself and the one of the oppsing dof Scalar selfToOppositeDistance() const { return selfToOppositeDistance_; } - //! The returns whether the unitNormal of the face point in positive coordinate direction + //! Returns whether the unitNormal of the face points in positive coordinate direction bool normalInPosCoordDir() const { return normalInPosCoordDir_; @@ -216,12 +219,13 @@ public: return outerNormalScalar_; } - + //! Returns the data for one sub face const PairData<Scalar, GlobalPosition>& pairData(const int idx) const { return pairData_[idx]; } + //! Return an array of all pair data const auto& pairData() const { return pairData_; diff --git a/dumux/discretization/staggered/freeflow/velocityoutput.hh b/dumux/discretization/staggered/freeflow/velocityoutput.hh index d2b98b02fafc167f97514f71d72df081c2b348db..5abe55a97dad5be87c2fef4a55444539c69ee65b 100644 --- a/dumux/discretization/staggered/freeflow/velocityoutput.hh +++ b/dumux/discretization/staggered/freeflow/velocityoutput.hh @@ -18,8 +18,8 @@ *****************************************************************************/ /*! * \file - * - * \brief Velocity output for staggered free-flow models + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredFreeFlowVelocityOutput */ #ifndef DUMUX_STAGGERED_FF_VELOCITYOUTPUT_HH #define DUMUX_STAGGERED_FF_VELOCITYOUTPUT_HH @@ -32,6 +32,7 @@ namespace Dumux { /*! + * \ingroup StaggeredDiscretization * \brief Velocity output for staggered free-flow models */ template<class TypeTag> @@ -78,9 +79,11 @@ public: velocityOutput_ = getParamFromGroup<bool>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "Vtk.AddVelocity"); } + //! Returns whether to enable the velocity output or not bool enableOutput() { return velocityOutput_; } + //! Return the problem boundary types auto problemBoundaryTypes(const Element& element, const SubControlVolumeFace& scvf) const { return problem_.boundaryTypes(element, scvf); } diff --git a/dumux/discretization/staggered/fvelementgeometry.hh b/dumux/discretization/staggered/fvelementgeometry.hh index c35f61ae7d920c5c26d143e6752ef8d9913bd119..fba3ca21030fbd96cbf21fd3dfd461b4a8ce5574 100644 --- a/dumux/discretization/staggered/fvelementgeometry.hh +++ b/dumux/discretization/staggered/fvelementgeometry.hh @@ -18,9 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief Base class for a local finite volume geometry for staggered models - * This builds up the sub control volumes and sub control volume faces - * for each element in the local scope we are restricting to, e.g. stencil or element. + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredFVElementGeometry */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_FV_ELEMENT_GEOMETRY_HH #define DUMUX_DISCRETIZATION_STAGGERED_FV_ELEMENT_GEOMETRY_HH @@ -33,22 +32,27 @@ namespace Dumux { -//! forward declaration of the global finite volume geometry +// forward declaration template<class TypeTag, bool EnableFVGridGeometryCache> class StaggeredFVGridGeometry; /*! - * \ingroup ImplicitModel + * \ingroup StaggeredDiscretization * \brief Base class for the finite volume geometry vector for staggered models - * This builds up the sub control volumes and sub control volume faces + * This locally builds up the sub control volumes and sub control volume faces * for each element. */ template<class TypeTag, bool EnableFVGridGeometryCache> class StaggeredFVElementGeometry {}; -//! specialization in case the FVElementGeometries are stored globally -//! In this case we just forward internally to the global object +/*! + * \ingroup StaggeredDiscretization + * \brief Class for the finite volume geometry vector for staggered models + * This locally builds up the sub control volumes and sub control volume faces + * for each element. Specialization in case the FVElementGeometries are stored globally. + In this case we just forward internally to the global object. + */ template<class TypeTag> class StaggeredFVElementGeometry<TypeTag, true> { @@ -149,7 +153,12 @@ private: const FVGridGeometry* fvGridGeometryPtr_; }; -//! specialization in case the FVElementGeometries are not stored +/*! + * \ingroup StaggeredDiscretization + * \brief Class for the finite volume geometry vector for staggered models + * This locally builds up the sub control volumes and sub control volume faces + * for each element. Specialization in case the FVElementGeometries are not stored globally. + */ template<class TypeTag> class StaggeredFVElementGeometry<TypeTag, false> { diff --git a/dumux/discretization/staggered/fvgridgeometry.hh b/dumux/discretization/staggered/fvgridgeometry.hh index a7f362398dc9b0ca9185acc108b294fafb52d308..caf05d8ab248acff673a9c9ba58f11530d73574b 100644 --- a/dumux/discretization/staggered/fvgridgeometry.hh +++ b/dumux/discretization/staggered/fvgridgeometry.hh @@ -18,12 +18,11 @@ *****************************************************************************/ /*! * \file - * \brief Base class for the finite volume geometry vector for staggered models - * This builds up the sub control volumes and sub control volume faces - * for each element of the grid partition. + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredFVGridGeometry */ -#ifndef DUMUX_DISCRETIZATION_STAGGERED_GLOBAL_FVGEOMETRY_HH -#define DUMUX_DISCRETIZATION_STAGGERED_GLOBAL_FVGEOMETRY_HH +#ifndef DUMUX_DISCRETIZATION_STAGGERED_FV_GRID_GEOMETRY +#define DUMUX_DISCRETIZATION_STAGGERED_FV_GRID_GEOMETRY #include <dumux/common/properties.hh> #include <dumux/discretization/basefvgridgeometry.hh> @@ -32,7 +31,7 @@ namespace Dumux { /*! - * \ingroup ImplicitModel + * \ingroup StaggeredDiscretization * \brief Base class for the finite volume geometry vector for staggered models * This builds up the sub control volumes and sub control volume faces * for each element. @@ -41,7 +40,12 @@ template<class TypeTag, bool EnableFVGridGeometryCache> class StaggeredFVGridGeometry {}; -// specialization in case the FVElementGeometries are stored globally +/*! + * \ingroup StaggeredDiscretization + * \brief Base class for the finite volume geometry vector for staggered models + * This builds up the sub control volumes and sub control volume faces + * for each element. Specialization in case the FVElementGeometries are stored. + */ template<class TypeTag> class StaggeredFVGridGeometry<TypeTag, true> : public BaseFVGridGeometry<TypeTag> { @@ -245,7 +249,12 @@ private: IndexType numBoundaryScvf_; }; -// specialization in case the FVElementGeometries are not stored +/*! + * \ingroup StaggeredDiscretization + * \brief Base class for the finite volume geometry vector for staggered models + * This builds up the sub control volumes and sub control volume faces + * for each element. Specialization in case the FVElementGeometries are stored. + */ template<class TypeTag> class StaggeredFVGridGeometry<TypeTag, false> { diff --git a/dumux/discretization/staggered/globalfacevariables.hh b/dumux/discretization/staggered/gridfacevariables.hh similarity index 81% rename from dumux/discretization/staggered/globalfacevariables.hh rename to dumux/discretization/staggered/gridfacevariables.hh index 6ad4360c7be0874522e323fe3a855129ea705aa6..0347548689e15a7d4b8ca34bab41544128bf7d1c 100644 --- a/dumux/discretization/staggered/globalfacevariables.hh +++ b/dumux/discretization/staggered/gridfacevariables.hh @@ -16,12 +16,13 @@ * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ -/*! - * \file - * \brief The global face variables class for staggered grid models - */ -#ifndef DUMUX_DISCRETIZATION_STAGGERED_GLOBAL_FACEVARIABLES_HH -#define DUMUX_DISCRETIZATION_STAGGERED_GLOBAL_FACEVARIABLES_HH + /*! + * \file + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredGridFaceVariables + */ +#ifndef DUMUX_DISCRETIZATION_STAGGERED_GRID_FACEVARIABLES_HH +#define DUMUX_DISCRETIZATION_STAGGERED_GRID_FACEVARIABLES_HH #include <dumux/common/properties.hh> #include <dumux/discretization/staggered/facesolution.hh> @@ -29,17 +30,21 @@ namespace Dumux { -namespace Properties -{ - NEW_PROP_TAG(ElementFaceVariables); -} - +/*! + * \ingroup StaggeredDiscretization + * \brief Face variables cache class for staggered models + */ template<class TypeTag, bool enableGlobalFaceVarsCache> -class StaggeredGlobalFaceVariables +class StaggeredGridFaceVariables {}; +/*! + * \ingroup StaggeredDiscretization + * \brief Face variables cache class for staggered models. + Specialization in case of storing the face variables. + */ template<class TypeTag> -class StaggeredGlobalFaceVariables<TypeTag, /*enableGlobalFaceVarsCache*/true> +class StaggeredGridFaceVariables<TypeTag, /*enableGlobalFaceVarsCache*/true> { using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); @@ -55,8 +60,9 @@ class StaggeredGlobalFaceVariables<TypeTag, /*enableGlobalFaceVarsCache*/true> typename DofTypeIndices::FaceIdx faceIdx; public: - StaggeredGlobalFaceVariables(const Problem& problem) : problemPtr_(&problem) {} + StaggeredGridFaceVariables(const Problem& problem) : problemPtr_(&problem) {} + //! Update all face variables void update(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) { const auto& faceSol = sol[faceIdx]; @@ -86,7 +92,7 @@ public: * The local object is only functional after calling its bind/bindElement method * This is a free function that will be found by means of ADL */ - friend inline ElementFaceVariables localView(const StaggeredGlobalFaceVariables& global) + friend inline ElementFaceVariables localView(const StaggeredGridFaceVariables& global) { return ElementFaceVariables(global); } const Problem& problem() const @@ -99,8 +105,13 @@ private: std::vector<FaceVariables> faceVariables_; }; +/*! + * \ingroup StaggeredDiscretization + * \brief Face variables cache class for staggered models. + Specialization in case of not storing the face variables. + */ template<class TypeTag> -class StaggeredGlobalFaceVariables<TypeTag, /*enableGlobalFaceVarsCache*/false> +class StaggeredGridFaceVariables<TypeTag, /*enableGlobalFaceVarsCache*/false> { using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); @@ -116,8 +127,9 @@ class StaggeredGlobalFaceVariables<TypeTag, /*enableGlobalFaceVarsCache*/false> typename DofTypeIndices::FaceIdx faceIdx; public: - StaggeredGlobalFaceVariables(const Problem& problem) : problemPtr_(&problem) {} + StaggeredGridFaceVariables(const Problem& problem) : problemPtr_(&problem) {} + //! Do nothing here. void update(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) { } @@ -126,7 +138,7 @@ public: * The local object is only functional after calling its bind/bindElement method * This is a free function that will be found by means of ADL */ - friend inline ElementFaceVariables localView(const StaggeredGlobalFaceVariables& global) + friend inline ElementFaceVariables localView(const StaggeredGridFaceVariables& global) { return ElementFaceVariables(global); } const Problem& problem() const diff --git a/dumux/discretization/staggered/gridfluxvariablescache.hh b/dumux/discretization/staggered/gridfluxvariablescache.hh index fdfb108f8014058030605bfcbb1923ca267a2d77..5cea787e5d7c813a08159e065ac81a46ca35bbad 100644 --- a/dumux/discretization/staggered/gridfluxvariablescache.hh +++ b/dumux/discretization/staggered/gridfluxvariablescache.hh @@ -18,7 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief The global object of flux var caches + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredGridFluxVariablesCache */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_GRID_FLUXVARSCACHE_HH #define DUMUX_DISCRETIZATION_STAGGERED_GRID_FLUXVARSCACHE_HH @@ -30,15 +31,16 @@ namespace Dumux { /*! - * \ingroup ImplicitModel - * \brief Base class for the flux variables cache vector, we store one cache per face + * \ingroup StaggeredDiscretization + * \brief Flux variables cache class for staggered models */ template<class TypeTag, bool EnableGridFluxVariablesCache> class StaggeredGridFluxVariablesCache; /*! - * \ingroup ImplicitModel - * \brief Spezialization when caching globally + * \ingroup StaggeredDiscretization + * \brief Flux variables cache class for staggered models. + Specialization in case of storing the flux cache. */ template<class TypeTag> class StaggeredGridFluxVariablesCache<TypeTag, true> @@ -107,8 +109,9 @@ private: }; /*! - * \ingroup ImplicitModel - * \brief Spezialization when not using global caching + * \ingroup StaggeredDiscretization + * \brief Flux variables cache class for staggered models. + Specialization in case of not storing the flux cache. */ template<class TypeTag> class StaggeredGridFluxVariablesCache<TypeTag, false> diff --git a/dumux/discretization/staggered/gridvariables.hh b/dumux/discretization/staggered/gridvariables.hh index e77dd96a78ec6b7f0b8f57de2cd83eb19b43abac..7f0fa62098cbc31a98fcb2d286e03a25689ba8c4 100644 --- a/dumux/discretization/staggered/gridvariables.hh +++ b/dumux/discretization/staggered/gridvariables.hh @@ -18,7 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief Class storing scv and scvf variables + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredGridVariables */ #ifndef DUMUX_STAGGERED_GRID_VARIABLES_HH #define DUMUX_STAGGERED_GRID_VARIABLES_HH @@ -30,8 +31,8 @@ namespace Dumux { /*! - * \ingroup ImplicitModel - * \brief Class storing scv and scvf variables + * \ingroup StaggeredDiscretization + * \brief Class storing data associated to scvs and scvfs */ template<class TypeTag> class StaggeredGridVariables : public FVGridVariables<TypeTag> @@ -40,7 +41,7 @@ class StaggeredGridVariables : public FVGridVariables<TypeTag> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); - using GridFaceVariables = typename GET_PROP_TYPE(TypeTag, GlobalFaceVars); + using GridFaceVariables = typename GET_PROP_TYPE(TypeTag, GridFaceVariables); using GridFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, GridFluxVariablesCache); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); @@ -91,15 +92,19 @@ public: curGridFaceVariables_ = prevGridFaceVariables_; } + //! return the current face variables const GridFaceVariables& curGridFaceVars() const { return curGridFaceVariables_; } + //! return the previous face variables const GridFaceVariables& prevGridFaceVars() const { return prevGridFaceVariables_; } + //! return the current face variables GridFaceVariables& curGridFaceVars() { return curGridFaceVariables_; } + //! return the previous face variables GridFaceVariables& prevGridFaceVars() { return prevGridFaceVariables_; } diff --git a/dumux/discretization/staggered/gridvolumevariables.hh b/dumux/discretization/staggered/gridvolumevariables.hh index 549a4a40f20acc33568f3c324370f8827521cfb1..63c81e2be8d038b5b9d562292e1ece433eb14ae7 100644 --- a/dumux/discretization/staggered/gridvolumevariables.hh +++ b/dumux/discretization/staggered/gridvolumevariables.hh @@ -18,7 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief The grid volume variables class for staggered centered models + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredGridVolumeVariables */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_GRID_VOLUMEVARIABLES_HH #define DUMUX_DISCRETIZATION_STAGGERED_GRID_VOLUMEVARIABLES_HH @@ -30,14 +31,18 @@ namespace Dumux { /*! - * \ingroup Staggered - * \brief Base class for the volume variables vector + * \ingroup StaggeredDiscretization + * \brief Grid volume variables class for staggered models */ template<class TypeTag, bool enableGridVolVarsCache> class StaggeredGridVolumeVariables {}; -//! specialization in case of storing the volume variables +/*! + * \ingroup StaggeredDiscretization + * \brief Grid volume variables class for staggered models. + Specialization in case of storing the volume variables + */ template<class TypeTag> class StaggeredGridVolumeVariables<TypeTag, /*enableGridVolVarsCache*/true> { @@ -65,6 +70,7 @@ class StaggeredGridVolumeVariables<TypeTag, /*enableGridVolVarsCache*/true> public: StaggeredGridVolumeVariables(const Problem& problem) : problemPtr_(&problem) {} + //! Update all volume variables void update(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) { auto numScv = fvGridGeometry.numScv(); @@ -146,7 +152,11 @@ private: }; -//! Specialization when the current volume variables are not stored globally +/*! + * \ingroup StaggeredDiscretization + * \brief Grid volume variables class for staggered models. + Specialization in case of not storing the volume variables + */ template<class TypeTag> class StaggeredGridVolumeVariables<TypeTag, /*enableGridVolVarsCache*/false> { diff --git a/dumux/discretization/staggered/properties.hh b/dumux/discretization/staggered/properties.hh index 12ae7d4c252a87afefa0a8e4b96697278757c488..4385fc018d3631409d4682bf90ee4cfb9eecf11d 100644 --- a/dumux/discretization/staggered/properties.hh +++ b/dumux/discretization/staggered/properties.hh @@ -17,10 +17,12 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ /*! - * \ingroup Properties + * \ingroup StaggeredDiscretization * \file * * \brief Defines a type tag and some properties for models using the staggered scheme. + This scheme features degrees of freedom at the elements' centers and intersections (faces). + * TODO: detailed documentation and figures */ #ifndef DUMUX_STAGGERD_PROPERTIES_HH @@ -42,7 +44,7 @@ #include <dumux/discretization/staggered/elementvolumevariables.hh> #include <dumux/discretization/staggered/fvgridgeometry.hh> #include <dumux/discretization/staggered/fvelementgeometry.hh> -#include <dumux/discretization/staggered/globalfacevariables.hh> +#include <dumux/discretization/staggered/gridfacevariables.hh> #include <dumux/discretization/staggered/facesolution.hh> #include <dumux/discretization/staggered/elementfacevariables.hh> #include <dumux/discretization/staggered/subcontrolvolumeface.hh> @@ -59,13 +61,6 @@ template<class TypeTag> class CCElementBoundaryTypes; namespace Properties { - -NEW_PROP_TAG(CellCenterSolutionVector); -NEW_PROP_TAG(FaceSolutionVector); -NEW_PROP_TAG(StaggeredFaceSolution); -NEW_PROP_TAG(ElementFaceVariables); -NEW_PROP_TAG(EnableGlobalFaceVariablesCache); - //! Type tag for the staggered scheme. NEW_TYPE_TAG(StaggeredModel, INHERITS_FROM(FiniteVolumeModel)); @@ -81,7 +76,7 @@ SET_TYPE_PROP(StaggeredModel, FVGridGeometry, StaggeredFVGridGeometry<TypeTag, G //! Set the default for the FVElementGeometry vector SET_TYPE_PROP(StaggeredModel, FVElementGeometry, StaggeredFVElementGeometry<TypeTag, GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>); -//! The sub control volume +//! The default sub control volume SET_PROP(StaggeredModel, SubControlVolume) { private: @@ -128,33 +123,44 @@ public: using type = BaseStaggeredGeometryHelper<GridView>; }; -SET_TYPE_PROP(StaggeredModel, GlobalFaceVars, StaggeredGlobalFaceVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGlobalFaceVariablesCache)>); +//! Set the default global face variables cache vector class +SET_TYPE_PROP(StaggeredModel, GridFaceVariables, StaggeredGridFaceVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridFaceVariablesCache)>); -//! Set the default for the ElementBoundaryTypes -SET_TYPE_PROP(StaggeredModel, ElementBoundaryTypes, CCElementBoundaryTypes<TypeTag>); +//! Set the default element face variables +SET_TYPE_PROP(StaggeredModel, ElementFaceVariables, StaggeredElementFaceVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridFaceVariablesCache)>); -//! The global volume variables vector class +//! Cache the face variables per default +SET_BOOL_PROP(StaggeredModel, EnableGridFaceVariablesCache, true); + +//! Set the default global volume variables cache vector class SET_TYPE_PROP(StaggeredModel, GridVolumeVariables, StaggeredGridVolumeVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridVolumeVariablesCache)>); -//! The element volume variables vector class +//! Set the element volume variables class SET_TYPE_PROP(StaggeredModel, ElementVolumeVariables, StaggeredElementVolumeVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridVolumeVariablesCache)>); -//! The global flux variables cache vector class +//! Set the global flux variables cache vector class SET_TYPE_PROP(StaggeredModel, GridFluxVariablesCache, StaggeredGridFluxVariablesCache<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridFluxVariablesCache)>); -//! The local flux variables cache vector class +//! Set the local flux variables cache vector class SET_TYPE_PROP(StaggeredModel, ElementFluxVariablesCache, StaggeredElementFluxVariablesCache<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridFluxVariablesCache)>); -//! Set the BaseLocalResidual to StaggeredLocalResidual -SET_TYPE_PROP(StaggeredModel, BaseLocalResidual, StaggeredLocalResidual<TypeTag>); +//! Set the face solution type +SET_TYPE_PROP(StaggeredModel, StaggeredFaceSolution, StaggeredFaceSolution<TypeTag>); -SET_TYPE_PROP(StaggeredModel, IntersectionMapper, ConformingGridIntersectionMapper<TypeTag>); +//! Set the element solution type +SET_TYPE_PROP(StaggeredModel, ElementSolutionVector, Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables)>); -SET_TYPE_PROP(StaggeredModel, StaggeredFaceSolution, StaggeredFaceSolution<TypeTag>); +//! Set the grid variables (volume, flux and face variables) +SET_TYPE_PROP(StaggeredModel, GridVariables, StaggeredGridVariables<TypeTag>); -SET_TYPE_PROP(StaggeredModel, ElementFaceVariables, StaggeredElementFaceVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGlobalFaceVariablesCache)>); +//! Use the cell center element boundary types per default +SET_TYPE_PROP(StaggeredModel, ElementBoundaryTypes, CCElementBoundaryTypes<TypeTag>); -SET_BOOL_PROP(StaggeredModel, EnableGlobalFaceVariablesCache, true); +//! Set the intersection mapper +SET_TYPE_PROP(StaggeredModel, IntersectionMapper, ConformingGridIntersectionMapper<TypeTag>); + +//! Set the BaseLocalResidual to StaggeredLocalResidual +SET_TYPE_PROP(StaggeredModel, BaseLocalResidual, StaggeredLocalResidual<TypeTag>); //! Definition of the indices for cell center and face dofs in the global solution vector SET_PROP(StaggeredModel, DofTypeIndices) @@ -163,17 +169,45 @@ SET_PROP(StaggeredModel, DofTypeIndices) using FaceIdx = Dune::index_constant<1>; }; -//! A vector of primary variables +//! The cell center primary variables SET_TYPE_PROP(StaggeredModel, CellCenterPrimaryVariables, Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, Scalar), GET_PROP_VALUE(TypeTag, NumEqCellCenter)>); -//! A vector of primary variables +//! The face primary variables SET_TYPE_PROP(StaggeredModel, FacePrimaryVariables, Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, Scalar), GET_PROP_VALUE(TypeTag, NumEqFace)>); +//! Boundary types at a single degree of freedom +SET_PROP(StaggeredModel, BoundaryTypes) +{ +private: + static constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); + static constexpr auto numEqFace = GET_PROP_VALUE(TypeTag, NumEqFace); +public: + using type = BoundaryTypes<numEqCellCenter + numEqFace>; +}; + +//! Set one or different base epsilons for the calculations of the localJacobian's derivatives +SET_PROP(StaggeredModel, BaseEpsilon) +{ +private: + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + static constexpr Scalar dCCdCC = 1e-8; + static constexpr Scalar dCCdFace = 1e-8; + static constexpr Scalar dFacedCC = 1e-8; + static constexpr Scalar dFacedFace = 1e-8; + +public: + static constexpr auto getEps() + { + return std::array<std::array<Scalar, 2>, 2>{{{dCCdCC, dCCdFace}, + {dFacedCC, dFacedFace}}}; + } +}; + // TODO: bundle SolutionVector, JacobianMatrix and LinearSolverPreconditionerBlockLevel // in LinearAlgebra traits @@ -202,24 +236,22 @@ SET_PROP(StaggeredModel, JacobianMatrix) { private: using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - enum { - numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter), - numEqFace = GET_PROP_VALUE(TypeTag, NumEqFace) - }; + + static constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); + static constexpr auto numEqFace = GET_PROP_VALUE(TypeTag, NumEqFace); public: // the sub-blocks - using MatrixLittleBlockCCToCC = typename Dune::FieldMatrix<Scalar, numEqCellCenter, numEqCellCenter>; // 2x2 - using MatrixLittleBlockCCToFace = typename Dune::FieldMatrix<Scalar, numEqCellCenter, numEqFace>; // 2x1 + using MatrixLittleBlockCCToCC = typename Dune::FieldMatrix<Scalar, numEqCellCenter, numEqCellCenter>; + using MatrixLittleBlockCCToFace = typename Dune::FieldMatrix<Scalar, numEqCellCenter, numEqFace>; - using MatrixLittleBlockFaceToFace = typename Dune::FieldMatrix<Scalar, numEqFace, numEqFace>; // 1x1 - using MatrixLittleBlockFaceToCC = typename Dune::FieldMatrix<Scalar, numEqFace, numEqCellCenter>; // 1x2 + using MatrixLittleBlockFaceToFace = typename Dune::FieldMatrix<Scalar, numEqFace, numEqFace>; + using MatrixLittleBlockFaceToCC = typename Dune::FieldMatrix<Scalar, numEqFace, numEqCellCenter>; // the BCRS matrices of the subproblems as big blocks using MatrixBlockCCToCC = typename Dune::BCRSMatrix<MatrixLittleBlockCCToCC>; using MatrixBlockCCToFace = typename Dune::BCRSMatrix<MatrixLittleBlockCCToFace>; - using MatrixBlockFaceToFace = typename Dune::BCRSMatrix<MatrixLittleBlockFaceToFace>; using MatrixBlockFaceToCC = typename Dune::BCRSMatrix<MatrixLittleBlockFaceToCC>; @@ -234,44 +266,6 @@ public: // set the block level to 2 (nested multiple times) TODO: move to LinearAlgebra traits SET_INT_PROP(StaggeredModel, LinearSolverPreconditionerBlockLevel, 2); -SET_TYPE_PROP(StaggeredModel, ElementSolutionVector, Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables)>); - -//! Boundary types at a single degree of freedom -SET_PROP(StaggeredModel, BoundaryTypes) -{ -private: - enum { - numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter), - numEqFace = GET_PROP_VALUE(TypeTag, NumEqFace) - }; -public: - using type = BoundaryTypes<numEqCellCenter + numEqFace>; -}; - - - -SET_TYPE_PROP(StaggeredModel, GridVariables, StaggeredGridVariables<TypeTag>); - -//! Set one or different base epsilons for the calculations of the localJacobian's derivatives -SET_PROP(StaggeredModel, BaseEpsilon) -{ -private: - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - static constexpr Scalar dCCdCC = 1e-8; - static constexpr Scalar dCCdFace = 1e-8; - static constexpr Scalar dFacedCC = 1e-8; - static constexpr Scalar dFacedFace = 1e-8; - -public: - static constexpr auto getEps() - { - return std::array<std::array<Scalar, 2>, 2>{{{dCCdCC, dCCdFace}, - {dFacedCC, dFacedFace}}}; - } -}; - - - } // namespace Properties } // namespace Dumux diff --git a/dumux/discretization/staggered/subcontrolvolumeface.hh b/dumux/discretization/staggered/subcontrolvolumeface.hh index ba2e20e0a2b5710a2158583fd1740804c1c05612..0ad970c1732d318dfe2690f2d70a23363794ad21 100644 --- a/dumux/discretization/staggered/subcontrolvolumeface.hh +++ b/dumux/discretization/staggered/subcontrolvolumeface.hh @@ -18,7 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief Base class for a sub control volume face + * \ingroup StaggeredDiscretization + * \copydoc Dumux::StaggeredSubControlVolumeFace */ #ifndef DUMUX_DISCRETIZATION_STAGGERED_SUBCONTROLVOLUMEFACE_HH #define DUMUX_DISCRETIZATION_STAGGERED_SUBCONTROLVOLUMEFACE_HH @@ -37,7 +38,7 @@ namespace Dumux { /*! - * \ingroup Discretization + * \ingroup StaggeredDiscretization * \brief Base class for a staggered grid geometry helper */ template<class GridView> @@ -52,6 +53,9 @@ public: BaseStaggeredGeometryHelper(const Element& element, const GridView& gridView) : element_(element), gridView_(gridView) { } + /*! + * \brief Updates the current face, i.e. sets the correct intersection + */ template<class IntersectionMapper> void updateLocalFace(const IntersectionMapper& intersectionMapper, const Intersection& intersection) { @@ -139,7 +143,7 @@ public: return center_; } - //! The center of the sub control volume face + //! The position of the dof living on the face const GlobalPosition& dofPosition() const { return center_; @@ -158,24 +162,25 @@ public: return area_; } - //! returns bolean if the sub control volume face is on the boundary + //! Returns bolean if the sub control volume face is on the boundary bool boundary() const { return boundary_; } + //! The unit outer normal vector const GlobalPosition& unitOuterNormal() const { return unitOuterNormal_; } - //! index of the inside sub control volume for spatial param evaluation + //! Index of the inside sub control volume GridIndexType insideScvIdx() const { return scvIndices_[0]; } - //! index of the outside sub control volume for spatial param evaluation + //! Index of the outside sub control volume // This results in undefined behaviour if boundary is true GridIndexType outsideScvIdx() const { @@ -188,6 +193,7 @@ public: return scvfIndex_; } + //! The positions of the corners const GlobalPosition& corner(unsigned int localIdx) const { assert(localIdx < corners_.size() && "provided index exceeds the number of corners"); diff --git a/dumux/freeflow/navierstokes/fluxvariables.hh b/dumux/freeflow/navierstokes/fluxvariables.hh index e274a4410b49884e7262eb2c57ee7705dd834b14..2bbcbd5a2b127a3f542663672e6d6bc7a02446c0 100644 --- a/dumux/freeflow/navierstokes/fluxvariables.hh +++ b/dumux/freeflow/navierstokes/fluxvariables.hh @@ -26,6 +26,7 @@ #include <dumux/common/properties.hh> #include <dumux/discretization/methods.hh> +#include <dumux/freeflow/navierstokes/staggered/fluxvariables.hh> namespace Dumux { diff --git a/dumux/freeflow/navierstokes/model.hh b/dumux/freeflow/navierstokes/model.hh index fc549c6f99075c5f46402150de176eaf2def1702..0d543fd675ac40f3ddc122069a72c40585581228 100644 --- a/dumux/freeflow/navierstokes/model.hh +++ b/dumux/freeflow/navierstokes/model.hh @@ -81,13 +81,6 @@ NEW_TYPE_TAG(NavierStokes, INHERITS_FROM(FreeFlow)); //! The type tag for the corresponding non-isothermal model NEW_TYPE_TAG(NavierStokesNI, INHERITS_FROM(NavierStokes, NavierStokesNonIsothermal)); -////////////////////////////////////////////////////////////////// -// Property tags -////////////////////////////////////////////////////////////////// - -NEW_PROP_TAG(EnableInertiaTerms); //!< Returns whether to include inertia terms in the momentum balance eq or not (Stokes / Navier-Stokes) -NEW_PROP_TAG(NormalizePressure); //!< Returns whether to normalize the pressure term in the momentum balance or not - /////////////////////////////////////////////////////////////////////////// // default property values for the isothermal single phase model /////////////////////////////////////////////////////////////////////////// diff --git a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh index 034a66711611c8418176e63933d075b39ecf5ece..fabb735d517ebdfbd688c44291a9d13044180a48 100644 --- a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh +++ b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh @@ -31,13 +31,6 @@ namespace Dumux { -namespace Properties -{ -// forward declaration -NEW_PROP_TAG(EnableInertiaTerms); -NEW_PROP_TAG(ElementFaceVariables); -} - // forward declaration template<class TypeTag, DiscretizationMethods Method> class NavierStokesFluxVariablesImpl; diff --git a/dumux/freeflow/navierstokes/staggered/localresidual.hh b/dumux/freeflow/navierstokes/staggered/localresidual.hh index abfc4dacd73740d6d0cbf8d5240c221b254948bb..7b9be3f06f42b8594deabdc46d99e464d17b29df 100644 --- a/dumux/freeflow/navierstokes/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokes/staggered/localresidual.hh @@ -32,13 +32,6 @@ namespace Dumux { -namespace Properties -{ -// forward declaration -NEW_PROP_TAG(EnableInertiaTerms); -NEW_PROP_TAG(NormalizePressure); -} - // forward declaration template<class TypeTag, DiscretizationMethods Method> class NavierStokesResidualImpl;