From a44cf17f97e936c6b76579b211e1ac22da217548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de> Date: Thu, 5 Apr 2018 15:26:28 +0200 Subject: [PATCH] [staggered] remove DofTypeIndices property --- dumux/assembly/staggeredfvassembler.hh | 9 +-- dumux/assembly/staggeredlocalassembler.hh | 30 ++------- dumux/common/properties.hh | 1 - dumux/common/staggeredfvproblem.hh | 4 +- .../freeflow/fvgridgeometrytraits.hh | 64 +++++++++++++++++++ .../staggered/freeflow/properties.hh | 28 +------- .../staggered/fvgridgeometry.hh | 6 +- dumux/discretization/staggered/properties.hh | 7 -- dumux/freeflow/navierstokes/problem.hh | 3 +- .../navierstokes/staggered/fluxoverplane.hh | 4 -- dumux/freeflow/rans/problem.hh | 8 +-- dumux/freeflow/rans/zeroeq/problem.hh | 6 +- dumux/io/staggeredvtkoutputmodule.hh | 4 -- .../navierstokes/angelitestproblem.hh | 8 +-- .../freeflow/navierstokes/doneatestproblem.hh | 8 +-- .../navierstokes/kovasznaytestproblem.hh | 8 +-- test/freeflow/navierstokes/test_angeli.cc | 7 +- test/freeflow/navierstokes/test_channel.cc | 7 +- .../navierstokes/test_closedsystem.cc | 7 +- test/freeflow/navierstokes/test_donea.cc | 7 +- test/freeflow/navierstokes/test_kovasznay.cc | 7 +- test/freeflow/navierstokesnc/test_channel.cc | 7 +- .../navierstokesnc/test_densitydrivenflow.cc | 7 +- .../navierstokesnc/test_msfreeflow.cc | 7 +- test/freeflow/rans/test_pipe_laufer.cc | 7 +- test/freeflow/ransnc/test_channel_zeroeq.cc | 7 +- 26 files changed, 109 insertions(+), 159 deletions(-) create mode 100644 dumux/discretization/staggered/freeflow/fvgridgeometrytraits.hh diff --git a/dumux/assembly/staggeredfvassembler.hh b/dumux/assembly/staggeredfvassembler.hh index f9955bcbd2..710d42ef6b 100644 --- a/dumux/assembly/staggeredfvassembler.hh +++ b/dumux/assembly/staggeredfvassembler.hh @@ -56,14 +56,11 @@ class StaggeredFVAssembler using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); using TimeLoop = TimeLoopBase<typename GET_PROP_TYPE(TypeTag, Scalar)>; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); + using LocalAssembler = StaggeredLocalAssembler<TypeTag, diffMethod, isImplicit>; static constexpr int dim = GridView::dimension; - - using LocalAssembler =StaggeredLocalAssembler<TypeTag, diffMethod, isImplicit>; - - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; + static constexpr auto cellCenterIdx = GET_PROP_TYPE(TypeTag, FVGridGeometry)::cellCenterIdx(); + static constexpr auto faceIdx = GET_PROP_TYPE(TypeTag, FVGridGeometry)::faceIdx(); using CCToCCMatrixBlock = typename GET_PROP(TypeTag, JacobianMatrix)::MatrixBlockCCToCC; using CCToFaceMatrixBlock = typename GET_PROP(TypeTag, JacobianMatrix)::MatrixBlockCCToFace; diff --git a/dumux/assembly/staggeredlocalassembler.hh b/dumux/assembly/staggeredlocalassembler.hh index 3241ac4ce9..1213bd150a 100644 --- a/dumux/assembly/staggeredlocalassembler.hh +++ b/dumux/assembly/staggeredlocalassembler.hh @@ -98,6 +98,8 @@ class StaggeredLocalAssembler<TypeTag, static constexpr bool enableGridFluxVarsCache = GET_PROP_VALUE(TypeTag, EnableGridFluxVariablesCache); static constexpr auto faceOffset = GET_PROP_VALUE(TypeTag, NumEqCellCenter); + static constexpr auto cellCenterIdx = FVGridGeometry::cellCenterIdx(); + static constexpr auto faceIdx = FVGridGeometry::faceIdx(); public: @@ -110,10 +112,6 @@ public: const Element& element, const SolutionVector& curSol) { - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; - // get some references for convenience const auto& problem = assembler.problem(); auto& localResidual = assembler.localResidual(); @@ -183,11 +181,6 @@ public: const Element& element, const SolutionVector& curSol) { - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; - - // get some references for convenience const auto& problem = assembler.problem(); auto& localResidual = assembler.localResidual(); @@ -314,9 +307,6 @@ protected: JacobianMatrix& matrix, const NumCellCenterEqVector& ccResidual) { - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - const auto& problem = assembler.problem(); auto& localResidual = assembler.localResidual(); auto& gridVariables = assembler.gridVariables(); @@ -376,11 +366,6 @@ protected: JacobianMatrix& matrix, const NumCellCenterEqVector& ccResidual) { - // build derivatives with for cell center dofs w.r.t. face dofs - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; - const auto& problem = assembler.problem(); auto& localResidual = assembler.localResidual(); auto& gridVariables = assembler.gridVariables(); @@ -440,10 +425,6 @@ protected: { for(auto&& scvf : scvfs(fvGeometry)) { - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; - const auto& problem = assembler.problem(); auto& localResidual = assembler.localResidual(); auto& gridVariables = assembler.gridVariables(); @@ -505,9 +486,6 @@ protected: JacobianMatrix& matrix, const FaceSolutionVector& cachedResidual) { - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::FaceIdx faceIdx; - const auto& problem = assembler.problem(); auto& localResidual = assembler.localResidual(); const auto& connectivityMap = assembler.fvGridGeometry().connectivityMap(); @@ -612,7 +590,7 @@ protected: //! Helper function that returns an iterable range of primary variable indices. //! Specialization for cell center dofs. - static auto priVarIndices_(typename GET_PROP(TypeTag, DofTypeIndices)::CellCenterIdx) + static auto priVarIndices_(typename FVGridGeometry::DofTypeIndices::CellCenterIdx) { constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); @@ -625,7 +603,7 @@ protected: //! Helper function that returns an iterable range of primary variable indices. //! Specialization for face dofs. - static auto priVarIndices_(typename GET_PROP(TypeTag, DofTypeIndices)::FaceIdx) + static auto priVarIndices_(typename FVGridGeometry::DofTypeIndices::FaceIdx) { constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); constexpr auto numEqFace = GET_PROP_VALUE(TypeTag, NumEqFace); diff --git a/dumux/common/properties.hh b/dumux/common/properties.hh index f8dca5487c..9c2b7bf1bc 100644 --- a/dumux/common/properties.hh +++ b/dumux/common/properties.hh @@ -154,7 +154,6 @@ NEW_PROP_TAG(GridFaceVariables); //!< Global vector containing NEW_PROP_TAG(CellCenterPrimaryVariables); //!< The primary variables container type for cell-centered dofs NEW_PROP_TAG(FacePrimaryVariables); //!< The primary variables container type for face dofs NEW_PROP_TAG(IntersectionMapper); //!< Specifies the intersection mapper -NEW_PROP_TAG(DofTypeIndices); //!< Specifies index types for accessing the multi type block vectors/matrices 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/staggeredfvproblem.hh b/dumux/common/staggeredfvproblem.hh index 6484bd1721..7d68b6c00c 100644 --- a/dumux/common/staggeredfvproblem.hh +++ b/dumux/common/staggeredfvproblem.hh @@ -160,7 +160,7 @@ protected: //! Helper function that returns an iterable range of primary variable indices. //! Specialization for cell center dofs. - static auto priVarIndices_(typename GET_PROP(TypeTag, DofTypeIndices)::CellCenterIdx) + static auto priVarIndices_(typename FVGridGeometry::DofTypeIndices::CellCenterIdx) { constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); @@ -173,7 +173,7 @@ protected: //! Helper function that returns an iterable range of primary variable indices. //! Specialization for face dofs. - static auto priVarIndices_(typename GET_PROP(TypeTag, DofTypeIndices)::FaceIdx) + static auto priVarIndices_(typename FVGridGeometry::DofTypeIndices::FaceIdx) { constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); constexpr auto numEq = GET_PROP_TYPE(TypeTag, ModelTraits)::numEq(); diff --git a/dumux/discretization/staggered/freeflow/fvgridgeometrytraits.hh b/dumux/discretization/staggered/freeflow/fvgridgeometrytraits.hh new file mode 100644 index 0000000000..29514118cb --- /dev/null +++ b/dumux/discretization/staggered/freeflow/fvgridgeometrytraits.hh @@ -0,0 +1,64 @@ +// -*- 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 StaggeredDiscretization + * \copydoc Dumux::StaggeredFreeFlowDefaultFVGridGeometryTraits + */ +#ifndef DUMUX_DISCRETIZATION_STAGGERED_FREEFLOW_FV_GRID_GEOMETRY_TRAITS +#define DUMUX_DISCRETIZATION_STAGGERED_FREEFLOW_FV_GRID_GEOMETRY_TRAITS + +#include <dumux/discretization/cellcentered/subcontrolvolume.hh> +#include <dumux/discretization/staggered/fvelementgeometry.hh> +#include <dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh> + +#include "subcontrolvolumeface.hh" +#include "connectivitymap.hh" +#include "staggeredgeometryhelper.hh" + +namespace Dumux { + +/*! + * \ingroup StaggeredDiscretization + * \brief Default traits for the finite volume grid geometry. + */ +template<class GridView> +struct StaggeredFreeFlowDefaultFVGridGeometryTraits : public DefaultMapperTraits<GridView> +{ + using SubControlVolume = CCSubControlVolume<GridView>; + using SubControlVolumeFace = FreeFlowStaggeredSubControlVolumeFace<GridView>; + using IntersectionMapper = ConformingGridIntersectionMapper<GridView>; + using GeometryHelper = FreeFlowStaggeredGeometryHelper<GridView>; + + struct DofTypeIndices + { + using CellCenterIdx = Dune::index_constant<0>; + using FaceIdx = Dune::index_constant<1>; + }; + + template<class FVGridGeometry> + using ConnectivityMap = StaggeredFreeFlowConnectivityMap<FVGridGeometry>; + + template<class FVGridGeometry, bool cachingEnabled> + using LocalView = StaggeredFVElementGeometry<FVGridGeometry, cachingEnabled>; +}; + +} + +#endif diff --git a/dumux/discretization/staggered/freeflow/properties.hh b/dumux/discretization/staggered/freeflow/properties.hh index 22ba9f669d..62a44bbac9 100644 --- a/dumux/discretization/staggered/freeflow/properties.hh +++ b/dumux/discretization/staggered/freeflow/properties.hh @@ -33,19 +33,13 @@ #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 <dumux/discretization/staggered/fvelementgeometry.hh> +#include <dumux/freeflow/properties.hh> -#include "subcontrolvolumeface.hh" -#include "connectivitymap.hh" #include "facevariables.hh" #include "boundarytypes.hh" #include "velocityoutput.hh" -#include "staggeredgeometryhelper.hh" +#include "fvgridgeometrytraits.hh" namespace Dumux { @@ -84,24 +78,8 @@ SET_PROP(StaggeredFreeFlowModel, FVGridGeometry) { private: using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using DofTypeIndicesType = typename GET_PROP(TypeTag, DofTypeIndices); + using Traits = StaggeredFreeFlowDefaultFVGridGeometryTraits<GridView>; static constexpr bool enableCache = GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache); - - struct Traits : public DefaultMapperTraits<GridView> - { - using SubControlVolume = CCSubControlVolume<GridView>; - using SubControlVolumeFace = FreeFlowStaggeredSubControlVolumeFace<GridView>; - using IntersectionMapper = ConformingGridIntersectionMapper<GridView>; - using GeometryHelper = FreeFlowStaggeredGeometryHelper<GridView>; - using DofTypeIndices = DofTypeIndicesType; - - template<class FVGridGeometry> - using ConnectivityMap = StaggeredFreeFlowConnectivityMap<FVGridGeometry>; - - template<class FVGridGeometry, bool enableCache> - using LocalView = StaggeredFVElementGeometry<FVGridGeometry, enableCache>; - }; - public: using type = StaggeredFVGridGeometry<GridView, enableCache, Traits>; }; diff --git a/dumux/discretization/staggered/fvgridgeometry.hh b/dumux/discretization/staggered/fvgridgeometry.hh index df4220f198..2c65787519 100644 --- a/dumux/discretization/staggered/fvgridgeometry.hh +++ b/dumux/discretization/staggered/fvgridgeometry.hh @@ -35,9 +35,9 @@ namespace Dumux { * This builds up the sub control volumes and sub control volume faces * for each element. */ - template<class GridView, - bool enableFVGridGeometryCache, - class Traits> +template<class GridView, + bool cachingEnabled, + class Traits> class StaggeredFVGridGeometry; /*! diff --git a/dumux/discretization/staggered/properties.hh b/dumux/discretization/staggered/properties.hh index c765fe38ff..a056029036 100644 --- a/dumux/discretization/staggered/properties.hh +++ b/dumux/discretization/staggered/properties.hh @@ -130,13 +130,6 @@ SET_TYPE_PROP(StaggeredModel, ElementBoundaryTypes, CCElementBoundaryTypes); //! Set the BaseLocalResidual to StaggeredLocalResidual SET_TYPE_PROP(StaggeredModel, BaseLocalResidual, StaggeredLocalResidual<TypeTag>); -//! Definition of the indices for cell center and face dofs in the global solution vector -SET_PROP(StaggeredModel, DofTypeIndices) -{ - using CellCenterIdx = Dune::index_constant<0>; - using FaceIdx = Dune::index_constant<1>; -}; - //! The cell center primary variables SET_TYPE_PROP(StaggeredModel, CellCenterPrimaryVariables, diff --git a/dumux/freeflow/navierstokes/problem.hh b/dumux/freeflow/navierstokes/problem.hh index 21f97c699a..9d987984bd 100644 --- a/dumux/freeflow/navierstokes/problem.hh +++ b/dumux/freeflow/navierstokes/problem.hh @@ -124,9 +124,8 @@ public: const SubControlVolumeFace& scvf, const PrimaryVariables& initSol) const { - typename GET_PROP(TypeTag, DofTypeIndices)::FaceIdx faceIdx; const auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); - sol[faceIdx][scvf.dofIndex()][numEqCellCenter] = initSol[Indices::velocity(scvf.directionIndex())]; + sol[FVGridGeometry::faceIdx()][scvf.dofIndex()][numEqCellCenter] = initSol[Indices::velocity(scvf.directionIndex())]; } private: diff --git a/dumux/freeflow/navierstokes/staggered/fluxoverplane.hh b/dumux/freeflow/navierstokes/staggered/fluxoverplane.hh index 0f0056e947..cb1420e263 100644 --- a/dumux/freeflow/navierstokes/staggered/fluxoverplane.hh +++ b/dumux/freeflow/navierstokes/staggered/fluxoverplane.hh @@ -58,10 +58,6 @@ class FluxOverPlane using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using Element = typename GridView::template Codim<0>::Entity; - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; - enum { // Grid and world dimension dim = GridView::dimension, diff --git a/dumux/freeflow/rans/problem.hh b/dumux/freeflow/rans/problem.hh index 9e36b3141e..06f5ec7108 100644 --- a/dumux/freeflow/rans/problem.hh +++ b/dumux/freeflow/rans/problem.hh @@ -70,10 +70,6 @@ class RANSProblem : public NavierStokesProblem<TypeTag> using DimVector = Dune::FieldVector<Scalar, dim>; using DimMatrix = Dune::FieldMatrix<Scalar, dim, dim>; - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; - public: //! The constructor sets the gravity, if desired by the user. RANSProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) @@ -232,7 +228,7 @@ public: for (auto&& scvf : scvfs(fvGeometry)) { const int dofIdxFace = scvf.dofIndex(); - const auto numericalSolutionFace = curSol[faceIdx][dofIdxFace][Indices::momentumBalanceIdx]; + const auto numericalSolutionFace = curSol[FVGridGeometry::faceIdx()][dofIdxFace][Indices::momentumBalanceIdx]; velocityTemp[scvf.directionIndex()] += numericalSolutionFace; } for (unsigned int dimIdx = 0; dimIdx < dim; ++dimIdx) @@ -288,7 +284,7 @@ public: for (auto&& scv : scvs(fvGeometry)) { const int dofIdx = scv.dofIndex(); - CellCenterPrimaryVariables priVars(curSol[cellCenterIdx][dofIdx]); + CellCenterPrimaryVariables priVars(curSol[FVGridGeometry::cellCenterIdx()][dofIdx]); auto elemSol = elementSolution<FVElementGeometry>(std::move(priVars)); VolumeVariables volVars; volVars.update(elemSol, asImp_(), element, scv); diff --git a/dumux/freeflow/rans/zeroeq/problem.hh b/dumux/freeflow/rans/zeroeq/problem.hh index 177f92e254..6144277a31 100644 --- a/dumux/freeflow/rans/zeroeq/problem.hh +++ b/dumux/freeflow/rans/zeroeq/problem.hh @@ -70,10 +70,6 @@ class ZeroEqProblem : public RANSProblem<TypeTag> using DimVector = Dune::FieldVector<Scalar, dim>; using DimMatrix = Dune::FieldMatrix<Scalar, dim, dim>; - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; - public: //! The constructor sets the gravity, if desired by the user. ZeroEqProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) @@ -120,7 +116,7 @@ public: using std::exp; const int dofIdx = scv.dofIndex(); - CellCenterPrimaryVariables priVars(curSol[cellCenterIdx][dofIdx]); + CellCenterPrimaryVariables priVars(curSol[FVGridGeometry::cellCenterIdx()][dofIdx]); auto elemSol = elementSolution<FVElementGeometry>(std::move(priVars)); VolumeVariables volVars; volVars.update(elemSol, asImp_(), element, scv); diff --git a/dumux/io/staggeredvtkoutputmodule.hh b/dumux/io/staggeredvtkoutputmodule.hh index 400b2cace7..266a2b5081 100644 --- a/dumux/io/staggeredvtkoutputmodule.hh +++ b/dumux/io/staggeredvtkoutputmodule.hh @@ -64,10 +64,6 @@ class StaggeredVtkOutputModule : public VtkOutputModule<TypeTag, phaseIdxOffset> using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; - struct FaceVarScalarDataInfo { std::function<Scalar(const FaceVariables&)> get; std::string name; }; struct FaceVarVectorDataInfo { std::function<GlobalPosition(const SubControlVolumeFace& scvf, const FaceVariables&)> get; std::string name; }; diff --git a/test/freeflow/navierstokes/angelitestproblem.hh b/test/freeflow/navierstokes/angelitestproblem.hh index 1bf48f17c8..69c8a21a9c 100644 --- a/test/freeflow/navierstokes/angelitestproblem.hh +++ b/test/freeflow/navierstokes/angelitestproblem.hh @@ -102,10 +102,6 @@ class AngeliTestProblem : public NavierStokesProblem<TypeTag> using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); using TimeLoopPtr = std::shared_ptr<TimeLoop<Scalar>>; - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; - public: AngeliTestProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) : ParentType(fvGridGeometry), eps_(1e-6) @@ -269,7 +265,7 @@ public: const auto dofIdxCellCenter = scv.dofIndex(); const auto& posCellCenter = scv.dofPosition(); const auto analyticalSolutionCellCenter = dirichletAtPos(posCellCenter)[pressureIdx]; - const auto numericalSolutionCellCenter = curSol[cellCenterIdx][dofIdxCellCenter][pressureIdx]; + const auto numericalSolutionCellCenter = curSol[FVGridGeometry::cellCenterIdx()][dofIdxCellCenter][pressureIdx]; sumError[pressureIdx] += squaredDiff_(analyticalSolutionCellCenter, numericalSolutionCellCenter) * scv.volume(); sumReference[pressureIdx] += analyticalSolutionCellCenter * analyticalSolutionCellCenter * scv.volume(); totalVolume += scv.volume(); @@ -280,7 +276,7 @@ public: const int dofIdxFace = scvf.dofIndex(); const int dirIdx = scvf.directionIndex(); const auto analyticalSolutionFace = dirichletAtPos(scvf.center())[Indices::velocity(dirIdx)]; - const auto numericalSolutionFace = curSol[faceIdx][dofIdxFace][momentumBalanceIdx]; + const auto numericalSolutionFace = curSol[FVGridGeometry::faceIdx()][dofIdxFace][momentumBalanceIdx]; directionIndex[dofIdxFace] = dirIdx; errorVelocity[dofIdxFace] = squaredDiff_(analyticalSolutionFace, numericalSolutionFace); velocityReference[dofIdxFace] = squaredDiff_(analyticalSolutionFace, 0.0); diff --git a/test/freeflow/navierstokes/doneatestproblem.hh b/test/freeflow/navierstokes/doneatestproblem.hh index aa37532b29..bcced08b37 100644 --- a/test/freeflow/navierstokes/doneatestproblem.hh +++ b/test/freeflow/navierstokes/doneatestproblem.hh @@ -107,10 +107,6 @@ class DoneaTestProblem : public NavierStokesProblem<TypeTag> using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; - public: DoneaTestProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) : ParentType(fvGridGeometry), eps_(1e-6) @@ -289,7 +285,7 @@ public: const auto dofIdxCellCenter = scv.dofIndex(); const auto& posCellCenter = scv.dofPosition(); const auto analyticalSolutionCellCenter = analyticalSolution(posCellCenter)[pressureIdx]; - const auto numericalSolutionCellCenter = curSol[cellCenterIdx][dofIdxCellCenter][pressureIdx]; + const auto numericalSolutionCellCenter = curSol[FVGridGeometry::cellCenterIdx()][dofIdxCellCenter][pressureIdx]; sumError[pressureIdx] += squaredDiff_(analyticalSolutionCellCenter, numericalSolutionCellCenter) * scv.volume(); sumReference[pressureIdx] += analyticalSolutionCellCenter * analyticalSolutionCellCenter * scv.volume(); totalVolume += scv.volume(); @@ -300,7 +296,7 @@ public: const int dofIdxFace = scvf.dofIndex(); const int dirIdx = scvf.directionIndex(); const auto analyticalSolutionFace = analyticalSolution(scvf.center())[Indices::velocity(dirIdx)]; - const auto numericalSolutionFace = curSol[faceIdx][dofIdxFace][momentumBalanceIdx]; + const auto numericalSolutionFace = curSol[FVGridGeometry::faceIdx()][dofIdxFace][momentumBalanceIdx]; directionIndex[dofIdxFace] = dirIdx; errorVelocity[dofIdxFace] = squaredDiff_(analyticalSolutionFace, numericalSolutionFace); velocityReference[dofIdxFace] = squaredDiff_(analyticalSolutionFace, 0.0); diff --git a/test/freeflow/navierstokes/kovasznaytestproblem.hh b/test/freeflow/navierstokes/kovasznaytestproblem.hh index a48d460850..42e3927340 100644 --- a/test/freeflow/navierstokes/kovasznaytestproblem.hh +++ b/test/freeflow/navierstokes/kovasznaytestproblem.hh @@ -100,10 +100,6 @@ class KovasznayTestProblem : public NavierStokesProblem<TypeTag> using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; - public: KovasznayTestProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) : ParentType(fvGridGeometry), eps_(1e-6) @@ -278,7 +274,7 @@ public: const auto dofIdxCellCenter = scv.dofIndex(); const auto& posCellCenter = scv.dofPosition(); const auto analyticalSolutionCellCenter = dirichletAtPos(posCellCenter)[pressureIdx]; - const auto numericalSolutionCellCenter = curSol[cellCenterIdx][dofIdxCellCenter][pressureIdx]; + const auto numericalSolutionCellCenter = curSol[FVGridGeometry::cellCenterIdx()][dofIdxCellCenter][pressureIdx]; sumError[pressureIdx] += squaredDiff_(analyticalSolutionCellCenter, numericalSolutionCellCenter) * scv.volume(); sumReference[pressureIdx] += analyticalSolutionCellCenter * analyticalSolutionCellCenter * scv.volume(); totalVolume += scv.volume(); @@ -289,7 +285,7 @@ public: const int dofIdxFace = scvf.dofIndex(); const int dirIdx = scvf.directionIndex(); const auto analyticalSolutionFace = dirichletAtPos(scvf.center())[Indices::velocity(dirIdx)]; - const auto numericalSolutionFace = curSol[faceIdx][dofIdxFace][momentumBalanceIdx]; + const auto numericalSolutionFace = curSol[FVGridGeometry::faceIdx()][dofIdxFace][momentumBalanceIdx]; directionIndex[dofIdxFace] = dirIdx; errorVelocity[dofIdxFace] = squaredDiff_(analyticalSolutionFace, numericalSolutionFace); velocityReference[dofIdxFace] = squaredDiff_(analyticalSolutionFace, 0.0); diff --git a/test/freeflow/navierstokes/test_angeli.cc b/test/freeflow/navierstokes/test_angeli.cc index f03d587cc2..8ced7b4870 100644 --- a/test/freeflow/navierstokes/test_angeli.cc +++ b/test/freeflow/navierstokes/test_angeli.cc @@ -139,14 +139,11 @@ int main(int argc, char** argv) try // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; const auto numDofsCellCenter = leafGridView.size(0); const auto numDofsFace = leafGridView.size(1); SolutionVector x; - x[cellCenterIdx].resize(numDofsCellCenter); - x[faceIdx].resize(numDofsFace); + x[FVGridGeometry::cellCenterIdx()].resize(numDofsCellCenter); + x[FVGridGeometry::faceIdx()].resize(numDofsFace); problem->applyInitialSolution(x); auto xOld = x; diff --git a/test/freeflow/navierstokes/test_channel.cc b/test/freeflow/navierstokes/test_channel.cc index a8ed792f88..1ac6b724a6 100644 --- a/test/freeflow/navierstokes/test_channel.cc +++ b/test/freeflow/navierstokes/test_channel.cc @@ -140,14 +140,11 @@ int main(int argc, char** argv) try // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; const auto numDofsCellCenter = leafGridView.size(0); const auto numDofsFace = leafGridView.size(1); SolutionVector x; - x[cellCenterIdx].resize(numDofsCellCenter); - x[faceIdx].resize(numDofsFace); + x[FVGridGeometry::cellCenterIdx()].resize(numDofsCellCenter); + x[FVGridGeometry::faceIdx()].resize(numDofsFace); problem->applyInitialSolution(x); auto xOld = x; diff --git a/test/freeflow/navierstokes/test_closedsystem.cc b/test/freeflow/navierstokes/test_closedsystem.cc index a9a0f91461..0fdd3bd631 100644 --- a/test/freeflow/navierstokes/test_closedsystem.cc +++ b/test/freeflow/navierstokes/test_closedsystem.cc @@ -122,14 +122,11 @@ int main(int argc, char** argv) try // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; const auto numDofsCellCenter = leafGridView.size(0); const auto numDofsFace = leafGridView.size(1); SolutionVector x; - x[cellCenterIdx].resize(numDofsCellCenter); - x[faceIdx].resize(numDofsFace); + x[FVGridGeometry::cellCenterIdx()].resize(numDofsCellCenter); + x[FVGridGeometry::faceIdx()].resize(numDofsFace); problem->applyInitialSolution(x); auto xOld = x; diff --git a/test/freeflow/navierstokes/test_donea.cc b/test/freeflow/navierstokes/test_donea.cc index 22f2060dd6..acfc162662 100644 --- a/test/freeflow/navierstokes/test_donea.cc +++ b/test/freeflow/navierstokes/test_donea.cc @@ -124,14 +124,11 @@ int main(int argc, char** argv) try // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; const auto numDofsCellCenter = leafGridView.size(0); const auto numDofsFace = leafGridView.size(1); SolutionVector x; - x[cellCenterIdx].resize(numDofsCellCenter); - x[faceIdx].resize(numDofsFace); + x[FVGridGeometry::cellCenterIdx()].resize(numDofsCellCenter); + x[FVGridGeometry::faceIdx()].resize(numDofsFace); // the grid variables using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); diff --git a/test/freeflow/navierstokes/test_kovasznay.cc b/test/freeflow/navierstokes/test_kovasznay.cc index fe78ec1ac4..882aca078b 100644 --- a/test/freeflow/navierstokes/test_kovasznay.cc +++ b/test/freeflow/navierstokes/test_kovasznay.cc @@ -123,14 +123,11 @@ int main(int argc, char** argv) try // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; const auto numDofsCellCenter = leafGridView.size(0); const auto numDofsFace = leafGridView.size(1); SolutionVector x; - x[cellCenterIdx].resize(numDofsCellCenter); - x[faceIdx].resize(numDofsFace); + x[FVGridGeometry::cellCenterIdx()].resize(numDofsCellCenter); + x[FVGridGeometry::faceIdx()].resize(numDofsFace); // the grid variables using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); diff --git a/test/freeflow/navierstokesnc/test_channel.cc b/test/freeflow/navierstokesnc/test_channel.cc index 4804fe67d8..9198f5df82 100644 --- a/test/freeflow/navierstokesnc/test_channel.cc +++ b/test/freeflow/navierstokesnc/test_channel.cc @@ -138,14 +138,11 @@ int main(int argc, char** argv) try // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; const auto numDofsCellCenter = leafGridView.size(0); const auto numDofsFace = leafGridView.size(1); SolutionVector x; - x[cellCenterIdx].resize(numDofsCellCenter); - x[faceIdx].resize(numDofsFace); + x[FVGridGeometry::cellCenterIdx()].resize(numDofsCellCenter); + x[FVGridGeometry::faceIdx()].resize(numDofsFace); problem->applyInitialSolution(x); auto xOld = x; diff --git a/test/freeflow/navierstokesnc/test_densitydrivenflow.cc b/test/freeflow/navierstokesnc/test_densitydrivenflow.cc index 878279e13f..614df58447 100644 --- a/test/freeflow/navierstokesnc/test_densitydrivenflow.cc +++ b/test/freeflow/navierstokesnc/test_densitydrivenflow.cc @@ -137,14 +137,11 @@ int main(int argc, char** argv) try // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; const auto numDofsCellCenter = leafGridView.size(0); const auto numDofsFace = leafGridView.size(1); SolutionVector x; - x[cellCenterIdx].resize(numDofsCellCenter); - x[faceIdx].resize(numDofsFace); + x[FVGridGeometry::cellCenterIdx()].resize(numDofsCellCenter); + x[FVGridGeometry::faceIdx()].resize(numDofsFace); problem->applyInitialSolution(x); auto xOld = x; diff --git a/test/freeflow/navierstokesnc/test_msfreeflow.cc b/test/freeflow/navierstokesnc/test_msfreeflow.cc index 60dfb7cbaf..88c23a75a6 100644 --- a/test/freeflow/navierstokesnc/test_msfreeflow.cc +++ b/test/freeflow/navierstokesnc/test_msfreeflow.cc @@ -137,14 +137,11 @@ int main(int argc, char** argv) try // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; const auto numDofsCellCenter = leafGridView.size(0); const auto numDofsFace = leafGridView.size(1); SolutionVector x; - x[cellCenterIdx].resize(numDofsCellCenter); - x[faceIdx].resize(numDofsFace); + x[FVGridGeometry::cellCenterIdx()].resize(numDofsCellCenter); + x[FVGridGeometry::faceIdx()].resize(numDofsFace); problem->applyInitialSolution(x); auto xOld = x; diff --git a/test/freeflow/rans/test_pipe_laufer.cc b/test/freeflow/rans/test_pipe_laufer.cc index 44145ade4a..c017d6f106 100644 --- a/test/freeflow/rans/test_pipe_laufer.cc +++ b/test/freeflow/rans/test_pipe_laufer.cc @@ -133,14 +133,11 @@ int main(int argc, char** argv) try // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; const auto numDofsCellCenter = leafGridView.size(0); const auto numDofsFace = leafGridView.size(1); SolutionVector x; - x[cellCenterIdx].resize(numDofsCellCenter); - x[faceIdx].resize(numDofsFace); + x[FVGridGeometry::cellCenterIdx()].resize(numDofsCellCenter); + x[FVGridGeometry::faceIdx()].resize(numDofsFace); problem->applyInitialSolution(x); problem->updateStaticWallProperties(); problem->updateDynamicWallProperties(x); diff --git a/test/freeflow/ransnc/test_channel_zeroeq.cc b/test/freeflow/ransnc/test_channel_zeroeq.cc index b5ec7fb8b7..da76773a4e 100644 --- a/test/freeflow/ransnc/test_channel_zeroeq.cc +++ b/test/freeflow/ransnc/test_channel_zeroeq.cc @@ -127,14 +127,11 @@ int main(int argc, char** argv) try // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; const auto numDofsCellCenter = leafGridView.size(0); const auto numDofsFace = leafGridView.size(1); SolutionVector x; - x[cellCenterIdx].resize(numDofsCellCenter); - x[faceIdx].resize(numDofsFace); + x[FVGridGeometry::cellCenterIdx()].resize(numDofsCellCenter); + x[FVGridGeometry::faceIdx()].resize(numDofsFace); problem->applyInitialSolution(x); problem->updateStaticWallProperties(); problem->updateDynamicWallProperties(x); -- GitLab