diff --git a/dumux/adaptive/markelements.hh b/dumux/adaptive/markelements.hh index 0f992bbb13e5c2d5ecce88471354d72ba234683b..abde8522daf22340e8c52872ca8f15c021661a23 100644 --- a/dumux/adaptive/markelements.hh +++ b/dumux/adaptive/markelements.hh @@ -37,7 +37,7 @@ namespace Dumux { * \return bool whether or not anything has been marked */ template<class Grid, class Indicator> -bool markElements(Grid& grid, Indicator& indicator, bool verbose = true) +bool markElements(Grid& grid, const Indicator& indicator, bool verbose = true) { // mark elements according to indicator std::size_t refine = 0; diff --git a/dumux/assembly/boxlocalresidual.hh b/dumux/assembly/boxlocalresidual.hh index 2858c752202145edb07110893489d12c8647f21f..72eec7960c8b80853b4f9a9fb2e6b53cbc648825 100644 --- a/dumux/assembly/boxlocalresidual.hh +++ b/dumux/assembly/boxlocalresidual.hh @@ -48,9 +48,9 @@ class BoxLocalResidual : public FVLocalResidual<TypeTag> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); diff --git a/dumux/assembly/cclocalassembler.hh b/dumux/assembly/cclocalassembler.hh index 111a065b2c51dcf70d1ecd52d7e2757061a8537a..5afe5a6fa881f19fe32fbd06cb5b335a636c3f4a 100644 --- a/dumux/assembly/cclocalassembler.hh +++ b/dumux/assembly/cclocalassembler.hh @@ -122,15 +122,16 @@ class CCLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, /*implicit=*/tru using LocalResidualValues = typename GET_PROP_TYPE(TypeTag, NumEqVector); using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); using JacobianMatrix = typename GET_PROP_TYPE(TypeTag, JacobianMatrix); enum { numEq = GET_PROP_VALUE(TypeTag, NumEq) }; enum { dim = GET_PROP_TYPE(TypeTag, GridView)::dimension }; - using FluxStencil = Dumux::FluxStencil<TypeTag>; - static constexpr int maxNeighbors = FluxStencil::maxFluxStencilSize*FVElementGeometry::maxNumElementScvfs; + using FluxStencil = Dumux::FluxStencil<FVElementGeometry>; + static constexpr int maxElementStencilSize = FVGridGeometry::maxElementStencilSize; static constexpr bool enableGridFluxVarsCache = GET_PROP_VALUE(TypeTag, EnableGridFluxVariablesCache); public: @@ -164,11 +165,11 @@ public: const auto numNeighbors = connectivityMap[globalI].size(); // container to store the neighboring elements - Dune::ReservedVector<Element, maxNeighbors+1> neighborElements; + Dune::ReservedVector<Element, maxElementStencilSize> neighborElements; neighborElements.resize(numNeighbors); // assemble the undeflected residual - using Residuals = ReservedBlockVector<LocalResidualValues, maxNeighbors+1>; + using Residuals = ReservedBlockVector<LocalResidualValues, maxElementStencilSize>; Residuals origResiduals(numNeighbors + 1); origResiduals = 0.0; origResiduals[0] = this->evalLocalResidual()[0]; diff --git a/dumux/assembly/cclocalresidual.hh b/dumux/assembly/cclocalresidual.hh index c90d2d47765ea392936d19076fab772adf8488ad..fdd38de851566c5e17b1011938ef2a99014e9000 100644 --- a/dumux/assembly/cclocalresidual.hh +++ b/dumux/assembly/cclocalresidual.hh @@ -46,8 +46,8 @@ class CCLocalResidual : public FVLocalResidual<TypeTag> using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; public: using ElementResidualVector = typename ParentType::ElementResidualVector; diff --git a/dumux/assembly/fvassembler.hh b/dumux/assembly/fvassembler.hh index abeeb48e597ae5335e52e7f881cee5f92451dfa3..7ea5dd824d836e87bafc010b82413c5e807f5a79 100644 --- a/dumux/assembly/fvassembler.hh +++ b/dumux/assembly/fvassembler.hh @@ -53,7 +53,6 @@ class FVAssembler using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using VertexMapper = typename GET_PROP_TYPE(TypeTag, VertexMapper); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); using JacobianMatrix = typename GET_PROP_TYPE(TypeTag, JacobianMatrix); @@ -167,6 +166,7 @@ public: // for box communicate the residual with the neighboring processes if (isBox && gridView().comm().size() > 1) { + using VertexMapper = typename FVGridGeometry::VertexMapper; VertexHandleSum<typename SolutionVector::block_type, SolutionVector, VertexMapper> sumResidualHandle(residual, fvGridGeometry_->vertexMapper()); gridView().communicate(sumResidualHandle, diff --git a/dumux/assembly/fvlocalassemblerbase.hh b/dumux/assembly/fvlocalassemblerbase.hh index 7758e8af9b06a12c8e160bb2f2422d474d6ea149..39be6aefb1972b165eb30bc9096398e9d68078d2 100644 --- a/dumux/assembly/fvlocalassemblerbase.hh +++ b/dumux/assembly/fvlocalassemblerbase.hh @@ -54,9 +54,9 @@ class FVLocalAssemblerBase using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); diff --git a/dumux/assembly/fvlocalresidual.hh b/dumux/assembly/fvlocalresidual.hh index a26e90e227ffbccf9e57a3481c359aa802629e12..3a4e4c747df2d80688885480281763f1c8fc9372 100644 --- a/dumux/assembly/fvlocalresidual.hh +++ b/dumux/assembly/fvlocalresidual.hh @@ -49,11 +49,11 @@ class FVLocalResidual using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); diff --git a/dumux/assembly/staggeredlocalassembler.hh b/dumux/assembly/staggeredlocalassembler.hh index d5d6bab9b809d0b5e8f349fd74e56c3e0824910c..896de8a30d20865be38013bbec86c4462521b0a6 100644 --- a/dumux/assembly/staggeredlocalassembler.hh +++ b/dumux/assembly/staggeredlocalassembler.hh @@ -69,7 +69,7 @@ class StaggeredLocalAssembler<TypeTag, using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); 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 FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; 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; @@ -78,7 +78,7 @@ class StaggeredLocalAssembler<TypeTag, using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using JacobianMatrix = typename GET_PROP_TYPE(TypeTag, JacobianMatrix); using NumCellCenterEqVector = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); @@ -95,7 +95,7 @@ class StaggeredLocalAssembler<TypeTag, using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); using FaceVariables = typename GET_PROP_TYPE(TypeTag, FaceVariables); using ElementFaceVariables = typename GET_PROP_TYPE(TypeTag, ElementFaceVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; static constexpr bool enableGridFluxVarsCache = GET_PROP_VALUE(TypeTag, EnableGridFluxVariablesCache); static constexpr auto faceOffset = GET_PROP_VALUE(TypeTag, NumEqCellCenter); diff --git a/dumux/assembly/staggeredlocalresidual.hh b/dumux/assembly/staggeredlocalresidual.hh index 12408a1b60f574e559f8cb697a6c23ae7e1d2e00..b1f71191d9cd37a22274b723e77d79515a4d6d21 100644 --- a/dumux/assembly/staggeredlocalresidual.hh +++ b/dumux/assembly/staggeredlocalresidual.hh @@ -47,9 +47,9 @@ class StaggeredLocalResidual using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); diff --git a/dumux/common/defaultmappertraits.hh b/dumux/common/defaultmappertraits.hh new file mode 100644 index 0000000000000000000000000000000000000000..9686dbed964eb121948da40a9b398f6a32dc5907 --- /dev/null +++ b/dumux/common/defaultmappertraits.hh @@ -0,0 +1,46 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * 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 + * \ingroup Common + * \brief Defines the default element and vertex mapper types + */ +#ifndef DUMUX_DEFAULT_MAPPER_TRAITS_HH +#define DUMUX_DEFAULT_MAPPER_TRAITS_HH + +#include <dune/common/version.hh> +#include <dune/grid/common/mcmgmapper.hh> + +namespace Dumux { + +template <class GridView> +struct DefaultMapperTraits +{ +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) + using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>; + using VertexMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>; +#else + using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout>; + using VertexMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGVertexLayout>; +#endif +}; + +} // namespace Dumux + +#endif diff --git a/dumux/common/fvproblem.hh b/dumux/common/fvproblem.hh index 9e213e57883ed6c7bb102957a00cac605c806f58..a9857b41d0d03bea6798584faa01cd715af67d9e 100644 --- a/dumux/common/fvproblem.hh +++ b/dumux/common/fvproblem.hh @@ -53,11 +53,10 @@ class FVProblem using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); - using VertexMapper = typename GET_PROP_TYPE(TypeTag, VertexMapper); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using PointSource = typename GET_PROP_TYPE(TypeTag, PointSource); using PointSourceHelper = typename GET_PROP_TYPE(TypeTag, PointSourceHelper); @@ -71,7 +70,6 @@ class FVProblem }; using Element = typename GridView::template Codim<0>::Entity; - using Vertex = typename GridView::template Codim<dim>::Entity; using CoordScalar = typename GridView::ctype; using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>; diff --git a/dumux/common/intersectionmapper.hh b/dumux/common/intersectionmapper.hh index c04dc5738495280fff94eb53848f3dcda21b3bff..5599c97eee00f46e206a6ff0087bf28c21fad1ec 100644 --- a/dumux/common/intersectionmapper.hh +++ b/dumux/common/intersectionmapper.hh @@ -30,28 +30,25 @@ #include <dune/grid/common/rangegenerators.hh> #include <dune/common/version.hh> -#include <dumux/common/properties.hh> -namespace Dumux -{ +namespace Dumux { /*! * \ingroup Common * \brief defines a standard intersection mapper for mapping of global DOFs assigned * to faces. It only works for conforming grids, without hanging nodes. - * \todo This shouldn't depend on type tag but gridview only */ -template<class TypeTag> +template<class GridView> class ConformingGridIntersectionMapper { - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using IndexType = unsigned int; static constexpr int codimIntersection = 1; public: - ConformingGridIntersectionMapper(const GridView& gridView) : gridView_(gridView) { } + ConformingGridIntersectionMapper(const GridView& gridView) + : gridView_(gridView) { } void update() {} @@ -85,12 +82,10 @@ private: * \ingroup Common * \brief defines an intersection mapper for mapping of global DOFs assigned * to faces which also works for non-conforming grids and corner-point grids. - * \todo This shouldn't depend on type tag but gridview only */ -template<class TypeTag> +template<class GridView> class NonConformingGridIntersectionMapper { - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using Intersection = typename GridView::Intersection; using IndexType = unsigned int; diff --git a/dumux/common/pointsource.hh b/dumux/common/pointsource.hh index e320cb13828ea71b7cba0aed10402707528138fd..ac4efb84f9b836800c49ba0fd715fffa4d894384 100644 --- a/dumux/common/pointsource.hh +++ b/dumux/common/pointsource.hh @@ -55,8 +55,8 @@ class PointSource using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using Element = typename GridView::template Codim<0>::Entity; static const int dimworld = GridView::dimensionworld; @@ -217,8 +217,8 @@ class SolDependentPointSource : public PointSource<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using Element = typename GridView::template Codim<0>::Entity; static const int dimworld = GridView::dimensionworld; diff --git a/dumux/common/properties.hh b/dumux/common/properties.hh index 4f592b4853f8e1d7dfa31153b28533e12c7088be..a0ccd5ffdf1d92ddba88b6463f44cc068ed68ed0 100644 --- a/dumux/common/properties.hh +++ b/dumux/common/properties.hh @@ -56,8 +56,6 @@ NEW_PROP_TAG(JacobianMatrix); //!< Type of the global jacobian matrix NEW_PROP_TAG(SolutionVector); //!< Vector containing all primary variable vector of the grid NEW_PROP_TAG(BoundaryTypes); //!< Stores the boundary types of a single degree of freedom NEW_PROP_TAG(DiscretizationMethod); //!< Property for the used discretization method -NEW_PROP_TAG(VertexMapper); //!< mapper for vertices -NEW_PROP_TAG(ElementMapper); //!< mapper for elements //! The type of the local residual function, i.e. the equation to be solved. Must inherit //! from the BaseLocalResidual property and fulfill its interfaces. @@ -79,11 +77,7 @@ NEW_PROP_TAG(BalanceEqOpts); //!< A class that collects options for the ///////////////////////////////////////////// NEW_PROP_TAG(ElementBoundaryTypes); //!< Stores the boundary types on an element NEW_PROP_TAG(ElementSolutionVector); //!< A vector of primary variables within an element -NEW_PROP_TAG(AssemblyMap); //!< Connectivity map (transposed) used for assembling the Jacobian matrix entries -NEW_PROP_TAG(SubControlVolume); //!< The type of the sub control volume -NEW_PROP_TAG(SubControlVolumeFace); //!< The type of the sub control volume face -NEW_PROP_TAG(FVElementGeometry); //!< The type of the local finite volume geometry (iterators over scvs, scvfs) NEW_PROP_TAG(FVGridGeometry); //!< The type of the global finite volume geometry NEW_PROP_TAG(EnableFVGridGeometryCache); //!< specifies if geometric data is saved (faster, but more memory consuming) @@ -102,7 +96,6 @@ NEW_PROP_TAG(MaxNumNeighborsPerScvf); //!< The maximum number of ne ///////////////////////////////////////////////////////////////// // Additional properties used by the cell-centered mpfa schemes: ///////////////////////////////////////////////////////////////// -NEW_PROP_TAG(MpfaMethod); //!< Specifies the mpfa method to be used NEW_PROP_TAG(MpfaHelper); //!< A Helper class depending on the mpfa method and grid dimension NEW_PROP_TAG(PrimaryInteractionVolume); //!< The primary interaction volume type NEW_PROP_TAG(SecondaryInteractionVolume); //!< The secondary interaction volume type used e.g. on the boundaries @@ -189,7 +182,6 @@ NEW_PROP_TAG(CellCenterPrimaryVariables); //!< The primary variables co NEW_PROP_TAG(FacePrimaryVariables); //!< The primary variables container type for face dofs NEW_PROP_TAG(IntersectionMapper); //!< Specifies the intersection mapper NEW_PROP_TAG(DofTypeIndices); //!< Specifies index types for accessing the multi type block vectors/matrices -NEW_PROP_TAG(StaggeredGeometryHelper); //!< Specifies a helper class for the staggered grid geometry NEW_PROP_TAG(StaggeredPrimaryVariables); //!< The hybrid primary variables container type NEW_PROP_TAG(BaseEpsilon); //!< A base epsilon for numerical differentiation, can contain multiple values NEW_PROP_TAG(FaceVariables); //!< Class containing local face-related data diff --git a/dumux/common/properties/grid.hh b/dumux/common/properties/grid.hh index 2c0c581bc5bf0ae85d7a292d34c50aff7e4eed8f..c3860784c259645b4c265f41f6af33c3105bec9c 100644 --- a/dumux/common/properties/grid.hh +++ b/dumux/common/properties/grid.hh @@ -25,7 +25,6 @@ #define DUMUX_GRID_PROPERTIES_HH #include <dune/common/version.hh> -#include <dune/grid/common/mcmgmapper.hh> #include <dumux/common/properties.hh> #include <dumux/common/pointsource.hh> @@ -50,32 +49,6 @@ SET_TYPE_PROP(GridProperties, PointSource, PointSource<TypeTag>); //! Use the point source helper using the bounding box tree as a default SET_TYPE_PROP(GridProperties, PointSourceHelper, BoundingBoxTreePointSourceHelper<TypeTag>); -//! Mapper for the grid view's vertices. -#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) -SET_TYPE_PROP(GridProperties, - VertexMapper, - Dune::MultipleCodimMultipleGeomTypeMapper<typename GET_PROP_TYPE(TypeTag, GridView)>); -#else -SET_TYPE_PROP(GridProperties, - VertexMapper, - Dune::MultipleCodimMultipleGeomTypeMapper<typename GET_PROP_TYPE(TypeTag, GridView), - Dune::MCMGVertexLayout>); -#endif - -//! Mapper for the grid view's elements. -#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) -SET_TYPE_PROP(GridProperties, - ElementMapper, - Dune::MultipleCodimMultipleGeomTypeMapper<typename GET_PROP_TYPE(TypeTag, GridView)>); -#else -SET_TYPE_PROP(GridProperties, - ElementMapper, - Dune::MultipleCodimMultipleGeomTypeMapper<typename GET_PROP_TYPE(TypeTag, GridView), - Dune::MCMGElementLayout>); -#endif - - - } // namespace Properties } // namespace Dumux diff --git a/dumux/common/staggeredfvproblem.hh b/dumux/common/staggeredfvproblem.hh index 68ecf0c5a623677ef7730eeb01564496b01bdf71..ed8193edec6a1592b9ea34328aac0c24ed5fa023 100644 --- a/dumux/common/staggeredfvproblem.hh +++ b/dumux/common/staggeredfvproblem.hh @@ -58,8 +58,9 @@ class StaggeredFVProblem : public FVProblem<TypeTag> using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; enum { dim = GridView::dimension, diff --git a/dumux/discretization/basefvgridgeometry.hh b/dumux/discretization/basefvgridgeometry.hh index 6e5064f9058683e22659ad8800b4f455e0ff56e5..b7fd9c2e0076fd66b76e3fb8dffe6259e3f270ad 100644 --- a/dumux/discretization/basefvgridgeometry.hh +++ b/dumux/discretization/basefvgridgeometry.hh @@ -32,31 +32,38 @@ #include <dumux/common/geometry/boundingboxtree.hh> #include <dumux/common/geometry/geometricentityset.hh> -namespace Dumux -{ +//! make the local view function available whenever we use the grid geometry +#include <dumux/discretization/localview.hh> + +namespace Dumux { /*! * \ingroup Discretization * \brief Base class for all finite volume grid geometries + * \tparam Impl the type of the actual implementation + * \tparam GV the grid view type + * \tparam Traits the fv geometry traits */ -template<class TypeTag> +template<class Impl, class GV, class Traits> class BaseFVGridGeometry { - using Implementation = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using ElementMapper = typename GET_PROP_TYPE(TypeTag, ElementMapper); - using VertexMapper = typename GET_PROP_TYPE(TypeTag, VertexMapper); - using ElementMap = EntityMap<GridView, 0>; - using ElementSet = GridViewGeometricEntitySet<GridView, 0>; + using ElementMap = EntityMap<GV, 0>; + using ElementSet = GridViewGeometricEntitySet<GV, 0>; using BoundingBoxTree = Dumux::BoundingBoxTree<ElementSet>; - static const int dim = GridView::dimension; - static const int dimWorld = GridView::dimensionworld; - using CoordScalar = typename GridView::ctype; + static const int dim = GV::dimension; + static const int dimWorld = GV::dimensionworld; + using CoordScalar = typename GV::ctype; using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>; public: + //! export the grid view type + using GridView = GV; + //! export the element mapper type + using ElementMapper = typename Traits::ElementMapper; + //! export the vertex mapper type + using VertexMapper = typename Traits::VertexMapper; + //! Constructor computes the bouding box of the entire domain, for e.g. setting boundary conditions BaseFVGridGeometry(const GridView& gridView) : gridView_(gridView) @@ -73,14 +80,6 @@ public: computeGlobalBoundingBox_(); } - /*! - * \brief Return a local restriction of this global object. - * 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 FVElementGeometry localView(const Implementation& fvGridGeometry) - { return FVElementGeometry(fvGridGeometry); } - /*! * \brief Update all fvElementGeometries (do this again after grid adaption) */ diff --git a/dumux/discretization/box/darcyslaw.hh b/dumux/discretization/box/darcyslaw.hh index 75a035dafe0ffdb6c86ed5446970a1e867879a7a..23438c4b38c6bc847c8daa2eb02178b41e2a0f0b 100644 --- a/dumux/discretization/box/darcyslaw.hh +++ b/dumux/discretization/box/darcyslaw.hh @@ -44,11 +44,11 @@ template <class TypeTag> class DarcysLawImplementation<TypeTag, DiscretizationMethods::Box> { using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElemFluxVarCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using FluxVarCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); diff --git a/dumux/discretization/box/elementboundarytypes.hh b/dumux/discretization/box/elementboundarytypes.hh index e7e0e266d6e1d71993ef1863e4e075c68f137386..5c742a2c6072772a9bd1d096533fe656d5ff105c 100644 --- a/dumux/discretization/box/elementboundarytypes.hh +++ b/dumux/discretization/box/elementboundarytypes.hh @@ -39,8 +39,8 @@ class BoxElementBoundaryTypes using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using LocalIndexType = typename SubControlVolume::Traits::LocalIndexType; enum { dim = GridView::dimension }; diff --git a/dumux/discretization/box/elementfluxvariablescache.hh b/dumux/discretization/box/elementfluxvariablescache.hh index 7b4c0d11bb51180166d738df20db0e558132cf68..80a3bce49ab34484656315afd0aff3a49ad24856 100644 --- a/dumux/discretization/box/elementfluxvariablescache.hh +++ b/dumux/discretization/box/elementfluxvariablescache.hh @@ -48,10 +48,10 @@ class BoxElementFluxVariablesCache<TypeTag, true> using IndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using GridFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, GridFluxVariablesCache); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); public: BoxElementFluxVariablesCache(const GridFluxVariablesCache& global) @@ -108,8 +108,8 @@ class BoxElementFluxVariablesCache<TypeTag, false> using Element = typename GridView::template Codim<0>::Entity; using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, GridFluxVariablesCache); public: diff --git a/dumux/discretization/box/elementsolution.hh b/dumux/discretization/box/elementsolution.hh index 6e5e27539f9223ccf848c1bf8cffb97c50844ce9..7f4a5707cdb6cb3c71b1734159a51923c6f3d8e2 100644 --- a/dumux/discretization/box/elementsolution.hh +++ b/dumux/discretization/box/elementsolution.hh @@ -41,7 +41,7 @@ class BoxElementSolution using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; public: using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); diff --git a/dumux/discretization/box/elementvolumevariables.hh b/dumux/discretization/box/elementvolumevariables.hh index 5d59105eb6623c65746cf96fcb033478141dfef1..ed83830f5395c34c422a8b2828c4565f1a482dea 100644 --- a/dumux/discretization/box/elementvolumevariables.hh +++ b/dumux/discretization/box/elementvolumevariables.hh @@ -46,9 +46,9 @@ class BoxElementVolumeVariables<TypeTag,/*enableGlobalVolVarCache*/true> using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using IndexType = typename GridView::IndexSet::IndexType; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); static const int dim = GridView::dimension; using Element = typename GridView::template Codim<0>::Entity; @@ -102,9 +102,9 @@ class BoxElementVolumeVariables<TypeTag, /*enableGlobalVolVarCache*/false> using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using IndexType = typename GridView::IndexSet::IndexType; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); static const int dim = GridView::dimension; diff --git a/dumux/discretization/box/fickslaw.hh b/dumux/discretization/box/fickslaw.hh index c7ed57a6a85c7f48137e71cf2c76b63d80f59839..46eaab2f79f91213e12eec50f6169b9418a111c5 100644 --- a/dumux/discretization/box/fickslaw.hh +++ b/dumux/discretization/box/fickslaw.hh @@ -45,11 +45,11 @@ class FicksLawImplementation<TypeTag, DiscretizationMethods::Box> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using FluxVarCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); using BalanceEqOpts = typename GET_PROP_TYPE(TypeTag, BalanceEqOpts); diff --git a/dumux/discretization/box/fourierslaw.hh b/dumux/discretization/box/fourierslaw.hh index 5fc27628fc6eeb26ab74307394661ff5f108d6cc..4bca34bde49edc8536a9e6f5de8ca2a0b535c7c9 100644 --- a/dumux/discretization/box/fourierslaw.hh +++ b/dumux/discretization/box/fourierslaw.hh @@ -46,12 +46,12 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::Box> using FluidState = typename GET_PROP_TYPE(TypeTag, FluidState); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using ThermalConductivityModel = typename GET_PROP_TYPE(TypeTag, ThermalConductivityModel); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using IndexType = typename GridView::IndexSet::IndexType; diff --git a/dumux/discretization/box/fourierslawnonequilibrium.hh b/dumux/discretization/box/fourierslawnonequilibrium.hh index 3edd1b51868000fe35279c07cb4b4a97a7524980..0666b8576d1f08de6385b54b5277be1d2791b932 100644 --- a/dumux/discretization/box/fourierslawnonequilibrium.hh +++ b/dumux/discretization/box/fourierslawnonequilibrium.hh @@ -49,11 +49,11 @@ class FouriersLawNonEquilibriumImplementation<TypeTag, DiscretizationMethods::Bo using FluidState = typename GET_PROP_TYPE(TypeTag, FluidState); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using IndexType = typename GridView::IndexSet::IndexType; diff --git a/dumux/discretization/box/fvelementgeometry.hh b/dumux/discretization/box/fvelementgeometry.hh index 393b8cd8b94d53f454a6289a4b182cef70993c72..fd1df112b82c9d38baa9a82863a6a75207ee25e6 100644 --- a/dumux/discretization/box/fvelementgeometry.hh +++ b/dumux/discretization/box/fvelementgeometry.hh @@ -18,6 +18,7 @@ *****************************************************************************/ /*! * \file + * \ingroup BoxDiscretization * \brief Base class for the local finite volume geometry for box models * This builds up the sub control volumes and sub control volume faces * for an element. @@ -29,58 +30,44 @@ #include <dune/geometry/referenceelements.hh> #include <dune/localfunctions/lagrange/pqkfactory.hh> -#include <dumux/common/properties.hh> #include <dumux/discretization/scvandscvfiterators.hh> #include <dumux/discretization/box/boxgeometryhelper.hh> -namespace Dumux -{ - -//! forward declaration of the global finite volume geometry -template<class TypeTag, bool EnableFVGridGeometryCache> -class BoxFVGridGeometry; +namespace Dumux { /*! - * \ingroup ImplicitModel + * \ingroup BoxDiscretization * \brief Base class for the finite volume geometry vector for box models * This builds up the sub control volumes and sub control volume faces * for each element. + * \tparam GG the finite volume grid geometry type + * \tparam enableFVGridGeometryCache if the grid geometry is cached or not */ -template<class TypeTag, bool EnableFVGridGeometryCache> -class BoxFVElementGeometry -{}; +template<class GG, bool enableFVGridGeometryCache> +class BoxFVElementGeometry; //! specialization in case the FVElementGeometries are stored -template<class TypeTag> -class BoxFVElementGeometry<TypeTag, true> +template<class GG> +class BoxFVElementGeometry<GG, true> { - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using GridView = typename GG::GridView; static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; + using IndexType = typename GridView::IndexSet::IndexType; + using Element = typename GridView::template Codim<0>::Entity; + using CoordScalar = typename GridView::ctype; + using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType; + using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>; public: //! export type of subcontrol volume - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using SubControlVolume = typename GG::SubControlVolume; //! export type of subcontrol volume face - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename GG::SubControlVolumeFace; //! export type of finite volume grid geometry - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using FVGridGeometry = GG; //! the maximum number of scvs per element (2^dim for cubes) static constexpr std::size_t maxNumElementScvs = (1<<dim); -private: - using ThisType = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using IndexType = typename GridView::IndexSet::IndexType; - using Element = typename GridView::template Codim<0>::Entity; - - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using CoordScalar = typename GridView::ctype; - - using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>; - using FeLocalBasis = typename FeCache::FiniteElementType::Traits::LocalBasisType; - using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>; - -public: - //! Constructor BoxFVElementGeometry(const FVGridGeometry& fvGridGeometry) : fvGridGeometryPtr_(&fvGridGeometry) {} @@ -170,38 +157,33 @@ private: }; //! specialization in case the FVElementGeometries are not stored -template<class TypeTag> -class BoxFVElementGeometry<TypeTag, false> +template<class GG> +class BoxFVElementGeometry<GG, false> { - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using GridView = typename GG::GridView; static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; -public: - //! export type of subcontrol volume - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - //! export type of subcontrol volume face - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - //! export type of finite volume grid geometry - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - //! the maximum number of scvs per element (2^dim for cubes) - static constexpr std::size_t maxNumElementScvs = (1<<dim); -private: using IndexType = typename GridView::IndexSet::IndexType; - using LocalIndexType = typename SubControlVolumeFace::Traits::LocalIndexType; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using Element = typename GridView::template Codim<0>::Entity; - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using CoordScalar = typename GridView::ctype; - - using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>; - using FeLocalBasis = typename FeCache::FiniteElementType::Traits::LocalBasisType; + using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType; using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>; - using GeometryHelper = BoxGeometryHelper<GridView, dim, SubControlVolume, SubControlVolumeFace>; - + using GeometryHelper = BoxGeometryHelper<GridView, dim, + typename GG::SubControlVolume, + typename GG::SubControlVolumeFace>; public: + //! export type of subcontrol volume + using SubControlVolume = typename GG::SubControlVolume; + //! export type of subcontrol volume face + using SubControlVolumeFace = typename GG::SubControlVolumeFace; + //! export type of finite volume grid geometry + using FVGridGeometry = GG; + //! the maximum number of scvs per element (2^dim for cubes) + static constexpr std::size_t maxNumElementScvs = (1<<dim); + //! Constructor BoxFVElementGeometry(const FVGridGeometry& fvGridGeometry) : fvGridGeometryPtr_(&fvGridGeometry) {} @@ -301,6 +283,7 @@ private: // construct the sub control volumes scvs_.resize(elementGeometry.corners()); + using LocalIndexType = typename SubControlVolumeFace::Traits::LocalIndexType; for (LocalIndexType scvLocalIdx = 0; scvLocalIdx < elementGeometry.corners(); ++scvLocalIdx) { // get asssociated dof index @@ -372,6 +355,6 @@ private: std::vector<SubControlVolumeFace> scvfs_; }; -} // end namespace +} // end namespace Dumux #endif diff --git a/dumux/discretization/box/fvgridgeometry.hh b/dumux/discretization/box/fvgridgeometry.hh index 71ea05f596b0285cb446132659b122a2beb95e32..58f3194d990a90a89a62f5a1c9d470a569158217 100644 --- a/dumux/discretization/box/fvgridgeometry.hh +++ b/dumux/discretization/box/fvgridgeometry.hh @@ -18,6 +18,7 @@ *****************************************************************************/ /*! * \file + * \ingroup BoxDiscretization * \brief Base class for the finite volume geometry vector for box models * This builds up the sub control volumes and sub control volume faces * for each element of the grid partition. @@ -29,59 +30,93 @@ #include <dune/localfunctions/lagrange/pqkfactory.hh> #include <dumux/discretization/methods.hh> +#include <dumux/common/defaultmappertraits.hh> #include <dumux/discretization/basefvgridgeometry.hh> #include <dumux/discretization/box/boxgeometryhelper.hh> #include <dumux/discretization/box/fvelementgeometry.hh> +#include <dumux/discretization/box/subcontrolvolume.hh> +#include <dumux/discretization/box/subcontrolvolumeface.hh> -namespace Dumux +namespace Dumux { + +/*! + * \ingroup BoxDiscretization + * \brief The default traits for the box finite volume grid geometry + * Defines the scv and scvf types and the mapper types + * \tparam the grid view type + */ +template<class GridView> +struct BoxDefaultGridGeometryTraits +: public DefaultMapperTraits<GridView> { + using SubControlVolume = BoxSubControlVolume<GridView>; + using SubControlVolumeFace = BoxSubControlVolumeFace<GridView>; + + template<class FVGridGeometry, bool enableCache> + using LocalView = BoxFVElementGeometry<FVGridGeometry, enableCache>; +}; /*! - * \ingroup ImplicitModel - * \brief Base class for the finite volume geometry vector for box models + * \ingroup BoxDiscretization + * \brief Base class for the finite volume geometry vector for box schemes * This builds up the sub control volumes and sub control volume faces - * for each element. + * \note This class is specialized for versions with and without caching the fv geometries on the grid view */ -template<class TypeTag, bool EnableFVGridGeometryCache> -class BoxFVGridGeometry -{}; +template<class Scalar, + class GridView, + bool enableFVGridGeometryCache = false, + class Traits = BoxDefaultGridGeometryTraits<GridView> > +class BoxFVGridGeometry; -// specialization in case the FVElementGeometries are stored -template<class TypeTag> -class BoxFVGridGeometry<TypeTag, true> : public BaseFVGridGeometry<TypeTag> +/*! + * \ingroup BoxDiscretization + * \brief Base class for the finite volume geometry vector for box schemes + * This builds up the sub control volumes and sub control volume faces + * \note For caching enabled we store the fv geometries for the whole grid view which is memory intensive but faster + */ +template<class Scalar, class GV, class Traits> +class BoxFVGridGeometry<Scalar, GV, true, Traits> +: public BaseFVGridGeometry<BoxFVGridGeometry<Scalar, GV, true, Traits>, GV, Traits> { - using ParentType = BaseFVGridGeometry<TypeTag>; - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using IndexType = typename GridView::IndexSet::IndexType; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using LocalIndexType = typename SubControlVolumeFace::Traits::LocalIndexType; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using VertexMapper = typename GET_PROP_TYPE(TypeTag, VertexMapper); - using Element = typename GridView::template Codim<0>::Entity; - - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using CoordScalar = typename GridView::ctype; - - static const int dim = GridView::dimension; - static const int dimWorld = GridView::dimensionworld; + using ThisType = BoxFVGridGeometry<Scalar, GV, true, Traits>; + using ParentType = BaseFVGridGeometry<ThisType, GV, Traits>; + using IndexType = typename GV::IndexSet::IndexType; + + using Element = typename GV::template Codim<0>::Entity; + using CoordScalar = typename GV::ctype; + static const int dim = GV::dimension; + static const int dimWorld = GV::dimensionworld; - using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>; using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>; - using GeometryHelper = BoxGeometryHelper<GridView, dim, SubControlVolume, SubControlVolumeFace>; + using GeometryHelper = BoxGeometryHelper<GV, dim, + typename Traits::SubControlVolume, + typename Traits::SubControlVolumeFace>; public: //! export discretization method static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::Box; + //! export the type of the fv element geometry (the local view type) + using LocalView = typename Traits::template LocalView<ThisType, true>; + //! export the type of sub control volume + using SubControlVolume = typename Traits::SubControlVolume; + //! export the type of sub control volume + using SubControlVolumeFace = typename Traits::SubControlVolumeFace; + //! export dof mapper type + using DofMapper = typename Traits::VertexMapper; + //! export the finite element cache type + using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>; + //! export the grid view type + using GridView = GV; + //! Constructor BoxFVGridGeometry(const GridView gridView) : ParentType(gridView) {} //! the vertex mapper is the dofMapper //! this is convenience to have better chance to have the same main files for box/tpfa/mpfa... - const VertexMapper& dofMapper() const + const DofMapper& dofMapper() const { return this->vertexMapper(); } //! The total number of sub control volumes @@ -141,6 +176,7 @@ public: // construct the sub control volumes scvs_[eIdx].resize(elementGeometry.corners()); + using LocalIndexType = typename SubControlVolumeFace::Traits::LocalIndexType; for (LocalIndexType scvLocalIdx = 0; scvLocalIdx < elementGeometry.corners(); ++scvLocalIdx) { const auto dofIdxGlobal = this->vertexMapper().subIndex(element, scvLocalIdx, dim); @@ -242,41 +278,53 @@ private: std::vector<bool> boundaryDofIndices_; }; -// specialization in case the FVElementGeometries are not stored -template<class TypeTag> -class BoxFVGridGeometry<TypeTag, false> : public BaseFVGridGeometry<TypeTag> +/*! + * \ingroup BoxDiscretization + * \brief Base class for the finite volume geometry vector for box schemes + * This builds up the sub control volumes and sub control volume faces + * \note For caching disabled we store only some essential index maps to build up local systems on-demand in + * the corresponding FVElementGeometry + */ +template<class Scalar, class GV, class Traits> +class BoxFVGridGeometry<Scalar, GV, false, Traits> +: public BaseFVGridGeometry<BoxFVGridGeometry<Scalar, GV, false, Traits>, GV, Traits> { - using ParentType = BaseFVGridGeometry<TypeTag>; - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using IndexType = typename GridView::IndexSet::IndexType; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using VertexMapper = typename GET_PROP_TYPE(TypeTag, VertexMapper); - - static const int dim = GridView::dimension; - static const int dimWorld = GridView::dimensionworld; + using ThisType = BoxFVGridGeometry<Scalar, GV, false, Traits>; + using ParentType = BaseFVGridGeometry<ThisType, GV, Traits>; + using IndexType = typename GV::IndexSet::IndexType; - using Element = typename GridView::template Codim<0>::Entity; - using Vertex = typename GridView::template Codim<dim>::Entity; + static const int dim = GV::dimension; + static const int dimWorld = GV::dimensionworld; - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using CoordScalar = typename GridView::ctype; + using Element = typename GV::template Codim<0>::Entity; + using CoordScalar = typename GV::ctype; - using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>; using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>; public: //! export discretization method static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::Box; + //! export the type of the fv element geometry (the local view type) + using LocalView = typename Traits::template LocalView<ThisType, false>; + //! export the type of sub control volume + using SubControlVolume = typename Traits::SubControlVolume; + //! export the type of sub control volume + using SubControlVolumeFace = typename Traits::SubControlVolumeFace; + //! export dof mapper type + using DofMapper = typename Traits::VertexMapper; + //! export the finite element cache type + using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>; + //! export the grid view type + using GridView = GV; + //! Constructor BoxFVGridGeometry(const GridView gridView) : ParentType(gridView) {} //! the vertex mapper is the dofMapper //! this is convenience to have better chance to have the same main files for box/tpfa/mpfa... - const VertexMapper& dofMapper() const + const DofMapper& dofMapper() const { return this->vertexMapper(); } //! The total number of sub control volumes diff --git a/dumux/discretization/box/gridfluxvariablescache.hh b/dumux/discretization/box/gridfluxvariablescache.hh index a02c03b0e73aad433c1ea75bb63cdff8ded1527a..5f45bd2c035a20b6af883c67c6dab08508db7404 100644 --- a/dumux/discretization/box/gridfluxvariablescache.hh +++ b/dumux/discretization/box/gridfluxvariablescache.hh @@ -26,16 +26,17 @@ #include <dumux/common/properties.hh> #include <dumux/discretization/box/elementfluxvariablescache.hh> -namespace Dumux -{ +//! make the local view function available whenever we use this class +#include <dumux/discretization/localview.hh> + +namespace Dumux { /*! * \ingroup ImplicitModel * \brief Base class for the flux variables cache vector, we store one cache per face */ template<class TypeTag, bool EnableGridFluxVariablesCache> -class BoxGridFluxVariablesCache -{}; +class BoxGridFluxVariablesCache; /*! * \ingroup ImplicitModel @@ -52,12 +53,14 @@ class BoxGridFluxVariablesCache<TypeTag, true> using IndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); - using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); + BoxGridFluxVariablesCache(const Problem& problem) : problemPtr_(&problem) {} void update(const FVGridGeometry& fvGridGeometry, @@ -86,14 +89,6 @@ public: } } - /*! - * \brief Return a local restriction of this global object - * 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 ElementFluxVariablesCache localView(const BoxGridFluxVariablesCache& global) - { return ElementFluxVariablesCache(global); } - const Problem& problem() const { return *problemPtr_; } @@ -127,11 +122,13 @@ class BoxGridFluxVariablesCache<TypeTag, false> using Element = typename GridView::template Codim<0>::Entity; using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); + BoxGridFluxVariablesCache(const Problem& problem) : problemPtr_(&problem) {} void update(const FVGridGeometry& fvGridGeometry, @@ -139,14 +136,6 @@ public: const SolutionVector& sol, bool forceUpdate = false) {} - /*! - * \brief Return a local restriction of this global object - * 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 ElementFluxVariablesCache localView(const BoxGridFluxVariablesCache& global) - { return ElementFluxVariablesCache(global); } - const Problem& problem() const { return *problemPtr_; } @@ -154,6 +143,6 @@ private: const Problem* problemPtr_; }; -} // end namespace +} // end namespace Dumux #endif diff --git a/dumux/discretization/box/gridvolumevariables.hh b/dumux/discretization/box/gridvolumevariables.hh index b4aa07fd2645d209dfd3bbf60e01528926387d96..d2cf4a49402849da333bdec4c446cd5a7a523f82 100644 --- a/dumux/discretization/box/gridvolumevariables.hh +++ b/dumux/discretization/box/gridvolumevariables.hh @@ -26,16 +26,17 @@ #include <dumux/common/properties.hh> #include <dumux/discretization/box/elementvolumevariables.hh> -namespace Dumux -{ +//! make the local view function available whenever we use this class +#include <dumux/discretization/localview.hh> + +namespace Dumux { /*! * \ingroup BoxModel * \brief Base class for the grid volume variables */ template<class TypeTag, bool enableGridVolVarsCache> -class BoxGridVolumeVariables -{}; +class BoxGridVolumeVariables; // specialization in case of storing the volume variables template<class TypeTag> @@ -45,10 +46,9 @@ class BoxGridVolumeVariables<TypeTag,/*enableGlobalVolVarCache*/true> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using IndexType = typename GridView::IndexSet::IndexType; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); @@ -56,6 +56,9 @@ class BoxGridVolumeVariables<TypeTag,/*enableGlobalVolVarCache*/true> using Element = typename GridView::template Codim<0>::Entity; public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); + BoxGridVolumeVariables(const Problem& problem) : problemPtr_(&problem) {} void update(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) @@ -78,14 +81,6 @@ public: } } - /*! - * \brief Return a local restriction of this global object - * 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 ElementVolumeVariables localView(const BoxGridVolumeVariables& global) - { return ElementVolumeVariables(global); } - const VolumeVariables& volVars(const SubControlVolume& scv) const { return volumeVariables_[scv.elementIndex()][scv.indexInElement()]; } @@ -114,22 +109,16 @@ class BoxGridVolumeVariables<TypeTag, /*enableGlobalVolVarCache*/false> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); + BoxGridVolumeVariables(const Problem& problem) : problemPtr_(&problem) {} void update(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) {} - /*! - * \brief Return a local restriction of this global object - * 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 ElementVolumeVariables localView(const BoxGridVolumeVariables& global) - { return ElementVolumeVariables(global); } - const Problem& problem() const { return *problemPtr_;} diff --git a/dumux/discretization/box/maxwellstefanslaw.hh b/dumux/discretization/box/maxwellstefanslaw.hh index 0416bb695b0ff63d8fad12986bf4ef809cacb6e4..a274a157140216722b2a449ab67adf3f504d0cb7 100644 --- a/dumux/discretization/box/maxwellstefanslaw.hh +++ b/dumux/discretization/box/maxwellstefanslaw.hh @@ -49,11 +49,11 @@ class MaxwellStefansLawImplementation<TypeTag, DiscretizationMethods::Box > using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using IndexType = typename GridView::IndexSet::IndexType; diff --git a/dumux/discretization/box/properties.hh b/dumux/discretization/box/properties.hh index aa940ef714b7cc3f153654723b7b43ee2f717243..5eabbb7f212fb727dc500cf7d39563c4aa0c8eb9 100644 --- a/dumux/discretization/box/properties.hh +++ b/dumux/discretization/box/properties.hh @@ -37,8 +37,6 @@ #include <dumux/discretization/methods.hh> #include <dumux/discretization/fvproperties.hh> -#include <dumux/discretization/box/subcontrolvolume.hh> -#include <dumux/discretization/box/subcontrolvolumeface.hh> #include <dumux/discretization/box/elementsolution.hh> #include <dumux/discretization/box/elementboundarytypes.hh> #include <dumux/discretization/box/gridfluxvariablescache.hh> @@ -61,96 +59,15 @@ SET_PROP(BoxModel, DiscretizationMethod) static const DiscretizationMethods value = DiscretizationMethods::Box; }; -//! Set the default for the FVElementGeometry vector -SET_TYPE_PROP(BoxModel, FVGridGeometry, BoxFVGridGeometry<TypeTag, - GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>); - -//! Set the default for the FVElementGeometry vector -SET_TYPE_PROP(BoxModel, FVElementGeometry, BoxFVElementGeometry<TypeTag, - GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>); - -//! The sub control volume -SET_PROP(BoxModel, SubControlVolume) -{ -private: - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - static const int dim = Grid::dimension; - static const int dimWorld = Grid::dimensionworld; - - // we use geometry traits that use static corner vectors to and a fixed geometry type - template <class ct> - struct ScvfMLGTraits : public Dune::MultiLinearGeometryTraits<ct> - { - // we use static vectors to store the corners as we know - // the number of corners in advance (2^(dim) corners (1<<(dim)) - template< int mydim, int cdim > - struct CornerStorage - { - using Type = std::array< Dune::FieldVector< ct, cdim >, (1<<(dim)) >; - }; - - // we know all scvfs will have the same geometry type - template< int mydim > - struct hasSingleGeometryType - { - static const bool v = true; - static const unsigned int topologyId = Dune::Impl::CubeTopology< mydim >::type::id; - }; - }; - - struct ScvGeometryTraits - { - using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; - using Scalar = typename Grid::ctype; - using Geometry = Dune::MultiLinearGeometry<Scalar, dim, dimWorld, ScvfMLGTraits<Scalar>>; - using CornerStorage = typename ScvfMLGTraits<Scalar>::template CornerStorage<dim, dimWorld>::Type; - using GlobalPosition = typename CornerStorage::value_type; - }; -public: - using type = BoxSubControlVolume<ScvGeometryTraits>; -}; - -SET_PROP(BoxModel, SubControlVolumeFace) +//! Set the default for the global finite volume geometry +SET_PROP(BoxModel, FVGridGeometry) { private: - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - static const int dim = Grid::dimension; - static const int dimWorld = Grid::dimensionworld; - - // we use geometry traits that use static corner vectors to and a fixed geometry type - template <class ct> - struct ScvfMLGTraits : public Dune::MultiLinearGeometryTraits<ct> - { - // we use static vectors to store the corners as we know - // the number of corners in advance (2^(dim-1) corners (1<<(dim-1)) - template< int mydim, int cdim > - struct CornerStorage - { - using Type = std::array< Dune::FieldVector< ct, cdim >, (1<<(dim-1)) >; - }; - - // we know all scvfs will have the same geometry type - template< int mydim > - struct hasSingleGeometryType - { - static const bool v = true; - static const unsigned int topologyId = Dune::Impl::CubeTopology< mydim >::type::id; - }; - }; - - struct ScvfGeometryTraits - { - using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; - using Scalar = typename Grid::ctype; - using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, ScvfMLGTraits<Scalar>>; - using CornerStorage = typename ScvfMLGTraits<Scalar>::template CornerStorage<dim-1, dimWorld>::Type; - using GlobalPosition = typename CornerStorage::value_type; - using BoundaryFlag = Dumux::BoundaryFlag<Grid>; - }; + static constexpr bool enableCache = GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache); + using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); public: - using type = BoxSubControlVolumeFace<ScvfGeometryTraits>; + using type = BoxFVGridGeometry<Scalar, GridView, enableCache>; }; //! Set the solution vector type for an element diff --git a/dumux/discretization/box/subcontrolvolume.hh b/dumux/discretization/box/subcontrolvolume.hh index 0ab8ad0cbddcb03ecadd0ff23706ea5caf99c637..a258e4b10e877903894d0b5cf7ac0160d21550cf 100644 --- a/dumux/discretization/box/subcontrolvolume.hh +++ b/dumux/discretization/box/subcontrolvolume.hh @@ -18,7 +18,8 @@ *****************************************************************************/ /*! * \file - * \brief Base class for a sub control volume + * \ingroup BoxDiscretization + * \brief the sub control volume for the box scheme */ #ifndef DUMUX_DISCRETIZATION_BOX_SUBCONTROLVOLUME_HH #define DUMUX_DISCRETIZATION_BOX_SUBCONTROLVOLUME_HH @@ -29,23 +30,74 @@ #include <dumux/discretization/box/boxgeometryhelper.hh> #include <dumux/common/math.hh> -namespace Dumux +namespace Dumux { + +/*! + * \ingroup BoxDiscretization + * \brief Default traits class to be used for the sub-control volumes + * for the box scheme + * \tparam GV the type of the grid view + */ +template<class GridView> +struct BoxDefaultScvGeometryTraits { -template<class ScvGeometryTraits> -class BoxSubControlVolume : public SubControlVolumeBase<BoxSubControlVolume<ScvGeometryTraits>, ScvGeometryTraits> + using Grid = typename GridView::Grid; + + static const int dim = Grid::dimension; + static const int dimWorld = Grid::dimensionworld; + + template <class ct> + struct ScvMLGTraits : public Dune::MultiLinearGeometryTraits<ct> + { + // we use static vectors to store the corners as we know + // the number of corners in advance (2^(dim) corners (1<<(dim)) + template< int mydim, int cdim > + struct CornerStorage + { + using Type = std::array< Dune::FieldVector< ct, cdim >, (1<<(dim)) >; + }; + + // we know all scvfs will have the same geometry type + template< int mydim > + struct hasSingleGeometryType + { + static const bool v = true; + static const unsigned int topologyId = Dune::Impl::CubeTopology< mydim >::type::id; + }; + }; + + using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; + using LocalIndexType = unsigned int; + using Scalar = typename Grid::ctype; + using Geometry = Dune::MultiLinearGeometry<Scalar, dim, dimWorld, ScvMLGTraits<Scalar>>; + using CornerStorage = typename ScvMLGTraits<Scalar>::template CornerStorage<dim, dimWorld>::Type; + using GlobalPosition = typename CornerStorage::value_type; +}; + +/*! + * \ingroup BoxDiscretization + * \brief the sub control volume for the box scheme + * \tparam GV the type of the grid view + * \tparam T the scvf geometry traits + */ +template<class GV, + class T = BoxDefaultScvGeometryTraits<GV> > +class BoxSubControlVolume +: public SubControlVolumeBase<BoxSubControlVolume<GV, T>, T> { - using ParentType = SubControlVolumeBase<BoxSubControlVolume<ScvGeometryTraits>, ScvGeometryTraits>; - using Geometry = typename ScvGeometryTraits::Geometry; - using GridIndexType = typename ScvGeometryTraits::GridIndexType; - using LocalIndexType = typename ScvGeometryTraits::LocalIndexType; - using Scalar = typename ScvGeometryTraits::Scalar; - using GlobalPosition = typename ScvGeometryTraits::GlobalPosition; - using CornerStorage = typename ScvGeometryTraits::CornerStorage; + using ThisType = BoxSubControlVolume<GV, T>; + using ParentType = SubControlVolumeBase<ThisType, T>; + using Geometry = typename T::Geometry; + using GridIndexType = typename T::GridIndexType; + using LocalIndexType = typename T::LocalIndexType; + using Scalar = typename T::Scalar; + using GlobalPosition = typename T::GlobalPosition; + using CornerStorage = typename T::CornerStorage; enum { dim = Geometry::mydimension }; public: //! state the traits public and thus export all types - using Traits = ScvGeometryTraits; + using Traits = T; //! The default constructor BoxSubControlVolume() = default; diff --git a/dumux/discretization/box/subcontrolvolumeface.hh b/dumux/discretization/box/subcontrolvolumeface.hh index 291a051e01c459673e76890300ec38ee78dd3f3b..ea106570725326015d5f3390bb0a572013670614 100644 --- a/dumux/discretization/box/subcontrolvolumeface.hh +++ b/dumux/discretization/box/subcontrolvolumeface.hh @@ -26,31 +26,81 @@ #include <utility> #include <dune/geometry/type.hh> #include <dune/common/version.hh> +#include <dumux/common/boundaryflag.hh> #include <dumux/discretization/subcontrolvolumefacebase.hh> #include <dumux/discretization/box/boxgeometryhelper.hh> -namespace Dumux +namespace Dumux { + +/*! + * \ingroup BoxDiscretization + * \brief Default traits class to be used for the sub-control volume faces + * for the box scheme + * \tparam GV the type of the grid view + */ +template<class GridView> +struct BoxDefaultScvfGeometryTraits { + using Grid = typename GridView::Grid; + static constexpr int dim = Grid::dimension; + static constexpr int dimWorld = Grid::dimensionworld; + + // we use geometry traits that use static corner vectors to and a fixed geometry type + template <class ct> + struct ScvfMLGTraits : public Dune::MultiLinearGeometryTraits<ct> + { + // we use static vectors to store the corners as we know + // the number of corners in advance (2^(dim-1) corners (1<<(dim-1)) + template< int mydim, int cdim > + struct CornerStorage + { + using Type = std::array< Dune::FieldVector< ct, cdim >, (1<<(dim-1)) >; + }; + + // we know all scvfs will have the same geometry type + template< int mydim > + struct hasSingleGeometryType + { + static const bool v = true; + static const unsigned int topologyId = Dune::Impl::CubeTopology< mydim >::type::id; + }; + }; + + using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; + using LocalIndexType = unsigned int; + using Scalar = typename Grid::ctype; + using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, ScvfMLGTraits<Scalar>>; + using CornerStorage = typename ScvfMLGTraits<Scalar>::template CornerStorage<dim-1, dimWorld>::Type; + using GlobalPosition = typename CornerStorage::value_type; + using BoundaryFlag = Dumux::BoundaryFlag<Grid>; +}; /*! - * \ingroup Discretization + * \ingroup BoxDiscretization * \brief Class for a sub control volume face in the box method, i.e a part of the boundary * of a sub control volume we compute fluxes on. We simply use the base class here. + * \tparam GV the type of the grid view + * \tparam T the scvf geometry traits */ -template<class ScvfGeometryTraits> +template<class GV, + class T = BoxDefaultScvfGeometryTraits<GV> > class BoxSubControlVolumeFace -: public SubControlVolumeFaceBase<BoxSubControlVolumeFace<ScvfGeometryTraits>, ScvfGeometryTraits> +: public SubControlVolumeFaceBase<BoxSubControlVolumeFace<GV, T>, T> { - using ParentType = SubControlVolumeFaceBase<BoxSubControlVolumeFace<ScvfGeometryTraits>, ScvfGeometryTraits>; - using GridIndexType = typename ScvfGeometryTraits::GridIndexType; - using LocalIndexType = typename ScvfGeometryTraits::LocalIndexType; - using Scalar = typename ScvfGeometryTraits::Scalar; - using GlobalPosition = typename ScvfGeometryTraits::GlobalPosition; - using CornerStorage = typename ScvfGeometryTraits::CornerStorage; - using Geometry = typename ScvfGeometryTraits::Geometry; - using BoundaryFlag = typename ScvfGeometryTraits::BoundaryFlag; + using ThisType = BoxSubControlVolumeFace<GV, T>; + using ParentType = SubControlVolumeFaceBase<ThisType, T>; + using GridIndexType = typename T::GridIndexType; + using LocalIndexType = typename T::LocalIndexType; + using Scalar = typename T::Scalar; + using GlobalPosition = typename T::GlobalPosition; + using CornerStorage = typename T::CornerStorage; + using Geometry = typename T::Geometry; + using BoundaryFlag = typename T::BoundaryFlag; public: + //! state the traits public and thus export all types + using Traits = T; + //! The default constructor BoxSubControlVolumeFace() = default; diff --git a/dumux/discretization/cellcentered/connectivitymap.hh b/dumux/discretization/cellcentered/connectivitymap.hh index 0f935b288ec93fa1040d5f4121963ba02a01cec2..b4297fa1c3ebf165d97d6cef6e97df3287d2b7a2 100644 --- a/dumux/discretization/cellcentered/connectivitymap.hh +++ b/dumux/discretization/cellcentered/connectivitymap.hh @@ -31,7 +31,6 @@ #include <algorithm> #include <dune/common/reservedvector.hh> -#include <dumux/common/properties.hh> #include <dumux/discretization/fluxstencil.hh> namespace Dumux { @@ -46,22 +45,21 @@ namespace Dumux { * to compute these fluxes. The same holds for scvfs in the cells J, i.e. we need only those * scvfs in the cells J in which the cell I is in the stencil. */ -template<class TypeTag> +template<class FVGridGeometry> class CCSimpleConnectivityMap { - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using FVElementGeometry = typename FVGridGeometry::LocalView; + using GridView = typename FVGridGeometry::GridView; using IndexType = typename GridView::IndexSet::IndexType; - using FluxStencil = Dumux::FluxStencil<TypeTag>; + using FluxStencil = Dumux::FluxStencil<FVElementGeometry>; struct DataJ { IndexType globalJ; - Dune::ReservedVector<IndexType, FluxStencil::maxNumScvfJForI> scvfsJ; + typename FluxStencil::ScvfStencilIForJ scvfsJ; // A list of additional scvfs is needed for compatibility // reasons with more complex connectivity maps (see mpfa) - Dune::ReservedVector<IndexType, FluxStencil::maxNumScvfJForI> additionalScvfs; + typename FluxStencil::ScvfStencilIForJ additionalScvfs; }; using Map = std::vector<std::vector<DataJ>>; @@ -78,9 +76,8 @@ public: map_.clear(); map_.resize(fvGridGeometry.gridView().size(0)); - // container to store for each element J the elements I that appear in J's flux stencils - static constexpr int maxNumJ = FluxStencil::maxFluxStencilSize*FVElementGeometry::maxNumElementScvfs; - Dune::ReservedVector<std::pair<IndexType, DataJ>, maxNumJ> dataJForI; + // container to store for each element J the elements I which have J in their flux stencil + Dune::ReservedVector<std::pair<IndexType, DataJ>, FVGridGeometry::maxElementStencilSize> dataJForI; for (const auto& element : elements(fvGridGeometry.gridView())) { diff --git a/dumux/discretization/cellcentered/elementboundarytypes.hh b/dumux/discretization/cellcentered/elementboundarytypes.hh index 188439bb480e030a0e8b624ee9b78b0174ab6928..46e3d6dcc847ded19741ac8bc9201e7af897832c 100644 --- a/dumux/discretization/cellcentered/elementboundarytypes.hh +++ b/dumux/discretization/cellcentered/elementboundarytypes.hh @@ -42,7 +42,7 @@ class CCElementBoundaryTypes { using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using Element = typename GridView::template Codim<0>::Entity; public: diff --git a/dumux/discretization/cellcentered/elementsolution.hh b/dumux/discretization/cellcentered/elementsolution.hh index 1ab481db9b31b871b7dc260d41b6ac01c635e7fb..f8af5a0f5ae2fcaed31744b38a09d8a2eb9ae972 100644 --- a/dumux/discretization/cellcentered/elementsolution.hh +++ b/dumux/discretization/cellcentered/elementsolution.hh @@ -39,7 +39,7 @@ class CCElementSolution { using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/dumux/discretization/cellcentered/gridvolumevariables.hh b/dumux/discretization/cellcentered/gridvolumevariables.hh index 9f970c2c4bef5f5e44998500d90a19f688984241..562e9ac5c73de37979777edd3663af5e90e45bb8 100644 --- a/dumux/discretization/cellcentered/gridvolumevariables.hh +++ b/dumux/discretization/cellcentered/gridvolumevariables.hh @@ -26,8 +26,10 @@ #include <dumux/common/properties.hh> -namespace Dumux -{ +//! make the local view function available whenever we use this class +#include <dumux/discretization/localview.hh> + +namespace Dumux { /*! * \ingroup CCDiscretization @@ -50,14 +52,17 @@ class CCGridVolumeVariables<TypeTag, /*enableGridVolVarsCache*/true> using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); - using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using IndexType = typename GridView::IndexSet::IndexType; static const int dim = GridView::dimension; using Element = typename GridView::template Codim<0>::Entity; public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); + CCGridVolumeVariables(const Problem& problem) : problemPtr_(&problem) {} void update(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) @@ -101,14 +106,6 @@ public: } } - /*! - * \brief Return a local restriction of this global object - * 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 ElementVolumeVariables localView(const CCGridVolumeVariables& global) - { return ElementVolumeVariables(global); } - const VolumeVariables& volVars(const IndexType scvIdx) const { return volumeVariables_[scvIdx]; } @@ -145,22 +142,16 @@ class CCGridVolumeVariables<TypeTag, /*enableGridVolVarsCache*/false> { using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); + CCGridVolumeVariables(const Problem& problem) : problemPtr_(&problem) {} void update(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) {} - /*! - * \brief Return a local restriction of this global object - * 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 ElementVolumeVariables localView(const CCGridVolumeVariables& global) - { return ElementVolumeVariables(global); } - //! The problem we are solving const Problem& problem() const { return *problemPtr_;} diff --git a/dumux/discretization/cellcentered/mpfa/connectivitymap.hh b/dumux/discretization/cellcentered/mpfa/connectivitymap.hh index 95073ed462527cc3659b57b2d5fa9d4694790fc3..47bcc5d4c0095b89a949b0e260aef97ebfae2aae 100644 --- a/dumux/discretization/cellcentered/mpfa/connectivitymap.hh +++ b/dumux/discretization/cellcentered/mpfa/connectivitymap.hh @@ -30,25 +30,16 @@ #include <dumux/common/properties.hh> #include <dumux/discretization/cellcentered/mpfa/methods.hh> #include <dumux/discretization/cellcentered/connectivitymap.hh> -#include <dumux/discretization/cellcentered/mpfa/generalconnectivitymap.hh> namespace Dumux { //! Forward declaration of method specific implementation of the assembly map -template<class TypeTag, MpfaMethods method> -class CCMpfaConnectivityMapImplementation; - -//! The Assembly map for models using mpfa methods -template<class TypeTag> -using CCMpfaConnectivityMap = CCMpfaConnectivityMapImplementation<TypeTag, GET_PROP_VALUE(TypeTag, MpfaMethod)>; - -//! The default is the general assembly map for mpfa schemes (non-symmetric schemes) -template<class TypeTag, MpfaMethods method> -class CCMpfaConnectivityMapImplementation : public CCMpfaGeneralConnectivityMap<TypeTag> {}; +template<class FVGridGeometry, MpfaMethods method> +class CCMpfaConnectivityMap; //! The o-method can use the simple (symmetric) assembly map -template<class TypeTag> -class CCMpfaConnectivityMapImplementation<TypeTag, MpfaMethods::oMethod> : public CCSimpleConnectivityMap<TypeTag> {}; +template<class FVGridGeometry> +class CCMpfaConnectivityMap<FVGridGeometry, MpfaMethods::oMethod> : public CCSimpleConnectivityMap<FVGridGeometry> {}; } #endif diff --git a/dumux/discretization/cellcentered/mpfa/darcyslaw.hh b/dumux/discretization/cellcentered/mpfa/darcyslaw.hh index 9ff81414195549d3849e38f683cee513a8b94a82..60e525c13d9666bbc8ed05fc5c1e43ace2a653ac 100644 --- a/dumux/discretization/cellcentered/mpfa/darcyslaw.hh +++ b/dumux/discretization/cellcentered/mpfa/darcyslaw.hh @@ -52,8 +52,8 @@ class DarcysLawImplementation<TypeTag, DiscretizationMethods::CCMpfa> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); diff --git a/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh b/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh index a93c7ce63970a589ca92cdf883dd9547556e1ee2..2288f3b49d00aa2d83089d6d30224ae23928162d 100644 --- a/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh +++ b/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh @@ -87,10 +87,11 @@ public: } //! Inserts scvf data + template<typename OutsideGridIndexStorage> void insert(const bool boundary, const GridIndexType scvfIdx, const GridIndexType insideScvIdx, - const std::vector<GridIndexType>& outsideScvIndices) + const OutsideGridIndexStorage& outsideScvIndices) { // this should always be called only once per scvf assert(std::find(scvfIndices_.begin(), scvfIndices_.end(), scvfIdx ) == scvfIndices_.end() diff --git a/dumux/discretization/cellcentered/mpfa/elementfluxvariablescache.hh b/dumux/discretization/cellcentered/mpfa/elementfluxvariablescache.hh index 52d4a4568db07b73574042055b9865e479e404be..f7709fe7878e8e776b4cf20f3649e6b26d786864 100644 --- a/dumux/discretization/cellcentered/mpfa/elementfluxvariablescache.hh +++ b/dumux/discretization/cellcentered/mpfa/elementfluxvariablescache.hh @@ -57,8 +57,8 @@ class CCMpfaElementFluxVariablesCache<TypeTag, true> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); using GridFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, GridFluxVariablesCache); @@ -113,11 +113,11 @@ class CCMpfaElementFluxVariablesCache<TypeTag, false> using GridIndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); using GridFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, GridFluxVariablesCache); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using FluxVariablesCacheFiller = CCMpfaFluxVariablesCacheFiller<TypeTag>; using PrimaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, PrimaryInteractionVolume); @@ -178,7 +178,12 @@ public: // Reserve memory (over-) estimate for interaction volumes and corresponding data. // The overestimate doesn't hurt as we are not in a memory-limited configuration. // We need to avoid reallocation because in the caches we store pointers to the data handles. - const auto numIvEstimate = getNoInteractionVolumesEstimate_(element, assemblyMapI); + // Default -> each facet has two neighbors (local adaption) and all scvfs belongs to different ivs. + // If you want to use higher local differences change the parameter below. + // TODO should this be a property? Statically allocated memory might be an issue for local adaptivity in general + static const std::size_t maxDiff = getParamFromGroup<std::size_t>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), + "Grid.MaxLocalElementLevelDifference", 2); + const auto numIvEstimate = FVElementGeometry::maxNumElementScvfs*maxDiff; primaryInteractionVolumes_.reserve(numIvEstimate); secondaryInteractionVolumes_.reserve(numIvEstimate); primaryIvDataHandles_.reserve(numIvEstimate); @@ -337,26 +342,6 @@ private: secondaryIvDataHandles_.clear(); } - //! get estimate of interaction volumes that are going to be required - template<class AssemblyMap> - std::size_t getNoInteractionVolumesEstimate_(const Element& element, const AssemblyMap& assemblyMap) - { - // if statements are optimized away by the compiler - if (GET_PROP_VALUE(TypeTag, MpfaMethod) == MpfaMethods::oMethod) - { - // Reserve memory for the case of each facet having neighbors being 4 levels higher. Memory limitations - // do not play an important role here as global caching is disabled. In the unlikely case you want - // to use higher local differences in element levels set a higher value for the parameter below - // in your input file (note that some grids might only support levels differences of one anyway) - static const unsigned int maxDiff = getParamFromGroup<unsigned int>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), - "Grid.MaxLocalElementLevelDifference", - 4); - return element.subEntities(GridView::dimension)*maxDiff; - } - else - DUNE_THROW(Dune::NotImplemented, "number of interaction volumes estimate for chosen mpfa scheme"); - } - //! get index of an scvf in the local container unsigned int getLocalScvfIdx_(const int scvfIdx) const { @@ -365,7 +350,6 @@ private: return std::distance(globalScvfIndices_.begin(), it); } - // the local flux vars caches and corresponding indices std::vector<FluxVariablesCache> fluxVarsCache_; std::vector<GridIndexType> globalScvfIndices_; diff --git a/dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh b/dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh index cc4ae3707f2d2a6d314aeecaaf38a0a0b731eb1c..78eb0f8b96557f453a5560a811eacd4b444a119e 100644 --- a/dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh +++ b/dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh @@ -51,10 +51,10 @@ class CCMpfaElementVolumeVariables<TypeTag, /*enableGridVolVarsCache*/true> using Element = typename GridView::template Codim<0>::Entity; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using GridIndexType = typename GridView::IndexSet::IndexType; public: @@ -106,8 +106,8 @@ class CCMpfaElementVolumeVariables<TypeTag, /*enableGridVolVarsCache*/false> using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using GridIndexType = typename GridView::IndexSet::IndexType; diff --git a/dumux/discretization/cellcentered/mpfa/fickslaw.hh b/dumux/discretization/cellcentered/mpfa/fickslaw.hh index 1f3ea99206a341aff67ccd83bdc78c8ca4ba6d34..ae3979d58deb66b2702ce536db2a6ae3cda9d59a 100644 --- a/dumux/discretization/cellcentered/mpfa/fickslaw.hh +++ b/dumux/discretization/cellcentered/mpfa/fickslaw.hh @@ -46,9 +46,9 @@ class FicksLawImplementation<TypeTag, DiscretizationMethods::CCMpfa> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); diff --git a/dumux/discretization/cellcentered/mpfa/fluxvariablescachefiller.hh b/dumux/discretization/cellcentered/mpfa/fluxvariablescachefiller.hh index f7172553cee3c69c95a8db8a3047dc3a4ff5de9a..5a90cc053a209e2b0dd5f93f714733c626088d04 100644 --- a/dumux/discretization/cellcentered/mpfa/fluxvariablescachefiller.hh +++ b/dumux/discretization/cellcentered/mpfa/fluxvariablescachefiller.hh @@ -47,8 +47,8 @@ class CCMpfaFluxVariablesCacheFiller using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); diff --git a/dumux/discretization/cellcentered/mpfa/fourierslaw.hh b/dumux/discretization/cellcentered/mpfa/fourierslaw.hh index ebdb9d76aa4e3e286acd5d59142653bf0158e81f..56e3af6da2d0625c0aca32d27c8afbec6f26cb41 100644 --- a/dumux/discretization/cellcentered/mpfa/fourierslaw.hh +++ b/dumux/discretization/cellcentered/mpfa/fourierslaw.hh @@ -49,8 +49,8 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::CCMpfa> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementFluxVarsCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); diff --git a/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh b/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh index 44b8f899fe6fdb14221087ea24a8bd92bf36fb6b..557b70dad7da825c71ab7501130d3f6c60dec7b1 100644 --- a/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh +++ b/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh @@ -31,7 +31,6 @@ #include <dune/common/iteratorrange.hh> #include <dune/geometry/referenceelements.hh> -#include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> #include <dumux/discretization/scvandscvfiterators.hh> @@ -42,9 +41,11 @@ namespace Dumux * \brief Stencil-local finite volume geometry (scvs and scvfs) for cell-centered mpfa 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. + * \tparam GG the finite volume grid geometry type + * \tparam enableFVGridGeometryCache if the grid geometry is cached or not * \note This class is specialized for versions with and without caching the fv geometries on the grid view */ -template<class TypeTag, bool EnableFVGridGeometryCache> +template<class GG, bool EnableFVGridGeometryCache> class CCMpfaFVElementGeometry; /*! @@ -53,11 +54,11 @@ class CCMpfaFVElementGeometry; * Specialization for grid caching enabled * \note The finite volume geometries are stored in the corresponding FVGridGeometry */ -template<class TypeTag> -class CCMpfaFVElementGeometry<TypeTag, true> +template<class GG> +class CCMpfaFVElementGeometry<GG, true> { - using ThisType = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using ThisType = CCMpfaFVElementGeometry<GG, true>; + using GridView = typename GG::GridView; using Element = typename GridView::template Codim<0>::Entity; using GridIndexType = typename GridView::IndexSet::IndexType; @@ -65,11 +66,11 @@ class CCMpfaFVElementGeometry<TypeTag, true> public: //! export type of subcontrol volume - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using SubControlVolume = typename GG::SubControlVolume; //! export type of subcontrol volume face - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename GG::SubControlVolumeFace; //! export type of finite volume grid geometry - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using FVGridGeometry = GG; //! the maximum number of scvs per element static constexpr std::size_t maxNumElementScvs = 1; //! the maximum number of scvfs per element (use cubes for maximum) @@ -165,31 +166,28 @@ private: * \brief Stencil-local finite volume geometry (scvs and scvfs) for cell-centered TPFA models * Specialization for grid caching disabled */ -template<class TypeTag> -class CCMpfaFVElementGeometry<TypeTag, false> +template<class GG> +class CCMpfaFVElementGeometry<GG, false> { - using ThisType = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using ThisType = CCMpfaFVElementGeometry<GG, false>; + using GridView = typename GG::GridView; using Element = typename GridView::template Codim<0>::Entity; using GridIndexType = typename GridView::IndexSet::IndexType; - - using MpfaHelper = typename GET_PROP_TYPE(TypeTag, MpfaHelper); + using MpfaHelper = typename GG::MpfaHelper; static const int dim = GridView::dimension; static const int dimWorld = GridView::dimensionworld; using CoordScalar = typename GridView::ctype; using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>; - using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; + using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>; public: //! export type of subcontrol volume - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using SubControlVolume = typename GG::SubControlVolume; //! export type of subcontrol volume face - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename GG::SubControlVolumeFace; //! export type of finite volume grid geometry - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using FVGridGeometry = GG; //! the maximum number of scvs per element static constexpr std::size_t maxNumElementScvs = 1; //! the maximum number of scvfs per element (use cubes for maximum) @@ -357,7 +355,7 @@ private: const auto& neighborVolVarIndices = fvGridGeometry().neighborVolVarIndices(eIdx); // the quadrature point parameterizaion to be used on scvfs - static const Scalar q = getParamFromGroup<Scalar>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "Mpfa.Q"); + static const auto q = getParam<CoordScalar>("Mpfa.Q"); // reserve memory for the scv faces const auto numLocalScvf = scvFaceIndices.size(); @@ -378,7 +376,7 @@ private: if (dim < dimWorld) { const auto indexInInside = is.indexInInside(); - if(finishedFacets[indexInInside]) + if (finishedFacets[indexInInside]) continue; else finishedFacets[indexInInside] = true; @@ -446,7 +444,7 @@ private: const auto& neighborVolVarIndices = fvGridGeometry().neighborVolVarIndices(eIdxGlobal); // the quadrature point parameterizaion to be used on scvfs - static const Scalar q = getParamFromGroup<Scalar>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "Mpfa.Q"); + static const auto q = getParam<CoordScalar>("Mpfa.Q"); // for network grids we only want to do one scvf per half facet // this approach assumes conforming grids at branching facets diff --git a/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh b/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh index 248c0129d9739c625ab49c728ab6f79c0414d3da..36a380d9002300402425a7e8887cde12ef95804e 100644 --- a/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh +++ b/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh @@ -26,28 +26,26 @@ #ifndef DUMUX_DISCRETIZATION_CC_MPFA_FV_GRID_GEOMETRY_HH #define DUMUX_DISCRETIZATION_CC_MPFA_FV_GRID_GEOMETRY_HH -#include <dune/geometry/multilineargeometry.hh> #include <dune/geometry/referenceelements.hh> -#include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> - #include <dumux/discretization/methods.hh> #include <dumux/discretization/basefvgridgeometry.hh> -#include <dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh> -#include <dumux/discretization/cellcentered/mpfa/connectivitymap.hh> -#include <dumux/discretization/cellcentered/mpfa/dualgridindexset.hh> -#include <dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh> -namespace Dumux -{ +namespace Dumux { + /*! * \ingroup CCMpfaDiscretization * \brief The finite volume geometry (scvs and scvfs) for cell-centered mpfa models on a grid view * This builds up the sub control volumes and sub control volume faces * \note This class is specialized for versions with and without caching the fv geometries on the grid view + * + * \tparam GridView the grid view + * \tparam GridIvIs the interaction volume index sets + * \tparam Traits traits class + * \tparam enableCache */ -template<class TypeTag, bool EnableFVElementGeometryCache> +template<class GridView, class Traits, bool enableCache> class CCMpfaFVGridGeometry; /*! @@ -56,43 +54,50 @@ class CCMpfaFVGridGeometry; * This builds up the sub control volumes and sub control volume faces * \note For caching enabled we store the fv geometries for the whole grid view which is memory intensive but faster */ -template<class TypeTag> -class CCMpfaFVGridGeometry<TypeTag, true> : public BaseFVGridGeometry<TypeTag> +template<class GV, class Traits> +class CCMpfaFVGridGeometry<GV, Traits, true> +: public BaseFVGridGeometry<CCMpfaFVGridGeometry<GV, Traits, true>, GV, Traits> { - using ParentType = BaseFVGridGeometry<TypeTag>; - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using ElementMapper = typename GET_PROP_TYPE(TypeTag, ElementMapper); - - using MpfaHelper = typename GET_PROP_TYPE(TypeTag, MpfaHelper); - using PrimaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, PrimaryInteractionVolume); - using DualGridNodalIndexSet = typename GET_PROP_TYPE(TypeTag, DualGridNodalIndexSet); - - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - static constexpr int dim = GridView::dimension; - static constexpr int dimWorld = GridView::dimensionworld; + using ThisType = CCMpfaFVGridGeometry<GV, Traits, true>; + using ParentType = BaseFVGridGeometry<ThisType, GV, Traits>; - using Element = typename GridView::template Codim<0>::Entity; - using Vertex = typename GridView::template Codim<dim>::Entity; - using Intersection = typename GridView::Intersection; - using CoordScalar = typename GridView::ctype; - using GridIndexType = typename GridView::IndexSet::IndexType; - using LocalIndexType = typename PrimaryInteractionVolume::Traits::LocalIndexType; - - using GridIVIndexSets = CCMpfaGridInteractionVolumeIndexSets<TypeTag>; - using ConnectivityMap = CCMpfaConnectivityMap<TypeTag>; + static constexpr int dim = GV::dimension; + static constexpr int dimWorld = GV::dimensionworld; + using Element = typename GV::template Codim<0>::Entity; + using Vertex = typename GV::template Codim<dim>::Entity; + using Intersection = typename GV::Intersection; + using GridIndexType = typename GV::IndexSet::IndexType; + using CoordScalar = typename GV::ctype; using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>; public: - //! export discretization method - static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::CCMpfa; - + //! export the mpfa helper type + using MpfaHelper = typename Traits::MpfaHelper; + //! export the grid interaction volume index set type + using GridIVIndexSets = typename Traits::template GridIvIndexSets<ThisType>; + //! export the type to be used for indicators where to use the secondary ivs using SecondaryIvIndicatorType = std::function<bool(const Element&, const Intersection&, bool)>; + //! export the type of the fv element geometry (the local view type) + using LocalView = typename Traits::template LocalView<ThisType, true>; + //! export the type of sub control volume + using SubControlVolume = typename Traits::SubControlVolume; + //! export the type of sub control volume + using SubControlVolumeFace = typename Traits::SubControlVolumeFace; + //! export the connectivity map type + using ConnectivityMap = typename Traits::template ConnectivityMap<ThisType>; + //! export dof mapper type + using DofMapper = typename Traits::ElementMapper; + //! export the grid view type + using GridView = GV; + + //! export the discretization method this geometry belongs to + static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::CCMpfa; + //! The maximum admissible stencil size (used for static memory allocation during assembly) + // TODO: Re-implement and obtain from nodal index set (for now we use a high value) + static constexpr int maxElementStencilSize = (dim < dimWorld || dim == 3) ? 45 : 15; + //! Constructor without indicator function for secondary interaction volumes //! Per default, we use the secondary IVs at branching points & boundaries CCMpfaFVGridGeometry(const GridView& gridView) @@ -109,7 +114,7 @@ public: //! the element mapper is the dofMapper //! this is convenience to have better chance to have the same main files for box/tpfa/mpfa... - const ElementMapper& dofMapper() const { return this->elementMapper(); } + const DofMapper& dofMapper() const { return this->elementMapper(); } //! The total number of sub control volumes std::size_t numScv() const { return scvs_.size(); } @@ -169,7 +174,7 @@ public: const auto isGhostVertex = MpfaHelper::findGhostVertices(this->gridView(), this->vertexMapper()); // instantiate the dual grid index set (to be used for construction of interaction volumes) - CCMpfaDualGridIndexSet< DualGridNodalIndexSet > dualIdSet(this->gridView()); + typename GridIVIndexSets::DualGridIndexSet dualIdSet(this->gridView()); // Build the SCVs and SCV faces GridIndexType scvfIdx = 0; @@ -185,9 +190,10 @@ public: std::vector<GridIndexType> scvfIndexSet; scvfIndexSet.reserve(MpfaHelper::getNumLocalScvfs(elementGeometry.type())); - // for network grids there might be multiple intersections with the same geometryInInside + // for network grids there might be multiple intersection with the same geometryInInside // we indentify those by the indexInInside for now (assumes conforming grids at branching facets) - std::vector<std::vector<GridIndexType>> outsideIndices; + using ScvfOutsideGridIndexStorage = typename SubControlVolumeFace::Traits::OutsideGridIndexStorage; + std::vector<ScvfOutsideGridIndexStorage> outsideIndices; if (dim < dimWorld) { outsideIndices.resize(element.subEntities(1)); @@ -195,8 +201,7 @@ public: { if (intersection.neighbor()) { - const auto& outside = intersection.outside(); - auto nIdx = this->elementMapper().index(outside); + const auto nIdx = this->elementMapper().index( intersection.outside() ); outsideIndices[intersection.indexInInside()].push_back(nIdx); } } @@ -251,24 +256,17 @@ public: secondaryInteractionVolumeVertices_[vIdxGlobal] = true; // the quadrature point parameterizarion to be used on scvfs - static const Scalar q = getParamFromGroup<Scalar>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "Mpfa.Q"); + static const auto q = getParam<CoordScalar>("Mpfa.Q"); // make the scv face (for non-boundary scvfs on network grids, use precalculated outside indices) const auto& outsideScvIndices = [&] () { if (!boundary) - { return dim == dimWorld ? - std::vector<GridIndexType>({this->elementMapper().index(is.outside())}) : + ScvfOutsideGridIndexStorage({this->elementMapper().index(is.outside())}) : outsideIndices[indexInInside]; - } else - { - // compute boundary scv idx and increment counter - const GridIndexType bIdx = numScvs + numBoundaryScvf_; - numBoundaryScvf_++; - return std::vector<GridIndexType>(1, bIdx); - } + return ScvfOutsideGridIndexStorage({GridIndexType(numScvs) + numBoundaryScvf_++}); } (); scvfIndexSet.push_back(scvfIdx); @@ -359,7 +357,7 @@ public: //! have derivatives with respect to a given dof. const ConnectivityMap& connectivityMap() const { return connectivityMap_; } - //! Returns the grid interaction volume seeds class. + //! Returns the grid interaction volume index set class. const GridIVIndexSets& gridInteractionVolumeIndexSets() const { return ivIndexSets_; } //! Get the scvf on the same face but from the other side @@ -382,7 +380,7 @@ private: // containers storing the global data std::vector<std::vector<GridIndexType>> scvfIndicesOfScv_; std::vector<bool> secondaryInteractionVolumeVertices_; - std::size_t numBoundaryScvf_; + GridIndexType numBoundaryScvf_; // needed for embedded surface and network grids (dim < dimWorld) std::vector<std::vector<GridIndexType>> flipScvfIndices_; @@ -401,42 +399,51 @@ private: * \note For caching disabled we store only some essential index maps to build up local systems on-demand in * the corresponding FVElementGeometry */ -template<class TypeTag> -class CCMpfaFVGridGeometry<TypeTag, false> : public BaseFVGridGeometry<TypeTag> +template<class GV, class Traits> +class CCMpfaFVGridGeometry<GV, Traits, false> +: public BaseFVGridGeometry<CCMpfaFVGridGeometry<GV, Traits, false>, GV, Traits> { - using ParentType = BaseFVGridGeometry<TypeTag>; - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using ElementMapper = typename GET_PROP_TYPE(TypeTag, ElementMapper); - - using MpfaHelper = typename GET_PROP_TYPE(TypeTag, MpfaHelper); - using PrimaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, PrimaryInteractionVolume); - using DualGridNodalIndexSet = typename GET_PROP_TYPE(TypeTag, DualGridNodalIndexSet); - - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using ThisType = CCMpfaFVGridGeometry<GV, Traits, false>; + using ParentType = BaseFVGridGeometry<ThisType, GV, Traits>; - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - static constexpr int dim = GridView::dimension; - static constexpr int dimWorld = GridView::dimensionworld; - - using Element = typename GridView::template Codim<0>::Entity; - using Vertex = typename GridView::template Codim<dim>::Entity; - using Intersection = typename GridView::Intersection; - using CoordScalar = typename GridView::ctype; - using GridIndexType = typename GridView::IndexSet::IndexType; - using LocalIndexType = typename PrimaryInteractionVolume::Traits::LocalIndexType; - - using GridIVIndexSets = CCMpfaGridInteractionVolumeIndexSets<TypeTag>; - using ConnectivityMap = CCMpfaConnectivityMap<TypeTag>; + static constexpr int dim = GV::dimension; + static constexpr int dimWorld = GV::dimensionworld; + using Element = typename GV::template Codim<0>::Entity; + using Vertex = typename GV::template Codim<dim>::Entity; + using Intersection = typename GV::Intersection; + using GridIndexType = typename GV::IndexSet::IndexType; + using CoordScalar = typename GV::ctype; using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>; + using ScvfOutsideGridIndexStorage = typename Traits::SubControlVolumeFace::Traits::OutsideGridIndexStorage; + public: - //! export discretization method - static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::CCMpfa; + //! export the mpfa helper type + using MpfaHelper = typename Traits::MpfaHelper; + //! export the grid interaction volume index set type + using GridIVIndexSets = typename Traits::template GridIvIndexSets<ThisType>; + //! export the type to be used for indicators where to use the secondary ivs + using SecondaryIvIndicatorType = std::function<bool(const Element&, const Intersection&, bool)>; - using SecondaryIvIndicator = std::function<bool(const Element&, const Intersection&, bool)>; + //! export the type of the fv element geometry (the local view type) + using LocalView = typename Traits::template LocalView<ThisType, false>; + //! export the type of sub control volume + using SubControlVolume = typename Traits::SubControlVolume; + //! export the type of sub control volume + using SubControlVolumeFace = typename Traits::SubControlVolumeFace; + //! export the connectivity map type + using ConnectivityMap = typename Traits::template ConnectivityMap<ThisType>; + //! export dof mapper type + using DofMapper = typename Traits::ElementMapper; + //! export the grid view type + using GridView = GV; + + //! export the discretization method this geometry belongs to + static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::CCMpfa; + //! The maximum admissible stencil size (used for static memory allocation during assembly) + // TODO: Re-implement and obtain from nodal index set (for now we use a high value) + static constexpr int maxElementStencilSize = (dim < dimWorld || dim == 3) ? 45 : 15; //! Constructor without indicator function for secondary interaction volumes //! Per default, we use the secondary IVs at branching points & boundaries @@ -447,14 +454,14 @@ public: {} //! Constructor with user-defined indicator function for secondary interaction volumes - CCMpfaFVGridGeometry(const GridView& gridView, const SecondaryIvIndicator& indicator) + CCMpfaFVGridGeometry(const GridView& gridView, const SecondaryIvIndicatorType& indicator) : ParentType(gridView) , secondaryIvIndicator_(indicator) {} //! the element mapper is the dofMapper //! this is convenience to have better chance to have the same main files for box/tpfa/mpfa... - const ElementMapper& dofMapper() const + const DofMapper& dofMapper() const { return this->elementMapper(); } //! Returns the total number of sub control volumes. @@ -514,7 +521,7 @@ public: isGhostVertex_ = MpfaHelper::findGhostVertices(this->gridView(), this->vertexMapper()); // instantiate the dual grid index set (to be used for construction of interaction volumes) - CCMpfaDualGridIndexSet< DualGridNodalIndexSet > dualIdSet(this->gridView()); + typename GridIVIndexSets::DualGridIndexSet dualIdSet(this->gridView()); // Build the SCVs and SCV faces numScvf_ = 0; @@ -529,13 +536,13 @@ public: // the element-wise index sets for finite volume geometry const auto numLocalFaces = MpfaHelper::getNumLocalScvfs(elementGeometry.type()); std::vector<GridIndexType> scvfsIndexSet; - std::vector< std::vector<GridIndexType> > neighborVolVarIndexSet; + std::vector<ScvfOutsideGridIndexStorage> neighborVolVarIndexSet; scvfsIndexSet.reserve(numLocalFaces); neighborVolVarIndexSet.reserve(numLocalFaces); // for network grids there might be multiple intersections with the same geometryInInside // we indentify those by the indexInInside for now (assumes conforming grids at branching facets) - std::vector<std::vector<GridIndexType>> outsideIndices; + std::vector<ScvfOutsideGridIndexStorage> outsideIndices; if (dim < dimWorld) { outsideIndices.resize(element.subEntities(1)); @@ -543,8 +550,7 @@ public: { if (intersection.neighbor()) { - const auto& outside = intersection.outside(); - auto nIdx = this->elementMapper().index(outside); + auto nIdx = this->elementMapper().index( intersection.outside() ); outsideIndices[intersection.indexInInside()].push_back(nIdx); } } @@ -595,18 +601,11 @@ public: const auto& outsideScvIndices = [&] () { if (!boundary) - { return dim == dimWorld ? - std::vector<GridIndexType>({this->elementMapper().index(is.outside())}) : + ScvfOutsideGridIndexStorage({this->elementMapper().index(is.outside())}) : outsideIndices[indexInInside]; - } else - { - // compute boundary scv idx and increment counter - const GridIndexType bIdx = numScvs_ + numBoundaryScvf_; - numBoundaryScvf_++; - return std::vector<GridIndexType>(1, bIdx); - } + return ScvfOutsideGridIndexStorage({GridIndexType(numScvs_) + numBoundaryScvf_++}); } (); // insert the scvf data into the dual grid index set @@ -646,7 +645,7 @@ public: { return scvfIndicesOfScv_[scvIdx]; } //! Returns the neighboring vol var indices for each scvf contained in an scv. - const std::vector< std::vector<GridIndexType> >& neighborVolVarIndices(GridIndexType scvIdx) const + const std::vector<ScvfOutsideGridIndexStorage>& neighborVolVarIndices(GridIndexType scvIdx) const { return neighborVolVarIndices_[scvIdx]; } //! Returns the connectivity map of which dofs @@ -662,18 +661,18 @@ private: // containers storing the global data std::vector<std::vector<GridIndexType>> scvfIndicesOfScv_; - std::vector< std::vector< std::vector<GridIndexType> > > neighborVolVarIndices_; + std::vector<std::vector<ScvfOutsideGridIndexStorage>> neighborVolVarIndices_; std::vector<bool> secondaryInteractionVolumeVertices_; std::vector<bool> isGhostVertex_; - std::size_t numScvs_; - std::size_t numScvf_; - std::size_t numBoundaryScvf_; + GridIndexType numScvs_; + GridIndexType numScvf_; + GridIndexType numBoundaryScvf_; // The grid interaction volume index set GridIVIndexSets ivIndexSets_; // Indicator function on where to use the secondary IVs - SecondaryIvIndicator secondaryIvIndicator_; + SecondaryIvIndicatorType secondaryIvIndicator_; }; } // end namespace Dumux diff --git a/dumux/discretization/cellcentered/mpfa/generalconnectivitymap.hh b/dumux/discretization/cellcentered/mpfa/generalconnectivitymap.hh deleted file mode 100644 index 24166a0539f63d0e3d2b472858c29df8a5cd50f2..0000000000000000000000000000000000000000 --- a/dumux/discretization/cellcentered/mpfa/generalconnectivitymap.hh +++ /dev/null @@ -1,204 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * 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 - * \ingroup CCMpfaDiscretization - * \brief Stores the face indices corresponding to the neighbors of an element - * that contribute to the derivative calculation - */ -#ifndef DUMUX_CC_MPFA_GENERAL_CONNECTIVITY_MAP_HH -#define DUMUX_CC_MPFA_GENERAL_CONNECTIVITY_MAP_HH - -#include <vector> -#include <utility> -#include <algorithm> -#include <dumux/common/properties.hh> -#include <dumux/discretization/fluxstencil.hh> - -namespace Dumux -{ - -/*! - * \ingroup CCMpfaDiscretization - * \brief General version of the assembly map for cellcentered schemes. To each - * cell I we store a list of cells J that are needed to compute the fluxes - * in these cells J that depend on cell I. Furthermore, we store for each cell J - * a list of scvfs in which cell I is in the stencil, as well as additional scvfs - * that are also required to set up the transmissibilities. - */ -template<class TypeTag> -class CCMpfaGeneralConnectivityMap -{ - using MpfaHelper = typename GET_PROP_TYPE(TypeTag, MpfaHelper); - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using GridIndexType = typename GridView::IndexSet::IndexType; - using FluxStencil = Dumux::FluxStencil<TypeTag>; - - // To each cell "globalI" there will be a list of "globalJ", in which globalI is part - // of the stencil. We save the scvfs over which fluxes depend on globalI and a list of - // additional scvfs which are needed temporarily to set up the transmissibilities of the scvfsJ - struct DataJ - { - GridIndexType globalJ; - std::vector<GridIndexType> scvfsJ; - std::vector<GridIndexType> additionalScvfs; - }; - - using Map = std::vector<std::vector<DataJ>>; - -public: - - /*! - * \brief Initialize the ConnectivityMap object. - * - * \param fvGridGeometry The grid's finite volume geometry. - */ - void update(const FVGridGeometry& fvGridGeometry) - { - map_.resize(fvGridGeometry.gridView().size(0)); - for (const auto& element : elements(fvGridGeometry.gridView())) - { - // We are looking for the elements I, for which this element J is in the flux stencil - auto globalJ = fvGridGeometry.elementMapper().index(element); - - auto fvGeometry = localView(fvGridGeometry); - fvGeometry.bindElement(element); - - // obtain the data of J in elements I - std::vector<std::pair<GridIndexType, std::vector<DataJ>>> dataJForI; - - // loop over sub control faces - for (auto&& scvf : scvfs(fvGeometry)) - { - const auto& stencil = FluxStencil::stencil(element, fvGeometry, scvf); - - // insert our index in the neighbor stencils of the elements in the flux stencil - for (auto globalI : stencil) - { - if (globalI == globalJ) - continue; - - auto it = std::find_if(dataJForI.begin(), - dataJForI.end(), - [globalI](const auto& pair) { return pair.first == globalI; }); - - if (it != dataJForI.end()) - { - // get the data J which corresponds to the actual global J - // This will be the first entry, as we do so in the else statement (see below) - auto& globalJDataJ = it->second[0]; - - // insert actual scvf index in the list of scvfs which couple I and J - globalJDataJ.scvfsJ.push_back(scvf.index()); - - // Also, all scvfs connected to a vertex together with the actual scvf - // land in the list of additional scvfs. Of that list we will delete those - // that are already in the list of scvfsJ later... - const auto scvfVectorAtVertex = MpfaHelper::getScvFacesAtVertex(scvf.vertexIndex(), element, fvGeometry); - std::vector<GridIndexType> scvfIndicesAtVertex(scvfVectorAtVertex.size()); - for (std::size_t i = 0; i < scvfVectorAtVertex.size(); ++i) - scvfIndicesAtVertex[i] = scvfVectorAtVertex[i]->index(); - globalJDataJ.additionalScvfs.insert(globalJDataJ.additionalScvfs.end(), - scvfIndicesAtVertex.begin(), - scvfIndicesAtVertex.end()); - - // all the other dofs in the stencil have to appear as "globalJ" to globalI as well - for (auto globalJ2 : stencil) - { - if (globalJ2 == globalJ || globalJ2 == globalI) - continue; - - auto it2 = std::find_if(it->second.begin(), - it->second.end(), - [globalJ2](const auto& dataJ) { return dataJ.globalJ == globalJ2; }); - - // if entry for globalJ2 does not exist yet, add globalJ2 to the J-data of globalI - // with an empty set of scvfs over which I and J are coupled (i.e. they aren't coupled) - if (it2 == it->second.end()) - it->second.push_back(DataJ({globalJ2, std::vector<GridIndexType>()})); - } - } - else - { - // No DataJ for globalI exists yet. Make it and insert data on the actual - // global J as first entry in the vector of DataJs belonging to globalI - dataJForI.emplace_back(std::make_pair(globalI, - std::vector<DataJ>({DataJ({globalJ, std::vector<GridIndexType>({scvf.index()})})}))); - - // Also, all scvfs connected to a vertex together with the actual scvf - // land in the list of additional scvfs. Of that list we will delete those - // that are already in the list of scvfsJ later... - const auto scvfVectorAtVertex = MpfaHelper::getScvFacesAtVertex(scvf.vertexIndex(), element, fvGeometry); - std::vector<GridIndexType> scvfIndicesAtVertex(scvfVectorAtVertex.size()); - for (unsigned int i = 0; i < scvfVectorAtVertex.size(); ++i) - scvfIndicesAtVertex[i] = scvfVectorAtVertex[i]->index(); - dataJForI.back().second[0].additionalScvfs.insert(dataJForI.back().second[0].additionalScvfs.end(), - scvfIndicesAtVertex.begin(), - scvfIndicesAtVertex.end()); - - // all the other dofs in the stencil will be "globalJ" to globalI as well - for (auto globalJ2 : stencil) - if (globalJ2 != globalJ && globalJ2 != globalI) - dataJForI.back().second.push_back(DataJ({globalJ2, std::vector<GridIndexType>()})); - } - } - } - - // Insert the data into the global map - for (auto&& pair : dataJForI) - { - // obtain the corresponding entry in the map - auto& dataJVector = map_[pair.first]; - for (auto&& dataJ : pair.second) - { - // delete those additionalScvfs indices that are already in the list of scvfs - dataJ.additionalScvfs.erase(std::remove_if(dataJ.additionalScvfs.begin(), - dataJ.additionalScvfs.end(), - [&dataJ] (const auto& idx) - { return MpfaHelper::VectorContainsValue(dataJ.scvfsJ, idx); }), - dataJ.additionalScvfs.end()); - - // if entry for j exists in the map already add scvf and additional scvf indices, create otherwise - auto it = std::find_if(dataJVector.begin(), - dataJVector.end(), - [&dataJ](const auto& dataJofMap) { return dataJofMap.globalJ == dataJ.globalJ; }); - - if (it != dataJVector.end()) - { - it->scvfsJ.insert(it->scvfsJ.end(), dataJ.scvfsJ.begin(), dataJ.scvfsJ.end()); - it->additionalScvfs.insert(it->additionalScvfs.end(), dataJ.additionalScvfs.begin(), dataJ.additionalScvfs.end()); - } - else - dataJVector.emplace_back(std::move(dataJ)); - } - } - } - } - - //! Returns the assembly map of the element with given grid index - const std::vector<DataJ>& operator[] (const GridIndexType globalI) const - { return map_[globalI]; } - -private: - Map map_; -}; -} // end namespace Dumux - -#endif diff --git a/dumux/discretization/cellcentered/mpfa/gridfluxvariablescache.hh b/dumux/discretization/cellcentered/mpfa/gridfluxvariablescache.hh index 1ac49768a65ae2b545caac995bf8006ce52451a6..87392c2b4f71f4a911e799b90394a49f35bde083 100644 --- a/dumux/discretization/cellcentered/mpfa/gridfluxvariablescache.hh +++ b/dumux/discretization/cellcentered/mpfa/gridfluxvariablescache.hh @@ -27,8 +27,10 @@ #include <dumux/common/properties.hh> #include <dumux/discretization/cellcentered/mpfa/fluxvariablescachefiller.hh> -namespace Dumux -{ +//! make the local view function available whenever we use this class +#include <dumux/discretization/localview.hh> + +namespace Dumux { /*! * \ingroup CCMpfaDiscretization @@ -52,13 +54,12 @@ class CCMpfaGridFluxVariablesCache<TypeTag, true> using IndexType = typename GridView::IndexSet::IndexType; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); - using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using PrimaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, PrimaryInteractionVolume); using PrimaryIvDataHandle = typename PrimaryInteractionVolume::Traits::DataHandle; @@ -67,6 +68,9 @@ class CCMpfaGridFluxVariablesCache<TypeTag, true> using FluxVariablesCacheFiller = CCMpfaFluxVariablesCacheFiller<TypeTag>; public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); + //! The constructor CCMpfaGridFluxVariablesCache(const Problem& problem) : problemPtr_(&problem) {} @@ -165,14 +169,6 @@ public: } } - /*! - * \brief Return a local restriction of this global object - * 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 ElementFluxVariablesCache localView(const CCMpfaGridFluxVariablesCache& global) - { return ElementFluxVariablesCache(global); } - //! access operators in the case of caching const FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) const { return fluxVarsCache_[scvf.index()]; } @@ -248,14 +244,16 @@ class CCMpfaGridFluxVariablesCache<TypeTag, false> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); + //! The constructor CCMpfaGridFluxVariablesCache(const Problem& problem) : problemPtr_(&problem) {} @@ -270,14 +268,6 @@ public: const FVElementGeometry& fvGeometry, const ElementVolumeVariables& elemVolVars) {} - /*! - * \brief Return a local restriction of this global object - * 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 ElementFluxVariablesCache localView(const CCMpfaGridFluxVariablesCache& global) - { return ElementFluxVariablesCache(global); } - const Problem& problem() const { return *problemPtr_; } diff --git a/dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh b/dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh index 7ace724febac7f73d204653a76a66ea72fc4ac84..7a6875ca5c1720aaaec215710a02812c877a4982 100644 --- a/dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh +++ b/dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh @@ -35,26 +35,27 @@ namespace Dumux /*! * \ingroup CCMpfaDiscretization * \brief Class that holds all interaction volume index sets on a grid view. + * + * \tparam FVG the finite volume grid geometry + * \tparam NI the type used for nodal index sets + * \tparam PI primary interaction volume type + * \tparam SI secondary interaction volume type */ -template<class TypeTag> +template<class FVG, class NI, class PI, class SI = PI> class CCMpfaGridInteractionVolumeIndexSets { - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using GridIndexType = typename GridView::IndexSet::IndexType; - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using DualGridNodalIndexSet = typename GET_PROP_TYPE(TypeTag, DualGridNodalIndexSet); + using SubControlVolumeFace = typename FVG::SubControlVolumeFace; + using PrimaryIVIndexSet = typename PI::Traits::IndexSet; + using SecondaryIVIndexSet = typename SI::Traits::IndexSet; - using PrimaryIV = typename GET_PROP_TYPE(TypeTag, PrimaryInteractionVolume); - using PrimaryIVIndexSet = typename PrimaryIV::Traits::IndexSet; - using SecondaryIV = typename GET_PROP_TYPE(TypeTag, SecondaryInteractionVolume); - using SecondaryIVIndexSet = typename SecondaryIV::Traits::IndexSet; +public: + using FVGridGeometry = FVG; + using PrimaryInteractionVolume = PI; + using SecondaryInteractionVolume = SI; - static constexpr int dim = GridView::dimension; - using LocalIndexType = typename PrimaryIV::Traits::LocalIndexType; - using DualGridIndexSet = CCMpfaDualGridIndexSet< DualGridNodalIndexSet >; + using GridIndexType = typename FVGridGeometry::GridView::IndexSet::IndexType; + using DualGridIndexSet = CCMpfaDualGridIndexSet< NI >; -public: /*! * \brief Construct all interaction volume index sets on the grid view * @@ -77,9 +78,9 @@ public: { const auto vIdxGlobal = fvGridGeometry.vertexMapper().index(vertex); if (!fvGridGeometry.vertexUsesSecondaryInteractionVolume(vIdxGlobal)) - numPrimaryIV_ += PrimaryIV::numInteractionVolumesAtVertex((*dualGridIndexSet_)[vIdxGlobal]); + numPrimaryIV_ += PrimaryInteractionVolume::numInteractionVolumesAtVertex((*dualGridIndexSet_)[vIdxGlobal]); else - numSecondaryIV_ += SecondaryIV::numInteractionVolumesAtVertex((*dualGridIndexSet_)[vIdxGlobal]); + numSecondaryIV_ += SecondaryInteractionVolume::numInteractionVolumesAtVertex((*dualGridIndexSet_)[vIdxGlobal]); } // reserve memory @@ -92,9 +93,9 @@ public: { const auto vIdxGlobal = fvGridGeometry.vertexMapper().index(vertex); if (!fvGridGeometry.vertexUsesSecondaryInteractionVolume(vIdxGlobal)) - PrimaryIV::addInteractionVolumeIndexSets(primaryIVIndexSets_, scvfIndexMap_, (*dualGridIndexSet_)[vIdxGlobal]); + PrimaryInteractionVolume::addInteractionVolumeIndexSets(primaryIVIndexSets_, scvfIndexMap_, (*dualGridIndexSet_)[vIdxGlobal]); else - SecondaryIV::addInteractionVolumeIndexSets(secondaryIVIndexSets_, scvfIndexMap_, (*dualGridIndexSet_)[vIdxGlobal]); + SecondaryInteractionVolume::addInteractionVolumeIndexSets(secondaryIVIndexSets_, scvfIndexMap_, (*dualGridIndexSet_)[vIdxGlobal]); } } diff --git a/dumux/discretization/cellcentered/mpfa/helper.hh b/dumux/discretization/cellcentered/mpfa/helper.hh index 5a32421a9ed42b371e90f08cf5fd5fae8155fb0c..71aa0263bae23999892d91bbc0cfdf94446df8f3 100644 --- a/dumux/discretization/cellcentered/mpfa/helper.hh +++ b/dumux/discretization/cellcentered/mpfa/helper.hh @@ -54,8 +54,8 @@ class MpfaDimensionHelper<TypeTag, /*dim*/2, /*dimWorld*/2> { using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ScvfCornerVector = typename SubControlVolumeFace::Traits::CornerStorage; using InteractionVolume = typename GET_PROP_TYPE(TypeTag, PrimaryInteractionVolume); using LocalScvType = typename InteractionVolume::Traits::LocalScvType; @@ -300,8 +300,8 @@ class MpfaDimensionHelper<TypeTag, /*dim*/3, /*dimWorld*/3> { using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ScvfCornerVector = typename SubControlVolumeFace::Traits::CornerStorage; using InteractionVolume = typename GET_PROP_TYPE(TypeTag, PrimaryInteractionVolume); using LocalScvType = typename InteractionVolume::Traits::LocalScvType; @@ -580,9 +580,10 @@ class CCMpfaHelperImplementation : public MpfaDimensionHelper<TypeTag, dim, dimW using PrimaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, PrimaryInteractionVolume); using SecondaryInteractionVolume = typename GET_PROP_TYPE(TypeTag, SecondaryInteractionVolume); - using VertexMapper = typename GET_PROP_TYPE(TypeTag, VertexMapper); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using VertexMapper = typename FVGridGeometry::VertexMapper; + using FVElementGeometry = typename FVGridGeometry::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ScvfCornerVector = typename SubControlVolumeFace::Traits::CornerStorage; using CoordScalar = typename GridView::ctype; diff --git a/dumux/discretization/cellcentered/mpfa/omethod/interactionvolume.hh b/dumux/discretization/cellcentered/mpfa/omethod/interactionvolume.hh index 06fefbd08a6d351b67beb5e264c78e17b3a76743..be2e526ac16536fd6a71bc3d72877fc9dd503a4a 100644 --- a/dumux/discretization/cellcentered/mpfa/omethod/interactionvolume.hh +++ b/dumux/discretization/cellcentered/mpfa/omethod/interactionvolume.hh @@ -60,7 +60,7 @@ public: //! export the problem type (needed for iv-local assembly) using Problem = typename GET_PROP_TYPE(TypeTag, Problem); //! export the type of the local view on the finite volume grid geometry - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; //! export the type of the local view on the grid volume variables using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); //! export the type of grid view diff --git a/dumux/discretization/cellcentered/mpfa/omethod/staticinteractionvolume.hh b/dumux/discretization/cellcentered/mpfa/omethod/staticinteractionvolume.hh index 0281136776edbb698ffa08cc0ada78a7bc4f5910..2304ac87383f7a48bcff8af92db2d87b91843bbf 100644 --- a/dumux/discretization/cellcentered/mpfa/omethod/staticinteractionvolume.hh +++ b/dumux/discretization/cellcentered/mpfa/omethod/staticinteractionvolume.hh @@ -62,7 +62,7 @@ public: //! export the problem type (needed for iv-local assembly) using Problem = typename GET_PROP_TYPE(TypeTag, Problem); //! export the type of the local view on the finite volume grid geometry - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; //! export the type of the local view on the grid volume variables using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); //! export the type of grid view diff --git a/dumux/discretization/cellcentered/mpfa/properties.hh b/dumux/discretization/cellcentered/mpfa/properties.hh index ce805e818a37a5fa7f8c5395f284b6fd4d15a26f..06f3d8704a822edb5cd882f1d935ea00745607e5 100644 --- a/dumux/discretization/cellcentered/mpfa/properties.hh +++ b/dumux/discretization/cellcentered/mpfa/properties.hh @@ -25,29 +25,28 @@ #ifndef DUMUX_CC_MPFA_PROPERTIES_HH #define DUMUX_CC_MPFA_PROPERTIES_HH -#include <dune/common/fvector.hh> -#include <dune/geometry/multilineargeometry.hh> - #include <dumux/common/properties.hh> +#include <dumux/common/defaultmappertraits.hh> #include <dumux/assembly/cclocalresidual.hh> -#include <dumux/discretization/methods.hh> #include <dumux/discretization/fvproperties.hh> #include <dumux/discretization/cellcentered/gridvolumevariables.hh> -#include <dumux/discretization/cellcentered/subcontrolvolume.hh> #include <dumux/discretization/cellcentered/elementsolution.hh> #include <dumux/discretization/cellcentered/elementboundarytypes.hh> +#include <dumux/discretization/cellcentered/subcontrolvolume.hh> -#include <dumux/discretization/cellcentered/mpfa/connectivitymap.hh> +#include <dumux/discretization/cellcentered/mpfa/methods.hh> #include <dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh> #include <dumux/discretization/cellcentered/mpfa/gridfluxvariablescache.hh> #include <dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh> +#include <dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh> #include <dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh> #include <dumux/discretization/cellcentered/mpfa/elementfluxvariablescache.hh> -#include <dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh> #include <dumux/discretization/cellcentered/mpfa/dualgridindexset.hh> +#include <dumux/discretization/cellcentered/mpfa/connectivitymap.hh> +#include <dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh> #include <dumux/discretization/cellcentered/mpfa/helper.hh> #include <dumux/discretization/cellcentered/mpfa/omethod/interactionvolume.hh> @@ -65,12 +64,6 @@ SET_PROP(CCMpfaModel, DiscretizationMethod) static const DiscretizationMethods value = DiscretizationMethods::CCMpfa; }; -//! Extract the used mpfa method from the primary interaction volume -SET_PROP(CCMpfaModel, MpfaMethod) -{ - static const MpfaMethods value = GET_PROP_TYPE(TypeTag, PrimaryInteractionVolume)::MpfaMethod; -}; - //! Set the maximum admissible number of branches per scvf SET_PROP(CCMpfaModel, MaxNumNeighborsPerScvf) { @@ -133,14 +126,38 @@ public: }; //! Set the default for the global finite volume geometry -SET_TYPE_PROP(CCMpfaModel, - FVGridGeometry, - CCMpfaFVGridGeometry<TypeTag, GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>); +SET_PROP(CCMpfaModel, FVGridGeometry) +{ +private: + using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using PrimaryIV = typename GET_PROP_TYPE(TypeTag, PrimaryInteractionVolume); + using SecondaryIV = typename GET_PROP_TYPE(TypeTag, SecondaryInteractionVolume); -//! Set the default for the local finite volume geometry -SET_TYPE_PROP(CCMpfaModel, - FVElementGeometry, - CCMpfaFVElementGeometry<TypeTag, GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>); + static constexpr bool enableCache = GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache); + + struct Traits : public DefaultMapperTraits<GridView> + { + using SubControlVolume = CCSubControlVolume<GridView>; + using SubControlVolumeFace = CCMpfaSubControlVolumeFace<GridView>; + using MpfaHelper = typename GET_PROP_TYPE(TypeTag, MpfaHelper); + using NodalIndexSet = typename GET_PROP_TYPE(TypeTag, DualGridNodalIndexSet); + + template< class FVGridGeometry > + using GridIvIndexSets = CCMpfaGridInteractionVolumeIndexSets< FVGridGeometry, + NodalIndexSet, + PrimaryIV, + SecondaryIV >; + + template< class FVGridGeometry, bool enableCache > + using LocalView = CCMpfaFVElementGeometry<FVGridGeometry, enableCache>; + + //! Per default, we use the o-method and thus the simple assembly map + template< class FVGridGeometry > + using ConnectivityMap = CCMpfaConnectivityMap<FVGridGeometry, FVGridGeometry::GridIVIndexSets::PrimaryInteractionVolume::MpfaMethod>; + }; +public: + using type = CCMpfaFVGridGeometry<GridView, Traits, enableCache>; +}; //! The global flux variables cache vector class SET_TYPE_PROP(CCMpfaModel, @@ -161,66 +178,6 @@ SET_TYPE_PROP(CCMpfaModel, //! The global current volume variables vector class SET_TYPE_PROP(CCMpfaModel, GridVolumeVariables, CCGridVolumeVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridVolumeVariablesCache)>); -//! The sub control volume -SET_PROP(CCMpfaModel, SubControlVolume) -{ -private: - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - struct ScvGeometryTraits - { - using Geometry = typename Grid::template Codim<0>::Geometry; - using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; - using Scalar = typename Geometry::ctype; - using GlobalPosition = Dune::FieldVector<Scalar, Geometry::coorddimension>; - }; -public: - using type = CCSubControlVolume<ScvGeometryTraits>; -}; - -//! The sub-control volume face class -SET_PROP(CCMpfaModel, SubControlVolumeFace) -{ -private: - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - static const int dim = Grid::dimension; - static const int dimWorld = Grid::dimensionworld; - - // we use geometry traits that use static corner vectors to and a fixed geometry type - template <class ct> - struct ScvfMLGTraits : public Dune::MultiLinearGeometryTraits<ct> - { - // we use static vectors to store the corners as we know - // the number of corners in advance (2^(dim-1) corners (1<<(dim-1)) - template< int mydim, int cdim > - struct CornerStorage - { - using Type = std::array< Dune::FieldVector< ct, cdim >, (1<<(dim-1)) >; - }; - - // we know all scvfs will have the same geometry type - template< int dim > - struct hasSingleGeometryType - { - static const bool v = true; - static const unsigned int topologyId = Dune::Impl::CubeTopology< dim >::type::id; - }; - }; - - struct ScvfGeometryTraits - { - using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; - using Scalar = typename Grid::ctype; - using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, ScvfMLGTraits<Scalar> >; - using CornerStorage = typename ScvfMLGTraits<Scalar>::template CornerStorage<dim-1, dimWorld>::Type; - using GlobalPosition = typename CornerStorage::value_type; - }; - -public: - using type = Dumux::CCMpfaSubControlVolumeFace< ScvfGeometryTraits>; -}; - //! Set the solution vector type for an element SET_TYPE_PROP(CCMpfaModel, ElementSolutionVector, CCElementSolution<TypeTag>); @@ -229,10 +186,6 @@ SET_TYPE_PROP(CCMpfaModel, ElementBoundaryTypes, CCElementBoundaryTypes<TypeTag> //! Set the BaseLocalResidual to CCLocalResidual SET_TYPE_PROP(CCMpfaModel, BaseLocalResidual, CCLocalResidual<TypeTag>); - -//! Set the AssemblyMap property -SET_TYPE_PROP(CCMpfaModel, AssemblyMap, Dumux::CCMpfaConnectivityMap<TypeTag>); - } // namespace Properties } // namespace Dumux diff --git a/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh b/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh index 45bd3cc55a86d4b51e1c0102de357429722ef881..96122d5982967a9d3676e64ad73ac1729b78ab3e 100644 --- a/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh +++ b/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh @@ -25,31 +25,83 @@ #define DUMUX_DISCRETIZATION_CC_MPFA_SUBCONTROLVOLUMEFACE_HH #include <vector> +#include <array> #include <dune/common/version.hh> +#include <dune/common/reservedvector.hh> +#include <dune/common/fvector.hh> #include <dune/geometry/type.hh> +#include <dune/geometry/multilineargeometry.hh> -namespace Dumux +namespace Dumux { + +/*! + * \ingroup CCMpfaDiscretization + * \brief Default traits class to be used for the sub-control volume faces + * for the cell-centered finite volume scheme using MPFA + * \tparam GV the type of the grid view + */ +template<class GridView> +struct CCMpfaDefaultScvfGeometryTraits { + using Grid = typename GridView::Grid; + + static const int dim = Grid::dimension; + static const int dimWorld = Grid::dimensionworld; + + using Scalar = typename Grid::ctype; + using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; + using LocalIndexType = unsigned int; + using OutsideGridIndexStorage = typename std::conditional_t< (dim<dimWorld), + std::vector<GridIndexType>, + Dune::ReservedVector<GridIndexType, 1> >; + + // we use geometry traits that use static corner vectors to and a fixed geometry type + template <class ct> + struct ScvfMLGTraits : public Dune::MultiLinearGeometryTraits<ct> + { + // we use static vectors to store the corners as we know + // the number of corners in advance (2^(dim-1) corners (1<<(dim-1)) + template< int mydim, int cdim > + struct CornerStorage + { + using Type = std::array< Dune::FieldVector< ct, cdim >, (1<<(dim-1)) >; + }; + + // we know all scvfs will have the same geometry type + template< int dim > + struct hasSingleGeometryType + { + static const bool v = true; + static const unsigned int topologyId = Dune::Impl::CubeTopology< dim >::type::id; + }; + }; + + using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, ScvfMLGTraits<Scalar> >; + using CornerStorage = typename ScvfMLGTraits<Scalar>::template CornerStorage<dim-1, dimWorld>::Type; + using GlobalPosition = typename CornerStorage::value_type; +}; /*! * \ingroup CCMpfaDiscretization * \brief Class for a sub control volume face in mpfa methods, i.e a part of the boundary * of a control volume we compute fluxes on. - * - * \param ScvfGeometryTraits the traits class for the geometry type + * \tparam GV the type of the grid view + * \tparam T the scvf geometry traits */ -template<class ScvfGeometryTraits> +template<class GV, + class T = CCMpfaDefaultScvfGeometryTraits<GV> > class CCMpfaSubControlVolumeFace { - using GridIndexType = typename ScvfGeometryTraits::GridIndexType; - using Scalar = typename ScvfGeometryTraits::Scalar; - using GlobalPosition = typename ScvfGeometryTraits::GlobalPosition; - using CornerStorage = typename ScvfGeometryTraits::CornerStorage; - using Geometry = typename ScvfGeometryTraits::Geometry; + using GridIndexType = typename T::GridIndexType; + using Scalar = typename T::Scalar; + using GlobalPosition = typename T::GlobalPosition; + using CornerStorage = typename T::CornerStorage; + using OutsideGridIndexStorage = typename T::OutsideGridIndexStorage; + using Geometry = typename T::Geometry; public: //! state the traits public and thus export all types - using Traits = ScvfGeometryTraits; + using Traits = T; /*! * \brief Constructor @@ -73,7 +125,7 @@ public: unsigned int vIdxLocal, GridIndexType scvfIndex, GridIndexType insideScvIdx, - const std::vector<GridIndexType>& outsideScvIndices, + const OutsideGridIndexStorage& outsideScvIndices, Scalar q, bool boundary) : boundary_(boundary) @@ -122,7 +174,7 @@ public: GridIndexType outsideScvIdx(int i = 0) const { return outsideScvIndices_[i]; } //! returns the outside scv indices (can be more than one index for dim < dimWorld) - const std::vector<GridIndexType>& outsideScvIndices() const { return outsideScvIndices_; } + const OutsideGridIndexStorage& outsideScvIndices() const { return outsideScvIndices_; } //! Returns the number of corners std::size_t corners() const { return corners_.size(); } @@ -161,7 +213,7 @@ private: GridIndexType vertexIndex_; GridIndexType scvfIndex_; GridIndexType insideScvIdx_; - std::vector<GridIndexType> outsideScvIndices_; + OutsideGridIndexStorage outsideScvIndices_; unsigned int vIdxInElement_; CornerStorage corners_; diff --git a/dumux/discretization/cellcentered/subcontrolvolume.hh b/dumux/discretization/cellcentered/subcontrolvolume.hh index c9521b8bbe4481579a1b7d376edfbda546523c61..8ec5d6c7d03c60bcc710b3fa9e4be063f420f57e 100644 --- a/dumux/discretization/cellcentered/subcontrolvolume.hh +++ b/dumux/discretization/cellcentered/subcontrolvolume.hh @@ -24,28 +24,50 @@ #ifndef DUMUX_DISCRETIZATION_CC_SUBCONTROLVOLUME_HH #define DUMUX_DISCRETIZATION_CC_SUBCONTROLVOLUME_HH +#include <dune/common/fvector.hh> #include <dumux/discretization/subcontrolvolumebase.hh> #include <dumux/common/optional.hh> -namespace Dumux +namespace Dumux { + +/*! + * \ingroup CCDiscretization + * \brief Default traits class to be used for the sub-control volumes + * for the cell-centered finite volume scheme using TPFA + * \tparam GV the type of the grid view + */ +template<class GridView> +struct CCDefaultScvGeometryTraits { + using Geometry = typename GridView::template Codim<0>::Geometry; + using GridIndexType = typename GridView::IndexSet::IndexType; + using LocalIndexType = unsigned int; + using Scalar = typename GridView::ctype; + using GlobalPosition = Dune::FieldVector<Scalar, GridView::dimensionworld>; +}; + /*! * \ingroup CCDiscretization * \brief Sub control volumes for cell-centered discretization schemes + * \tparam GV the type of the grid view + * \tparam T the scv geometry traits */ -template<class ScvGeometryTraits> -class CCSubControlVolume : public SubControlVolumeBase<CCSubControlVolume<ScvGeometryTraits>, ScvGeometryTraits> +template<class GV, + class T = CCDefaultScvGeometryTraits<GV> > +class CCSubControlVolume +: public SubControlVolumeBase<CCSubControlVolume<GV, T>, T> { - using ParentType = SubControlVolumeBase<CCSubControlVolume<ScvGeometryTraits>, ScvGeometryTraits>; - using Geometry = typename ScvGeometryTraits::Geometry; - using GridIndexType = typename ScvGeometryTraits::GridIndexType; - using LocalIndexType = typename ScvGeometryTraits::LocalIndexType; - using Scalar = typename ScvGeometryTraits::Scalar; - using GlobalPosition = typename ScvGeometryTraits::GlobalPosition; + using ThisType = CCSubControlVolume<GV, T>; + using ParentType = SubControlVolumeBase<ThisType, T>; + using Geometry = typename T::Geometry; + using GridIndexType = typename T::GridIndexType; + using LocalIndexType = typename T::LocalIndexType; + using Scalar = typename T::Scalar; + using GlobalPosition = typename T::GlobalPosition; public: //! state the traits public and thus export all types - using Traits = ScvGeometryTraits; + using Traits = T; CCSubControlVolume() = default; diff --git a/dumux/discretization/cellcentered/tpfa/darcyslaw.hh b/dumux/discretization/cellcentered/tpfa/darcyslaw.hh index aa2f60977f61451fbd714a7c4e40484ed89d99c5..2a408e32ac9b8fe5e38ea579b33c1a02bc8430d5 100644 --- a/dumux/discretization/cellcentered/tpfa/darcyslaw.hh +++ b/dumux/discretization/cellcentered/tpfa/darcyslaw.hh @@ -58,9 +58,9 @@ template<class TypeTag> class TpfaDarcysLawCacheFiller { using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); @@ -90,9 +90,9 @@ class TpfaDarcysLawCache using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using AdvectionType = typename GET_PROP_TYPE(TypeTag, AdvectionType); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); public: @@ -123,11 +123,11 @@ class CCTpfaDarcysLaw<TypeTag, /*isNetwork*/ false> { using Implementation = DarcysLawImplementation<TypeTag, DiscretizationMethods::CCTpfa>; using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using ElementFluxVarsCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); @@ -279,11 +279,11 @@ class CCTpfaDarcysLaw<TypeTag, /*isNetwork*/ true> { using Implementation = DarcysLawImplementation<TypeTag, DiscretizationMethods::CCTpfa>; using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using ElementFluxVarsCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); diff --git a/dumux/discretization/cellcentered/tpfa/elementfluxvariablescache.hh b/dumux/discretization/cellcentered/tpfa/elementfluxvariablescache.hh index c0a210c6f2d5956d4eda15f9c0117b116d0b183a..353d603462bcafe1133bf163eb07d2a73f508cac 100644 --- a/dumux/discretization/cellcentered/tpfa/elementfluxvariablescache.hh +++ b/dumux/discretization/cellcentered/tpfa/elementfluxvariablescache.hh @@ -53,11 +53,11 @@ class CCTpfaElementFluxVariablesCache<TypeTag, true> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using IndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); using GridFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, GridFluxVariablesCache); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; public: CCTpfaElementFluxVariablesCache(const GridFluxVariablesCache& global) @@ -110,11 +110,11 @@ class CCTpfaElementFluxVariablesCache<TypeTag, false> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using IndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); using GridFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, GridFluxVariablesCache); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using FluxVariablesCacheFiller = CCTpfaFluxVariablesCacheFiller<TypeTag>; public: diff --git a/dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh b/dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh index 619581a5fb586a95b3e86f78fe3ee8be0ace1bbc..9cd9327741939dcd087fa31f33ff569ebc830443 100644 --- a/dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh +++ b/dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh @@ -50,10 +50,10 @@ class CCTpfaElementVolumeVariables<TypeTag, /*enableGridVolVarsCache*/true> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using IndexType = typename GridView::IndexSet::IndexType; static const int dim = GridView::dimension; @@ -105,8 +105,8 @@ class CCTpfaElementVolumeVariables<TypeTag, /*enableGridVolVarsCache*/false> using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using IndexType = typename GridView::IndexSet::IndexType; static const int dim = GridView::dimension; diff --git a/dumux/discretization/cellcentered/tpfa/fickslaw.hh b/dumux/discretization/cellcentered/tpfa/fickslaw.hh index b1f4bf7b47e3d66f29eaff1e437e5bb50ff154d9..4004d642c3dc1f552e93e13a15a8bb6fe65d53ed 100644 --- a/dumux/discretization/cellcentered/tpfa/fickslaw.hh +++ b/dumux/discretization/cellcentered/tpfa/fickslaw.hh @@ -46,11 +46,11 @@ class FicksLawImplementation<TypeTag, DiscretizationMethods::CCTpfa> using Implementation = FicksLawImplementation<TypeTag, DiscretizationMethods::CCTpfa>; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using IndexType = typename GridView::IndexSet::IndexType; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using Element = typename GridView::template Codim<0>::Entity; diff --git a/dumux/discretization/cellcentered/tpfa/fluxvariablescachefiller.hh b/dumux/discretization/cellcentered/tpfa/fluxvariablescachefiller.hh index 17d8890746ef5e65def282daf5a37c44df386d15..b0118ada760834b57d5086f9b22e7b3cca80dc76 100644 --- a/dumux/discretization/cellcentered/tpfa/fluxvariablescachefiller.hh +++ b/dumux/discretization/cellcentered/tpfa/fluxvariablescachefiller.hh @@ -39,9 +39,9 @@ class CCTpfaFluxVariablesCacheFiller { using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); diff --git a/dumux/discretization/cellcentered/tpfa/fourierslaw.hh b/dumux/discretization/cellcentered/tpfa/fourierslaw.hh index c6ba00912f2a744cf3b3c16884bce903ca84df46..acc077fb20c01d22c989329258e4734ca65a5249 100644 --- a/dumux/discretization/cellcentered/tpfa/fourierslaw.hh +++ b/dumux/discretization/cellcentered/tpfa/fourierslaw.hh @@ -46,11 +46,11 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::CCTpfa> using Implementation = FouriersLawImplementation<TypeTag, DiscretizationMethods::CCTpfa>; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using IndexType = typename GridView::IndexSet::IndexType; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using Element = typename GridView::template Codim<0>::Entity; using ElementFluxVarsCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); diff --git a/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh b/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh index 014c54320a1529052b78b67b2c8ef9654dd42195..a4f64384f131fa99ab93de24ae737af83f599237 100644 --- a/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh +++ b/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh @@ -26,28 +26,26 @@ #ifndef DUMUX_DISCRETIZATION_CCTPFA_FV_ELEMENT_GEOMETRY_HH #define DUMUX_DISCRETIZATION_CCTPFA_FV_ELEMENT_GEOMETRY_HH +#include <algorithm> +#include <array> + #include <dune/common/exceptions.hh> #include <dune/common/iteratorrange.hh> -#include <dumux/common/properties.hh> #include <dumux/discretization/scvandscvfiterators.hh> -namespace Dumux -{ - -//! forward declaration of the global finite volume geometry -template<class TypeTag, bool EnableFVGridGeometryCache> -class CCTpfaFVGridGeometry; +namespace Dumux { /*! * \ingroup CCTpfaDiscretization * \brief Stencil-local finite volume geometry (scvs and scvfs) for cell-centered TPFA 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. + * \tparam GG the finite volume grid geometry type + * \tparam enableFVGridGeometryCache if the grid geometry is cached or not * \note This class is specialized for versions with and without caching the fv geometries on the grid view */ -template<class TypeTag, bool EnableFVGridGeometryCache> -class CCTpfaFVElementGeometry -{}; +template<class GG, bool enableFVGridGeometryCache> +class CCTpfaFVElementGeometry; /*! * \ingroup CCTpfaDiscretization @@ -55,21 +53,21 @@ class CCTpfaFVElementGeometry * Specialization for grid caching enabled * \note The finite volume geometries are stored in the corresponding FVGridGeometry */ -template<class TypeTag> -class CCTpfaFVElementGeometry<TypeTag, true> +template<class GG> +class CCTpfaFVElementGeometry<GG, true> { - using ThisType = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using ThisType = CCTpfaFVElementGeometry<GG, true>; + using GridView = typename GG::GridView; using IndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; public: //! export type of subcontrol volume - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using SubControlVolume = typename GG::SubControlVolume; //! export type of subcontrol volume face - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename GG::SubControlVolumeFace; //! export type of finite volume grid geometry - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using FVGridGeometry = GG; //! the maximum number of scvs per element static constexpr std::size_t maxNumElementScvs = 1; //! the maximum number of scvfs per element (use cubes for maximum) @@ -169,11 +167,11 @@ private: * \brief Stencil-local finite volume geometry (scvs and scvfs) for cell-centered TPFA models * Specialization for grid caching disabled */ -template<class TypeTag> -class CCTpfaFVElementGeometry<TypeTag, false> +template<class GG> +class CCTpfaFVElementGeometry<GG, false> { - using ThisType = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using ThisType = CCTpfaFVElementGeometry<GG, false>; + using GridView = typename GG::GridView; using IndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; @@ -182,11 +180,11 @@ class CCTpfaFVElementGeometry<TypeTag, false> public: //! export type of subcontrol volume - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using SubControlVolume = typename GG::SubControlVolume; //! export type of subcontrol volume face - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename GG::SubControlVolumeFace; //! export type of finite volume grid geometry - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using FVGridGeometry = GG; //! the maximum number of scvs per element static constexpr std::size_t maxNumElementScvs = 1; //! the maximum number of scvfs per element (use cubes for maximum) @@ -395,6 +393,8 @@ private: //! create scvs and scvfs of the bound element void makeElementGeometries(const Element& element) { + using ScvfGridIndexStorage = typename SubControlVolumeFace::Traits::GridIndexStorage; + const auto eIdx = fvGridGeometry().elementMapper().index(element); scvs_[0] = SubControlVolume(element.geometry(), eIdx); scvIndices_[0] = eIdx; @@ -412,22 +412,23 @@ private: int scvfCounter = 0; for (const auto& intersection : intersections(fvGridGeometry().gridView(), element)) { - // TODO check if intersection is on interior boundary - const auto isInteriorBoundary = false; - if (dim < dimWorld) if (handledScvf[intersection.indexInInside()]) continue; + const auto& scvfNeighborVolVarIndices = neighborVolVarIndices[scvfCounter]; + if (intersection.neighbor() || intersection.boundary()) { - std::vector<IndexType> scvIndices({eIdx}); - scvIndices.insert(scvIndices.end(), neighborVolVarIndices[scvfCounter].begin(), neighborVolVarIndices[scvfCounter].end()); + ScvfGridIndexStorage scvIndices; + scvIndices.resize(scvfNeighborVolVarIndices.size() + 1); + scvIndices[0] = eIdx; + std::copy(scvfNeighborVolVarIndices.begin(), scvfNeighborVolVarIndices.end(), scvIndices.begin()+1); scvfs_.emplace_back(intersection, intersection.geometry(), scvFaceIndices[scvfCounter], scvIndices, - intersection.boundary() || isInteriorBoundary); + intersection.boundary()); scvfIndices_.emplace_back(scvFaceIndices[scvfCounter]); scvfCounter++; @@ -441,6 +442,8 @@ private: //! create the necessary scvs and scvfs of the neighbor elements to the bound elements void makeNeighborGeometries(const Element& element, const IndexType eIdx) { + using ScvfGridIndexStorage = typename SubControlVolumeFace::Traits::GridIndexStorage; + // create the neighbor scv neighborScvs_.emplace_back(element.geometry(), eIdx); neighborScvIndices_.push_back(eIdx); @@ -458,22 +461,20 @@ private: int scvfCounter = 0; for (const auto& intersection : intersections(fvGridGeometry().gridView(), element)) { - // TODO check if intersection is on interior boundary - const auto isInteriorBoundary = false; - if (dim < dimWorld) if (handledScvf[intersection.indexInInside()]) continue; - if (intersection.neighbor() && !isInteriorBoundary) + const auto& scvfNeighborVolVarIndices = neighborVolVarIndices[scvfCounter]; + + if (intersection.neighbor()) { // only create subcontrol faces where the outside element is the bound element if (dim == dimWorld) { if (intersection.outside() == *elementPtr_) { - std::vector<IndexType> scvIndices({eIdx}); - scvIndices.insert(scvIndices.end(), neighborVolVarIndices[scvfCounter].begin(), neighborVolVarIndices[scvfCounter].end()); + ScvfGridIndexStorage scvIndices({eIdx, scvfNeighborVolVarIndices[0]}); neighborScvfs_.emplace_back(intersection, intersection.geometry(), scvFaceIndices[scvfCounter], @@ -489,12 +490,14 @@ private: // (will be optimized away for dim == dimWorld) else { - for (unsigned outsideScvIdx = 0; outsideScvIdx < neighborVolVarIndices[scvfCounter].size(); ++outsideScvIdx) + for (unsigned outsideScvIdx = 0; outsideScvIdx < scvfNeighborVolVarIndices.size(); ++outsideScvIdx) { - if (neighborVolVarIndices[scvfCounter][outsideScvIdx] == fvGridGeometry().elementMapper().index(*elementPtr_)) + if (scvfNeighborVolVarIndices[outsideScvIdx] == fvGridGeometry().elementMapper().index(*elementPtr_)) { - std::vector<IndexType> scvIndices({eIdx}); - scvIndices.insert(scvIndices.end(), neighborVolVarIndices[scvfCounter].begin(), neighborVolVarIndices[scvfCounter].end()); + ScvfGridIndexStorage scvIndices; + scvIndices.resize(scvfNeighborVolVarIndices.size() + 1); + scvIndices[0] = eIdx; + std::copy(scvfNeighborVolVarIndices.begin(), scvfNeighborVolVarIndices.end(), scvIndices.begin()+1); neighborScvfs_.emplace_back(intersection, intersection.geometry(), scvFaceIndices[scvfCounter], @@ -513,7 +516,7 @@ private: handledScvf[intersection.indexInInside()] = true; scvfCounter++; } - else if (intersection.boundary() || isInteriorBoundary) + else if (intersection.boundary()) { // for surface and network grids mark that we handled this face if (dim < dimWorld) diff --git a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh index 9d38e45f97d540192eec3a8dcf194fdddbce4ba2..536027447f9b9f84e9892f90dc80c05e81085c55 100644 --- a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh +++ b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh @@ -26,15 +26,37 @@ #ifndef DUMUX_DISCRETIZATION_CCTPFA_FV_GRID_GEOMETRY_HH #define DUMUX_DISCRETIZATION_CCTPFA_FV_GRID_GEOMETRY_HH -#include <dune/common/version.hh> +#include <algorithm> +#include <dumux/common/defaultmappertraits.hh> #include <dumux/discretization/methods.hh> #include <dumux/discretization/basefvgridgeometry.hh> -#include <dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh> +#include <dumux/discretization/cellcentered/subcontrolvolume.hh> #include <dumux/discretization/cellcentered/connectivitymap.hh> +#include <dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh> +#include <dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh> + +namespace Dumux { -namespace Dumux +/*! + * \ingroup CCTpfaDiscretization + * \brief The default traits for the tpfa finite volume grid geometry + * Defines the scv and scvf types and the mapper types + * \tparam the grid view type + */ +template<class GridView> +struct CCTpfaDefaultGridGeometryTraits +: public DefaultMapperTraits<GridView> { + using SubControlVolume = CCSubControlVolume<GridView>; + using SubControlVolumeFace = CCTpfaSubControlVolumeFace<GridView>; + + template<class FVGridGeometry> + using ConnectivityMap = CCSimpleConnectivityMap<FVGridGeometry>; + + template<class FVGridGeometry, bool enableCache> + using LocalView = CCTpfaFVElementGeometry<FVGridGeometry, enableCache>; +}; /*! * \ingroup CCTpfaDiscretization @@ -42,9 +64,10 @@ namespace Dumux * This builds up the sub control volumes and sub control volume faces * \note This class is specialized for versions with and without caching the fv geometries on the grid view */ -template<class TypeTag, bool EnableFVGridGeometryCache> -class CCTpfaFVGridGeometry -{}; +template<class GridView, + bool enableFVGridGeometryCache = false, + class Traits = CCTpfaDefaultGridGeometryTraits<GridView> > +class CCTpfaFVGridGeometry; /*! * \ingroup CCTpfaDiscretization @@ -52,32 +75,41 @@ class CCTpfaFVGridGeometry * This builds up the sub control volumes and sub control volume faces * \note For caching enabled we store the fv geometries for the whole grid view which is memory intensive but faster */ -template<class TypeTag> -class CCTpfaFVGridGeometry<TypeTag, true> : public BaseFVGridGeometry<TypeTag> +template<class GV, class Traits> +class CCTpfaFVGridGeometry<GV, true, Traits> +: public BaseFVGridGeometry<CCTpfaFVGridGeometry<GV, true, Traits>, GV, Traits> { - using ParentType = BaseFVGridGeometry<TypeTag>; - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using IndexType = typename GridView::IndexSet::IndexType; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using ElementMapper = typename GET_PROP_TYPE(TypeTag, ElementMapper); - using Element = typename GridView::template Codim<0>::Entity; - using ConnectivityMap = CCSimpleConnectivityMap<TypeTag>; - - static const int dim = GridView::dimension; - static const int dimWorld = GridView::dimensionworld; - using CoordScalar = typename GridView::ctype; + using ThisType = CCTpfaFVGridGeometry<GV, true, Traits>; + using ParentType = BaseFVGridGeometry<ThisType, GV, Traits>; + using ConnectivityMap = typename Traits::template ConnectivityMap<ThisType>; + using IndexType = typename GV::IndexSet::IndexType; + using Element = typename GV::template Codim<0>::Entity; + + static const int dim = GV::dimension; + static const int dimWorld = GV::dimensionworld; + using CoordScalar = typename GV::ctype; using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>; - //! The local class needs access to the scv, scvfs and the fv element geometry - //! as they are globally cached - friend typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - public: - //! export discretization method + //! export the type of the fv element geometry (the local view type) + using LocalView = typename Traits::template LocalView<ThisType, true>; + //! export the type of sub control volume + using SubControlVolume = typename Traits::SubControlVolume; + //! export the type of sub control volume + using SubControlVolumeFace = typename Traits::SubControlVolumeFace; + //! export dof mapper type + using DofMapper = typename Traits::ElementMapper; + + //! export the discretization method this geometry belongs to static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::CCTpfa; + //! The maximum admissible stencil size (used for static memory allocation during assembly) + //! Per default, we allow for 9 branches per scvf on network/surface grids + static constexpr int maxElementStencilSize = (dim < dimWorld) ? LocalView::maxNumElementScvfs*8 + 1 + : LocalView::maxNumElementScvfs + 1; + //! export the grid view type + using GridView = GV; + //! Constructor CCTpfaFVGridGeometry(const GridView& gridView) : ParentType(gridView) @@ -85,7 +117,7 @@ public: //! the element mapper is the dofMapper //! this is convenience to have better chance to have the same main files for box/tpfa/mpfa... - const ElementMapper& dofMapper() const + const DofMapper& dofMapper() const { return this->elementMapper(); } //! The total number of sub control volumes @@ -154,29 +186,29 @@ public: // for network grids there might be multiple intersection with the same geometryInInside // we indentify those by the indexInInside for now (assumes conforming grids at branching facets) - std::vector<std::vector<IndexType>> outsideIndices; + using ScvfGridIndexStorage = typename SubControlVolumeFace::Traits::GridIndexStorage; + std::vector<ScvfGridIndexStorage> outsideIndices; if (dim < dimWorld) { + //! first, push inside index in all neighbor sets outsideIndices.resize(element.subEntities(1)); + std::for_each(outsideIndices.begin(), outsideIndices.end(), [eIdx] (auto& nIndices) { nIndices.push_back(eIdx); }); + + // second, insert neighbors for (const auto& intersection : intersections(this->gridView(), element)) { if (intersection.neighbor()) { - const auto& outside = intersection.outside(); - const auto nIdx = this->elementMapper().index(outside); + const auto nIdx = this->elementMapper().index( intersection.outside() ); outsideIndices[intersection.indexInInside()].push_back(nIdx); } - } } for (const auto& intersection : intersections(this->gridView(), element)) { - // TODO check if intersection is on interior boundary - const auto isInteriorBoundary = false; - // inner sub control volume faces - if (intersection.neighbor() && !isInteriorBoundary) + if (intersection.neighbor()) { if (dim == dimWorld) { @@ -184,7 +216,7 @@ public: scvfs_.emplace_back(intersection, intersection.geometry(), scvfIdx, - std::vector<IndexType>({eIdx, nIdx}), + ScvfGridIndexStorage({eIdx, nIdx}), false); scvfsIndexSet.push_back(scvfIdx++); } @@ -198,12 +230,10 @@ public: continue; else { - std::vector<IndexType> scvIndices({eIdx}); - scvIndices.insert(scvIndices.end(), outsideIndices[indexInInside].begin(), outsideIndices[indexInInside].end()); scvfs_.emplace_back(intersection, intersection.geometry(), scvfIdx, - scvIndices, + outsideIndices[indexInInside], false); scvfsIndexSet.push_back(scvfIdx++); outsideIndices[indexInInside].clear(); @@ -211,12 +241,12 @@ public: } } // boundary sub control volume faces - else if (intersection.boundary() || isInteriorBoundary) + else if (intersection.boundary()) { scvfs_.emplace_back(intersection, intersection.geometry(), scvfIdx, - std::vector<IndexType>({eIdx, this->gridView().size(0) + numBoundaryScvf_++}), + ScvfGridIndexStorage({eIdx, this->gridView().size(0) + numBoundaryScvf_++}), true); scvfsIndexSet.push_back(scvfIdx++); } @@ -315,29 +345,49 @@ private: * \note For caching disabled we store only some essential index maps to build up local systems on-demand in * the corresponding FVElementGeometry */ -template<class TypeTag> -class CCTpfaFVGridGeometry<TypeTag, false> : public BaseFVGridGeometry<TypeTag> +template<class GV, class Traits> +class CCTpfaFVGridGeometry<GV, false, Traits> +: public BaseFVGridGeometry<CCTpfaFVGridGeometry<GV, false, Traits>, GV, Traits> { - using ParentType = BaseFVGridGeometry<TypeTag>; - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using IndexType = typename GridView::IndexSet::IndexType; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using ElementMapper = typename GET_PROP_TYPE(TypeTag, ElementMapper); - using Element = typename GridView::template Codim<0>::Entity; - using ConnectivityMap = CCSimpleConnectivityMap<TypeTag>; - - static const int dim = GridView::dimension; - static const int dimWorld = GridView::dimensionworld; - - using CoordScalar = typename GridView::ctype; + using ThisType = CCTpfaFVGridGeometry<GV, false, Traits>; + using ParentType = BaseFVGridGeometry<ThisType, GV, Traits>; + using ConnectivityMap = typename Traits::template ConnectivityMap<ThisType>; + + using IndexType = typename GV::IndexSet::IndexType; + using Element = typename GV::template Codim<0>::Entity; + + static const int dim = GV::dimension; + static const int dimWorld = GV::dimensionworld; + + using CoordScalar = typename GV::ctype; using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>; + using ScvfGridIndexStorage = typename Traits::SubControlVolumeFace::Traits::GridIndexStorage; + using NeighborVolVarIndices = typename std::conditional_t< (dim<dimWorld), + ScvfGridIndexStorage, + Dune::ReservedVector<IndexType, 1> >; + public: - //! export discretization method + //! export the type of the fv element geometry (the local view type) + using LocalView = typename Traits::template LocalView<ThisType, false>; + //! export the type of sub control volume + using SubControlVolume = typename Traits::SubControlVolume; + //! export the type of sub control volume + using SubControlVolumeFace = typename Traits::SubControlVolumeFace; + //! export dof mapper type + using DofMapper = typename Traits::ElementMapper; + + //! Export the discretization method this geometry belongs to static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::CCTpfa; + //! The maximum admissible stencil size (used for static memory allocation during assembly) + //! Per default, we allow for 9 branches per scvf on network/surface grids + static constexpr int maxElementStencilSize = (dim < dimWorld) ? LocalView::maxNumElementScvfs*8 + 1 + : LocalView::maxNumElementScvfs + 1; + + //! Export the type of the grid view + using GridView = GV; + //! Constructor CCTpfaFVGridGeometry(const GridView& gridView) : ParentType(gridView) @@ -345,7 +395,7 @@ public: //! the element mapper is the dofMapper //! this is convenience to have better chance to have the same main files for box/tpfa/mpfa... - const ElementMapper& dofMapper() const + const DofMapper& dofMapper() const { return this->elementMapper(); } //! The total number of sub control volumes @@ -402,13 +452,13 @@ public: // the element-wise index sets for finite volume geometry auto numLocalFaces = element.subEntities(1); std::vector<IndexType> scvfsIndexSet; - std::vector<std::vector<IndexType>> neighborVolVarIndexSet; + std::vector<NeighborVolVarIndices> neighborVolVarIndexSet; scvfsIndexSet.reserve(numLocalFaces); neighborVolVarIndexSet.reserve(numLocalFaces); // for network grids there might be multiple intersection with the same geometryInInside // we indentify those by the indexInInside for now (assumes conforming grids at branching facets) - std::vector<std::vector<IndexType>> outsideIndices; + std::vector<NeighborVolVarIndices> outsideIndices; if (dim < dimWorld) { outsideIndices.resize(numLocalFaces); @@ -416,27 +466,22 @@ public: { if (intersection.neighbor()) { - const auto& outside = intersection.outside(); - const auto nIdx = this->elementMapper().index(outside); + const auto nIdx = this->elementMapper().index(intersection.outside()); outsideIndices[intersection.indexInInside()].push_back(nIdx); } - } } for (const auto& intersection : intersections(this->gridView(), element)) { - // TODO check if intersection is on interior boundary - const auto isInteriorBoundary = false; - // inner sub control volume faces - if (intersection.neighbor() && !isInteriorBoundary) + if (intersection.neighbor()) { if (dim == dimWorld) { scvfsIndexSet.push_back(numScvf_++); const auto nIdx = this->elementMapper().index(intersection.outside()); - neighborVolVarIndexSet.push_back({nIdx}); + neighborVolVarIndexSet.emplace_back(NeighborVolVarIndices({nIdx})); } // this is for network grids // (will be optimized away of dim == dimWorld) @@ -449,16 +494,16 @@ public: else { scvfsIndexSet.push_back(numScvf_++); - neighborVolVarIndexSet.push_back(outsideIndices[indexInInside]); + neighborVolVarIndexSet.emplace_back(std::move(outsideIndices[indexInInside])); outsideIndices[indexInInside].clear(); } } } // boundary sub control volume faces - else if (intersection.boundary() || isInteriorBoundary) + else if (intersection.boundary()) { scvfsIndexSet.push_back(numScvf_++); - neighborVolVarIndexSet.push_back({numScvs_ + numBoundaryScvf_++}); + neighborVolVarIndexSet.emplace_back(NeighborVolVarIndices({numScvs_ + numBoundaryScvf_++})); } } @@ -475,7 +520,7 @@ public: { return scvfIndicesOfScv_[scvIdx]; } //! Return the neighbor volVar indices for all scvfs in the scv with index scvIdx - const std::vector<std::vector<IndexType>>& neighborVolVarIndices(IndexType scvIdx) const + const std::vector<NeighborVolVarIndices>& neighborVolVarIndices(IndexType scvIdx) const { return neighborVolVarIndices_[scvIdx]; } /*! @@ -497,7 +542,7 @@ private: //! vectors that store the global data std::vector<std::vector<IndexType>> scvfIndicesOfScv_; - std::vector<std::vector<std::vector<IndexType>>> neighborVolVarIndices_; + std::vector<std::vector<NeighborVolVarIndices>> neighborVolVarIndices_; }; } // end namespace Dumux diff --git a/dumux/discretization/cellcentered/tpfa/gridfluxvariablescache.hh b/dumux/discretization/cellcentered/tpfa/gridfluxvariablescache.hh index 88a551240492507080e1b6524b024b9cf61bce6a..e9e66fcbe4a9c65107b357321e763b5563e5f34d 100644 --- a/dumux/discretization/cellcentered/tpfa/gridfluxvariablescache.hh +++ b/dumux/discretization/cellcentered/tpfa/gridfluxvariablescache.hh @@ -27,8 +27,10 @@ #include <dumux/common/properties.hh> #include <dumux/discretization/cellcentered/tpfa/fluxvariablescachefiller.hh> -namespace Dumux -{ +//! make the local view function available whenever we use this class +#include <dumux/discretization/localview.hh> + +namespace Dumux { /*! * \ingroup CCTpfaDiscretization @@ -49,18 +51,20 @@ class CCTpfaGridFluxVariablesCache<TypeTag, true> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using IndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); - using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using FluxVariablesCacheFiller = CCTpfaFluxVariablesCacheFiller<TypeTag>; public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); + // The constructor CCTpfaGridFluxVariablesCache(const Problem& problem) : problemPtr_(&problem) {} @@ -132,14 +136,6 @@ public: const Problem& problem() const { return *problemPtr_; } - /*! - * \brief Return a local restriction of this global object - * 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 ElementFluxVariablesCache localView(const CCTpfaGridFluxVariablesCache& global) - { return ElementFluxVariablesCache(global); } - private: const Problem* problemPtr_; @@ -157,14 +153,16 @@ class CCTpfaGridFluxVariablesCache<TypeTag, false> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); + // The constructor CCTpfaGridFluxVariablesCache(const Problem& problem) : problemPtr_(&problem) {} @@ -182,14 +180,6 @@ public: const Problem& problem() const { return *problemPtr_; } - /*! - * \brief Return a local restriction of this global object - * 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 ElementFluxVariablesCache localView(const CCTpfaGridFluxVariablesCache& global) - { return ElementFluxVariablesCache(global); } - private: const Problem* problemPtr_; }; diff --git a/dumux/discretization/cellcentered/tpfa/maxwellstefanslaw.hh b/dumux/discretization/cellcentered/tpfa/maxwellstefanslaw.hh index fdf32f96cb921ec0345957f42e74e15d8acdd3ac..f3e6bda7d37ec547f34889b778f7cb3e6347abf7 100644 --- a/dumux/discretization/cellcentered/tpfa/maxwellstefanslaw.hh +++ b/dumux/discretization/cellcentered/tpfa/maxwellstefanslaw.hh @@ -48,11 +48,11 @@ class MaxwellStefansLawImplementation<TypeTag, DiscretizationMethods::CCTpfa > using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using EffDiffModel = typename GET_PROP_TYPE(TypeTag, EffectiveDiffusivityModel); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using IndexType = typename GridView::IndexSet::IndexType; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using Element = typename GridView::template Codim<0>::Entity; diff --git a/dumux/discretization/cellcentered/tpfa/properties.hh b/dumux/discretization/cellcentered/tpfa/properties.hh index c9262c4b141561ec9b65bdec6de69c0019461f51..c0efc9cdb342547361e7d01e8e3a7b79048c2a28 100644 --- a/dumux/discretization/cellcentered/tpfa/properties.hh +++ b/dumux/discretization/cellcentered/tpfa/properties.hh @@ -42,7 +42,6 @@ #include <dumux/discretization/cellcentered/subcontrolvolume.hh> #include <dumux/discretization/cellcentered/elementboundarytypes.hh> -#include <dumux/discretization/cellcentered/connectivitymap.hh> #include <dumux/discretization/cellcentered/elementsolution.hh> #include <dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh> #include <dumux/discretization/cellcentered/tpfa/gridfluxvariablescache.hh> @@ -65,14 +64,18 @@ SET_PROP(CCTpfaModel, DiscretizationMethod) }; //! Set the default for the global finite volume geometry -SET_TYPE_PROP(CCTpfaModel, FVGridGeometry, CCTpfaFVGridGeometry<TypeTag, GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>); +SET_PROP(CCTpfaModel, FVGridGeometry) +{ +private: + static constexpr bool enableCache = GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache); + using GridView = typename GET_PROP_TYPE(TypeTag, GridView); +public: + using type = CCTpfaFVGridGeometry<GridView, enableCache>; +}; //! The global flux variables cache vector class SET_TYPE_PROP(CCTpfaModel, GridFluxVariablesCache, CCTpfaGridFluxVariablesCache<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridFluxVariablesCache)>); -//! Set the default for the local finite volume geometry -SET_TYPE_PROP(CCTpfaModel, FVElementGeometry, CCTpfaFVElementGeometry<TypeTag, GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>); - //! The global previous volume variables vector class SET_TYPE_PROP(CCTpfaModel, ElementVolumeVariables, CCTpfaElementVolumeVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridVolumeVariablesCache)>); @@ -95,58 +98,6 @@ public: static constexpr std::size_t value = dim < dimWorld ? 9 : 2; }; -//! The sub control volume -SET_PROP(CCTpfaModel, SubControlVolume) -{ -private: - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - struct ScvGeometryTraits - { - using Geometry = typename Grid::template Codim<0>::Geometry; - using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; - using Scalar = typename Grid::ctype; - using GlobalPosition = Dune::FieldVector<Scalar, Grid::dimensionworld>; - }; -public: - using type = CCSubControlVolume<ScvGeometryTraits>; -}; - -//! The sub control volume face -SET_PROP(CCTpfaModel, SubControlVolumeFace) -{ -private: - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - static constexpr int dim = Grid::dimension; - static constexpr int dimWorld = Grid::dimensionworld; - - // we use geometry traits that use static corner vectors to and a fixed geometry type - template <class ct> - struct ScvfMLGTraits : public Dune::MultiLinearGeometryTraits<ct> - { - // we use static vectors to store the corners as we know - // the number of corners in advance (2^(dim-1) corners (1<<(dim-1)) - template< int mydim, int cdim > - struct CornerStorage - { - using Type = Dune::ReservedVector< Dune::FieldVector< ct, cdim >, (1<<(dim-1)) >; - }; - }; - - struct ScvfGeometryTraits - { - using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; - using Scalar = typename Grid::ctype; - using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, ScvfMLGTraits<Scalar> >; - using CornerStorage = typename ScvfMLGTraits<Scalar>::template CornerStorage<dim-1, dimWorld>::Type; - using GlobalPosition = typename CornerStorage::value_type; - using BoundaryFlag = Dumux::BoundaryFlag<Grid>; - }; -public: - using type = Dumux::CCTpfaSubControlVolumeFace<ScvfGeometryTraits>; -}; - //! Set the solution vector type for an element SET_TYPE_PROP(CCTpfaModel, ElementSolutionVector, CCElementSolution<TypeTag>); @@ -155,10 +106,6 @@ SET_TYPE_PROP(CCTpfaModel, ElementBoundaryTypes, CCElementBoundaryTypes<TypeTag> //! Set the BaseLocalResidual to CCLocalResidual SET_TYPE_PROP(CCTpfaModel, BaseLocalResidual, CCLocalResidual<TypeTag>); - -//! Set the AssemblyMap to the SimpleAssemblyMap per default -SET_TYPE_PROP(CCTpfaModel, AssemblyMap, CCSimpleConnectivityMap<TypeTag>); - } // namespace Properties } // namespace Dumux diff --git a/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh b/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh index 58c837af98aa0982817d2e04d1f706a75baa93c9..77173113135371f788967535cf9be49176094592 100644 --- a/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh +++ b/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh @@ -25,30 +25,81 @@ #define DUMUX_DISCRETIZATION_CC_TPFA_SUBCONTROLVOLUMEFACE_HH #include <utility> +#include <vector> + +#include <dune/common/reservedvector.hh> #include <dune/geometry/type.hh> +#include <dune/geometry/multilineargeometry.hh> + +#include <dumux/common/boundaryflag.hh> #include <dumux/discretization/subcontrolvolumefacebase.hh> -namespace Dumux +namespace Dumux { + +/*! + * \ingroup CCDiscretization + * \brief Default traits class to be used for the sub-control volume faces + * for the cell-centered finite volume scheme using TPFA + * \tparam GV the type of the grid view + */ +template<class GridView> +struct CCTpfaDefaultScvfGeometryTraits { + using Grid = typename GridView::Grid; + + static constexpr int dim = Grid::dimension; + static constexpr int dimWorld = Grid::dimensionworld; + + using Scalar = typename Grid::ctype; + using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; + using LocalIndexType = unsigned int; + using GridIndexStorage = typename std::conditional_t< (dim<dimWorld), + std::vector<GridIndexType>, + Dune::ReservedVector<GridIndexType, 2> >; + + // we use geometry traits that use static corner vectors to and a fixed geometry type + template <class ct> + struct ScvfMLGTraits : public Dune::MultiLinearGeometryTraits<ct> + { + // we use static vectors to store the corners as we know + // the number of corners in advance (2^(dim-1) corners (1<<(dim-1)) + template< int mydim, int cdim > + struct CornerStorage + { + using Type = Dune::ReservedVector< Dune::FieldVector< ct, cdim >, (1<<(dim-1)) >; + }; + }; + + using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, ScvfMLGTraits<Scalar> >; + using CornerStorage = typename ScvfMLGTraits<Scalar>::template CornerStorage<dim-1, dimWorld>::Type; + using GlobalPosition = typename CornerStorage::value_type; + using BoundaryFlag = Dumux::BoundaryFlag<Grid>; +}; /*! * \ingroup CCTpfaDiscretization * \brief The sub control volume face + * \tparam GV the type of the grid view + * \tparam T the scvf geometry traits */ -template<class ScvfGeometryTraits> -class CCTpfaSubControlVolumeFace : public SubControlVolumeFaceBase<CCTpfaSubControlVolumeFace<ScvfGeometryTraits>,ScvfGeometryTraits> +template<class GV, + class T = CCTpfaDefaultScvfGeometryTraits<GV> > +class CCTpfaSubControlVolumeFace +: public SubControlVolumeFaceBase<CCTpfaSubControlVolumeFace<GV, T>, T> { - using ParentType = SubControlVolumeFaceBase<CCTpfaSubControlVolumeFace<ScvfGeometryTraits>, ScvfGeometryTraits>; - using GridIndexType = typename ScvfGeometryTraits::GridIndexType; - using Scalar = typename ScvfGeometryTraits::Scalar; - using GlobalPosition = typename ScvfGeometryTraits::GlobalPosition; - using CornerStorage = typename ScvfGeometryTraits::CornerStorage; - using Geometry = typename ScvfGeometryTraits::Geometry; - using BoundaryFlag = typename ScvfGeometryTraits::BoundaryFlag; + using ThisType = CCTpfaSubControlVolumeFace<GV, T>; + using ParentType = SubControlVolumeFaceBase<ThisType, T>; + using GridIndexType = typename T::GridIndexType; + using Scalar = typename T::Scalar; + using GlobalPosition = typename T::GlobalPosition; + using CornerStorage = typename T::CornerStorage; + using GridIndexStorage = typename T::GridIndexStorage; + using Geometry = typename T::Geometry; + using BoundaryFlag = typename T::BoundaryFlag; public: //! state the traits public and thus export all types - using Traits = ScvfGeometryTraits; + using Traits = T; // the default constructor CCTpfaSubControlVolumeFace() = default; @@ -66,7 +117,7 @@ public: CCTpfaSubControlVolumeFace(const Intersection& is, const typename Intersection::Geometry& isGeometry, GridIndexType scvfIndex, - const std::vector<GridIndexType>& scvIndices, + const GridIndexStorage& scvIndices, bool isBoundary) : ParentType() , geomType_(isGeometry.type()) @@ -165,7 +216,7 @@ private: GlobalPosition center_; GlobalPosition unitOuterNormal_; GridIndexType scvfIndex_; - std::vector<GridIndexType> scvIndices_; + GridIndexStorage scvIndices_; bool boundary_; BoundaryFlag boundaryFlag_; }; diff --git a/dumux/discretization/fluxstencil.hh b/dumux/discretization/fluxstencil.hh index a138efb0a86c1d47f8812807a75e088fcde77d3e..e34321cf03a10707a3a534099c732a2af21cf89b 100644 --- a/dumux/discretization/fluxstencil.hh +++ b/dumux/discretization/fluxstencil.hh @@ -25,16 +25,11 @@ #define DUMUX_DISCRETIZATION_FLUXSTENCIL_HH #include <dune/common/reservedvector.hh> -#include <dumux/common/properties.hh> #include <dumux/discretization/methods.hh> namespace Dumux { -//! Forward declaration of the upwind scheme implementation -template<class TypeTag, DiscretizationMethods Method> -class FluxStencilImplementation; - /*! * \ingroup Discretization * \brief The flux stencil specialized for different discretization schemes @@ -44,32 +39,31 @@ class FluxStencilImplementation; * since we use the flux stencil for matrix and assembly. This might lead to some zeros stored * in the matrix. */ -template<class TypeTag> -using FluxStencil = FluxStencilImplementation<TypeTag, GET_PROP_VALUE(TypeTag, DiscretizationMethod)>; +template<class FVElementGeometry, DiscretizationMethods Method = FVElementGeometry::FVGridGeometry::discretizationMethod> +class FluxStencil; /* * \ingroup Discretization * \brief Flux stencil specialization for the cell-centered tpfa scheme + * \tparam FVElementGeometry The local view on the finite volume grid geometry */ -template<class TypeTag> -class FluxStencilImplementation<TypeTag, DiscretizationMethods::CCTpfa> +template<class FVElementGeometry> +class FluxStencil<FVElementGeometry, DiscretizationMethods::CCTpfa> { - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVGridGeometry = typename FVElementGeometry::FVGridGeometry; + using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace; + using GridView = typename FVGridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using IndexType = typename GridView::IndexSet::IndexType; public: - //! The maximum number of elements in a flux stencil - static constexpr int maxFluxStencilSize = GET_PROP_VALUE(TypeTag, MaxNumNeighborsPerScvf); - - //! States how many scvfs of an element J might have an element I in the flux stencil - static constexpr int maxNumScvfJForI = 1; + //! Each cell I couples to a cell J always only via one face + using ScvfStencilIForJ = Dune::ReservedVector<IndexType, 1>; //! The flux stencil type - using Stencil = Dune::ReservedVector<IndexType, maxFluxStencilSize>; + using Stencil = typename SubControlVolumeFace::Traits::GridIndexStorage; + //! Returns the flux stencil static Stencil stencil(const Element& element, const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf) @@ -91,42 +85,28 @@ public: /* * \ingroup Discretization * \brief Flux stencil specialization for the cell-centered mpfa scheme + * \tparam FVElementGeometry The local view on the finite volume grid geometry */ -template<class TypeTag> -class FluxStencilImplementation<TypeTag, DiscretizationMethods::CCMpfa> +template<class FVElementGeometry> +class FluxStencil<FVElementGeometry, DiscretizationMethods::CCMpfa> { - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVGridGeometry = typename FVElementGeometry::FVGridGeometry; + using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace; + using GridView = typename FVGridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using IndexType = typename GridView::IndexSet::IndexType; - static constexpr int dim = GridView::dimension; // Use the stencil type of the primary interaction volume - using NodalIndexSet = typename GET_PROP_TYPE(TypeTag, DualGridNodalIndexSet); + using NodalIndexSet = typename FVGridGeometry::GridIVIndexSets::DualGridIndexSet::NodalIndexSet; public: - //! The maximum number of elements in a flux stencil (equal to number of elements at node) - static constexpr int maxFluxStencilSize = NodalIndexSet::maxNumElementsAtNode; - - //! States how many scvfs of an element J might have an element I in the flux stencil - //! We use cubes here for determining the maximum. Only basic geometries are not supported. - static constexpr int maxNumScvfJForI = dim == 3 ? 12 : 4; + //! We don't know yet how many faces couple to a neighboring element + using ScvfStencilIForJ = std::vector<IndexType>; //! The flux stencil type using Stencil = typename NodalIndexSet::GridStencilType; - /* - * \brief Returns a set of grid element indices that participate in the - * flux calculations on a given scvf. - * - * \note The interaction volume index sets must use the same type for the - * stencils as the nodal index set. If not, the compiler will complain here. - * - * \param element The grid element - * \param fvGeometry The finite volume geometry of this element - * \param scvf The sub-control volume face embedded in this element - */ + //! Returns the indices of the elements required for flux calculation on an scvf. static const Stencil& stencil(const Element& element, const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf) diff --git a/dumux/discretization/fluxvariablesbase.hh b/dumux/discretization/fluxvariablesbase.hh index 1de501c7a26fb301adae6a850d3929377cb89e3e..4f6b8d5946e52287f3c29fee4a38ee6a0125b5ac 100644 --- a/dumux/discretization/fluxvariablesbase.hh +++ b/dumux/discretization/fluxvariablesbase.hh @@ -57,8 +57,8 @@ class FluxVariablesBaseImplementation using IndexType = typename GridView::IndexSet::IndexType; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Stencil = std::vector<IndexType>; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); diff --git a/dumux/discretization/fluxvariablescaching.hh b/dumux/discretization/fluxvariablescaching.hh index b8168b61e9e3ac1250b1b86a9266c1471554ed9f..e0c7b3676be753d47b885804d68580f44d808bdf 100644 --- a/dumux/discretization/fluxvariablescaching.hh +++ b/dumux/discretization/fluxvariablescaching.hh @@ -38,9 +38,9 @@ class EmptyCacheFiller using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); public: //! Fill, signature for advection filler diff --git a/dumux/discretization/localview.hh b/dumux/discretization/localview.hh new file mode 100644 index 0000000000000000000000000000000000000000..a41760a08c26ca41eb9419369f00215d9caaeb7e --- /dev/null +++ b/dumux/discretization/localview.hh @@ -0,0 +1,43 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * 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 + * \ingroup Discretization + * \brief Free function to get the local view of a grid cache object + */ + +#ifndef DUMUX_LOCAL_VIEW_HH +#define DUMUX_LOCAL_VIEW_HH + +namespace Dumux { + +/*! + * \ingroup Discretization + * \brief Free function to get the local view of a grid cache object + * \note A local object is only functional after calling its bind/bindElement method. + * \tparam GridCache the grid caching type (such as FVGridGeometry) + * \param gridCache the grid caching object we want to localView from + */ +template<class GridCache> +inline typename GridCache::LocalView localView(const GridCache& gridCache) +{ return typename GridCache::LocalView(gridCache); } + +} // end namespace Dumux + +#endif diff --git a/dumux/discretization/scvoperator.hh b/dumux/discretization/scvoperator.hh index 2856fc6e570a744ab70ec7e6fc151fa371271534..b3ecc81424e642c08bfabe6289395fa110904558 100644 --- a/dumux/discretization/scvoperator.hh +++ b/dumux/discretization/scvoperator.hh @@ -51,7 +51,8 @@ class SubControlVolumeOperatorImplementation<TypeTag, true> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); @@ -163,7 +164,8 @@ class SubControlVolumeOperatorImplementation<TypeTag, false> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); diff --git a/dumux/discretization/staggered/elementfacevariables.hh b/dumux/discretization/staggered/elementfacevariables.hh index 9015c0b959d0104cbb392ee477b672df1fc98ab9..73f382057ec55c3e9981450e1ffbc023b04b76f9 100644 --- a/dumux/discretization/staggered/elementfacevariables.hh +++ b/dumux/discretization/staggered/elementfacevariables.hh @@ -47,10 +47,10 @@ class StaggeredElementFaceVariables<TypeTag, /*enableGridFaceVariablesCache*/tru 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 FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; 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: @@ -101,10 +101,10 @@ class StaggeredElementFaceVariables<TypeTag, /*enableGridFaceVariablesCache*/fal 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 FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; 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; using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); diff --git a/dumux/discretization/staggered/elementfluxvariablescache.hh b/dumux/discretization/staggered/elementfluxvariablescache.hh index c44d93e9461d56564d215205a3bf2fbb4b29b087..eb77c9aac79d585bf48371cbc2101aa85a8da9f1 100644 --- a/dumux/discretization/staggered/elementfluxvariablescache.hh +++ b/dumux/discretization/staggered/elementfluxvariablescache.hh @@ -48,11 +48,11 @@ class StaggeredElementFluxVariablesCache<TypeTag, true> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using IndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); using GridFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, GridFluxVariablesCache); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; public: StaggeredElementFluxVariablesCache(const GridFluxVariablesCache& global) @@ -98,11 +98,11 @@ class StaggeredElementFluxVariablesCache<TypeTag, false> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using IndexType = typename GridView::IndexSet::IndexType; using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); using GridFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, GridFluxVariablesCache); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; public: StaggeredElementFluxVariablesCache(const GridFluxVariablesCache& global) diff --git a/dumux/discretization/staggered/elementvolumevariables.hh b/dumux/discretization/staggered/elementvolumevariables.hh index 02e16ecd2e4d8deb0edaa798c2112ea78deda70f..fc1576e6ede81f51db68fa1745b378381f04f145 100644 --- a/dumux/discretization/staggered/elementvolumevariables.hh +++ b/dumux/discretization/staggered/elementvolumevariables.hh @@ -49,10 +49,10 @@ class StaggeredElementVolumeVariables<TypeTag, /*enableGridVolVarsCache*/true> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using IndexType = typename GridView::IndexSet::IndexType; static const int dim = GridView::dimension; @@ -110,8 +110,8 @@ class StaggeredElementVolumeVariables<TypeTag, /*enableGridVolVarsCache*/false> using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using IndexType = typename GridView::IndexSet::IndexType; static const int dim = GridView::dimension; diff --git a/dumux/discretization/staggered/facesolution.hh b/dumux/discretization/staggered/facesolution.hh index de1fe872cd4832934072d467098687b16163e1bc..25299bedcb7e6350dc9a3aaa4fc4ecc65709f841 100644 --- a/dumux/discretization/staggered/facesolution.hh +++ b/dumux/discretization/staggered/facesolution.hh @@ -45,7 +45,8 @@ class StaggeredFaceSolution using FaceSolutionVector = typename GET_PROP_TYPE(TypeTag, FaceSolutionVector); using FacePrimaryVariables = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); typename DofTypeIndices::CellCenterIdx cellCenterIdx; diff --git a/dumux/discretization/staggered/freeflow/connectivitymap.hh b/dumux/discretization/staggered/freeflow/connectivitymap.hh index 49f3554bd3c520cc94e09bce96d0ce95085c7b91..1f0ec37cf51663a6899e3998b54ddaf486db6b5f 100644 --- a/dumux/discretization/staggered/freeflow/connectivitymap.hh +++ b/dumux/discretization/staggered/freeflow/connectivitymap.hh @@ -25,28 +25,24 @@ #define DUMUX_STAGGERED_FREEFLOW_CONNECTIVITY_MAP_HH #include <vector> -#include <dumux/common/properties.hh> -namespace Dumux -{ +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> +template<class FVGridGeometry, class DofTypeIndices> class StaggeredFreeFlowConnectivityMap { - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using GridView = typename FVGridGeometry::GridView; + using FVElementGeometry = typename FVGridGeometry::LocalView; + using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace; using Element = typename GridView::template Codim<0>::Entity; using IndexType = typename GridView::IndexSet::IndexType; - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); typename DofTypeIndices::CellCenterIdx cellCenterIdx; typename DofTypeIndices::FaceIdx faceIdx; diff --git a/dumux/discretization/staggered/freeflow/facevariables.hh b/dumux/discretization/staggered/freeflow/facevariables.hh index 6477e244305c9a7ec38652850ec2f19b9e7b4d9a..ad29caaeed655a9f1383e1681277295c3f458386 100644 --- a/dumux/discretization/staggered/freeflow/facevariables.hh +++ b/dumux/discretization/staggered/freeflow/facevariables.hh @@ -42,8 +42,8 @@ class StaggeredFaceVariables using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using FacePrimaryVariables = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using Indices = typename GET_PROP_TYPE(TypeTag, Indices); static constexpr int dimWorld = GridView::dimensionworld; diff --git a/dumux/discretization/staggered/freeflow/fickslaw.hh b/dumux/discretization/staggered/freeflow/fickslaw.hh index 85eb80e9631619ca5d48bb2da6e7588656c580cf..f2f402e3b3e0322d16e7d6d63099372937725327 100644 --- a/dumux/discretization/staggered/freeflow/fickslaw.hh +++ b/dumux/discretization/staggered/freeflow/fickslaw.hh @@ -49,9 +49,9 @@ class FicksLawImplementation<TypeTag, DiscretizationMethods::Staggered > { using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); diff --git a/dumux/discretization/staggered/freeflow/fourierslaw.hh b/dumux/discretization/staggered/freeflow/fourierslaw.hh index 4d6b574c959548a44874decb98573f6f777a90cd..4fb841a24493374e551ccf46fb6e710b348a0326 100644 --- a/dumux/discretization/staggered/freeflow/fourierslaw.hh +++ b/dumux/discretization/staggered/freeflow/fourierslaw.hh @@ -45,10 +45,10 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::Staggered > { using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using Element = typename GridView::template Codim<0>::Entity; using Indices = typename GET_PROP_TYPE(TypeTag, Indices); diff --git a/dumux/discretization/staggered/freeflow/maxwellstefanslaw.hh b/dumux/discretization/staggered/freeflow/maxwellstefanslaw.hh index b10fa30245fbff360edc98a81cbb2b07c54c7435..4a7d879d2074e5afee54a9560810e8f6ac60dc7a 100644 --- a/dumux/discretization/staggered/freeflow/maxwellstefanslaw.hh +++ b/dumux/discretization/staggered/freeflow/maxwellstefanslaw.hh @@ -47,10 +47,10 @@ class MaxwellStefansLawImplementation<TypeTag, DiscretizationMethods::Staggered { using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); diff --git a/dumux/discretization/staggered/freeflow/properties.hh b/dumux/discretization/staggered/freeflow/properties.hh index dc0367e61f3bdad5645f266b094f4d8461c10f2d..a1c6f6be95f121722de02a9acd4041c0462785e5 100644 --- a/dumux/discretization/staggered/freeflow/properties.hh +++ b/dumux/discretization/staggered/freeflow/properties.hh @@ -29,14 +29,22 @@ #define DUMUX_STAGGERD_FREE_FLOW_PROPERTIES_HH #include <dumux/common/properties.hh> +#include <dumux/common/intersectionmapper.hh> +#include <dumux/common/defaultmappertraits.hh> + #include <dumux/discretization/staggered/properties.hh> #include <dumux/freeflow/properties.hh> +#include <dumux/discretization/cellcentered/subcontrolvolume.hh> +#include <dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh> +#include <dumux/discretization/staggered/fvgridgeometry.hh> + #include "subcontrolvolumeface.hh" #include "connectivitymap.hh" #include "facevariables.hh" #include "boundarytypes.hh" #include "velocityoutput.hh" +#include "staggeredgeometryhelper.hh" namespace Dumux { @@ -69,34 +77,30 @@ public: static constexpr int value = GET_PROP_VALUE(TypeTag, NumEq) - dim; }; -//! The default sub-controlvolume face -SET_PROP(StaggeredFreeFlowModel, SubControlVolumeFace) +//! The default fv grid geometry +SET_PROP(StaggeredFreeFlowModel, FVGridGeometry) { private: - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - static constexpr int dim = Grid::dimension; - static constexpr int dimWorld = Grid::dimensionworld; + using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); + static constexpr bool enableCache = GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache); - struct ScvfGeometryTraits + struct Traits : public DefaultMapperTraits<GridView> { - using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; - using Scalar = typename Grid::ctype; - using Geometry = typename Grid::template Codim<1>::Geometry; - using GlobalPosition = Dune::FieldVector<Scalar, dim>; - }; + using SubControlVolume = CCSubControlVolume<GridView>; + using SubControlVolumeFace = FreeFlowStaggeredSubControlVolumeFace<GridView>; + using IntersectionMapper = ConformingGridIntersectionMapper<GridView>; + using GeometryHelper = FreeFlowStaggeredGeometryHelper<GridView>; -public: - using type = FreeFlowStaggeredSubControlVolumeFace<ScvfGeometryTraits>; -}; + template<class FVGridGeometry> + using ConnectivityMap = StaggeredFreeFlowConnectivityMap<FVGridGeometry, DofTypeIndices>; + + template<class FVGridGeometry, bool enableCache> + using LocalView = StaggeredFVElementGeometry<FVGridGeometry, enableCache>; + }; -//! The default geometry helper required for the stencils, etc. -SET_PROP(StaggeredFreeFlowModel, StaggeredGeometryHelper) -{ -private: - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); public: - using type = FreeFlowStaggeredGeometryHelper<GridView>; + using type = StaggeredFVGridGeometry<GridView, enableCache, Traits>; }; //! The variables living on the faces @@ -114,9 +118,6 @@ public: //! The velocity output SET_TYPE_PROP(StaggeredFreeFlowModel, VelocityOutput, StaggeredFreeFlowVelocityOutput<TypeTag>); -SET_TYPE_PROP(StaggeredFreeFlowModel, AssemblyMap, StaggeredFreeFlowConnectivityMap<TypeTag>); - - } // namespace Properties } // namespace Dumux diff --git a/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh b/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh index 9742c3c12a91186479eb2e85e750a936d0386635..be10af48e93e590ec2d76bd46bd4576e4626da73 100644 --- a/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh +++ b/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh @@ -28,38 +28,41 @@ #include <dune/common/fvector.hh> #include <dumux/discretization/subcontrolvolumefacebase.hh> +#include <dumux/discretization/staggered/subcontrolvolumeface.hh> #include <dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh> #include <dumux/common/properties.hh> #include <dumux/common/optional.hh> #include <typeinfo> -namespace Dumux -{ +namespace Dumux { /*! * \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. */ -template<class ScvfGeometryTraits> -class FreeFlowStaggeredSubControlVolumeFace : public SubControlVolumeFaceBase<FreeFlowStaggeredSubControlVolumeFace<ScvfGeometryTraits>, ScvfGeometryTraits> +template<class GV, + class T = StaggeredDefaultScvfGeometryTraits<GV> > +class FreeFlowStaggeredSubControlVolumeFace +: public SubControlVolumeFaceBase<FreeFlowStaggeredSubControlVolumeFace<GV, T>, T> { - using ParentType = SubControlVolumeFaceBase<FreeFlowStaggeredSubControlVolumeFace<ScvfGeometryTraits>,ScvfGeometryTraits>; - using Geometry = typename ScvfGeometryTraits::Geometry; - using GridIndexType = typename ScvfGeometryTraits::GridIndexType; + using ThisType = FreeFlowStaggeredSubControlVolumeFace<GV, T>; + using ParentType = SubControlVolumeFaceBase<ThisType, T>; + using Geometry = typename T::Geometry; + using GridIndexType = typename T::GridIndexType; - using Scalar = typename ScvfGeometryTraits::Scalar; + using Scalar = typename T::Scalar; static const int dim = Geometry::mydimension; static const int dimworld = Geometry::coorddimension; - using GlobalPosition = typename ScvfGeometryTraits::GlobalPosition; + using GlobalPosition = typename T::GlobalPosition; static constexpr int numPairs = (dimworld == 2) ? 2 : 4; public: //! State the traits public and thus export all types - using Traits = ScvfGeometryTraits; + using Traits = T; // The default constructor FreeFlowStaggeredSubControlVolumeFace() = default; @@ -252,8 +255,6 @@ private: bool isGhostFace_; }; - - -} // end namespace +} // end namespace Dumux #endif diff --git a/dumux/discretization/staggered/freeflow/velocityoutput.hh b/dumux/discretization/staggered/freeflow/velocityoutput.hh index 5abe55a97dad5be87c2fef4a55444539c69ee65b..556c32cc27b617bfe29b8fb0b9679bb68439e641 100644 --- a/dumux/discretization/staggered/freeflow/velocityoutput.hh +++ b/dumux/discretization/staggered/freeflow/velocityoutput.hh @@ -40,8 +40,8 @@ class StaggeredFreeFlowVelocityOutput { using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); diff --git a/dumux/discretization/staggered/fvelementgeometry.hh b/dumux/discretization/staggered/fvelementgeometry.hh index fba3ca21030fbd96cbf21fd3dfd461b4a8ce5574..eb9773e07506c524607ed7986b6f7b17b6fedf40 100644 --- a/dumux/discretization/staggered/fvelementgeometry.hh +++ b/dumux/discretization/staggered/fvelementgeometry.hh @@ -26,48 +26,44 @@ #include <dune/common/iteratorrange.hh> -#include <dumux/common/properties.hh> #include <dumux/discretization/scvandscvfiterators.hh> -namespace Dumux -{ - -// forward declaration -template<class TypeTag, bool EnableFVGridGeometryCache> -class StaggeredFVGridGeometry; +namespace Dumux { /*! * \ingroup StaggeredDiscretization * \brief Base 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. + * \tparam GG the finite volume grid geometry type + * \tparam enableFVGridGeometryCache if the grid geometry is cached or not */ -template<class TypeTag, bool EnableFVGridGeometryCache> -class StaggeredFVElementGeometry -{}; +template<class GG, bool enableFVGridGeometryCache> +class StaggeredFVElementGeometry; /*! * \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. + * In this case we just forward internally to the global object. */ -template<class TypeTag> -class StaggeredFVElementGeometry<TypeTag, true> +template<class GG> +class StaggeredFVElementGeometry<GG, true> { - using ThisType = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using ThisType = StaggeredFVElementGeometry<GG, true>; + using GridView = typename GG::GridView; using IndexType = typename GridView::IndexSet::IndexType; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); using Element = typename GridView::template Codim<0>::Entity; - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - - using ScvIterator = Dumux::ScvIterator<SubControlVolume, std::vector<IndexType>, ThisType>; - using ScvfIterator = Dumux::ScvfIterator<SubControlVolumeFace, std::vector<IndexType>, ThisType>; public: + //! export type of subcontrol volume + using SubControlVolume = typename GG::SubControlVolume; + //! export type of subcontrol volume face + using SubControlVolumeFace = typename GG::SubControlVolumeFace; + //! export type of finite volume grid geometry + using FVGridGeometry = GG; + //! Constructor StaggeredFVElementGeometry(const FVGridGeometry& fvGridGeometry) : fvGridGeometryPtr_(&fvGridGeometry) {} @@ -96,9 +92,9 @@ public: //! This is a free function found by means of ADL //! To iterate over all sub control volumes of this FVElementGeometry use //! for (auto&& scv : scvs(fvGeometry)) - friend inline Dune::IteratorRange<ScvIterator> - scvs(const StaggeredFVElementGeometry& fvGeometry) + friend inline auto scvs(const StaggeredFVElementGeometry& fvGeometry) { + using ScvIterator = Dumux::ScvIterator<SubControlVolume, std::vector<IndexType>, ThisType>; return Dune::IteratorRange<ScvIterator>(ScvIterator(fvGeometry.scvIndices_.begin(), fvGeometry), ScvIterator(fvGeometry.scvIndices_.end(), fvGeometry)); } @@ -108,11 +104,11 @@ public: //! This is a free function found by means of ADL //! To iterate over all sub control volume faces of this FVElementGeometry use //! for (auto&& scvf : scvfs(fvGeometry)) - friend inline Dune::IteratorRange<ScvfIterator> - scvfs(const StaggeredFVElementGeometry& fvGeometry) + friend inline auto scvfs(const StaggeredFVElementGeometry& fvGeometry) { const auto& g = fvGeometry.fvGridGeometry(); const auto scvIdx = fvGeometry.scvIndices_[0]; + using ScvfIterator = Dumux::ScvfIterator<SubControlVolumeFace, std::vector<IndexType>, ThisType>; return Dune::IteratorRange<ScvfIterator>(ScvfIterator(g.scvfIndicesOfScv(scvIdx).begin(), fvGeometry), ScvfIterator(g.scvfIndicesOfScv(scvIdx).end(), fvGeometry)); } @@ -159,22 +155,22 @@ private: * 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> +template<class GG> +class StaggeredFVElementGeometry<GG, false> { - using ThisType = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using ThisType = StaggeredFVElementGeometry<GG, false>; + using GridView = typename GG::GridView; using IndexType = typename GridView::IndexSet::IndexType; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); using Element = typename GridView::template Codim<0>::Entity; - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - - using ScvIterator = Dumux::ScvIterator<SubControlVolume, std::vector<IndexType>, ThisType>; - using ScvfIterator = Dumux::ScvfIterator<SubControlVolumeFace, std::vector<IndexType>, ThisType>; public: + //! export type of subcontrol volume + using SubControlVolume = typename GG::SubControlVolume; + //! export type of subcontrol volume face + using SubControlVolumeFace = typename GG::SubControlVolumeFace; + //! export type of finite volume grid geometry + using FVGridGeometry = GG; + //! Constructor StaggeredFVElementGeometry(const FVGridGeometry& fvGridGeometry) : fvGridGeometryPtr_(&fvGridGeometry) {} diff --git a/dumux/discretization/staggered/fvgridgeometry.hh b/dumux/discretization/staggered/fvgridgeometry.hh index caf05d8ab248acff673a9c9ba58f11530d73574b..1d111be5287988011446a2c4968b36b9825959c0 100644 --- a/dumux/discretization/staggered/fvgridgeometry.hh +++ b/dumux/discretization/staggered/fvgridgeometry.hh @@ -24,11 +24,9 @@ #ifndef DUMUX_DISCRETIZATION_STAGGERED_FV_GRID_GEOMETRY #define DUMUX_DISCRETIZATION_STAGGERED_FV_GRID_GEOMETRY -#include <dumux/common/properties.hh> #include <dumux/discretization/basefvgridgeometry.hh> -namespace Dumux -{ +namespace Dumux { /*! * \ingroup StaggeredDiscretization @@ -36,9 +34,10 @@ namespace Dumux * This builds up the sub control volumes and sub control volume faces * for each element. */ -template<class TypeTag, bool EnableFVGridGeometryCache> -class StaggeredFVGridGeometry -{}; + template<class GridView, + bool enableFVGridGeometryCache, + class Traits> +class StaggeredFVGridGeometry; /*! * \ingroup StaggeredDiscretization @@ -46,31 +45,35 @@ class StaggeredFVGridGeometry * 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> +template<class GV, class Traits> +class StaggeredFVGridGeometry<GV, true, Traits> +: public BaseFVGridGeometry<StaggeredFVGridGeometry<GV, true, Traits>, GV, Traits> { - using ParentType = BaseFVGridGeometry<TypeTag>; - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using IndexType = typename GridView::IndexSet::IndexType; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using Element = typename GridView::template Codim<0>::Entity; - using IntersectionMapper = typename GET_PROP_TYPE(TypeTag, IntersectionMapper); - //! The local class needs access to the scv, scvfs and the fv element geometry - //! as they are globally cached - friend typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using ThisType = StaggeredFVGridGeometry<GV, true, Traits>; + using ParentType = BaseFVGridGeometry<ThisType, GV, Traits>; + using IndexType = typename GV::IndexSet::IndexType; + using Element = typename GV::template Codim<0>::Entity; enum { // Grid and world dimension - dim = GridView::dimension, - dimWorld = GridView::dimensionworld + dim = GV::dimension, + dimWorld = GV::dimensionworld }; - using GeometryHelper = typename GET_PROP_TYPE(TypeTag, StaggeredGeometryHelper); - using ConnectivityMap = typename GET_PROP_TYPE(TypeTag, AssemblyMap); + using IntersectionMapper = typename Traits::IntersectionMapper; + using GeometryHelper = typename Traits::GeometryHelper; + using ConnectivityMap = typename Traits::template ConnectivityMap<ThisType>; public: + //! export the type of the fv element geometry (the local view type) + using LocalView = typename Traits::template LocalView<ThisType, true>; + //! export the type of sub control volume + using SubControlVolume = typename Traits::SubControlVolume; + //! export the type of sub control volume + using SubControlVolumeFace = typename Traits::SubControlVolumeFace; + //! export the grid view type + using GridView = GV; + //! Constructor StaggeredFVGridGeometry(const GridView& gridView) : ParentType(gridView) @@ -198,8 +201,6 @@ public: connectivityMap_.update(*this); } -//private: - //! Get a sub control volume with a global scv index const SubControlVolume& scv(IndexType scvIdx) const { @@ -255,8 +256,8 @@ private: * 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> +template<class GV, class Traits> +class StaggeredFVGridGeometry<GV, false, Traits> { // TODO: implement without caching }; diff --git a/dumux/discretization/staggered/gridfacevariables.hh b/dumux/discretization/staggered/gridfacevariables.hh index 0347548689e15a7d4b8ca34bab41544128bf7d1c..ec5032a86ef43200bb1022341df0044c8e447594 100644 --- a/dumux/discretization/staggered/gridfacevariables.hh +++ b/dumux/discretization/staggered/gridfacevariables.hh @@ -27,16 +27,17 @@ #include <dumux/common/properties.hh> #include <dumux/discretization/staggered/facesolution.hh> -namespace Dumux -{ +//! make the local view function available whenever we use this class +#include <dumux/discretization/localview.hh> + +namespace Dumux { /*! * \ingroup StaggeredDiscretization * \brief Face variables cache class for staggered models */ template<class TypeTag, bool enableGlobalFaceVarsCache> -class StaggeredGridFaceVariables -{}; +class StaggeredGridFaceVariables; /*! * \ingroup StaggeredDiscretization @@ -46,20 +47,20 @@ class StaggeredGridFaceVariables template<class TypeTag> class StaggeredGridFaceVariables<TypeTag, /*enableGlobalFaceVarsCache*/true> { - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using FaceVariables = typename GET_PROP_TYPE(TypeTag, FaceVariables); - using ElementFaceVariables = typename GET_PROP_TYPE(TypeTag, ElementFaceVariables); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using IndexType = typename GridView::IndexSet::IndexType; using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; typename DofTypeIndices::FaceIdx faceIdx; public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementFaceVariables); + StaggeredGridFaceVariables(const Problem& problem) : problemPtr_(&problem) {} //! Update all face variables @@ -86,15 +87,6 @@ public: FaceVariables& faceVars(const IndexType facetIdx) { return faceVariables_[facetIdx]; } - - /*! - * \brief Return a local restriction of this global object - * 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 StaggeredGridFaceVariables& global) - { return ElementFaceVariables(global); } - const Problem& problem() const { return *problemPtr_; } @@ -113,44 +105,26 @@ private: template<class TypeTag> class StaggeredGridFaceVariables<TypeTag, /*enableGlobalFaceVarsCache*/false> { - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using FaceVariables = typename GET_PROP_TYPE(TypeTag, FaceVariables); - using ElementFaceVariables = typename GET_PROP_TYPE(TypeTag, ElementFaceVariables); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using IndexType = typename GridView::IndexSet::IndexType; - - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementFaceVariables); + StaggeredGridFaceVariables(const Problem& problem) : problemPtr_(&problem) {} //! Do nothing here. - void update(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) - { } - - /*! - * \brief Return a local restriction of this global object - * 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 StaggeredGridFaceVariables& global) - { return ElementFaceVariables(global); } + void update(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) {} const Problem& problem() const { return *problemPtr_; } - private: - const Problem* problemPtr_; }; - -} // end namespace +} // end namespace Dumux #endif diff --git a/dumux/discretization/staggered/gridfluxvariablescache.hh b/dumux/discretization/staggered/gridfluxvariablescache.hh index 5cea787e5d7c813a08159e065ac81a46ca35bbad..5633b6dc1f290b21666cb9d10bd2673914866af0 100644 --- a/dumux/discretization/staggered/gridfluxvariablescache.hh +++ b/dumux/discretization/staggered/gridfluxvariablescache.hh @@ -27,8 +27,10 @@ #include <dumux/common/properties.hh> #include <dumux/discretization/staggered/elementfluxvariablescache.hh> -namespace Dumux -{ +//! make the local view function available whenever we use this class +#include <dumux/discretization/localview.hh> + +namespace Dumux { /*! * \ingroup StaggeredDiscretization @@ -54,10 +56,13 @@ class StaggeredGridFluxVariablesCache<TypeTag, true> using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); using IndexType = typename GridView::IndexSet::IndexType; using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); - using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); + StaggeredGridFluxVariablesCache(const Problem& problem) : problemPtr_(&problem) {} // When global caching is enabled, precompute transmissibilities and stencils for all the scv faces @@ -83,14 +88,6 @@ public: // } } - /*! - * \brief Return a local restriction of this global object - * 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 ElementFluxVariablesCache localView(const StaggeredGridFluxVariablesCache& global) - { return ElementFluxVariablesCache(global); } - const Problem& problem() const { return *problemPtr_; } @@ -119,21 +116,15 @@ class StaggeredGridFluxVariablesCache<TypeTag, false> // the local class needs access to the problem friend StaggeredElementFluxVariablesCache<TypeTag, false>; using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); + // When global flux variables caching is disabled, we don't need to update the cache void update(Problem& problem) { problemPtr_ = &problem; } - /*! - * \brief Return a local restriction of this global object - * 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 ElementFluxVariablesCache localView(const StaggeredGridFluxVariablesCache& global) - { return ElementFluxVariablesCache(global); } - private: const Problem& problem_() const @@ -142,6 +133,6 @@ private: const Problem* problemPtr_; }; -} // end namespace +} // end namespace Dumux #endif diff --git a/dumux/discretization/staggered/gridvolumevariables.hh b/dumux/discretization/staggered/gridvolumevariables.hh index 63c81e2be8d038b5b9d562292e1ece433eb14ae7..f7afd295c13dac885dc261ee29e9b07ba22fa77e 100644 --- a/dumux/discretization/staggered/gridvolumevariables.hh +++ b/dumux/discretization/staggered/gridvolumevariables.hh @@ -27,16 +27,17 @@ #include <dune/common/exceptions.hh> #include <dumux/common/properties.hh> -namespace Dumux -{ +//! make the local view function available whenever we use this class +#include <dumux/discretization/localview.hh> + +namespace Dumux { /*! * \ingroup StaggeredDiscretization * \brief Grid volume variables class for staggered models */ template<class TypeTag, bool enableGridVolVarsCache> -class StaggeredGridVolumeVariables -{}; +class StaggeredGridVolumeVariables; /*! * \ingroup StaggeredDiscretization @@ -51,14 +52,13 @@ class StaggeredGridVolumeVariables<TypeTag, /*enableGridVolVarsCache*/true> using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename FVGridGeometry::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using IndexType = typename GridView::IndexSet::IndexType; using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; static const int dim = GridView::dimension; using Element = typename GridView::template Codim<0>::Entity; @@ -68,6 +68,9 @@ class StaggeredGridVolumeVariables<TypeTag, /*enableGridVolVarsCache*/true> enum { numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter) }; public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); + StaggeredGridVolumeVariables(const Problem& problem) : problemPtr_(&problem) {} //! Update all volume variables @@ -121,14 +124,6 @@ public: } } - /*! - * \brief Return a local restriction of this global object - * 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 ElementVolumeVariables localView(const StaggeredGridVolumeVariables& global) - { return ElementVolumeVariables(global); } - const VolumeVariables& volVars(const IndexType scvIdx) const { return volumeVariables_[scvIdx]; } @@ -145,9 +140,7 @@ public: { return *problemPtr_; } private: - const Problem* problemPtr_; - std::vector<VolumeVariables> volumeVariables_; }; @@ -163,21 +156,15 @@ class StaggeredGridVolumeVariables<TypeTag, /*enableGridVolVarsCache*/false> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); public: + //! export the type of the local view + using LocalView = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); + StaggeredGridVolumeVariables(const Problem& problem) : problemPtr_(&problem) {} void update(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) {} - /*! - * \brief Return a local restriction of this global object - * 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 ElementVolumeVariables localView(const StaggeredGridVolumeVariables& global) - { return ElementVolumeVariables(global); } - const Problem& problem() const { return *problemPtr_;} @@ -186,6 +173,6 @@ private: const Problem* problemPtr_; }; -} // end namespace +} // end namespace Dumux #endif diff --git a/dumux/discretization/staggered/properties.hh b/dumux/discretization/staggered/properties.hh index 2b7ce7c9dc652812525a257a092f6da1a90e1f0e..155c1b4279f71c3a57961a1e1d61e0b0c3a3310b 100644 --- a/dumux/discretization/staggered/properties.hh +++ b/dumux/discretization/staggered/properties.hh @@ -49,7 +49,6 @@ #include <dumux/discretization/staggered/elementfacevariables.hh> #include <dumux/discretization/staggered/subcontrolvolumeface.hh> -#include <dumux/common/intersectionmapper.hh> #include <dune/istl/multitypeblockvector.hh> #include <dune/istl/multitypeblockmatrix.hh> @@ -70,59 +69,6 @@ SET_PROP(StaggeredModel, DiscretizationMethod) static const DiscretizationMethods value = DiscretizationMethods::Staggered; }; -//! Set the default for the FVElementGeometry vector -SET_TYPE_PROP(StaggeredModel, FVGridGeometry, StaggeredFVGridGeometry<TypeTag, GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>); - -//! Set the default for the FVElementGeometry vector -SET_TYPE_PROP(StaggeredModel, FVElementGeometry, StaggeredFVElementGeometry<TypeTag, GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>); - -//! The default sub control volume -SET_PROP(StaggeredModel, SubControlVolume) -{ -private: - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - struct ScvGeometryTraits - { - using Geometry = typename Grid::template Codim<0>::Geometry; - using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; - using Scalar = typename Grid::ctype; - using GlobalPosition = Dune::FieldVector<Scalar, Grid::dimensionworld>; - }; -public: - using type = CCSubControlVolume<ScvGeometryTraits>; -}; - -//! The default sub-controlvolume face -SET_PROP(StaggeredModel, SubControlVolumeFace) -{ -private: - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - static constexpr int dim = Grid::dimension; - static constexpr int dimWorld = Grid::dimensionworld; - - struct ScvfGeometryTraits - { - using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType; - using LocalIndexType = unsigned int; - using Scalar = typename Grid::ctype; - using Geometry = typename Grid::template Codim<1>::Geometry; - using GlobalPosition = Dune::FieldVector<Scalar, dim>; - }; - -public: - using type = StaggeredSubControlVolumeFace<ScvfGeometryTraits>; -}; - -//! The default geometry helper required for the stencils, etc. -SET_PROP(StaggeredModel, StaggeredGeometryHelper) -{ -private: - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); -public: - using type = BaseStaggeredGeometryHelper<GridView>; -}; - //! Set the default global face variables cache vector class SET_TYPE_PROP(StaggeredModel, GridFaceVariables, StaggeredGridFaceVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridFaceVariablesCache)>); @@ -156,9 +102,6 @@ SET_TYPE_PROP(StaggeredModel, GridVariables, StaggeredGridVariables<TypeTag>); //! Use the cell center element boundary types per default SET_TYPE_PROP(StaggeredModel, ElementBoundaryTypes, CCElementBoundaryTypes<TypeTag>); -//! Set the intersection mapper -SET_TYPE_PROP(StaggeredModel, IntersectionMapper, ConformingGridIntersectionMapper<TypeTag>); - //! Set the BaseLocalResidual to StaggeredLocalResidual SET_TYPE_PROP(StaggeredModel, BaseLocalResidual, StaggeredLocalResidual<TypeTag>); diff --git a/dumux/discretization/staggered/subcontrolvolumeface.hh b/dumux/discretization/staggered/subcontrolvolumeface.hh index 0ad970c1732d318dfe2690f2d70a23363794ad21..c969a91540ad033e605e3e856e6d929fafeb5c6e 100644 --- a/dumux/discretization/staggered/subcontrolvolumeface.hh +++ b/dumux/discretization/staggered/subcontrolvolumeface.hh @@ -34,8 +34,7 @@ #include <typeinfo> -namespace Dumux -{ +namespace Dumux { /*! * \ingroup StaggeredDiscretization @@ -50,7 +49,9 @@ class BaseStaggeredGeometryHelper public: - BaseStaggeredGeometryHelper(const Element& element, const GridView& gridView) : element_(element), gridView_(gridView) + BaseStaggeredGeometryHelper(const Element& element, const GridView& gridView) + : element_(element) + , gridView_(gridView) { } /*! @@ -86,28 +87,47 @@ private: const GridView gridView_; }; + +/*! + * \ingroup StaggeredDiscretization + * \brief Default traits class to be used for the sub-control volume faces + * for the staggered finite volume scheme + * \tparam GV the type of the grid view + */ +template<class GridView> +struct StaggeredDefaultScvfGeometryTraits +{ + using Geometry = typename GridView::template Codim<1>::Geometry; + using GridIndexType = typename GridView::IndexSet::IndexType; + using LocalIndexType = unsigned int; + using Scalar = typename GridView::ctype; + using GlobalPosition = Dune::FieldVector<Scalar, GridView::dimensionworld>; +}; + /*! - * \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. */ -template<class ScvfGeometryTraits> -class StaggeredSubControlVolumeFace : public SubControlVolumeFaceBase<StaggeredSubControlVolumeFace<ScvfGeometryTraits>, ScvfGeometryTraits> +template<class GV, + class T = StaggeredDefaultScvfGeometryTraits<GV> > +class StaggeredSubControlVolumeFace +: public SubControlVolumeFaceBase<StaggeredSubControlVolumeFace<GV, T>, T> { - using ParentType = SubControlVolumeFaceBase<StaggeredSubControlVolumeFace<ScvfGeometryTraits>,ScvfGeometryTraits>; - using Geometry = typename ScvfGeometryTraits::Geometry; - using GridIndexType = typename ScvfGeometryTraits::GridIndexType; + using ThisType = StaggeredSubControlVolumeFace<GV, T>; + using ParentType = SubControlVolumeFaceBase<ThisType, T>; + using Geometry = typename T::Geometry; + using GridIndexType = typename T::GridIndexType; - using Scalar = typename ScvfGeometryTraits::Scalar; + using Scalar = typename T::Scalar; static const int dim = Geometry::mydimension; static const int dimworld = Geometry::coorddimension; - using GlobalPosition = typename ScvfGeometryTraits::GlobalPosition; - + using GlobalPosition = typename T::GlobalPosition; public: //! state the traits public and thus export all types - using Traits = ScvfGeometryTraits; + using Traits = T; // the default constructor StaggeredSubControlVolumeFace() = default; @@ -115,27 +135,26 @@ public: //! Constructor with intersection template <class Intersection, class GeometryHelper> StaggeredSubControlVolumeFace(const Intersection& is, - const typename Intersection::Geometry& isGeometry, - GridIndexType scvfIndex, - const std::vector<GridIndexType>& scvIndices, - const GeometryHelper& geometryHelper - ) - : ParentType(), - geomType_(isGeometry.type()), - area_(isGeometry.volume()), - center_(isGeometry.center()), - unitOuterNormal_(is.centerUnitOuterNormal()), - scvfIndex_(scvfIndex), - scvIndices_(scvIndices), - boundary_(is.boundary()) - { - corners_.resize(isGeometry.corners()); - for (int i = 0; i < isGeometry.corners(); ++i) - corners_[i] = isGeometry.corner(i); - - dofIdx_ = geometryHelper.dofIndex(); - localFaceIdx_ = geometryHelper.localFaceIndex(); - } + const typename Intersection::Geometry& isGeometry, + GridIndexType scvfIndex, + const std::vector<GridIndexType>& scvIndices, + const GeometryHelper& geometryHelper) + : ParentType() + , geomType_(isGeometry.type()) + , area_(isGeometry.volume()) + , center_(isGeometry.center()) + , unitOuterNormal_(is.centerUnitOuterNormal()) + , scvfIndex_(scvfIndex) + , scvIndices_(scvIndices) + , boundary_(is.boundary()) + { + corners_.resize(isGeometry.corners()); + for (int i = 0; i < isGeometry.corners(); ++i) + corners_[i] = isGeometry.corner(i); + + dofIdx_ = geometryHelper.dofIndex(); + localFaceIdx_ = geometryHelper.localFaceIndex(); + } //! The center of the sub control volume face const GlobalPosition& center() const @@ -232,8 +251,6 @@ private: int localFaceIdx_; }; - - -} // end namespace +} // end namespace Dumux #endif diff --git a/dumux/discretization/stationaryvelocityfield.hh b/dumux/discretization/stationaryvelocityfield.hh index d7a304fa058c23d83646dd9be020c97d9de68958..f43484483a625b8a54a6b94e714bc8adb44efdfb 100644 --- a/dumux/discretization/stationaryvelocityfield.hh +++ b/dumux/discretization/stationaryvelocityfield.hh @@ -41,10 +41,10 @@ template <class TypeTag> class StationaryVelocityField { using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementFluxVarsCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using Element = typename GridView::template Codim<0>::Entity; diff --git a/dumux/freeflow/navierstokes/fluxvariablescache.hh b/dumux/freeflow/navierstokes/fluxvariablescache.hh index a1c539106f37f96ee11f1222ea8c247a2534c2a9..5c83cae5221db7d35248caaf527807650622e561 100644 --- a/dumux/freeflow/navierstokes/fluxvariablescache.hh +++ b/dumux/freeflow/navierstokes/fluxvariablescache.hh @@ -53,9 +53,9 @@ class FreeFlowFluxVariablesCacheImplementation<TypeTag, DiscretizationMethods::S { using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using Element = typename GridView::template Codim<0>::Entity; public: diff --git a/dumux/freeflow/navierstokes/problem.hh b/dumux/freeflow/navierstokes/problem.hh index 30dffc19ca9214bdf5f7e44134b79f5d3e3e4970..5cd86cf206c2a486db32b9321905b7a4476543fe 100644 --- a/dumux/freeflow/navierstokes/problem.hh +++ b/dumux/freeflow/navierstokes/problem.hh @@ -67,7 +67,8 @@ class NavierStokesProblem : public NavierStokesParentProblem<TypeTag> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); diff --git a/dumux/freeflow/navierstokes/staggered/fluxoverplane.hh b/dumux/freeflow/navierstokes/staggered/fluxoverplane.hh index 862d278630ce0d92ca2d49cd8ca93e5644c731f2..4ad42d794541f7d691d12defa6d4eba9a90f85aa 100644 --- a/dumux/freeflow/navierstokes/staggered/fluxoverplane.hh +++ b/dumux/freeflow/navierstokes/staggered/fluxoverplane.hh @@ -48,8 +48,8 @@ class FluxOverPlane using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); using LocalResidual = typename GET_PROP_TYPE(TypeTag, LocalResidual); diff --git a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh index fabb735d517ebdfbd688c44291a9d13044180a48..82048727f7d2fefde35b85f79b7286e3c789200f 100644 --- a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh +++ b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh @@ -47,11 +47,11 @@ class NavierStokesFluxVariablesImpl<TypeTag, DiscretizationMethods::Staggered> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); using FacePrimaryVariables = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables); diff --git a/dumux/freeflow/navierstokes/staggered/localresidual.hh b/dumux/freeflow/navierstokes/staggered/localresidual.hh index 4a978fbe37f5bd2b5902e120ce6e6198f7b65ad5..b8e5989eafb3437e647d3ef5b41ad62859daafae 100644 --- a/dumux/freeflow/navierstokes/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokes/staggered/localresidual.hh @@ -56,9 +56,9 @@ class NavierStokesResidualImpl<TypeTag, DiscretizationMethods::Staggered> using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); using FacePrimaryVariables = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); diff --git a/dumux/freeflow/navierstokes/volumevariables.hh b/dumux/freeflow/navierstokes/volumevariables.hh index 7203c8d4ce849c6b53e08dd854d9e8181246b3eb..5829203d924ec9c91d8573d9f610b4a038191091 100644 --- a/dumux/freeflow/navierstokes/volumevariables.hh +++ b/dumux/freeflow/navierstokes/volumevariables.hh @@ -52,7 +52,8 @@ class NavierStokesVolumeVariablesImplementation<TypeTag, false> { using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); @@ -228,7 +229,8 @@ class NavierStokesVolumeVariablesImplementation<TypeTag, true> using ParentType = NavierStokesVolumeVariablesImplementation<TypeTag, false>; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; diff --git a/dumux/freeflow/navierstokes/vtkoutputfields.hh b/dumux/freeflow/navierstokes/vtkoutputfields.hh index 87c9c72d11e072933440dd418f6de1303866027a..46679784082c22571243bc5d2cdecedc48d59c60 100644 --- a/dumux/freeflow/navierstokes/vtkoutputfields.hh +++ b/dumux/freeflow/navierstokes/vtkoutputfields.hh @@ -43,7 +43,8 @@ class NavierStokesVtkOutputFields using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using FaceVariables = typename GET_PROP_TYPE(TypeTag, FaceVariables); using GlobalPosition = Dune::FieldVector<Scalar, GridView::dimensionworld>; diff --git a/dumux/freeflow/navierstokesnc/staggered/fluxvariables.hh b/dumux/freeflow/navierstokesnc/staggered/fluxvariables.hh index 294f13d95dbecf6819bcd31334a613c878667b91..f7123db0cf6b09d32cf678905c0ca36d393c687e 100644 --- a/dumux/freeflow/navierstokesnc/staggered/fluxvariables.hh +++ b/dumux/freeflow/navierstokesnc/staggered/fluxvariables.hh @@ -48,11 +48,11 @@ class NavierStokesNCFluxVariablesImpl<TypeTag, DiscretizationMethods::Staggered> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementFaceVariables = typename GET_PROP_TYPE(TypeTag, ElementFaceVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); diff --git a/dumux/freeflow/navierstokesnc/staggered/localresidual.hh b/dumux/freeflow/navierstokesnc/staggered/localresidual.hh index e0f54677f9fd9966d3023ba1426414765916808e..0e764a3290efa82c0a9637fbbe87aef76bc28fd0 100644 --- a/dumux/freeflow/navierstokesnc/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokesnc/staggered/localresidual.hh @@ -49,7 +49,8 @@ class NavierStokesNCResidualImpl<TypeTag, DiscretizationMethods::Staggered> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); diff --git a/dumux/freeflow/navierstokesnc/volumevariables.hh b/dumux/freeflow/navierstokesnc/volumevariables.hh index e77070496886a021a0f1788d57b1562516a84f30..e29daf5866fb2285a9a456320ba9368f7a172cf3 100644 --- a/dumux/freeflow/navierstokesnc/volumevariables.hh +++ b/dumux/freeflow/navierstokesnc/volumevariables.hh @@ -45,7 +45,8 @@ class NavierStokesNCVolumeVariables : public NavierStokesVolumeVariables<TypeTag using Implementation = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); diff --git a/dumux/io/staggeredvtkoutputmodule.hh b/dumux/io/staggeredvtkoutputmodule.hh index 5a89283d56e00cf00c7f14d84480ae7fdcb00106..ea0499923416a8aea15d9ecd2f11505f0972e7a1 100644 --- a/dumux/io/staggeredvtkoutputmodule.hh +++ b/dumux/io/staggeredvtkoutputmodule.hh @@ -52,7 +52,8 @@ class StaggeredVtkOutputModule : public VtkOutputModule<TypeTag> using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using FaceVariables = typename GET_PROP_TYPE(TypeTag, FaceVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; enum { dim = GridView::dimension }; diff --git a/dumux/io/vtkoutputmodule.hh b/dumux/io/vtkoutputmodule.hh index e7e3f7187f31755d6e52940ab66bc502c8706645..b366093542cf041b3468c4e35e59d2862f1e336f 100644 --- a/dumux/io/vtkoutputmodule.hh +++ b/dumux/io/vtkoutputmodule.hh @@ -45,163 +45,162 @@ #include <dumux/common/parameters.hh> #include <dumux/discretization/methods.hh> -namespace Dumux -{ +namespace Dumux { +namespace Vtk { -namespace Vtk +//! struct that can hold any field that fulfills the VTKFunction interface +template<class GridView> +class Field { - //! struct that can hold any field that fulfills the VTKFunction interface - template<class GridView> - class Field - { - enum { dim = GridView::dimension }; - using ctype = typename GridView::ctype; - using Element = typename GridView::template Codim<0>::Entity; + enum { dim = GridView::dimension }; + using ctype = typename GridView::ctype; + using Element = typename GridView::template Codim<0>::Entity; - // a VTK function that supports both scalar and vector values for each element + // a VTK function that supports both scalar and vector values for each element #if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) - template <typename F> - struct VectorP0VTKFunction : Dune::VTKFunction<GridView> - { - using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>; + template <typename F> + struct VectorP0VTKFunction : Dune::VTKFunction<GridView> + { + using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>; #else - template<typename F, typename Mapper> - struct VectorP0VTKFunction : Dune::VTKFunction<GridView> - { + template<typename F, typename Mapper> + struct VectorP0VTKFunction : Dune::VTKFunction<GridView> + { #endif - public: - //! return number of components - virtual int ncomps () const - { return nComps_; } - - //! evaluate - virtual double evaluate (int mycomp, const Element& e, - const Dune::FieldVector<ctype,dim>&) const - { return accessChooser_(mycomp, mapper_.index(e), Dune::is_indexable<decltype(field_[0])>()); } - - //! get name - virtual std::string name () const - { return name_; } - - VectorP0VTKFunction(const GridView &gridView, const Mapper& mapper, const F& field, const std::string& name, int nComps) - : field_(field), name_(name), nComps_(nComps), mapper_(mapper) - { - if (field.size()!=(unsigned int)(gridView.size(0))) - DUNE_THROW(Dune::IOError, "NestedP0VTKFunction: size mismatch"); - } - private: - double accessChooser_(int mycomp, int i, std::true_type) const - { return field_[i][mycomp]; } + public: + //! return number of components + virtual int ncomps () const + { return nComps_; } - double accessChooser_(int mycomp, int i, std::false_type) const - { return field_[i]; } + //! evaluate + virtual double evaluate (int mycomp, const Element& e, + const Dune::FieldVector<ctype,dim>&) const + { return accessChooser_(mycomp, mapper_.index(e), Dune::is_indexable<decltype(field_[0])>()); } - const F& field_; - const std::string name_; - int nComps_; - const Mapper& mapper_; - }; + //! get name + virtual std::string name () const + { return name_; } - // a VTK function that supports both scalar and vector values for each vertex -#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) - template <typename F> - struct VectorP1VTKFunction : Dune::VTKFunction<GridView> + VectorP0VTKFunction(const GridView &gridView, const Mapper& mapper, const F& field, const std::string& name, int nComps) + : field_(field), name_(name), nComps_(nComps), mapper_(mapper) { - using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>; + if (field.size()!=(unsigned int)(gridView.size(0))) + DUNE_THROW(Dune::IOError, "NestedP0VTKFunction: size mismatch"); + } + private: + double accessChooser_(int mycomp, int i, std::true_type) const + { return field_[i][mycomp]; } + + double accessChooser_(int mycomp, int i, std::false_type) const + { return field_[i]; } + + const F& field_; + const std::string name_; + int nComps_; + const Mapper& mapper_; + }; + + // a VTK function that supports both scalar and vector values for each vertex +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) + template <typename F> + struct VectorP1VTKFunction : Dune::VTKFunction<GridView> + { + using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>; #else - template<typename F, typename Mapper> - struct VectorP1VTKFunction : Dune::VTKFunction<GridView> - { + template<typename F, typename Mapper> + struct VectorP1VTKFunction : Dune::VTKFunction<GridView> + { #endif - public: - //! return number of components - virtual int ncomps () const - { return nComps_; } - - //! evaluate - virtual double evaluate (int mycomp, const Element& e, - const Dune::FieldVector<ctype,dim>& xi) const - { - const unsigned int dim = Element::mydimension; - const unsigned int nVertices = e.subEntities(dim); + public: + //! return number of components + virtual int ncomps () const + { return nComps_; } + + //! evaluate + virtual double evaluate (int mycomp, const Element& e, + const Dune::FieldVector<ctype,dim>& xi) const + { + const unsigned int dim = Element::mydimension; + const unsigned int nVertices = e.subEntities(dim); - std::vector<Dune::FieldVector<ctype, 1>> cornerValues(nVertices); - for (unsigned i = 0; i < nVertices; ++i) - cornerValues[i] = accessChooser_(mycomp, mapper_.subIndex(e, i, dim), Dune::is_indexable<decltype(field_[0])>()); + std::vector<Dune::FieldVector<ctype, 1>> cornerValues(nVertices); + for (unsigned i = 0; i < nVertices; ++i) + cornerValues[i] = accessChooser_(mycomp, mapper_.subIndex(e, i, dim), Dune::is_indexable<decltype(field_[0])>()); - // (Ab)use the MultiLinearGeometry class to do multi-linear interpolation between scalars - const Dune::MultiLinearGeometry<ctype, dim, 1> interpolation(e.type(), std::move(cornerValues)); - return interpolation.global(xi); - } + // (Ab)use the MultiLinearGeometry class to do multi-linear interpolation between scalars + const Dune::MultiLinearGeometry<ctype, dim, 1> interpolation(e.type(), std::move(cornerValues)); + return interpolation.global(xi); + } - //! get name - virtual std::string name () const - { return name_; } + //! get name + virtual std::string name () const + { return name_; } - VectorP1VTKFunction(const GridView &gridView, const Mapper& mapper, const F& field, const std::string& name, int nComps) - : field_(field), name_(name), nComps_(nComps), mapper_(mapper) - { - if (field.size()!=(unsigned int)(gridView.size(GridView::dimension))) - DUNE_THROW(Dune::IOError, "NestedP1VTKFunction: size mismatch"); - } - private: - double accessChooser_(int mycomp, int i, std::true_type) const - { return field_[i][mycomp]; } + VectorP1VTKFunction(const GridView &gridView, const Mapper& mapper, const F& field, const std::string& name, int nComps) + : field_(field), name_(name), nComps_(nComps), mapper_(mapper) + { + if (field.size()!=(unsigned int)(gridView.size(GridView::dimension))) + DUNE_THROW(Dune::IOError, "NestedP1VTKFunction: size mismatch"); + } + private: + double accessChooser_(int mycomp, int i, std::true_type) const + { return field_[i][mycomp]; } - double accessChooser_(int mycomp, int i, std::false_type) const - { return field_[i]; } + double accessChooser_(int mycomp, int i, std::false_type) const + { return field_[i]; } - const F& field_; - const std::string name_; - int nComps_; - const Mapper& mapper_; - }; + const F& field_; + const std::string name_; + int nComps_; + const Mapper& mapper_; + }; - public: - // template constructor selects the right VTKFunction implementation - template <typename F, class Mapper> - Field(const GridView& gridView, const Mapper& mapper, F const& f, - const std::string& name, int numComp = 1, int codim = 0) - : codim_(codim) - { - if (codim == GridView::dimension) +public: + // template constructor selects the right VTKFunction implementation + template <typename F, class Mapper> + Field(const GridView& gridView, const Mapper& mapper, F const& f, + const std::string& name, int numComp = 1, int codim = 0) + : codim_(codim) + { + if (codim == GridView::dimension) #if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) - field_ = std::make_shared<VectorP1VTKFunction<F>>(gridView, mapper, f, name, numComp); + field_ = std::make_shared<VectorP1VTKFunction<F>>(gridView, mapper, f, name, numComp); #else - field_ = std::make_shared<VectorP1VTKFunction<F, Mapper>>(gridView, mapper, f, name, numComp); + field_ = std::make_shared<VectorP1VTKFunction<F, Mapper>>(gridView, mapper, f, name, numComp); #endif - else if (codim == 0) + else if (codim == 0) #if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) - field_ = std::make_shared<VectorP0VTKFunction<F>>(gridView, mapper, f, name, numComp); + field_ = std::make_shared<VectorP0VTKFunction<F>>(gridView, mapper, f, name, numComp); #else - field_ = std::make_shared<VectorP0VTKFunction<F, Mapper>>(gridView, mapper, f, name, numComp); + field_ = std::make_shared<VectorP0VTKFunction<F, Mapper>>(gridView, mapper, f, name, numComp); #endif - else - DUNE_THROW(Dune::NotImplemented, "Only element or vertex quantities allowed."); - } + else + DUNE_THROW(Dune::NotImplemented, "Only element or vertex quantities allowed."); + } - virtual std::string name () const - { return field_->name(); } + virtual std::string name () const + { return field_->name(); } - virtual int ncomps() const - { return field_->ncomps(); } + virtual int ncomps() const + { return field_->ncomps(); } - virtual double evaluate(int mycomp, - const Element &element, - const Dune::FieldVector< ctype, dim > &xi) const - { return field_->evaluate(mycomp, element, xi); } + virtual double evaluate(int mycomp, + const Element &element, + const Dune::FieldVector< ctype, dim > &xi) const + { return field_->evaluate(mycomp, element, xi); } - int codim() const - { return codim_; } + int codim() const + { return codim_; } - const std::shared_ptr<Dune::VTKFunction<GridView>>& get() const - { return field_; } + const std::shared_ptr<Dune::VTKFunction<GridView>>& get() const + { return field_; } + +private: + int codim_; + // can point to anything fulfilling the VTKFunction interface + std::shared_ptr<Dune::VTKFunction<GridView>> field_; +}; - private: - int codim_; - // can point to anything fulfilling the VTKFunction interface - std::shared_ptr<Dune::VTKFunction<GridView>> field_; - }; } // end namespace Vtk /*! @@ -221,10 +220,10 @@ class VtkOutputModule using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using ElementMapper = typename GET_PROP_TYPE(TypeTag, ElementMapper); - using VertexMapper = typename GET_PROP_TYPE(TypeTag, VertexMapper); using VelocityOutput = typename GET_PROP_TYPE(TypeTag, VelocityOutput); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using ElementMapper = typename FVGridGeometry::ElementMapper; + using VertexMapper = typename FVGridGeometry::VertexMapper; using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); diff --git a/dumux/linear/amgtraits.hh b/dumux/linear/amgtraits.hh index 72e95a441e251cf3654bb6a4d5c442592d2488ee..7ccb7d1204c2fd383107026d188471449bc3654f 100644 --- a/dumux/linear/amgtraits.hh +++ b/dumux/linear/amgtraits.hh @@ -88,7 +88,7 @@ struct AmgTraitsImpl<TypeTag, DiscretizationMethods::Box> using ScalarProduct = typename SolverTraits::ScalarProduct; using Smoother = typename SolverTraits::Smoother; - using DofMapper = typename GET_PROP_TYPE(TypeTag, VertexMapper); + using DofMapper = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::VertexMapper; }; //! OverlappingSolverTraits used by discretization with overlapping parallel model @@ -136,7 +136,7 @@ struct AmgTraitsImpl<TypeTag, DiscretizationMethods::CCTpfa> using ScalarProduct = typename SolverTraits::ScalarProduct; using Smoother = typename SolverTraits::Smoother; - using DofMapper = typename GET_PROP_TYPE(TypeTag, ElementMapper); + using DofMapper = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::ElementMapper; }; template<class TypeTag> diff --git a/dumux/material/chemistry/electrochemistry/electrochemistry.hh b/dumux/material/chemistry/electrochemistry/electrochemistry.hh index 7c0d7a0bfe30b2729c93e471e5994b1c8d561b72..f15df6e9a5f45e6c82a40de99c8332c3095966d6 100644 --- a/dumux/material/chemistry/electrochemistry/electrochemistry.hh +++ b/dumux/material/chemistry/electrochemistry/electrochemistry.hh @@ -56,7 +56,7 @@ class ElectroChemistry using SourceValues = typename GET_PROP_TYPE(TypeTag, NumEqVector); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using Constant = Constants<Scalar>; diff --git a/dumux/material/fluidmatrixinteractions/mineralization/effectivesoliddensity.hh b/dumux/material/fluidmatrixinteractions/mineralization/effectivesoliddensity.hh index a31d679049258b3fbb26c45e823e7107be66b4b8..075f5475a1e1946b3006e906739ca68b35527583 100644 --- a/dumux/material/fluidmatrixinteractions/mineralization/effectivesoliddensity.hh +++ b/dumux/material/fluidmatrixinteractions/mineralization/effectivesoliddensity.hh @@ -41,7 +41,8 @@ class EffectiveSolidDensity using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; static const int dim = GridView::dimension; static const int dimWorld = GridView::dimensionworld; diff --git a/dumux/material/fluidmatrixinteractions/mineralization/effectivesolidheatcapacity.hh b/dumux/material/fluidmatrixinteractions/mineralization/effectivesolidheatcapacity.hh index 64c6fec235822dfca45831414be1cf7fb6019e34..04a97bbc2601481420269ff6d74deaa18a541633 100644 --- a/dumux/material/fluidmatrixinteractions/mineralization/effectivesolidheatcapacity.hh +++ b/dumux/material/fluidmatrixinteractions/mineralization/effectivesolidheatcapacity.hh @@ -41,7 +41,8 @@ class EffectiveSolidHeatCapacity using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; static const int dim = GridView::dimension; static const int dimWorld = GridView::dimensionworld; diff --git a/dumux/material/fluidmatrixinteractions/permeabilitykozenycarman.hh b/dumux/material/fluidmatrixinteractions/permeabilitykozenycarman.hh index 248cd71ff30287aacc08d6c90544723e9922d411..2e6842c3041e3da7ce608402e9b97e60af5138fe 100644 --- a/dumux/material/fluidmatrixinteractions/permeabilitykozenycarman.hh +++ b/dumux/material/fluidmatrixinteractions/permeabilitykozenycarman.hh @@ -44,7 +44,8 @@ class PermeabilityKozenyCarman using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); static constexpr int dim = GridView::dimension; diff --git a/dumux/material/fluidmatrixinteractions/porosityprecipitation.hh b/dumux/material/fluidmatrixinteractions/porosityprecipitation.hh index 621d030caf47e6f38744872f14b3e2c5585b1f26..27edea92b951583fe6214c89082f68500561ae92 100644 --- a/dumux/material/fluidmatrixinteractions/porosityprecipitation.hh +++ b/dumux/material/fluidmatrixinteractions/porosityprecipitation.hh @@ -41,7 +41,8 @@ class PorosityPrecipitation using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; static const int dim = GridView::dimension; static const int dimWorld = GridView::dimensionworld; diff --git a/dumux/material/fluidmatrixinteractions/porosityreactivebed.hh b/dumux/material/fluidmatrixinteractions/porosityreactivebed.hh index 7513488d75fa254cef063b28e19e51c967c929f1..5f9b7db827282f4ad531b3d0837a15f3e5f600ee 100644 --- a/dumux/material/fluidmatrixinteractions/porosityreactivebed.hh +++ b/dumux/material/fluidmatrixinteractions/porosityreactivebed.hh @@ -41,7 +41,8 @@ class PorosityReactiveBed using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; static const int dim = GridView::dimension; static const int dimWorld = GridView::dimensionworld; diff --git a/dumux/material/spatialparams/fv.hh b/dumux/material/spatialparams/fv.hh index d53477d5ab2ba40ff7dddc4f8a0c79972653de46..d9974381dcc823c172b516f1dff5752ec0167a2c 100644 --- a/dumux/material/spatialparams/fv.hh +++ b/dumux/material/spatialparams/fv.hh @@ -41,7 +41,8 @@ class FVSpatialParams: public FVSpatialParamsOneP<TypeTag> { using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using MaterialLawParams = typename GET_PROP_TYPE(TypeTag, MaterialLaw)::Params; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Element = typename GridView::template Codim<0>::Entity; diff --git a/dumux/material/spatialparams/fv1p.hh b/dumux/material/spatialparams/fv1p.hh index 5ee11e11853de82c43e022e1bf620c6d85283d41..0aa896b9fe7a73957bae7cf52d272c1cab5c6129 100644 --- a/dumux/material/spatialparams/fv1p.hh +++ b/dumux/material/spatialparams/fv1p.hh @@ -46,8 +46,9 @@ class FVSpatialParamsOneP using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Implementation = typename GET_PROP_TYPE(TypeTag, SpatialParams); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Element = typename GridView::template Codim<0>::Entity; diff --git a/dumux/porousmediumflow/1p/incompressiblelocalresidual.hh b/dumux/porousmediumflow/1p/incompressiblelocalresidual.hh index 1a0f1177ca8b88f7634b6c7458b54117124d8759..d75546e3303c772b78aa65234b1dde88b1866cab 100644 --- a/dumux/porousmediumflow/1p/incompressiblelocalresidual.hh +++ b/dumux/porousmediumflow/1p/incompressiblelocalresidual.hh @@ -47,9 +47,9 @@ class OnePIncompressibleLocalResidual : public ImmiscibleLocalResidual<TypeTag> using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using Indices = typename GET_PROP_TYPE(TypeTag, Indices); diff --git a/dumux/porousmediumflow/1p/volumevariables.hh b/dumux/porousmediumflow/1p/volumevariables.hh index 055a6c7b7246f50430486c9d8cbb00a41363cd59..69c370e6ede0b33ac8c711ed0b639e0f07bdda4b 100644 --- a/dumux/porousmediumflow/1p/volumevariables.hh +++ b/dumux/porousmediumflow/1p/volumevariables.hh @@ -45,7 +45,8 @@ class OnePVolumeVariables : public PorousMediumFlowVolumeVariables<TypeTag> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); using PermeabilityType = typename SpatialParams::PermeabilityType; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); diff --git a/dumux/porousmediumflow/1pnc/volumevariables.hh b/dumux/porousmediumflow/1pnc/volumevariables.hh index c0d8f9ab60684711da61e83a02388a093740ec2e..cc80106d9294e36c5dc31a26099f9e383bc26159 100644 --- a/dumux/porousmediumflow/1pnc/volumevariables.hh +++ b/dumux/porousmediumflow/1pnc/volumevariables.hh @@ -56,8 +56,8 @@ class OnePNCVolumeVariables : public PorousMediumFlowVolumeVariables<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using Implementation = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); using PermeabilityType = typename SpatialParams::PermeabilityType; diff --git a/dumux/porousmediumflow/2p/griddatatransfer.hh b/dumux/porousmediumflow/2p/griddatatransfer.hh index 5b9ee3e08d1fffbdbd675e0b62db47d05d3d1eba..46ce02a3116a2c511588bf3fc188b4435323c22d 100644 --- a/dumux/porousmediumflow/2p/griddatatransfer.hh +++ b/dumux/porousmediumflow/2p/griddatatransfer.hh @@ -46,7 +46,8 @@ class TwoPGridDataTransfer : public GridDataTransfer using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); diff --git a/dumux/porousmediumflow/2p/incompressiblelocalresidual.hh b/dumux/porousmediumflow/2p/incompressiblelocalresidual.hh index 73affdffac48d9ffdedaa9c69635e0dffd5f8760..e5279b06bb9f88a0d38ff6df4d9e1502143ff5e7 100644 --- a/dumux/porousmediumflow/2p/incompressiblelocalresidual.hh +++ b/dumux/porousmediumflow/2p/incompressiblelocalresidual.hh @@ -50,9 +50,9 @@ class TwoPIncompressibleLocalResidual : public ImmiscibleLocalResidual<TypeTag> using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); diff --git a/dumux/porousmediumflow/2p/volumevariables.hh b/dumux/porousmediumflow/2p/volumevariables.hh index fcf1e3d9ea2827eb514372c28787d6248020fb11..0df89ab83206144501eccc94c8afc7012be2f836 100644 --- a/dumux/porousmediumflow/2p/volumevariables.hh +++ b/dumux/porousmediumflow/2p/volumevariables.hh @@ -49,7 +49,8 @@ class TwoPVolumeVariables : public PorousMediumFlowVolumeVariables<TypeTag> using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); enum diff --git a/dumux/porousmediumflow/2p1c/darcyslaw.hh b/dumux/porousmediumflow/2p1c/darcyslaw.hh index bb8f14b6df9f3e2d4528e058cae53e9d80c3724a..75a85d718665de6dd2d029c92968a4592bc9ef65 100644 --- a/dumux/porousmediumflow/2p1c/darcyslaw.hh +++ b/dumux/porousmediumflow/2p1c/darcyslaw.hh @@ -49,11 +49,11 @@ class TwoPOneCDarcysLaw : public DarcysLaw<TypeTag> { using ParentType = DarcysLaw<TypeTag>; using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElemFluxVarCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using FluxVarCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); diff --git a/dumux/porousmediumflow/2p1c/localresidual.hh b/dumux/porousmediumflow/2p1c/localresidual.hh index 2738250c0e91c4908b8be3bcec6f532016a41d66..d6d2da18d89548518d8eb6ea444f75bbff83bead 100644 --- a/dumux/porousmediumflow/2p1c/localresidual.hh +++ b/dumux/porousmediumflow/2p1c/localresidual.hh @@ -44,9 +44,9 @@ class TwoPOneCLocalResidual : public ImmiscibleLocalResidual<TypeTag> using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using EnergyLocalResidual = typename GET_PROP_TYPE(TypeTag, EnergyLocalResidual); diff --git a/dumux/porousmediumflow/2p1c/volumevariables.hh b/dumux/porousmediumflow/2p1c/volumevariables.hh index 5b01995819c4c61a5335e5c24813e9bb54d3bf03..a8926090edadb2816ab18e6aa90087655a21e360 100644 --- a/dumux/porousmediumflow/2p1c/volumevariables.hh +++ b/dumux/porousmediumflow/2p1c/volumevariables.hh @@ -45,7 +45,8 @@ class TwoPOneCVolumeVariables : public PorousMediumFlowVolumeVariables<TypeTag> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); using PermeabilityType = typename SpatialParams::PermeabilityType; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); diff --git a/dumux/porousmediumflow/2p2c/volumevariables.hh b/dumux/porousmediumflow/2p2c/volumevariables.hh index f9ce2ace0001cb5b426742fe9617fa4a4111bfb7..0c00038a76822e15a8647d702b1669949fe11813 100644 --- a/dumux/porousmediumflow/2p2c/volumevariables.hh +++ b/dumux/porousmediumflow/2p2c/volumevariables.hh @@ -53,7 +53,8 @@ class TwoPTwoCVolumeVariables : public PorousMediumFlowVolumeVariables<TypeTag> using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); // component indices diff --git a/dumux/porousmediumflow/2pnc/volumevariables.hh b/dumux/porousmediumflow/2pnc/volumevariables.hh index 0a552fc3c005e97a1786b97a086475a6a77b2d78..ee561d319a25c48e8be6253ccbe26b9de1904c1b 100644 --- a/dumux/porousmediumflow/2pnc/volumevariables.hh +++ b/dumux/porousmediumflow/2pnc/volumevariables.hh @@ -57,7 +57,8 @@ class TwoPNCVolumeVariables : public PorousMediumFlowVolumeVariables<TypeTag> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); using PermeabilityType = typename SpatialParams::PermeabilityType; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); diff --git a/dumux/porousmediumflow/3p/volumevariables.hh b/dumux/porousmediumflow/3p/volumevariables.hh index eb5150f286b8e3a626c9e7a0c4184389a2d902a1..40121d7ddf2e00375aebc8fd3ea15532ff20929e 100644 --- a/dumux/porousmediumflow/3p/volumevariables.hh +++ b/dumux/porousmediumflow/3p/volumevariables.hh @@ -50,7 +50,8 @@ class ThreePVolumeVariables : public PorousMediumFlowVolumeVariables<TypeTag> using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); diff --git a/dumux/porousmediumflow/3p3c/localresidual.hh b/dumux/porousmediumflow/3p3c/localresidual.hh index db0361e0dbdb22d30cbea0edfa06588f1a4f9c46..fe8f616183218198b550103232a76876dd4fe6c4 100644 --- a/dumux/porousmediumflow/3p3c/localresidual.hh +++ b/dumux/porousmediumflow/3p3c/localresidual.hh @@ -43,13 +43,13 @@ class ThreePThreeCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual using Implementation = typename GET_PROP_TYPE(TypeTag, LocalResidual); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); diff --git a/dumux/porousmediumflow/3p3c/volumevariables.hh b/dumux/porousmediumflow/3p3c/volumevariables.hh index b0cd1738ef2bd320c85a71814be2efa2c216a735..6c6f96973cd5e973f51358c0fd04d3ae659be3dd 100644 --- a/dumux/porousmediumflow/3p3c/volumevariables.hh +++ b/dumux/porousmediumflow/3p3c/volumevariables.hh @@ -50,7 +50,8 @@ class ThreePThreeCVolumeVariables : public PorousMediumFlowVolumeVariables<TypeT using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); diff --git a/dumux/porousmediumflow/3pwateroil/localresidual.hh b/dumux/porousmediumflow/3pwateroil/localresidual.hh index 4bee5928de89d86274fa3af8e25bf4f3bb448723..a62a0bd42cf0ce748018d46656b3ffb61911eaad 100644 --- a/dumux/porousmediumflow/3pwateroil/localresidual.hh +++ b/dumux/porousmediumflow/3pwateroil/localresidual.hh @@ -45,13 +45,13 @@ protected: using Implementation = typename GET_PROP_TYPE(TypeTag, LocalResidual); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); diff --git a/dumux/porousmediumflow/3pwateroil/volumevariables.hh b/dumux/porousmediumflow/3pwateroil/volumevariables.hh index 433d65627026f09c96fe45890b20cc885a19eac4..805e32f29c0a1bbf2e10e5350316e659b7e59666 100644 --- a/dumux/porousmediumflow/3pwateroil/volumevariables.hh +++ b/dumux/porousmediumflow/3pwateroil/volumevariables.hh @@ -59,7 +59,8 @@ class ThreePWaterOilVolumeVariables : public PorousMediumFlowVolumeVariables<Typ using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); enum { diff --git a/dumux/porousmediumflow/co2/volumevariables.hh b/dumux/porousmediumflow/co2/volumevariables.hh index ebe4fe2cbc5fc879811aa607237b26d73972c208..0f6722cc8eb86fcdbf07f5e4e6c8067b534e648d 100644 --- a/dumux/porousmediumflow/co2/volumevariables.hh +++ b/dumux/porousmediumflow/co2/volumevariables.hh @@ -43,7 +43,8 @@ class TwoPTwoCCO2VolumeVariables : public TwoPTwoCVolumeVariables<TypeTag> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); diff --git a/dumux/porousmediumflow/compositional/localresidual.hh b/dumux/porousmediumflow/compositional/localresidual.hh index 8fcd629da655cbbab080aed8d2f41d92d46c088f..7edf93259be4c545b4dc909a6fb8441485777b0e 100644 --- a/dumux/porousmediumflow/compositional/localresidual.hh +++ b/dumux/porousmediumflow/compositional/localresidual.hh @@ -42,13 +42,13 @@ class CompositionalLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidua using Implementation = typename GET_PROP_TYPE(TypeTag, LocalResidual); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); diff --git a/dumux/porousmediumflow/compositional/primaryvariableswitch.hh b/dumux/porousmediumflow/compositional/primaryvariableswitch.hh index 789b47652b248128ce1f74cd3db828df18ffd793..275cf8780c8775a63e6ca7a5aea4596f402bd3f0 100644 --- a/dumux/porousmediumflow/compositional/primaryvariableswitch.hh +++ b/dumux/porousmediumflow/compositional/primaryvariableswitch.hh @@ -75,7 +75,8 @@ class PrimaryVariableSwitch using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); using GridVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using Element = typename GridView::template Codim<0>::Entity; diff --git a/dumux/porousmediumflow/fluxvariables.hh b/dumux/porousmediumflow/fluxvariables.hh index 2132d520c635b3c6d11f72119bdbc8c15c3f7f41..acd3f2c4ad80fbb11c6eb8d3efb707381c7854f4 100644 --- a/dumux/porousmediumflow/fluxvariables.hh +++ b/dumux/porousmediumflow/fluxvariables.hh @@ -44,8 +44,8 @@ class PorousMediumFluxVariables : public FluxVariablesBase<TypeTag> using Element = typename GridView::template Codim<0>::Entity; using IndexType = typename GridView::IndexSet::IndexType; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); diff --git a/dumux/porousmediumflow/fluxvariablescache.hh b/dumux/porousmediumflow/fluxvariablescache.hh index 51c5ae3bfac45e0b62969c96b6639984d8e28c5f..57662df20fb9661fd1d5cc89f29f4df87e46378a 100644 --- a/dumux/porousmediumflow/fluxvariablescache.hh +++ b/dumux/porousmediumflow/fluxvariablescache.hh @@ -60,9 +60,9 @@ class PorousMediumFluxVariablesCacheImplementation<TypeTag, DiscretizationMethod using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using Element = typename GridView::template Codim<0>::Entity; using IndexType = typename GridView::IndexSet::IndexType; using Stencil = std::vector<IndexType>; diff --git a/dumux/porousmediumflow/immiscible/localresidual.hh b/dumux/porousmediumflow/immiscible/localresidual.hh index 25dee78a72cc0f68e64d2f6e40343a24058c039a..b7bd6864a576769db6ae38f7893cc148270ab25a 100644 --- a/dumux/porousmediumflow/immiscible/localresidual.hh +++ b/dumux/porousmediumflow/immiscible/localresidual.hh @@ -45,9 +45,9 @@ class ImmiscibleLocalResidual : public GET_PROP_TYPE(TypeTag, BaseLocalResidual) using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using EnergyLocalResidual = typename GET_PROP_TYPE(TypeTag, EnergyLocalResidual); diff --git a/dumux/porousmediumflow/mineralization/localresidual.hh b/dumux/porousmediumflow/mineralization/localresidual.hh index 83c785ca53a5f50d0a469e01cc6e2218ca114203..97f3e17c69a2909e10f816b913a6f42e492ad580 100644 --- a/dumux/porousmediumflow/mineralization/localresidual.hh +++ b/dumux/porousmediumflow/mineralization/localresidual.hh @@ -39,7 +39,8 @@ class MineralizationLocalResidual: public CompositionalLocalResidual<TypeTag> { using ParentType = CompositionalLocalResidual<TypeTag>; using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); diff --git a/dumux/porousmediumflow/mineralization/volumevariables.hh b/dumux/porousmediumflow/mineralization/volumevariables.hh index e7d290f9c852fff45460a1f0c17e33ed2659a60f..1fe7442a3c1b01b0c8b9f4f9a719f2cf7ef30f6f 100644 --- a/dumux/porousmediumflow/mineralization/volumevariables.hh +++ b/dumux/porousmediumflow/mineralization/volumevariables.hh @@ -44,7 +44,8 @@ class MineralizationVolumeVariables : public GET_PROP_TYPE(TypeTag, NonMineraliz using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using Element = typename GridView::template Codim<0>::Entity; diff --git a/dumux/porousmediumflow/mpnc/localresidual.hh b/dumux/porousmediumflow/mpnc/localresidual.hh index 737b507b71e7c23231995d98e480a2b8192ab4a7..bf0d088680c0798396b6cd8094be7631cf0f1012 100644 --- a/dumux/porousmediumflow/mpnc/localresidual.hh +++ b/dumux/porousmediumflow/mpnc/localresidual.hh @@ -46,7 +46,7 @@ class MPNCLocalResidual : public CompositionalLocalResidual<TypeTag> { using ParentType = CompositionalLocalResidual<TypeTag>; using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); diff --git a/dumux/porousmediumflow/mpnc/volumevariables.hh b/dumux/porousmediumflow/mpnc/volumevariables.hh index 3b26164a8fc89fd3d6e1debb85a2389f8f46fb5e..b72bb4483e904b2e52427f9f9369440aecf55a32 100644 --- a/dumux/porousmediumflow/mpnc/volumevariables.hh +++ b/dumux/porousmediumflow/mpnc/volumevariables.hh @@ -55,7 +55,8 @@ class MPNCVolumeVariables using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using PermeabilityType = typename SpatialParams::PermeabilityType; using Element = typename GridView::template Codim<0>::Entity; diff --git a/dumux/porousmediumflow/nonequilibrium/localresidual.hh b/dumux/porousmediumflow/nonequilibrium/localresidual.hh index 9ef5cb22a9afc98ada9142a9647dcb609941f419..72ef5af0783ecf81816b72564aa5c69e67752963 100644 --- a/dumux/porousmediumflow/nonequilibrium/localresidual.hh +++ b/dumux/porousmediumflow/nonequilibrium/localresidual.hh @@ -48,9 +48,9 @@ class NonEquilibriumLocalResidualImplementation<TypeTag, true, false>: public GE using ParentType = typename GET_PROP_TYPE(TypeTag, EquilibriumLocalResidual); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); @@ -157,15 +157,15 @@ class NonEquilibriumLocalResidualImplementation<TypeTag, true, true>: public GET using Implementation = typename GET_PROP_TYPE(TypeTag, LocalResidual); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); diff --git a/dumux/porousmediumflow/nonequilibrium/thermal/localresidual.hh b/dumux/porousmediumflow/nonequilibrium/thermal/localresidual.hh index 12e3c7e812676b0c706cbe0620069447af20f25a..f9caee373c348e0bdf27ac901da2df52b7f4ac74 100644 --- a/dumux/porousmediumflow/nonequilibrium/thermal/localresidual.hh +++ b/dumux/porousmediumflow/nonequilibrium/thermal/localresidual.hh @@ -46,15 +46,15 @@ class EnergyLocalResidualNonEquilibrium<TypeTag, 1/*numEnergyEqFluid*/> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; enum { numEnergyEqFluid = GET_PROP_VALUE(TypeTag, NumEnergyEqFluid) }; enum { numEnergyEqSolid = GET_PROP_VALUE(TypeTag, NumEnergyEqSolid) }; @@ -315,15 +315,15 @@ class EnergyLocalResidualNonEquilibrium<TypeTag, 2 /*numEnergyEqFluid*/> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; enum { numPhases = GET_PROP_VALUE(TypeTag, NumPhases) }; enum { numEnergyEqFluid = GET_PROP_VALUE(TypeTag, NumEnergyEqFluid) }; diff --git a/dumux/porousmediumflow/nonequilibrium/volumevariables.hh b/dumux/porousmediumflow/nonequilibrium/volumevariables.hh index 7fcd4fff66c698b493b0084fc6f1f59b26146161..09c4f656bebde10e631eea5e31b9977e7f2336e3 100644 --- a/dumux/porousmediumflow/nonequilibrium/volumevariables.hh +++ b/dumux/porousmediumflow/nonequilibrium/volumevariables.hh @@ -61,7 +61,8 @@ class NonEquilibriumVolumeVariablesImplementation<TypeTag, false/*enableChemical using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Element = typename GridView::template Codim<0>::Entity; using FluidState = typename GET_PROP_TYPE(TypeTag, FluidState); @@ -103,7 +104,8 @@ class NonEquilibriumVolumeVariablesImplementation<TypeTag, /*enableChemicalNonEq using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Element = typename GridView::template Codim<0>::Entity; using FluidState = typename GET_PROP_TYPE(TypeTag, FluidState); @@ -280,7 +282,8 @@ class NonEquilibriumVolumeVariablesImplementation<TypeTag, true/*enableChemicalN using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Element = typename GridView::template Codim<0>::Entity; using FluidState = typename GET_PROP_TYPE(TypeTag, FluidState); @@ -497,7 +500,8 @@ class NonEquilibriumVolumeVariablesImplementation<TypeTag, true/*enableChemicalN using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Element = typename GridView::template Codim<0>::Entity; using FluidState = typename GET_PROP_TYPE(TypeTag, FluidState); diff --git a/dumux/porousmediumflow/nonisothermal/localresidual.hh b/dumux/porousmediumflow/nonisothermal/localresidual.hh index e89b6157f23b915d528fc24b15b536ea816e7a12..75b6aa4e496c4d063aa671b1869cdec3c901f135 100644 --- a/dumux/porousmediumflow/nonisothermal/localresidual.hh +++ b/dumux/porousmediumflow/nonisothermal/localresidual.hh @@ -46,7 +46,8 @@ class EnergyLocalResidualImplementation<TypeTag, false> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); public: @@ -109,7 +110,8 @@ class EnergyLocalResidualImplementation<TypeTag, true> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); diff --git a/dumux/porousmediumflow/richards/localresidual.hh b/dumux/porousmediumflow/richards/localresidual.hh index 7ca47e66ca7962ca93838e8333b6b014e357a64b..85f2d4af63703525e7cbad5705b67cc6e1ce989f 100644 --- a/dumux/porousmediumflow/richards/localresidual.hh +++ b/dumux/porousmediumflow/richards/localresidual.hh @@ -47,9 +47,9 @@ class RichardsLocalResidual : public GET_PROP_TYPE(TypeTag, BaseLocalResidual) using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using EnergyLocalResidual = typename GET_PROP_TYPE(TypeTag, EnergyLocalResidual); diff --git a/dumux/porousmediumflow/richards/volumevariables.hh b/dumux/porousmediumflow/richards/volumevariables.hh index d3e4a90f48f15d6e7a13a94053716fbfee4fe661..db075e63272f875eb004f3196da4efd2d05d2bcb 100644 --- a/dumux/porousmediumflow/richards/volumevariables.hh +++ b/dumux/porousmediumflow/richards/volumevariables.hh @@ -53,7 +53,8 @@ class RichardsVolumeVariables : public PorousMediumFlowVolumeVariables<TypeTag> using PermeabilityType = typename SpatialParams::PermeabilityType; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); diff --git a/dumux/porousmediumflow/richardsnc/volumevariables.hh b/dumux/porousmediumflow/richardsnc/volumevariables.hh index b8650cd8d114530f638364a0b868a2c0c8cf330c..f4b44bf96add0599e664875c275df2a113d7983c 100644 --- a/dumux/porousmediumflow/richardsnc/volumevariables.hh +++ b/dumux/porousmediumflow/richardsnc/volumevariables.hh @@ -49,7 +49,8 @@ class RichardsBaseVolumeVariables : public PorousMediumFlowVolumeVariables<TypeT using PermeabilityType = typename SpatialParams::PermeabilityType; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); @@ -312,7 +313,8 @@ class RichardsNCVolumeVariables : public RichardsBaseVolumeVariables<TypeTag> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Implementation = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); diff --git a/dumux/porousmediumflow/sequential/properties.hh b/dumux/porousmediumflow/sequential/properties.hh index 28e1cb65eaacc1a34aa55565e296491ce4c76c14..21b730f9990a7254ed25377570af3a4bc2055eaa 100644 --- a/dumux/porousmediumflow/sequential/properties.hh +++ b/dumux/porousmediumflow/sequential/properties.hh @@ -22,6 +22,7 @@ #include <dumux/common/properties.hh> #include <dumux/common/properties/model.hh> #include <dumux/common/properties/grid.hh> +#include <dumux/common/defaultmappertraits.hh> #include <dumux/porousmediumflow/sequential/gridadaptproperties.hh> #include <dumux/porousmediumflow/sequential/gridadaptinitializationindicatordefault.hh> @@ -130,6 +131,9 @@ public: static const int value = 2*dim; }; +//! A simplified grid geometry for compatibility with new style models +SET_TYPE_PROP(SequentialModel, FVGridGeometry, DefaultMapperTraits<typename GET_PROP_TYPE(TypeTag, GridView)>); + /*! * \brief Specifies the types which are assoicated with a solution. * diff --git a/dumux/porousmediumflow/tracer/localresidual.hh b/dumux/porousmediumflow/tracer/localresidual.hh index ef288636fab5651affba6829e56a7efd5828a59f..09f1fdefec77d8fb71ef407c7c547c3c18096ffb 100644 --- a/dumux/porousmediumflow/tracer/localresidual.hh +++ b/dumux/porousmediumflow/tracer/localresidual.hh @@ -44,12 +44,12 @@ class TracerLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual) using ParentType = typename GET_PROP_TYPE(TypeTag, BaseLocalResidual); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); diff --git a/dumux/porousmediumflow/tracer/volumevariables.hh b/dumux/porousmediumflow/tracer/volumevariables.hh index f31d136da520ad569bbc0c613b1fc7da0a45fa47..25896b46225864fe0074ee89c42bafb9355db42e 100644 --- a/dumux/porousmediumflow/tracer/volumevariables.hh +++ b/dumux/porousmediumflow/tracer/volumevariables.hh @@ -46,7 +46,8 @@ class TracerVolumeVariables : public PorousMediumFlowVolumeVariables<TypeTag> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Implementation = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); diff --git a/dumux/porousmediumflow/velocityoutput.hh b/dumux/porousmediumflow/velocityoutput.hh index 8443c62105c21f2e897febe820c36158e39d9e7c..39531318fa872d2c13bb7dd33b6ee4897fa4866c 100644 --- a/dumux/porousmediumflow/velocityoutput.hh +++ b/dumux/porousmediumflow/velocityoutput.hh @@ -44,9 +44,9 @@ class PorousMediumFlowVelocityOutput { using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); diff --git a/dumux/porousmediumflow/volumevariables.hh b/dumux/porousmediumflow/volumevariables.hh index c423a4b5d1269b9da6a28e4f01efe55f0c5f872b..f7e6c65015ae6e172a8fd497649cfc52570ff82b 100644 --- a/dumux/porousmediumflow/volumevariables.hh +++ b/dumux/porousmediumflow/volumevariables.hh @@ -54,7 +54,8 @@ class PorousMediumFlowVolumeVariablesImplementation<TypeTag, false> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); @@ -146,7 +147,8 @@ class PorousMediumFlowVolumeVariablesImplementation<TypeTag, true> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); diff --git a/test/discretization/box/CMakeLists.txt b/test/discretization/box/CMakeLists.txt index 767f3bf40f0407716f03df0d848e18aa862d8788..91a9d142adf257c23646ee554c5f0ad4cfe88d0f 100644 --- a/test/discretization/box/CMakeLists.txt +++ b/test/discretization/box/CMakeLists.txt @@ -1,6 +1,6 @@ dune_add_test(NAME test_boxfvgeometry SOURCES test_boxfvgeometry.cc - COMPILE_DEFINITIONS ENABLE_CACHING=false) + COMPILE_DEFINITIONS ENABLE_CACHING=false) dune_add_test(NAME test_boxfvgeometry_caching SOURCES test_boxfvgeometry.cc diff --git a/test/discretization/box/test_boxfvgeometry.cc b/test/discretization/box/test_boxfvgeometry.cc index 8be5b2b06ffc794c0b0a25e943d8ad9efd5fe6f1..570b78a8f2c17dadf8775755f3b85d2f1161dac4 100644 --- a/test/discretization/box/test_boxfvgeometry.cc +++ b/test/discretization/box/test_boxfvgeometry.cc @@ -27,53 +27,44 @@ #include <utility> #include <dune/common/test/iteratortest.hh> +#include <dune/common/fvector.hh> #include <dune/grid/utility/structuredgridfactory.hh> #include <dune/grid/yaspgrid.hh> -#include <dune/grid/common/mcmgmapper.hh> -#include <dumux/common/properties.hh> -#include <dumux/discretization/box/properties.hh> - -namespace Dumux -{ - -namespace Properties -{ -NEW_TYPE_TAG(TestBoxFVGeometry, INHERITS_FROM(BoxModel)); - -SET_TYPE_PROP(TestBoxFVGeometry, Scalar, double); -SET_TYPE_PROP(TestBoxFVGeometry, Grid, Dune::YaspGrid<3>); -SET_BOOL_PROP(TestBoxFVGeometry, EnableFVGridGeometryCache, ENABLE_CACHING); -} - -} +#include <dumux/discretization/box/fvgridgeometry.hh> +#ifndef DOXYGEN +namespace Dumux { +namespace Detail { template<class T> class NoopFunctor { public: NoopFunctor() {} void operator()(const T& t){} }; +} // end namespace Detail +} // end namespace Dumux +#endif int main (int argc, char *argv[]) try { + using namespace Dumux; + // maybe initialize mpi Dune::MPIHelper::instance(argc, argv); std::cout << "Checking the FVGeometries, SCVs and SCV faces" << std::endl; - // aliases - using TypeTag = TTAG(TestBoxFVGeometry); - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - using GridView = typename Grid::LeafGridView; + using Grid = Dune::YaspGrid<3>; - constexpr int dim = GridView::dimension; - constexpr int dimworld = GridView::dimensionworld; + constexpr int dim = Grid::dimension; + constexpr int dimworld = Grid::dimensionworld; - using GlobalPosition = Dune::FieldVector<typename GridView::ctype, dimworld>; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using GlobalPosition = Dune::FieldVector<typename Grid::ctype, dimworld>; + using FVGridGeometry = BoxFVGridGeometry<double, typename Grid::LeafGridView, ENABLE_CACHING>; + using FVElementGeometry = typename FVGridGeometry::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; // make a grid GlobalPosition lower(0.0); @@ -94,7 +85,7 @@ int main (int argc, char *argv[]) try fvGeometry.bind(element); auto range = scvs(fvGeometry); - NoopFunctor<SubControlVolume> op; + Detail::NoopFunctor<SubControlVolume> op; if(0 != testForwardIterator(range.begin(), range.end(), op)) DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept"); @@ -104,7 +95,7 @@ int main (int argc, char *argv[]) try } auto range2 = scvfs(fvGeometry); - NoopFunctor<SubControlVolumeFace> op2; + Detail::NoopFunctor<SubControlVolumeFace> op2; if(0 != testForwardIterator(range2.begin(), range2.end(), op2)) DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept"); diff --git a/test/discretization/cellcentered/tpfa/CMakeLists.txt b/test/discretization/cellcentered/tpfa/CMakeLists.txt index f1a9818e9f789f451c2c064d6fa500827aa07d6f..74de3de84290aed94dbbdcbe2de3f1965286c029 100644 --- a/test/discretization/cellcentered/tpfa/CMakeLists.txt +++ b/test/discretization/cellcentered/tpfa/CMakeLists.txt @@ -1,15 +1,17 @@ dune_add_test(NAME test_tpfafvgeometry SOURCES test_tpfafvgeometry.cc - COMMAND ./test_tpfafvgeometry) + COMPILE_DEFINITIONS ENABLE_CACHING=false) + +dune_add_test(NAME test_tpfafvgeometry_caching + SOURCES test_tpfafvgeometry.cc + COMPILE_DEFINITIONS ENABLE_CACHING=true) dune_add_test(NAME test_tpfafvgeometry_nonconforming SOURCES test_tpfafvgeometry_nonconforming.cc - COMPILE_DEFINITIONS TYPETAG=TestFVGeometryNonConforming - CMAKE_GUARD dune-alugrid_FOUND - COMMAND ./test_tpfafvgeometry_nonconforming) + COMPILE_DEFINITIONS ENABLE_CACHING=false + CMAKE_GUARD dune-alugrid_FOUND) dune_add_test(NAME test_cachedtpfafvgeometry_nonconforming SOURCES test_tpfafvgeometry_nonconforming.cc - COMPILE_DEFINITIONS TYPETAG=TestCachedFVGeometryNonConforming - CMAKE_GUARD dune-alugrid_FOUND - COMMAND ./test_cachedtpfafvgeometry_nonconforming) + COMPILE_DEFINITIONS ENABLE_CACHING=true + CMAKE_GUARD dune-alugrid_FOUND) diff --git a/test/discretization/cellcentered/tpfa/test_tpfafvgeometry.cc b/test/discretization/cellcentered/tpfa/test_tpfafvgeometry.cc index 87109b1cedbdae0742fd2961ed51f2b711b8a544..3f6c269c52149f759232ad118337360158545b7a 100644 --- a/test/discretization/cellcentered/tpfa/test_tpfafvgeometry.cc +++ b/test/discretization/cellcentered/tpfa/test_tpfafvgeometry.cc @@ -26,47 +26,45 @@ #include <iostream> #include <utility> +#include <dune/common/fvector.hh> #include <dune/common/test/iteratortest.hh> #include <dune/grid/utility/structuredgridfactory.hh> #include <dune/grid/yaspgrid.hh> -#include <dune/grid/common/mcmgmapper.hh> -#include <dumux/common/properties.hh> -#include <dumux/discretization/cellcentered/tpfa/properties.hh> +#include <dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh> +#ifndef DOXYGEN namespace Dumux { -namespace Properties { -NEW_TYPE_TAG(TestFVGeometry, INHERITS_FROM(CCTpfaModel)); -SET_TYPE_PROP(TestFVGeometry, Grid, Dune::YaspGrid<2>); -} // end namespace Properties -} // end namespace Dumux - +namespace Detail { template<class T> class NoopFunctor { public: NoopFunctor() {} void operator()(const T& t){} }; +} // end namespace Detail +} // end namespace Dumux +#endif int main (int argc, char *argv[]) try { + using namespace Dumux; + // maybe initialize mpi Dune::MPIHelper::instance(argc, argv); std::cout << "Checking the FVGeometries, SCVs and SCV faces" << std::endl; - // aliases - using TypeTag = TTAG(TestFVGeometry); - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - using GridView = typename Grid::LeafGridView; + using Grid = Dune::YaspGrid<2>; - constexpr int dim = GridView::dimension; - constexpr int dimworld = GridView::dimensionworld; + constexpr int dim = Grid::dimension; + constexpr int dimworld = Grid::dimensionworld; - using GlobalPosition = Dune::FieldVector<typename GridView::ctype, dimworld>; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using GlobalPosition = Dune::FieldVector<typename Grid::ctype, dimworld>; + using FVGridGeometry = CCTpfaFVGridGeometry<typename Grid::LeafGridView, ENABLE_CACHING>; + using FVElementGeometry = typename FVGridGeometry::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; // make a grid GlobalPosition lower(0.0); @@ -88,7 +86,7 @@ int main (int argc, char *argv[]) try fvGeometry.bind(element); auto range = scvs(fvGeometry); - NoopFunctor<SubControlVolume> op; + Detail::NoopFunctor<SubControlVolume> op; if(0 != testForwardIterator(range.begin(), range.end(), op)) DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept"); @@ -98,7 +96,7 @@ int main (int argc, char *argv[]) try } auto range2 = scvfs(fvGeometry); - NoopFunctor<SubControlVolumeFace> op2; + Detail::NoopFunctor<SubControlVolumeFace> op2; if(0 != testForwardIterator(range2.begin(), range2.end(), op2)) DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept"); diff --git a/test/discretization/cellcentered/tpfa/test_tpfafvgeometry_nonconforming.cc b/test/discretization/cellcentered/tpfa/test_tpfafvgeometry_nonconforming.cc index a26bb86696b947398d597df304bd9dc553d3eb2b..f20998e0c506389eab8c7dd650bcadafb293a499 100644 --- a/test/discretization/cellcentered/tpfa/test_tpfafvgeometry_nonconforming.cc +++ b/test/discretization/cellcentered/tpfa/test_tpfafvgeometry_nonconforming.cc @@ -32,26 +32,13 @@ #include <dune/grid/utility/structuredgridfactory.hh> #include <dune/alugrid/grid.hh> -#include <dune/grid/common/mcmgmapper.hh> - -#include <dumux/common/properties.hh> -#include <dumux/discretization/cellcentered/tpfa/properties.hh> - -namespace Dumux { -namespace Properties{ -//! Test without using global caching of the geometries -NEW_TYPE_TAG(TestFVGeometryNonConforming, INHERITS_FROM(CCTpfaModel)); -SET_TYPE_PROP(TestFVGeometryNonConforming, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>); - -//! Test using global geometry caching -NEW_TYPE_TAG(TestCachedFVGeometryNonConforming, INHERITS_FROM(CCTpfaModel)); -SET_TYPE_PROP(TestCachedFVGeometryNonConforming, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>); -SET_BOOL_PROP(TestCachedFVGeometryNonConforming, EnableFVGridGeometryCache, true); -} // end namespace Properties -} // end namespace Dumux +#include <dumux/adaptive/markelements.hh> +#include <dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh> +#ifndef DOXGEN namespace Dumux { +namespace Test { //! epsilon for checking direction of scvf normals constexpr double eps = 1e-6; @@ -115,27 +102,27 @@ std::string elementTypeName(const Dune::FieldVector<double, 2>& center) DUNE_THROW(Dune::InvalidStateException, "Element center position could not be interpreted."); } +} // end namespace Test } // end namespace Dumux +#endif int main (int argc, char *argv[]) try { + using namespace Dumux; + using namespace Dumux::Test; + // maybe initialize mpi Dune::MPIHelper::instance(argc, argv); std::cout << "Checking the FVGeometries, SCVs and SCV faces on a non-conforming grid" << std::endl; - using namespace Dumux; - - //! aliases - using TypeTag = TTAG(TYPETAG); - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - using GridView = typename Grid::LeafGridView; + using Grid = Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>; - constexpr int dim = GridView::dimension; - constexpr int dimworld = GridView::dimensionworld; + constexpr int dim = Grid::dimension; + constexpr int dimworld = Grid::dimensionworld; using GlobalPosition = Dune::FieldVector<typename Grid::ctype, dimworld>; - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using FVGridGeometry = CCTpfaFVGridGeometry<typename Grid::LeafGridView, ENABLE_CACHING>; //! make a grid GlobalPosition lower(0.0); @@ -145,9 +132,7 @@ int main (int argc, char *argv[]) try //! refine the central element once auto leafGridView = grid->leafGridView(); - for (const auto& element : elements(leafGridView)) - if (isInCentralElement(element.geometry().center())) - grid->mark(1, element); + markElements(*grid, [&](const auto& e){ return isInCentralElement(e.geometry().center()) ? 1 : 0; }); grid->preAdapt(); grid->adapt(); grid->postAdapt(); diff --git a/test/discretization/staggered/test_staggered_free_flow_geometry.cc b/test/discretization/staggered/test_staggered_free_flow_geometry.cc index 253d3d6b946fc73d91f4bea1a7f94bf2886aaecb..b6f72ef7a1ae7194d11dfa774e730015377984f9 100644 --- a/test/discretization/staggered/test_staggered_free_flow_geometry.cc +++ b/test/discretization/staggered/test_staggered_free_flow_geometry.cc @@ -31,85 +31,71 @@ #include <dune/grid/utility/structuredgridfactory.hh> #include <dune/grid/yaspgrid.hh> -#include <dumux/common/properties.hh> -#include <dumux/discretization/staggered/freeflow/properties.hh> - -namespace Dumux -{ - -//! Dummy flux variables class so that we can update the connectivity map -class MockFluxVariables -{ +#include <dumux/common/intersectionmapper.hh> +#include <dumux/common/defaultmappertraits.hh> +#include <dumux/discretization/cellcentered/subcontrolvolume.hh> +#include <dumux/discretization/staggered/fvelementgeometry.hh> +#include <dumux/discretization/staggered/fvgridgeometry.hh> +#include <dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh> +#include <dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh> +#include <dumux/discretization/staggered/freeflow/connectivitymap.hh> + +#ifndef DOXYGEN +namespace Dumux { +namespace Detail { +template<class T> +class NoopFunctor { public: - - template<class Map, class Element, class FvGeometry, class Scvf> - void computeCellCenterToCellCenterStencil(Map& map, - const Element& element, - const FvGeometry& fvGeometry, - const Scvf& scvf) - {} - - template<class Map, class Element, class FvGeometry, class Scvf> - void computeCellCenterToFaceStencil(Map& map, - const Element& element, - const FvGeometry& fvGeometry, - const Scvf& scvf) - {} - - template<class Map, class FvGeometry, class Scvf> - void computeFaceToCellCenterStencil(Map& map, - const FvGeometry& fvGeometry, - const Scvf& scvf) - {} - - template<class Map, class FvGeometry, class Scvf> - void computeFaceToFaceStencil(Map& map, - const FvGeometry& fvGeometry, - const Scvf& scvf) - {} - + NoopFunctor() {} + void operator()(const T& t){} }; +} // end namespace Detail - -namespace Properties +//! the fv grid geometry traits for this test +template<class GridView> +struct TestFVGGTraits : public DefaultMapperTraits<GridView> { -NEW_TYPE_TAG(TestStaggeredFreeFlowGeometry, INHERITS_FROM(StaggeredFreeFlowModel)); - -SET_TYPE_PROP(TestStaggeredFreeFlowGeometry, Grid, Dune::YaspGrid<2>); + using SubControlVolume = CCSubControlVolume<GridView>; + using SubControlVolumeFace = FreeFlowStaggeredSubControlVolumeFace<GridView>; + using IntersectionMapper = ConformingGridIntersectionMapper<GridView>; + using GeometryHelper = FreeFlowStaggeredGeometryHelper<GridView>; -SET_TYPE_PROP(TestStaggeredFreeFlowGeometry, FluxVariables, MockFluxVariables); - -SET_BOOL_PROP(TestStaggeredFreeFlowGeometry, EnableFVGridGeometryCache, true); -} + struct DofTypeIndices + { + using CellCenterIdx = Dune::index_constant<0>; + using FaceIdx = Dune::index_constant<1>; + }; -} + template<class FVGridGeometry> + using ConnectivityMap = StaggeredFreeFlowConnectivityMap<FVGridGeometry, DofTypeIndices>; -template<class T> -class NoopFunctor { -public: - NoopFunctor() {} - void operator()(const T& t){} + template<class FVGridGeometry, bool enableCache> + using LocalView = StaggeredFVElementGeometry<FVGridGeometry, enableCache>; }; +} // end namespace Dumux +#endif + int main (int argc, char *argv[]) try { + using namespace Dumux; + // maybe initialize mpi Dune::MPIHelper::instance(argc, argv); std::cout << "Checking the FVGeometries, SCVs and SCV faces" << std::endl; - // aliases - using TypeTag = TTAG(TestStaggeredFreeFlowGeometry); - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - using GridView = typename Grid::LeafGridView; + using Grid = Dune::YaspGrid<2>; - constexpr int dim = GridView::dimension; - constexpr int dimworld = GridView::dimensionworld; + constexpr int dim = Grid::dimension; + constexpr int dimworld = Grid::dimensionworld; - using GlobalPosition = typename Dune::FieldVector<Grid::ctype, dimworld>; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using GlobalPosition = Dune::FieldVector<typename Grid::ctype, dimworld>; + using FVGridGeometry = StaggeredFVGridGeometry<typename Grid::LeafGridView, /*enable caching=*/ true, + TestFVGGTraits<typename Grid::LeafGridView> >; + using FVElementGeometry = typename FVGridGeometry::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; // make a grid GlobalPosition lower(0.0); @@ -140,7 +126,7 @@ int main (int argc, char *argv[]) try fvGeometry.bind(element); auto range = scvs(fvGeometry); - NoopFunctor<SubControlVolume> op; + Detail::NoopFunctor<SubControlVolume> op; if(0 != testForwardIterator(range.begin(), range.end(), op)) DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept"); @@ -150,7 +136,7 @@ int main (int argc, char *argv[]) try } auto range2 = scvfs(fvGeometry); - NoopFunctor<SubControlVolumeFace> op2; + Detail::NoopFunctor<SubControlVolumeFace> op2; if(0 != testForwardIterator(range2.begin(), range2.end(), op2)) DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept"); diff --git a/test/discretization/staggered/test_staggeredfvgeometry.cc b/test/discretization/staggered/test_staggeredfvgeometry.cc index 14827323bd3fc34e01faa2a7f26eaa76164b2791..7191b03face3b32cb762ad033f303e8901f05351 100644 --- a/test/discretization/staggered/test_staggeredfvgeometry.cc +++ b/test/discretization/staggered/test_staggeredfvgeometry.cc @@ -31,60 +31,68 @@ #include <dune/grid/utility/structuredgridfactory.hh> #include <dune/grid/yaspgrid.hh> -#include <dumux/common/properties.hh> -#include <dumux/discretization/staggered/properties.hh> - -namespace Dumux -{ - -//! Dummy connectivity map, required by FVGridGeometry -class MockConnectivityMap -{ +#include <dumux/common/intersectionmapper.hh> +#include <dumux/common/defaultmappertraits.hh> +#include <dumux/discretization/cellcentered/subcontrolvolume.hh> +#include <dumux/discretization/staggered/fvelementgeometry.hh> +#include <dumux/discretization/staggered/fvgridgeometry.hh> +#include <dumux/discretization/staggered/subcontrolvolumeface.hh> + +#ifndef DOXYGEN +namespace Dumux { +namespace Detail { +template<class T> +class NoopFunctor { public: - template<class FVGridGeometry> - void update(const FVGridGeometry& fvGridGeometry) - {} + NoopFunctor() {} + void operator()(const T& t){} }; +} // end namespace Detail -namespace Properties +//! the fv grid geometry traits for this test +template<class GridView> +struct TestFVGGTraits : public DefaultMapperTraits<GridView> { -NEW_TYPE_TAG(TestFVGeometry, INHERITS_FROM(StaggeredModel)); - -SET_TYPE_PROP(TestFVGeometry, Grid, Dune::YaspGrid<2>); - -SET_TYPE_PROP(TestFVGeometry, AssemblyMap, MockConnectivityMap); + using SubControlVolume = CCSubControlVolume<GridView>; + using SubControlVolumeFace = StaggeredSubControlVolumeFace<GridView>; + using IntersectionMapper = ConformingGridIntersectionMapper<GridView>; + using GeometryHelper = BaseStaggeredGeometryHelper<GridView>; -SET_BOOL_PROP(TestFVGeometry, EnableFVGridGeometryCache, true); -} + //! Dummy connectivity map, required by FVGridGeometry + template<class FVGridGeometry> + struct MockConnectivityMap + { void update(const FVGridGeometry& fvGridGeometry) {} }; -} + template<class FVGridGeometry> + using ConnectivityMap = MockConnectivityMap<FVGridGeometry>; -template<class T> -class NoopFunctor { -public: - NoopFunctor() {} - void operator()(const T& t){} + template<class FVGridGeometry, bool enableCache> + using LocalView = StaggeredFVElementGeometry<FVGridGeometry, enableCache>; }; +} // end namespace Dumux +#endif + int main (int argc, char *argv[]) try { + using namespace Dumux; + // maybe initialize mpi Dune::MPIHelper::instance(argc, argv); std::cout << "Checking the FVGeometries, SCVs and SCV faces" << std::endl; - // aliases - using TypeTag = TTAG(TestFVGeometry); - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - using GridView = typename Grid::LeafGridView; + using Grid = Dune::YaspGrid<2>; - constexpr int dim = GridView::dimension; - constexpr int dimworld = GridView::dimensionworld; + constexpr int dim = Grid::dimension; + constexpr int dimworld = Grid::dimensionworld; using GlobalPosition = typename Dune::FieldVector<Grid::ctype, dimworld>; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using FVGridGeometry = StaggeredFVGridGeometry<typename Grid::LeafGridView, /*enable caching=*/ true, + TestFVGGTraits<typename Grid::LeafGridView> >; + using FVElementGeometry = typename FVGridGeometry::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; // make a grid GlobalPosition lower(0.0); @@ -105,7 +113,7 @@ int main (int argc, char *argv[]) try fvGeometry.bind(element); auto range = scvs(fvGeometry); - NoopFunctor<SubControlVolume> op; + Detail::NoopFunctor<SubControlVolume> op; if(0 != testForwardIterator(range.begin(), range.end(), op)) DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept"); @@ -115,7 +123,7 @@ int main (int argc, char *argv[]) try } auto range2 = scvfs(fvGeometry); - NoopFunctor<SubControlVolumeFace> op2; + Detail::NoopFunctor<SubControlVolumeFace> op2; if(0 != testForwardIterator(range2.begin(), range2.end(), op2)) DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept"); diff --git a/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh b/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh index 25670344271c4551efaa2218fbd9d7c7bfd6c0fa..8356ddee48b8ad5dd52eb33f0c963719e8c2b093 100644 --- a/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh +++ b/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh @@ -99,8 +99,8 @@ class OnePNIConvectionProblem : public PorousMediumFlowProblem<TypeTag> using ParentType = PorousMediumFlowProblem<TypeTag>; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); diff --git a/test/porousmediumflow/1p/implicit/1ptestspatialparams.hh b/test/porousmediumflow/1p/implicit/1ptestspatialparams.hh index 27b1780e7fe72d958efee7237f6257ee6bab7057..cf87b002556f23476593fc705ff4354ed1b3414c 100644 --- a/test/porousmediumflow/1p/implicit/1ptestspatialparams.hh +++ b/test/porousmediumflow/1p/implicit/1ptestspatialparams.hh @@ -54,9 +54,9 @@ class OnePTestSpatialParams : public FVSpatialParamsOneP<TypeTag> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using IndexSet = typename GridView::IndexSet; - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); enum { dim=GridView::dimension, @@ -121,6 +121,7 @@ public: * * \param gridView The GridView used by the problem */ + template<class FVGridGeometry> void initRandomField(const FVGridGeometry& gg) { const auto& gridView = gg.gridView(); diff --git a/test/porousmediumflow/1p/implicit/compressible/spatialparams.hh b/test/porousmediumflow/1p/implicit/compressible/spatialparams.hh index 536e058674ec8316df1cabf5308cf4bbd461c1bf..94a6a0f1d2b236ee95e9501d3fdc0dd284035909 100644 --- a/test/porousmediumflow/1p/implicit/compressible/spatialparams.hh +++ b/test/porousmediumflow/1p/implicit/compressible/spatialparams.hh @@ -42,7 +42,8 @@ class OnePTestSpatialParams : public FVSpatialParamsOneP<TypeTag> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); static constexpr int dimWorld = GridView::dimensionworld; diff --git a/test/porousmediumflow/1p/implicit/incompressible/spatialparams.hh b/test/porousmediumflow/1p/implicit/incompressible/spatialparams.hh index fbb7fad7871cf79d7c00feff99fb7c4f520fe575..f406d50aca6369c10b1aaf93dcc175897c8bed34 100644 --- a/test/porousmediumflow/1p/implicit/incompressible/spatialparams.hh +++ b/test/porousmediumflow/1p/implicit/incompressible/spatialparams.hh @@ -42,7 +42,8 @@ class OnePTestSpatialParams : public FVSpatialParamsOneP<TypeTag> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); static constexpr int dimWorld = GridView::dimensionworld; diff --git a/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblemtimedependent.hh b/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblemtimedependent.hh index dccf3d9f19ffe5cb5d415bcee70dd606b23dd342..0ae5be43708f1076e6225fc9a8adcb9085beb03d 100644 --- a/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblemtimedependent.hh +++ b/test/porousmediumflow/1p/implicit/pointsources/1psingularityproblemtimedependent.hh @@ -68,9 +68,9 @@ class OnePSingularityProblemTimeDependent : public OnePSingularityProblem<TypeTa using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); public: diff --git a/test/porousmediumflow/1p/implicit/pointsources/1psingularityspatialparams.hh b/test/porousmediumflow/1p/implicit/pointsources/1psingularityspatialparams.hh index 8f44623a79d07639def22d3d2244cf9fe97ac3d0..96cfdf489e8eac60393f3abdf1782a7f097707fc 100644 --- a/test/porousmediumflow/1p/implicit/pointsources/1psingularityspatialparams.hh +++ b/test/porousmediumflow/1p/implicit/pointsources/1psingularityspatialparams.hh @@ -40,10 +40,11 @@ class OnePSingularitySpatialParams : public FVSpatialParamsOneP<TypeTag> { using ParentType = FVSpatialParamsOneP<TypeTag>; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); + using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; public: @@ -65,9 +66,9 @@ public: * \param elemSol The element solution vector * \return the intrinsic permeability */ - Scalar permeability(const Element& element, - const SubControlVolume& scv, - const ElementSolutionVector& elemSol) const + PermeabilityType permeability(const Element& element, + const SubControlVolume& scv, + const ElementSolutionVector& elemSol) const { return permeability_; } diff --git a/test/porousmediumflow/1p/implicit/tubesproblem.hh b/test/porousmediumflow/1p/implicit/tubesproblem.hh index 95db66e019e7410ebe3acb70634355a8d84b5547..85c835e47188489e0a5909f825edb9334c733c85 100644 --- a/test/porousmediumflow/1p/implicit/tubesproblem.hh +++ b/test/porousmediumflow/1p/implicit/tubesproblem.hh @@ -96,8 +96,8 @@ class TubesTestProblem : public PorousMediumFlowProblem<TypeTag> using Element = typename GridView::template Codim<0>::Entity; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; enum { isBox = GET_PROP_VALUE(TypeTag, DiscretizationMethod) == DiscretizationMethods::Box }; diff --git a/test/porousmediumflow/1p/implicit/tubesspatialparams.hh b/test/porousmediumflow/1p/implicit/tubesspatialparams.hh index 5cf7a8ecdd280f366d7c6b3463cc1f539cadb8a5..a1182288d8037a27378bd24f9b693147bfc594b2 100644 --- a/test/porousmediumflow/1p/implicit/tubesspatialparams.hh +++ b/test/porousmediumflow/1p/implicit/tubesspatialparams.hh @@ -40,10 +40,11 @@ class TubesTestSpatialParams : public FVSpatialParamsOneP<TypeTag> { using ParentType = FVSpatialParamsOneP<TypeTag>; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); + using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; public: diff --git a/test/porousmediumflow/1pnc/implicit/1p2cniconvectionproblem.hh b/test/porousmediumflow/1pnc/implicit/1p2cniconvectionproblem.hh index 144c31a511bfb26a6cd56a60f7227db4198c5477..475fcec9f57877a53ca836dcdf8505827b732ea7 100644 --- a/test/porousmediumflow/1pnc/implicit/1p2cniconvectionproblem.hh +++ b/test/porousmediumflow/1pnc/implicit/1p2cniconvectionproblem.hh @@ -107,10 +107,10 @@ class OnePTwoCNIConvectionProblem : public PorousMediumFlowProblem<TypeTag> using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Element = typename GridView::template Codim<0>::Entity; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); diff --git a/test/porousmediumflow/1pnc/implicit/1p2ctestproblem.hh b/test/porousmediumflow/1pnc/implicit/1p2ctestproblem.hh index f3e452ffc6e775923ed7f848218d964b09322538..555f3e24193187e6b44f9c6e476efad1a9ec74df 100644 --- a/test/porousmediumflow/1pnc/implicit/1p2ctestproblem.hh +++ b/test/porousmediumflow/1pnc/implicit/1p2ctestproblem.hh @@ -108,10 +108,10 @@ class OnePTwoCTestProblem : public PorousMediumFlowProblem<TypeTag> using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Element = typename GridView::template Codim<0>::Entity; diff --git a/test/porousmediumflow/1pnc/implicit/1pnctestspatialparams.hh b/test/porousmediumflow/1pnc/implicit/1pnctestspatialparams.hh index 7eed0a87f309b93a83c33d4e0224266c8e859c99..0004c18f413ac2c2a28c43fd275e40b1e91cb925 100644 --- a/test/porousmediumflow/1pnc/implicit/1pnctestspatialparams.hh +++ b/test/porousmediumflow/1pnc/implicit/1pnctestspatialparams.hh @@ -43,7 +43,8 @@ class OnePNCTestSpatialParams : public FVSpatialParamsOneP<TypeTag> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); static const int dimWorld = GridView::dimensionworld; diff --git a/test/porousmediumflow/1pncmin/implicit/thermochemproblem.hh b/test/porousmediumflow/1pncmin/implicit/thermochemproblem.hh index ec74493fdf0052035fed487014d762aed2af5a78..c72e474f658c7a7ef308d019f17df9445fa72b9c 100644 --- a/test/porousmediumflow/1pncmin/implicit/thermochemproblem.hh +++ b/test/porousmediumflow/1pncmin/implicit/thermochemproblem.hh @@ -93,9 +93,9 @@ class ThermoChemProblem : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);; using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); diff --git a/test/porousmediumflow/1pncmin/implicit/thermochemspatialparams.hh b/test/porousmediumflow/1pncmin/implicit/thermochemspatialparams.hh index 30dbfe70b02b9b324dc8b783527ac0663eb2f65d..856a0d8590f9ed80f69440147f1587df44d28215 100644 --- a/test/porousmediumflow/1pncmin/implicit/thermochemspatialparams.hh +++ b/test/porousmediumflow/1pncmin/implicit/thermochemspatialparams.hh @@ -76,7 +76,8 @@ class ThermoChemSpatialParams : public FVSpatialParamsOneP<TypeTag> hPhaseIdx = FluidSystem::hPhaseIdx }; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using Element = typename GridView::template Codim<0>::Entity; using PorosityLaw = PorosityReactiveBed<TypeTag>; diff --git a/test/porousmediumflow/2p/implicit/incompressible/spatialparams.hh b/test/porousmediumflow/2p/implicit/incompressible/spatialparams.hh index ddba9968fd7ee529761e94b127e88907352d465e..788956c9fb7582f49ae01a00bd21a78d27f80589 100644 --- a/test/porousmediumflow/2p/implicit/incompressible/spatialparams.hh +++ b/test/porousmediumflow/2p/implicit/incompressible/spatialparams.hh @@ -69,7 +69,8 @@ class TwoPTestSpatialParams : public FVSpatialParams<TypeTag> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); using MaterialLawParams = typename MaterialLaw::Params; diff --git a/test/porousmediumflow/2p/implicit/nonisothermal/problem.hh b/test/porousmediumflow/2p/implicit/nonisothermal/problem.hh index 65c935f1ac588643984535dd0c84161cec9fa5cd..0fc40e9725cbbc82af3824971fc8a0f266155e58 100644 --- a/test/porousmediumflow/2p/implicit/nonisothermal/problem.hh +++ b/test/porousmediumflow/2p/implicit/nonisothermal/problem.hh @@ -126,8 +126,8 @@ class InjectionProblem2PNI : public PorousMediumFlowProblem<TypeTag> using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); diff --git a/test/porousmediumflow/2p1c/implicit/steaminjectionproblem.hh b/test/porousmediumflow/2p1c/implicit/steaminjectionproblem.hh index e7fc0be088c508778a4a75a237dcf9ccbfddae8a..b8b515e9d5633330a6f3e7b8d11ca3c55428ad56 100644 --- a/test/porousmediumflow/2p1c/implicit/steaminjectionproblem.hh +++ b/test/porousmediumflow/2p1c/implicit/steaminjectionproblem.hh @@ -88,9 +88,9 @@ class InjectionProblem : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using Sources = typename GET_PROP_TYPE(TypeTag, NumEqVector); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/2p1c/implicit/steaminjectionspatialparams.hh b/test/porousmediumflow/2p1c/implicit/steaminjectionspatialparams.hh index 8cd1624e81b8abdb1e54fcb0b89679eec4c6be35..a141a789cf55147f7d5c84a2cce1846b780fc2db 100644 --- a/test/porousmediumflow/2p1c/implicit/steaminjectionspatialparams.hh +++ b/test/porousmediumflow/2p1c/implicit/steaminjectionspatialparams.hh @@ -73,7 +73,8 @@ class InjectionProblemSpatialParams : public FVSpatialParams<TypeTag> using MaterialLawParams = typename MaterialLaw::Params; using CoordScalar = typename GridView::ctype; using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); static constexpr int dimWorld = GridView::dimensionworld; diff --git a/test/porousmediumflow/2p2c/implicit/injectionproblem.hh b/test/porousmediumflow/2p2c/implicit/injectionproblem.hh index b8ecdbfd61f5724df464cadd9db4fb7ce14d7f70..1dffdf9e509488840c3c11afb6c738748e7daf24 100644 --- a/test/porousmediumflow/2p2c/implicit/injectionproblem.hh +++ b/test/porousmediumflow/2p2c/implicit/injectionproblem.hh @@ -120,8 +120,8 @@ class InjectionProblem : public PorousMediumFlowProblem<TypeTag> using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; //! property that defines whether mole or mass fractions are used diff --git a/test/porousmediumflow/2p2c/implicit/waterairproblem.hh b/test/porousmediumflow/2p2c/implicit/waterairproblem.hh index 13f80251a2cf247f9eadf02af7367d5c12f2b48b..60797abd7ca220635ba1b8c47ef0ecf6e4c5d851 100644 --- a/test/porousmediumflow/2p2c/implicit/waterairproblem.hh +++ b/test/porousmediumflow/2p2c/implicit/waterairproblem.hh @@ -131,9 +131,9 @@ class WaterAirProblem : public PorousMediumFlowProblem<TypeTag> using NeumannFluxes = typename GET_PROP_TYPE(TypeTag, NumEqVector); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; diff --git a/test/porousmediumflow/2pnc/implicit/fuelcellproblem.hh b/test/porousmediumflow/2pnc/implicit/fuelcellproblem.hh index 62ce76f91eb252319499b6fab788a2bd8a6008b5..b0312a144d3d56dba9db334f3220892f4e7c2196 100644 --- a/test/porousmediumflow/2pnc/implicit/fuelcellproblem.hh +++ b/test/porousmediumflow/2pnc/implicit/fuelcellproblem.hh @@ -86,8 +86,8 @@ class FuelCellProblem : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using Sources = typename GET_PROP_TYPE(TypeTag, NumEqVector); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/2pncmin/implicit/dissolutionproblem.hh b/test/porousmediumflow/2pncmin/implicit/dissolutionproblem.hh index 73e2955087dcd87bff39e33e494e075adf712806..2779900a944ddff0a64da8eae0f3d8576c0e21fb 100644 --- a/test/porousmediumflow/2pncmin/implicit/dissolutionproblem.hh +++ b/test/porousmediumflow/2pncmin/implicit/dissolutionproblem.hh @@ -132,8 +132,8 @@ class DissolutionProblem : public PorousMediumFlowProblem<TypeTag> using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; public: diff --git a/test/porousmediumflow/2pncmin/implicit/dissolutionspatialparams.hh b/test/porousmediumflow/2pncmin/implicit/dissolutionspatialparams.hh index a258407ab5710b5d601f65e5a75d2699247bf697..30585172c1d37fd4189fade5b5c1614ce662d333 100644 --- a/test/porousmediumflow/2pncmin/implicit/dissolutionspatialparams.hh +++ b/test/porousmediumflow/2pncmin/implicit/dissolutionspatialparams.hh @@ -78,7 +78,8 @@ class DissolutionSpatialparams : public FVSpatialParams<TypeTag> using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>; using Tensor = Dune::FieldMatrix<CoordScalar, dimWorld, dimWorld>; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using Element = typename GridView::template Codim<0>::Entity; using PorosityLaw = PorosityPrecipitation<TypeTag>; diff --git a/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh b/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh index 18fd4f4d2e60f50b334ab3d98d529a548a9098c9..67a0383bcb406a9a1cfe1f5a9a1588414ff7b283 100644 --- a/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh +++ b/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh @@ -105,7 +105,7 @@ class ThreePNIConvectionProblem : public PorousMediumFlowProblem<TypeTag> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); @@ -114,7 +114,7 @@ class ThreePNIConvectionProblem : public PorousMediumFlowProblem<TypeTag> using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using IapwsH2O = H2O<Scalar>; // copy some indices for convenience diff --git a/test/porousmediumflow/3p/implicit/infiltration3pspatialparams.hh b/test/porousmediumflow/3p/implicit/infiltration3pspatialparams.hh index 13305ef00bd10fcbbd5800cff9ce5bbb5d70a0ae..56959340895fe324bd61314edcf767b222a86562 100644 --- a/test/porousmediumflow/3p/implicit/infiltration3pspatialparams.hh +++ b/test/porousmediumflow/3p/implicit/infiltration3pspatialparams.hh @@ -80,7 +80,8 @@ class InfiltrationThreePSpatialParams : public FVSpatialParams<TypeTag> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag,ElementSolutionVector); enum { dimWorld=GridView::dimensionworld }; diff --git a/test/porousmediumflow/3p3c/implicit/columnxylolproblem.hh b/test/porousmediumflow/3p3c/implicit/columnxylolproblem.hh index 691d11a59abe1023b75818df6f396e9b47498ca4..cf209daa1d78aebba636feeb8d957333b374070e 100644 --- a/test/porousmediumflow/3p3c/implicit/columnxylolproblem.hh +++ b/test/porousmediumflow/3p3c/implicit/columnxylolproblem.hh @@ -117,11 +117,11 @@ class ColumnProblem : public PorousMediumFlowProblem<TypeTag> using NeumannFluxes = typename GET_PROP_TYPE(TypeTag, NumEqVector); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GlobalPosition = Dune::FieldVector<typename GridView::ctype, dimWorld>; public: diff --git a/test/porousmediumflow/3p3c/implicit/columnxylolspatialparams.hh b/test/porousmediumflow/3p3c/implicit/columnxylolspatialparams.hh index 8144399b65bbea927db44091bd229719b9712809..f9fbe3dcfdcf97ccaf676a92d340131376045875 100644 --- a/test/porousmediumflow/3p3c/implicit/columnxylolspatialparams.hh +++ b/test/porousmediumflow/3p3c/implicit/columnxylolspatialparams.hh @@ -72,7 +72,8 @@ class ColumnSpatialParams : public FVSpatialParams<TypeTag> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); enum { dimWorld=GridView::dimensionworld }; using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GlobalPosition = Dune::FieldVector<typename GridView::ctype, dimWorld>; diff --git a/test/porousmediumflow/3p3c/implicit/infiltration3p3cspatialparams.hh b/test/porousmediumflow/3p3c/implicit/infiltration3p3cspatialparams.hh index 7d25be8faa3c60268af7bbd3a04a9283d702f3f7..8d03c0fd342524e1d883ec2bba0dd92b7322b69c 100644 --- a/test/porousmediumflow/3p3c/implicit/infiltration3p3cspatialparams.hh +++ b/test/porousmediumflow/3p3c/implicit/infiltration3p3cspatialparams.hh @@ -80,7 +80,8 @@ class InfiltrationThreePThreeCSpatialParams : public FVSpatialParams<TypeTag> enum { dimWorld=GridView::dimensionworld }; using GlobalPosition = Dune::FieldVector<typename GridView::ctype, dimWorld>; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Element = typename GridView::template Codim<0>::Entity; diff --git a/test/porousmediumflow/3p3c/implicit/kuevetteproblem.hh b/test/porousmediumflow/3p3c/implicit/kuevetteproblem.hh index 8f039f1c913a95721f8f477c502b6d0293ef3f19..63d53d14e72883c33a1b8c4a1c2292703a5ff6c1 100644 --- a/test/porousmediumflow/3p3c/implicit/kuevetteproblem.hh +++ b/test/porousmediumflow/3p3c/implicit/kuevetteproblem.hh @@ -134,11 +134,11 @@ class KuevetteProblem : public PorousMediumFlowProblem<TypeTag> using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using Element = typename GridView::template Codim<0>::Entity; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GlobalPosition = Dune::FieldVector<typename GridView::ctype, dimWorld>; public: diff --git a/test/porousmediumflow/3p3c/implicit/kuevettespatialparams.hh b/test/porousmediumflow/3p3c/implicit/kuevettespatialparams.hh index 799c2e7f19bbfe407c2b331ad81a546da3484ecf..51866119a1bc36897376fdb49a4aa1fbf47a2079 100644 --- a/test/porousmediumflow/3p3c/implicit/kuevettespatialparams.hh +++ b/test/porousmediumflow/3p3c/implicit/kuevettespatialparams.hh @@ -78,7 +78,8 @@ class KuevetteSpatialParams : public FVSpatialParams<TypeTag> enum { dimWorld=GridView::dimensionworld }; using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GlobalPosition = Dune::FieldVector<typename GridView::ctype, dimWorld>; diff --git a/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdproblem.hh b/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdproblem.hh index 9480c1e702842a7979cf56186fea5d9d1411b188..4c5ebb1f1eed245b88fe53e3c591da1cfb20e742 100644 --- a/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdproblem.hh +++ b/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdproblem.hh @@ -105,8 +105,8 @@ class SagdProblem : public PorousMediumFlowProblem<TypeTag> using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; public: diff --git a/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdspatialparams.hh b/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdspatialparams.hh index 2d47684d3dce4332109115f2449a46e64e2b830f..acee6cb5248eb75050f50f92fa4f75183732927d 100644 --- a/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdspatialparams.hh +++ b/test/porousmediumflow/3pwateroil/implicit/3pwateroilsagdspatialparams.hh @@ -80,7 +80,8 @@ class SagdSpatialParams : public FVSpatialParams<TypeTag> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); using MaterialLawParams = typename MaterialLaw::Params; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; enum { dimWorld=GridView::dimensionworld }; using CoordScalar = typename Grid::ctype; diff --git a/test/porousmediumflow/co2/implicit/heterogeneousproblem.hh b/test/porousmediumflow/co2/implicit/heterogeneousproblem.hh index fb81046f79ef8c9eb0c7efbd960875a7fd854990..e5bd91d321a65647e15f7df6a6652a3f11835aba 100644 --- a/test/porousmediumflow/co2/implicit/heterogeneousproblem.hh +++ b/test/porousmediumflow/co2/implicit/heterogeneousproblem.hh @@ -157,9 +157,9 @@ class HeterogeneousProblem : public PorousMediumFlowProblem<TypeTag> using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using Element = typename GridView::template Codim<0>::Entity; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; using CO2 = Dumux::CO2<Scalar, HeterogeneousCO2Tables::CO2Tables>; diff --git a/test/porousmediumflow/co2/implicit/heterogeneousspatialparameters.hh b/test/porousmediumflow/co2/implicit/heterogeneousspatialparameters.hh index 43eedaa0a1493ffa829e8e54e7bce04494daebed..b8c43dfbb4969857d320026a5dc5ec3c84e65853 100644 --- a/test/porousmediumflow/co2/implicit/heterogeneousspatialparameters.hh +++ b/test/porousmediumflow/co2/implicit/heterogeneousspatialparameters.hh @@ -81,8 +81,8 @@ class HeterogeneousSpatialParams : public FVSpatialParams<TypeTag> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); diff --git a/test/porousmediumflow/mpnc/implicit/combustionproblem1c.hh b/test/porousmediumflow/mpnc/implicit/combustionproblem1c.hh index 4a5df4cf5ffab43e5c9b31dba9feda76a88b30cd..b67d06fe2339e04db3654f62459fc6dde7f8ba61 100644 --- a/test/porousmediumflow/mpnc/implicit/combustionproblem1c.hh +++ b/test/porousmediumflow/mpnc/implicit/combustionproblem1c.hh @@ -118,9 +118,9 @@ class CombustionProblemOneComponent: public PorousMediumFlowProblem<TypeTag> using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/mpnc/implicit/combustionspatialparams.hh b/test/porousmediumflow/mpnc/implicit/combustionspatialparams.hh index 47a35710b34c2c56d654eaea5afc914bea739bdf..47cc7d6f649bde84948992ed61b47054d82ba1a2 100644 --- a/test/porousmediumflow/mpnc/implicit/combustionspatialparams.hh +++ b/test/porousmediumflow/mpnc/implicit/combustionspatialparams.hh @@ -82,7 +82,8 @@ class CombustionSpatialParams : public FVSpatialParams<TypeTag> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); using MaterialLawParams = typename MaterialLaw::Params; diff --git a/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh b/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh index 42a2d233e2e3163b40d8ecf08b9d133cd5198ba0..6205c76f098ebd45f3a0b3459a598955e07eaeae 100644 --- a/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh +++ b/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh @@ -106,9 +106,9 @@ class EvaporationAtmosphereProblem: public PorousMediumFlowProblem<TypeTag> using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/mpnc/implicit/evaporationatmospherespatialparams.hh b/test/porousmediumflow/mpnc/implicit/evaporationatmospherespatialparams.hh index 2a5b031a6eb06031123eb97f2727c993f65f9148..6ace49f6a1192dd590ae8cb848741d38526208b9 100644 --- a/test/porousmediumflow/mpnc/implicit/evaporationatmospherespatialparams.hh +++ b/test/porousmediumflow/mpnc/implicit/evaporationatmospherespatialparams.hh @@ -155,7 +155,8 @@ class EvaporationAtmosphereSpatialParams : public FVSpatialParams<TypeTag> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); using MaterialLawParams = typename MaterialLaw::Params; diff --git a/test/porousmediumflow/mpnc/implicit/obstacleproblem.hh b/test/porousmediumflow/mpnc/implicit/obstacleproblem.hh index 57d785033e30180a273f81492fa66569519c500b..66a856afc9b4f9cb58bf4b90ba9c1f16ef0bb317 100644 --- a/test/porousmediumflow/mpnc/implicit/obstacleproblem.hh +++ b/test/porousmediumflow/mpnc/implicit/obstacleproblem.hh @@ -114,9 +114,9 @@ class ObstacleProblem using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); diff --git a/test/porousmediumflow/mpnc/implicit/obstaclespatialparams.hh b/test/porousmediumflow/mpnc/implicit/obstaclespatialparams.hh index dba91bcb03c357099f341ca9009c297ec9c2e91f..7e76fb9a212cb0daf61b7eb8f1061a17cdf1948d 100644 --- a/test/porousmediumflow/mpnc/implicit/obstaclespatialparams.hh +++ b/test/porousmediumflow/mpnc/implicit/obstaclespatialparams.hh @@ -79,7 +79,8 @@ class ObstacleSpatialParams : public FVSpatialParams<TypeTag> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); using MaterialLawParams = typename MaterialLaw::Params; diff --git a/test/porousmediumflow/mpnc/implicit/plotoverline2d.hh b/test/porousmediumflow/mpnc/implicit/plotoverline2d.hh index 0b112a69132db2be63f18ddafeb9408e4b79de2e..88f3fbcc53ce0dc78ca63bdc65fef65f4fefa1da 100644 --- a/test/porousmediumflow/mpnc/implicit/plotoverline2d.hh +++ b/test/porousmediumflow/mpnc/implicit/plotoverline2d.hh @@ -63,7 +63,7 @@ class PlotOverLine2D using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using DofMapper = typename GET_PROP_TYPE(TypeTag, DofMapper); using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); diff --git a/test/porousmediumflow/richards/implicit/richardsniconvectionproblem.hh b/test/porousmediumflow/richards/implicit/richardsniconvectionproblem.hh index 76949884f2bc24a2df4cbb80aef70db38dfdbaa7..ed504f860435111802c2fd8b4089e591541e5d18 100644 --- a/test/porousmediumflow/richards/implicit/richardsniconvectionproblem.hh +++ b/test/porousmediumflow/richards/implicit/richardsniconvectionproblem.hh @@ -102,7 +102,7 @@ class RichardsNIConvectionProblem : public PorousMediumFlowProblem<TypeTag> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); @@ -112,7 +112,7 @@ class RichardsNIConvectionProblem : public PorousMediumFlowProblem<TypeTag> using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using IapwsH2O = H2O<Scalar>; // copy some indices for convenience diff --git a/test/porousmediumflow/richardsnc/implicit/richardswelltracerproblem.hh b/test/porousmediumflow/richardsnc/implicit/richardswelltracerproblem.hh index c24e033026455c8a5ab8061b87e1933f37b08531..496f2af5d5b40a67a8a7f28af60a995141a8d600 100644 --- a/test/porousmediumflow/richardsnc/implicit/richardswelltracerproblem.hh +++ b/test/porousmediumflow/richardsnc/implicit/richardswelltracerproblem.hh @@ -96,9 +96,9 @@ class RichardsWellTracerProblem : public PorousMediumFlowProblem<TypeTag> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using PointSource = typename GET_PROP_TYPE(TypeTag, PointSource); diff --git a/test/porousmediumflow/tracer/1ptracer/1ptestproblem.hh b/test/porousmediumflow/tracer/1ptracer/1ptestproblem.hh index 2720ee0ccee4ec4ddcb87ce101ac8da8305cca3e..338747d1306b21a60f7eacd28ebe30e22db8e6cd 100644 --- a/test/porousmediumflow/tracer/1ptracer/1ptestproblem.hh +++ b/test/porousmediumflow/tracer/1ptracer/1ptestproblem.hh @@ -77,7 +77,8 @@ class OnePTestProblem : public PorousMediumFlowProblem<TypeTag> using Element = typename GridView::template Codim<0>::Entity; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); diff --git a/test/porousmediumflow/tracer/1ptracer/1ptestspatialparams.hh b/test/porousmediumflow/tracer/1ptracer/1ptestspatialparams.hh index d7b982bafb1e7f3a1dd7a3e309fb5dcbb68ed5c3..eb8768eed1176c5c3c0f60c6266d3212e432f835 100644 --- a/test/porousmediumflow/tracer/1ptracer/1ptestspatialparams.hh +++ b/test/porousmediumflow/tracer/1ptracer/1ptestspatialparams.hh @@ -41,7 +41,8 @@ class OnePTestSpatialParams : public FVSpatialParamsOneP<TypeTag> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); static constexpr int dimWorld = GridView::dimensionworld; diff --git a/test/porousmediumflow/tracer/1ptracer/test_cctracer.cc b/test/porousmediumflow/tracer/1ptracer/test_cctracer.cc index 3d31d2283989c6cf1e2a0d782850c2c3189b0e1e..9c5cb8cd661aba3136dacc65383c192abe3ec62d 100644 --- a/test/porousmediumflow/tracer/1ptracer/test_cctracer.cc +++ b/test/porousmediumflow/tracer/1ptracer/test_cctracer.cc @@ -33,13 +33,10 @@ #include <dune/common/timer.hh> #include <dune/grid/io/file/dgfparser/dgfexception.hh> #include <dune/grid/io/file/vtk.hh> -#include <dune/istl/io.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/valgrind.hh> #include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> #include <dumux/linear/seqsolverbackend.hh> #include <dumux/nonlinear/newtonmethod.hh> @@ -49,7 +46,7 @@ #include <dumux/io/vtkoutputmodule.hh> -int main(int argc, char** argv) +int main(int argc, char** argv) try { using namespace Dumux; @@ -92,13 +89,13 @@ int main(int argc, char** argv) //////////////////////////////////////////////////////////// //! create the finite volume grid geometry - using OnePFVGridGeometry = typename GET_PROP_TYPE(OnePTypeTag, FVGridGeometry); - auto onePFvGridGeometry = std::make_shared<OnePFVGridGeometry>(leafGridView); - onePFvGridGeometry->update(); + using FVGridGeometry = typename GET_PROP_TYPE(OnePTypeTag, FVGridGeometry); + auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); + fvGridGeometry->update(); //! the problem (boundary conditions) using OnePProblem = typename GET_PROP_TYPE(OnePTypeTag, Problem); - auto problemOneP = std::make_shared<OnePProblem>(onePFvGridGeometry); + auto problemOneP = std::make_shared<OnePProblem>(fvGridGeometry); //! the solution vector using JacobianMatrix = typename GET_PROP_TYPE(OnePTypeTag, JacobianMatrix); @@ -111,12 +108,12 @@ int main(int argc, char** argv) //! the grid variables using OnePGridVariables = typename GET_PROP_TYPE(OnePTypeTag, GridVariables); - auto onePGridVariables = std::make_shared<OnePGridVariables>(problemOneP, onePFvGridGeometry); + auto onePGridVariables = std::make_shared<OnePGridVariables>(problemOneP, fvGridGeometry); onePGridVariables->init(p); //! the assembler using OnePAssembler = FVAssembler<OnePTypeTag, DiffMethod::analytic>; - auto assemblerOneP = std::make_shared<OnePAssembler>(problemOneP, onePFvGridGeometry, onePGridVariables); + auto assemblerOneP = std::make_shared<OnePAssembler>(problemOneP, fvGridGeometry, onePGridVariables); assemblerOneP->setLinearSystem(A, r); Dune::Timer timer; @@ -159,13 +156,13 @@ int main(int argc, char** argv) // compute volume fluxes for the tracer model //////////////////////////////////////////////////////////// using Scalar = typename GET_PROP_TYPE(OnePTypeTag, Scalar); - std::vector<Scalar> volumeFlux(onePFvGridGeometry->numScvf(), 0.0); + std::vector<Scalar> volumeFlux(fvGridGeometry->numScvf(), 0.0); using FluxVariables = typename GET_PROP_TYPE(OnePTypeTag, FluxVariables); auto upwindTerm = [](const auto& volVars) { return volVars.mobility(0); }; for (const auto& element : elements(leafGridView)) { - auto fvGeometry = localView(*onePFvGridGeometry); + auto fvGeometry = localView(*fvGridGeometry); fvGeometry.bind(element); auto elemVolVars = localView(onePGridVariables->curGridVolVars()); @@ -201,11 +198,6 @@ int main(int argc, char** argv) // setup & solve tracer problem on the same grid //////////////////////////////////////////////////////////// - //! create the finite volume grid geometry - using TracerFVGridGeometry = typename GET_PROP_TYPE(TracerTypeTag, FVGridGeometry); - auto fvGridGeometry = std::make_shared<TracerFVGridGeometry>(leafGridView); - fvGridGeometry->update(); - //! the problem (initial and boundary conditions) using TracerProblem = typename GET_PROP_TYPE(TracerTypeTag, Problem); auto tracerProblem = std::make_shared<TracerProblem>(fvGridGeometry); @@ -311,4 +303,28 @@ int main(int argc, char** argv) return 0; -} // end main +} +catch (Dumux::ParameterException &e) +{ + std::cerr << std::endl << e << " ---> Abort!" << std::endl; + return 1; +} +catch (Dune::DGFException & e) +{ + std::cerr << "DGF exception thrown (" << e << + "). Most likely, the DGF file name is wrong " + "or the DGF file is corrupted, " + "e.g. missing hash at end of file or wrong number (dimensions) of entries." + << " ---> Abort!" << std::endl; + return 2; +} +catch (Dune::Exception &e) +{ + std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl; + return 3; +} +catch (...) +{ + std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl; + return 4; +} diff --git a/test/porousmediumflow/tracer/1ptracer/tracertestproblem.hh b/test/porousmediumflow/tracer/1ptracer/tracertestproblem.hh index c1003b7c9254085ff4315fffcceea05dc96374e8..9f834139181b8cfc41dec696fce9760ad7394fbc 100644 --- a/test/porousmediumflow/tracer/1ptracer/tracertestproblem.hh +++ b/test/porousmediumflow/tracer/1ptracer/tracertestproblem.hh @@ -25,9 +25,7 @@ #ifndef DUMUX_TRACER_TEST_PROBLEM_HH #define DUMUX_TRACER_TEST_PROBLEM_HH -#include <dumux/discretization/box/properties.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> -#include <dumux/discretization/cellcentered/mpfa/properties.hh> #include <dumux/porousmediumflow/tracer/model.hh> #include <dumux/porousmediumflow/problem.hh> #include <dumux/material/fluidsystems/base.hh> @@ -48,8 +46,6 @@ namespace Properties { NEW_TYPE_TAG(TracerTestProblem, INHERITS_FROM(Tracer)); NEW_TYPE_TAG(TracerTestCCProblem, INHERITS_FROM(CCTpfaModel, TracerTestProblem)); -NEW_TYPE_TAG(TracerTestCCMpfaProblem, INHERITS_FROM(CCMpfaModel, TracerTestProblem)); -NEW_TYPE_TAG(TracerTestBoxProblem, INHERITS_FROM(BoxModel, TracerTestProblem)); // enable caching SET_BOOL_PROP(TracerTestProblem, EnableGridVolumeVariablesCache, true); @@ -78,7 +74,8 @@ class TracerFluidSystem : public FluidSystems::BaseFluidSystem<typename GET_PROP using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; public: //! If the fluid system only contains tracer components diff --git a/test/porousmediumflow/tracer/1ptracer/tracertestspatialparams.hh b/test/porousmediumflow/tracer/1ptracer/tracertestspatialparams.hh index 5def0abd1c6762a95550f9c3ba956ca8057108a6..aa5bbc540f920db4ff41ba32362ae74de68b73c4 100644 --- a/test/porousmediumflow/tracer/1ptracer/tracertestspatialparams.hh +++ b/test/porousmediumflow/tracer/1ptracer/tracertestspatialparams.hh @@ -40,10 +40,10 @@ class TracerTestSpatialParams : public FVSpatialParamsOneP<TypeTag> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); static const int dimWorld = GridView::dimensionworld; diff --git a/test/porousmediumflow/tracer/constvel/tracertestproblem.hh b/test/porousmediumflow/tracer/constvel/tracertestproblem.hh index b60cc8f01aff24bb49699ff8f572523cf1dcb4b7..d6455f754b21853cf0640a74f79c18904756c4c1 100644 --- a/test/porousmediumflow/tracer/constvel/tracertestproblem.hh +++ b/test/porousmediumflow/tracer/constvel/tracertestproblem.hh @@ -81,7 +81,8 @@ class TracerFluidSystem : public FluidSystems::BaseFluidSystem<typename GET_PROP using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; public: static constexpr bool isTracerFluidSystem() diff --git a/test/porousmediumflow/tracer/constvel/tracertestspatialparams.hh b/test/porousmediumflow/tracer/constvel/tracertestspatialparams.hh index a5e0d5dfbc74be6a79cdf2101226cc57517f8831..152f05181a80a147a44e3e98d151d91ea9990df9 100644 --- a/test/porousmediumflow/tracer/constvel/tracertestspatialparams.hh +++ b/test/porousmediumflow/tracer/constvel/tracertestspatialparams.hh @@ -41,10 +41,10 @@ class TracerTestSpatialParams : public FVSpatialParamsOneP<TypeTag> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); static const int dimWorld = GridView::dimensionworld; diff --git a/test/porousmediumflow/tracer/multicomp/maxwellstefantestproblem.hh b/test/porousmediumflow/tracer/multicomp/maxwellstefantestproblem.hh index 342e395443e6e991c964b84c3636c7bf6c38e9fb..8b97ab35673e50749b41516fd4fee52236aab094 100644 --- a/test/porousmediumflow/tracer/multicomp/maxwellstefantestproblem.hh +++ b/test/porousmediumflow/tracer/multicomp/maxwellstefantestproblem.hh @@ -72,7 +72,8 @@ class H2N2CO2FluidSystem: public FluidSystems::BaseFluidSystem<typename GET_PROP using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; public: static constexpr bool isTracerFluidSystem() diff --git a/test/porousmediumflow/tracer/multicomp/maxwellstefantestspatialparams.hh b/test/porousmediumflow/tracer/multicomp/maxwellstefantestspatialparams.hh index 0eadc6d948ffc41a967ab0308a834d763174ef30..c1fd92a45469b5dbf829f9e274e8d9f3b7358968 100644 --- a/test/porousmediumflow/tracer/multicomp/maxwellstefantestspatialparams.hh +++ b/test/porousmediumflow/tracer/multicomp/maxwellstefantestspatialparams.hh @@ -41,10 +41,10 @@ class MaxwellStefanTestSpatialParams : public FVSpatialParamsOneP<TypeTag> using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); static const int dimWorld = GridView::dimensionworld; diff --git a/tutorial/ex1/injection2p2cproblem.hh b/tutorial/ex1/injection2p2cproblem.hh index 54399e825fe57f610c779e97bae9584eb012026b..80f43f81c6d7a060957684fc1e1628e720834191 100644 --- a/tutorial/ex1/injection2p2cproblem.hh +++ b/tutorial/ex1/injection2p2cproblem.hh @@ -86,7 +86,7 @@ class Injection2p2cProblem : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); enum { dimWorld = GridView::dimensionworld }; diff --git a/tutorial/ex1/injection2pniproblem.hh b/tutorial/ex1/injection2pniproblem.hh index 761e5fa767d82f459194deba398a7be0144e46ab..b85587c0c25c72a3958405f84e4dd9f6e57eaeda 100644 --- a/tutorial/ex1/injection2pniproblem.hh +++ b/tutorial/ex1/injection2pniproblem.hh @@ -88,7 +88,7 @@ class InjectionProblem2PNI : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); enum { dimWorld = GridView::dimensionworld }; diff --git a/tutorial/ex1/injection2pproblem.hh b/tutorial/ex1/injection2pproblem.hh index 1242a1bcad975d97b24ccbfd42f45b88b786a22d..e35c94d8596b33438c30d1231f931392cac12a24 100644 --- a/tutorial/ex1/injection2pproblem.hh +++ b/tutorial/ex1/injection2pproblem.hh @@ -84,7 +84,7 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); enum { dimWorld = GridView::dimensionworld }; diff --git a/tutorial/ex2/injection2p2cproblem.hh b/tutorial/ex2/injection2p2cproblem.hh index 678e458465f3fe551691a689360fab6d56cafddf..9455d68c43574123341b57fb6e737beaffde6375 100644 --- a/tutorial/ex2/injection2p2cproblem.hh +++ b/tutorial/ex2/injection2p2cproblem.hh @@ -100,7 +100,7 @@ class Injection2p2cProblem : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; enum { dimWorld = GridView::dimensionworld }; using GlobalPosition = Dune::FieldVector<Scalar, GridView::dimension>; diff --git a/tutorial/ex2/mylocalresidual.hh b/tutorial/ex2/mylocalresidual.hh index bd7b28ea04ea740bc728e04e18936b08efa68751..1ad4063a8de8a0492c64a10c2e3d5bb9eda769ce 100644 --- a/tutorial/ex2/mylocalresidual.hh +++ b/tutorial/ex2/mylocalresidual.hh @@ -43,13 +43,13 @@ class MyCompositionalLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResid using Implementation = typename GET_PROP_TYPE(TypeTag, LocalResidual); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); diff --git a/tutorial/ex3/2p2cproblem.hh b/tutorial/ex3/2p2cproblem.hh index 56db1e4691e6f57269d5150d63410daa6a867203..79877993b7d806c4e1232ba5150d907f33b0ba34 100644 --- a/tutorial/ex3/2p2cproblem.hh +++ b/tutorial/ex3/2p2cproblem.hh @@ -95,7 +95,7 @@ class ExerciseThreeProblemTwoPTwoC : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); public: diff --git a/tutorial/ex3/2pproblem.hh b/tutorial/ex3/2pproblem.hh index 74e8ae8119c1c86c109330b42cdb23b60de3e73b..972f72dd572f1b85db4af55c3089889f2aae6f5c 100644 --- a/tutorial/ex3/2pproblem.hh +++ b/tutorial/ex3/2pproblem.hh @@ -114,7 +114,7 @@ class ExerciseThreeProblemTwoP : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); public: diff --git a/tutorial/solution/ex1/injection2p2cproblem.hh b/tutorial/solution/ex1/injection2p2cproblem.hh index 1de5074410de97dff0a5d1a36c9a61d84b9c01a6..2632ff0bc3f3d8caf4815fc0b1f54b433e33e7a0 100644 --- a/tutorial/solution/ex1/injection2p2cproblem.hh +++ b/tutorial/solution/ex1/injection2p2cproblem.hh @@ -86,7 +86,7 @@ class Injection2p2cProblem : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); enum { dimWorld = GridView::dimensionworld }; diff --git a/tutorial/solution/ex1/injection2pniproblem.hh b/tutorial/solution/ex1/injection2pniproblem.hh index 87c4e54f970f830ef8bea24e388b83acb09b9b4e..3bc55865993078b001cd804a4052574837a870ba 100644 --- a/tutorial/solution/ex1/injection2pniproblem.hh +++ b/tutorial/solution/ex1/injection2pniproblem.hh @@ -84,7 +84,7 @@ class InjectionProblem2PNI : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); enum { dimWorld = GridView::dimensionworld }; diff --git a/tutorial/solution/ex2/injection2p2cproblem.hh b/tutorial/solution/ex2/injection2p2cproblem.hh index 1e33f81b4766a8a1e0080576cda93a269668f0de..453f673fa4802f68d75eb43cb47d0522d9f27446 100644 --- a/tutorial/solution/ex2/injection2p2cproblem.hh +++ b/tutorial/solution/ex2/injection2p2cproblem.hh @@ -98,7 +98,7 @@ class Injection2p2cProblem : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; enum { dimWorld = GridView::dimensionworld }; using GlobalPosition = Dune::FieldVector<Scalar, GridView::dimension>; diff --git a/tutorial/solution/ex2/mylocalresidual.hh b/tutorial/solution/ex2/mylocalresidual.hh index 9c2edb33652ab0c7df87773927d6802c58dfc886..f304b22a467a888e76f5ba65e7136954060414f1 100644 --- a/tutorial/solution/ex2/mylocalresidual.hh +++ b/tutorial/solution/ex2/mylocalresidual.hh @@ -44,13 +44,13 @@ class MyCompositionalLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResid using Implementation = typename GET_PROP_TYPE(TypeTag, LocalResidual); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using SubControlVolume = typename FVElementGeometry::SubControlVolume; + using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables);