From f2399bb1d70b271da88c1ff22ee4a52be5e1024b Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Fri, 15 Dec 2017 17:42:15 +0100 Subject: [PATCH 01/31] [staggered] Remove unused aliases and enums --- dumux/assembly/staggeredlocalresidual.hh | 1 - dumux/freeflow/navierstokes/staggered/fluxvariables.hh | 4 ---- dumux/freeflow/navierstokes/staggered/localresidual.hh | 1 - 3 files changed, 6 deletions(-) diff --git a/dumux/assembly/staggeredlocalresidual.hh b/dumux/assembly/staggeredlocalresidual.hh index 7be67fc539..ac744c868d 100644 --- a/dumux/assembly/staggeredlocalresidual.hh +++ b/dumux/assembly/staggeredlocalresidual.hh @@ -53,7 +53,6 @@ class StaggeredLocalResidual using Implementation = typename GET_PROP_TYPE(TypeTag, LocalResidual); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Element = typename GridView::template Codim<0>::Entity; - using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); diff --git a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh index 06d2c25ba6..778405f0ef 100644 --- a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh +++ b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh @@ -76,11 +76,7 @@ class NavierStokesFluxVariablesImpl dim = GridView::dimension, dimWorld = GridView::dimensionworld, - pressureIdx = Indices::pressureIdx, - velocityIdx = Indices::velocityIdx, - massBalanceIdx = Indices::massBalanceIdx, - momentumBalanceIdx = Indices::momentumBalanceIdx }; using GlobalPosition = Dune::FieldVector; diff --git a/dumux/freeflow/navierstokes/staggered/localresidual.hh b/dumux/freeflow/navierstokes/staggered/localresidual.hh index 75024913c3..ea12910eb2 100644 --- a/dumux/freeflow/navierstokes/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokes/staggered/localresidual.hh @@ -63,7 +63,6 @@ class NavierStokesResidualImpl using Implementation = typename GET_PROP_TYPE(TypeTag, LocalResidual); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Element = typename GridView::template Codim<0>::Entity; - using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); -- GitLab From f56916b2ff76d093d8334ec96c4790859cebb7b0 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Fri, 15 Dec 2017 17:44:49 +0100 Subject: [PATCH 02/31] [navierstokes] Adapt indices * add method to determine the velocity index for a given direction --- dumux/freeflow/navierstokes/indices.hh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dumux/freeflow/navierstokes/indices.hh b/dumux/freeflow/navierstokes/indices.hh index 165ec691c4..5a72bc66d8 100644 --- a/dumux/freeflow/navierstokes/indices.hh +++ b/dumux/freeflow/navierstokes/indices.hh @@ -55,11 +55,15 @@ struct NavierStokesCommonIndices static constexpr int momentumXBalanceIdx = momentumBalanceIdx; //!< Index of the momentum balance equation static constexpr int momentumYBalanceIdx = momentumBalanceIdx + 1; //!< Index of the momentum balance equation static constexpr int momentumZBalanceIdx = momentumBalanceIdx + 2; //!< Index of the momentum balance equation - static constexpr int velocityIdx = momentumBalanceIdx; //!< Index of the velocity in a solution vector - static constexpr int velocityXIdx = velocityIdx; //!< Index of the velocity in a solution vector - static constexpr int velocityYIdx = velocityIdx + 1; //!< Index of the velocity in a solution vector - static constexpr int velocityZIdx = velocityIdx + 2; //!< Index of the velocity in a solution vector + static constexpr int velocityXIdx = momentumBalanceIdx; //!< Index of the velocity in a solution vector + static constexpr int velocityYIdx = momentumBalanceIdx + 1; //!< Index of the velocity in a solution vector + static constexpr int velocityZIdx = momentumBalanceIdx + 2; //!< Index of the velocity in a solution vector + + static constexpr int velocity(int dirIdx) //!< Index of the velocity in a solution vector given a certain dimension + { + return dirIdx + momentumBalanceIdx; + } }; // \} -- GitLab From b70d8a564d827aa20c751c3a8a49d613729cef7a Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Fri, 15 Dec 2017 17:48:59 +0100 Subject: [PATCH 03/31] [staggered][faceVars] Use new index method --- dumux/discretization/staggered/freeflow/facevariables.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dumux/discretization/staggered/freeflow/facevariables.hh b/dumux/discretization/staggered/freeflow/facevariables.hh index dc09d3d43f..26b07b34df 100644 --- a/dumux/discretization/staggered/freeflow/facevariables.hh +++ b/dumux/discretization/staggered/freeflow/facevariables.hh @@ -43,6 +43,7 @@ class StaggeredFaceVariables 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 Indices = typename GET_PROP_TYPE(TypeTag, Indices); static constexpr int dimWorld = GridView::dimensionworld; static constexpr int numPairs = (dimWorld == 2) ? 2 : 4; @@ -120,13 +121,13 @@ public: { const auto& normalFace = fvGeometry.scvf(scvf.insideScvIdx(), subFaceData.localNormalFaceIdx); const auto normalDirIdx = normalFace.directionIndex(); - velocityNormalOutside_[i] = problem.dirichlet(element, makeGhostFace(subFaceData.virtualOuterNormalFaceDofPos))[faceIdx][normalDirIdx]; + velocityNormalOutside_[i] = problem.dirichlet(element, makeGhostFace(subFaceData.virtualOuterNormalFaceDofPos))[Indices::velocity(normalDirIdx)]; } // treat the velocity parallel to the face velocityParallel_[i] = hasParallelNeighbor(subFaceData) ? velocityParallel_[i] = faceSol[subFaceData.outerParallelFaceDofIdx] : - problem.dirichlet(element, makeGhostFace(subFaceData.virtualOuterParallelFaceDofPos))[faceIdx][scvf.directionIndex()]; + problem.dirichlet(element, makeGhostFace(subFaceData.virtualOuterParallelFaceDofPos))[Indices::velocity(scvf.directionIndex())]; } } -- GitLab From 1b75fd606f8b104ad3ec74b67daea5bf708a2f2f Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Fri, 15 Dec 2017 17:49:41 +0100 Subject: [PATCH 04/31] [staggered][navierstokes] Use new index method in localRes --- .../navierstokes/staggered/localresidual.hh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/dumux/freeflow/navierstokes/staggered/localresidual.hh b/dumux/freeflow/navierstokes/staggered/localresidual.hh index ea12910eb2..bfb171b304 100644 --- a/dumux/freeflow/navierstokes/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokes/staggered/localresidual.hh @@ -92,7 +92,6 @@ class NavierStokesResidualImpl dimWorld = GridView::dimensionworld, pressureIdx = Indices::pressureIdx, - velocityIdx = Indices::velocityIdx, massBalanceIdx = Indices::massBalanceIdx, momentumBalanceIdx = Indices::momentumBalanceIdx @@ -214,7 +213,7 @@ public: const auto& insideVolVars = elemVolVars[insideScvIdx]; source += problem.gravity()[scvf.directionIndex()] * insideVolVars.density(); - source += problem.sourceAtPos(scvf.center())[faceIdx][scvf.directionIndex()]; + source += problem.sourceAtPos(scvf.center())[Indices::velocity(scvf.directionIndex())]; return source; } @@ -289,7 +288,7 @@ protected: if(bcTypes.isNeumann(eqIdx)) { const auto extrusionFactor = 1.0; //TODO: get correct extrusion factor - boundaryFlux[eqIdx] = problem.neumann(element, fvGeometry, elemVolVars, scvf)[cellCenterIdx][eqIdx] + boundaryFlux[eqIdx] = problem.neumann(element, fvGeometry, elemVolVars, scvf)[eqIdx] * extrusionFactor * scvf.area(); } } @@ -319,7 +318,7 @@ protected: if(bcTypes.isDirichletCell(massBalanceIdx)) { const auto& insideVolVars = elemVolVars[insideScv]; - residual[pressureIdx] = insideVolVars.pressure() - problem.dirichletAtPos(insideScv.center())[cellCenterIdx][pressureIdx]; + residual[pressureIdx] = insideVolVars.pressure() - problem.dirichletAtPos(insideScv.center())[pressureIdx]; } } @@ -344,9 +343,8 @@ protected: // set a fixed value for the velocity for Dirichlet boundary conditions if(bcTypes.isDirichlet(momentumBalanceIdx)) { - // const Scalar velocity = faceVars.faceVars(scvf.dofIndex()).velocity(); const Scalar velocity = elementFaceVars[scvf].velocitySelf(); - const Scalar dirichletValue = problem.dirichlet(element, scvf)[faceIdx][scvf.directionIndex()]; + const Scalar dirichletValue = problem.dirichlet(element, scvf)[Indices::velocity(scvf.directionIndex())]; residual = velocity - dirichletValue; } @@ -393,14 +391,14 @@ private: const auto insideScvIdx = scvf.insideScvIdx(); const auto& insideVolVars = elemVolVars[insideScvIdx]; - const Scalar deltaP = normalizePressure ? problem.initialAtPos(scvf.center())[cellCenterIdx][pressureIdx] : 0.0; + const Scalar deltaP = normalizePressure ? problem.initialAtPos(scvf.center())[pressureIdx] : 0.0; Scalar result = (insideVolVars.pressure() - deltaP) * scvf.area() * -1.0 * sign(scvf.outerNormalScalar()); // treat outflow BCs if(scvf.boundary()) { - const Scalar pressure = problem.dirichlet(element, scvf)[cellCenterIdx][pressureIdx] - deltaP; + const Scalar pressure = problem.dirichlet(element, scvf)[pressureIdx] - deltaP; result += pressure * scvf.area() * sign(scvf.outerNormalScalar()); } return result; -- GitLab From 0b7d8981b9776b349392438baa963730b614a613 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Fri, 15 Dec 2017 18:26:24 +0100 Subject: [PATCH 05/31] [staggered][globalVolVars] Use eqIdx directly --- dumux/discretization/staggered/gridvolumevariables.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dumux/discretization/staggered/gridvolumevariables.hh b/dumux/discretization/staggered/gridvolumevariables.hh index b63beb1b1f..ba7bce363b 100644 --- a/dumux/discretization/staggered/gridvolumevariables.hh +++ b/dumux/discretization/staggered/gridvolumevariables.hh @@ -97,7 +97,7 @@ public: for(int eqIdx = 0; eqIdx < numEqCellCenter; ++eqIdx) { if(bcTypes.isDirichlet(eqIdx) || bcTypes.isDirichletCell(eqIdx)) - boundaryPriVars[eqIdx] = problem().dirichlet(element, scvf)[cellCenterIdx][eqIdx]; + boundaryPriVars[eqIdx] = problem().dirichlet(element, scvf)[eqIdx]; else if(bcTypes.isNeumann(eqIdx) || bcTypes.isOutflow(eqIdx) || bcTypes.isSymmetry()) boundaryPriVars[eqIdx] = sol[cellCenterIdx][scvf.insideScvIdx()][eqIdx]; //TODO: this assumes a zero-gradient for e.g. the pressure on the boundary -- GitLab From 8c30d792d4bdcc7ad66c7eab80461a78333c367c Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Fri, 15 Dec 2017 18:27:07 +0100 Subject: [PATCH 06/31] [test][donea] Adapt calculation of analytical solution --- test/freeflow/staggered/doneatestproblem.hh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/freeflow/staggered/doneatestproblem.hh b/test/freeflow/staggered/doneatestproblem.hh index d01b83681a..14fa28c67f 100644 --- a/test/freeflow/staggered/doneatestproblem.hh +++ b/test/freeflow/staggered/doneatestproblem.hh @@ -390,9 +390,9 @@ private: fvGeometry.bindElement(element); for (auto&& scv : scvs(fvGeometry)) { - auto ccDofIdx = scv.dofIndex(); - auto ccDofPosition = scv.dofPosition(); - auto analyticalSolutionAtCc = analyticalSolution(ccDofPosition); + const auto ccDofIdx = scv.dofIndex(); + const auto ccDofPosition = scv.dofPosition(); + const auto analyticalSolutionAtCc = analyticalSolution(ccDofPosition); // velocities on faces for (auto&& scvf : scvfs(fvGeometry)) @@ -401,11 +401,15 @@ private: const auto faceDofPosition = scvf.center(); const auto dirIdx = scvf.directionIndex(); const auto analyticalSolutionAtFace = analyticalSolution(faceDofPosition); - analyticalVelocityOnFace_[faceDofIdx][dirIdx] = analyticalSolutionAtFace[faceIdx][dirIdx]; + analyticalVelocityOnFace_[faceDofIdx][dirIdx] = analyticalSolutionAtFace[Indices::velocity(dirIdx)]; } analyticalPressure_[ccDofIdx] = analyticalSolutionAtCc[pressureIdx]; - analyticalVelocity_[ccDofIdx] = analyticalSolutionAtCc[faceIdx]; + + for(int dirIdx = 0; dirIdx < dim; ++dirIdx) + { + analyticalVelocity_[ccDofIdx][dirIdx] = analyticalSolutionAtCc[Indices::velocity(dirIdx)]; + } } } } -- GitLab From 80fe8bf4e72ab1e3bc27371a0dec109140c23c91 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Fri, 15 Dec 2017 18:40:24 +0100 Subject: [PATCH 07/31] [freeflow][staggered] Remove PrimaryVariables property --- .../staggered/freeflow/properties.hh | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/dumux/discretization/staggered/freeflow/properties.hh b/dumux/discretization/staggered/freeflow/properties.hh index e734421301..49b3a176ee 100644 --- a/dumux/discretization/staggered/freeflow/properties.hh +++ b/dumux/discretization/staggered/freeflow/properties.hh @@ -103,28 +103,10 @@ public: //! The variables living on the faces SET_TYPE_PROP(StaggeredFreeFlowModel, FaceVariables, StaggeredFaceVariables); -//! A container class used to specify values for boundary/initial conditions -SET_PROP(StaggeredFreeFlowModel, PrimaryVariables) -{ -private: - using CellCenterBoundaryValues = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FaceBoundaryValues = Dune::FieldVector; -public: - using type = StaggeredPrimaryVariables; -}; - //! A container class used to specify values for sources and Neumann BCs SET_PROP(StaggeredFreeFlowModel, NumEqVector) { -private: - using CellCenterBoundaryValues = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FaceBoundaryValues = Dune::FieldVector; -public: - using type = StaggeredPrimaryVariables; + using type = Dune::FieldVector; }; //! Boundary types at a single degree of freedom -- GitLab From 0d434400ca5ead1c6e9cdf539ec530fec0882da2 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Fri, 15 Dec 2017 18:40:50 +0100 Subject: [PATCH 08/31] [staggered] Remove PrimaryVariable and NumEqVector properties --- dumux/discretization/staggered/properties.hh | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/dumux/discretization/staggered/properties.hh b/dumux/discretization/staggered/properties.hh index ceed74b979..9c684077a1 100644 --- a/dumux/discretization/staggered/properties.hh +++ b/dumux/discretization/staggered/properties.hh @@ -250,25 +250,7 @@ public: using type = BoundaryTypes; }; -//! A container class used to specify values for boundary/initial conditions -SET_PROP(StaggeredModel, PrimaryVariables) -{ -private: - using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); - using FacePrimaryVariables = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables); -public: - using type = StaggeredPrimaryVariables; -}; -//! A container class used to specify values for sources and Neumann BCs -SET_PROP(StaggeredModel, NumEqVector) -{ -private: - using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); - using FacePrimaryVariables = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables); -public: - using type = StaggeredPrimaryVariables; -}; SET_TYPE_PROP(StaggeredModel, GridVariables, StaggeredGridVariables); -- GitLab From d51e66f68a5274f0eef7e6775a11274ad6fec012 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Sun, 17 Dec 2017 20:17:39 +0100 Subject: [PATCH 09/31] [staggered] Remove primary variables class --- dumux/discretization/staggered/properties.hh | 2 +- dumux/implicit/staggered/primaryvariables.hh | 135 ------------------- 2 files changed, 1 insertion(+), 136 deletions(-) delete mode 100644 dumux/implicit/staggered/primaryvariables.hh diff --git a/dumux/discretization/staggered/properties.hh b/dumux/discretization/staggered/properties.hh index 9c684077a1..ca82217268 100644 --- a/dumux/discretization/staggered/properties.hh +++ b/dumux/discretization/staggered/properties.hh @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include diff --git a/dumux/implicit/staggered/primaryvariables.hh b/dumux/implicit/staggered/primaryvariables.hh deleted file mode 100644 index 64114a8387..0000000000 --- a/dumux/implicit/staggered/primaryvariables.hh +++ /dev/null @@ -1,135 +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 . * - *****************************************************************************/ -/*! - * \file - * \brief Primary Variables for the Staggered Grid models - */ -#ifndef DUMUX_STAGGERED_PRIMARYVARIABLES_HH -#define DUMUX_STAGGERED_PRIMARYVARIABLES_HH - -#include -#include - -namespace Dumux -{ - -/*! - * \ingroup NavierStokesModel - * \brief This class inherits from DUNE's MultiTypeBlockVector and provides a specific [] operator for convenience - */ -template -class StaggeredPrimaryVariables : public Dune::MultiTypeBlockVector -{ - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; - - using ParentType = Dune::MultiTypeBlockVector; - - static constexpr auto faceOffset = GET_PROP_VALUE(TypeTag, NumEqCellCenter); - - -public: - StaggeredPrimaryVariables() = default; - - // introduce a blocklevel variable so that this class can be used in a Dune::BlockVector - static constexpr int blocklevel = 1; - - - /*! - * \brief Constructor to initialize all entries with the same value - * - * \param value The value - */ - StaggeredPrimaryVariables(const Scalar value) noexcept - { - (*this)[cellCenterIdx] = value; - (*this)[faceIdx] = value; - } - - /*! - * \brief Constructor to initialize the cellcenter and face primary values with given values - * - * \param ccPriVars The cellcenter primary variables used for initialization - * \param facePriVars The face primary variables used for initialization - */ - StaggeredPrimaryVariables(CellCenterPrimaryVariables&& ccPriVars, FacePrimaryVariables&& facePriVars) noexcept - { - (*this)[cellCenterIdx] = std::forward(ccPriVars); - (*this)[faceIdx] = std::forward(facePriVars); - } - - /*! - * \brief Operator overload which allows to automatically access the "right" priVars vector via pvIdx. - * const version - * \note: the ParentType (DUNE multitypeblockvector) [] operator has to be visible (using ...) - * - * \param pvIdx The global index of the primary variable - */ - using ParentType::operator []; - const Scalar& operator [](const unsigned int pvIdx) const - { - if(pvIdx < faceOffset) - return ParentType::operator[](cellCenterIdx)[pvIdx]; - else - return ParentType::operator[](faceIdx)[pvIdx - faceOffset]; - } - - /*! - * \brief Operator overload which allows to automatically access the "right" priVars vector via pvIdx - * non-const version - * - * \param pvIdx The global index of the primary variable - */ - Scalar& operator [](const unsigned int pvIdx) - { - if(pvIdx < faceOffset) - return ParentType::operator[](cellCenterIdx)[pvIdx]; - else - return ParentType::operator[](faceIdx)[pvIdx - faceOffset]; - } -}; - -/*! -* \brief Class which provides two ranges of indices (cc and face) -* cc: for(auto i : PriVarIndices(cellCenterIdx)) { ... } -* face: for(auto i : PriVarIndices(faceIdx)) { ... } -*/ -template -class PriVarIndices : public IntRange -{ - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - using cellCenterIdx = typename DofTypeIndices::CellCenterIdx; - using faceIdx = typename DofTypeIndices::FaceIdx; - - static constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); - static constexpr auto numEqFace = GET_PROP_VALUE(TypeTag, NumEqFace); - -public: - PriVarIndices(cellCenterIdx) : IntRange(0, numEqCellCenter) {} - PriVarIndices(faceIdx) : IntRange(numEqCellCenter, numEqCellCenter + numEqFace) {} -}; - -} // namespace Dumux - -#endif -- GitLab From 60800c7f271a457821f4ae180b9d3f0c43255dc3 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Sun, 17 Dec 2017 20:19:51 +0100 Subject: [PATCH 10/31] [staggeredlocalassembler] Mimic functionality of old priVars class * Use private methods to provide iterable range with the correct indices for cell center and face priVars --- dumux/assembly/staggeredlocalassembler.hh | 42 +++++++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/dumux/assembly/staggeredlocalassembler.hh b/dumux/assembly/staggeredlocalassembler.hh index 98278964dd..76078bafac 100644 --- a/dumux/assembly/staggeredlocalassembler.hh +++ b/dumux/assembly/staggeredlocalassembler.hh @@ -30,9 +30,16 @@ #include #include -#include #include +#include + +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) + #include +#else + #include +#endif + namespace Dumux { /*! @@ -75,7 +82,6 @@ class StaggeredLocalAssembler; using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using FacePrimaryVariables = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables); using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); @@ -324,7 +330,7 @@ static void dCCdCC_(Assembler& assembler, auto& curVolVars = getVolVarAccess(gridVariables.curGridVolVars(), curElemVolVars, scvJ); VolumeVariables origVolVars(curVolVars); - for(auto pvIdx : PriVarIndices(cellCenterIdx)) + for(auto pvIdx : priVarIndices_(cellCenterIdx)) { CellCenterPrimaryVariables priVars(curSol[cellCenterIdx][globalJ]); @@ -386,7 +392,7 @@ static void dCCdFace_(Assembler& assembler, auto& faceVars = getFaceVarAccess(gridVariables.curGridFaceVars(), curElemFaceVars, scvfJ); const auto origFaceVars(faceVars); - for(auto pvIdx : PriVarIndices(faceIdx)) + for(auto pvIdx : priVarIndices_(faceIdx)) { FacePrimaryVariables facePriVars(curSol[faceIdx][globalJ]); const Scalar eps = numericEpsilon(facePriVars[pvIdx], cellCenterIdx, faceIdx); @@ -451,7 +457,7 @@ static void dFacedCC_(Assembler& assembler, auto& curVolVars = getVolVarAccess(gridVariables.curGridVolVars(), curElemVolVars, scvJ); VolumeVariables origVolVars(curVolVars); - for(auto pvIdx : PriVarIndices(cellCenterIdx)) + for(auto pvIdx : priVarIndices_(cellCenterIdx)) { CellCenterPrimaryVariables priVars(curSol[cellCenterIdx][globalJ]); @@ -515,7 +521,7 @@ static void dFacedFace_(Assembler& assembler, auto& faceVars = getFaceVarAccess(gridVariables.curGridFaceVars(), curElemFaceVars, scvf); const auto origFaceVars(faceVars); - for(auto pvIdx : PriVarIndices(faceIdx)) + for(auto pvIdx : priVarIndices_(faceIdx)) { auto faceSolution = FaceSolution(scvf, curSol[faceIdx], assembler.fvGridGeometry()); @@ -593,9 +599,31 @@ static void updateGlobalJacobian_(SubMatrix& matrix, } } +//! 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) +{ + constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) + return Dune::range(0, numEqCellCenter); +#else + return IntRange(0, numEqCellCenter); +#endif +} - +//! Helper function that returns an iterable range of primary variable indices. +//! Specialization for face dofs. +static auto priVarIndices_(typename GET_PROP(TypeTag, DofTypeIndices)::FaceIdx) +{ + constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); + constexpr auto numEqFace = GET_PROP_VALUE(TypeTag, NumEqFace); +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) + return Dune::range(numEqCellCenter, numEqCellCenter + numEqFace); +#else + return IntRange(numEqCellCenter, numEqCellCenter + numEqFace); +#endif +} private: template -- GitLab From 4ce22b433c95910754c105b5a7b72086003a4741 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Sun, 17 Dec 2017 20:22:04 +0100 Subject: [PATCH 11/31] [staggeredfvproblem] Set initial values correctly * us asImp methods that can be overwritten by the actual implementation to set cc and face init values --- dumux/common/staggeredfvproblem.hh | 57 +++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/dumux/common/staggeredfvproblem.hh b/dumux/common/staggeredfvproblem.hh index fb13dc50a0..933cd6af64 100644 --- a/dumux/common/staggeredfvproblem.hh +++ b/dumux/common/staggeredfvproblem.hh @@ -46,6 +46,9 @@ class StaggeredFVProblem : public FVProblem using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); 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 ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); + using Indices = typename GET_PROP_TYPE(TypeTag, Indices); enum { dim = GridView::dimension, @@ -112,20 +115,38 @@ public: { // let the problem do the dirty work of nailing down // the initial solution. - auto initPriVars = asImp_().initial(scv)[cellCenterIdx]; - auto dofIdxGlobal = scv.dofIndex(); - sol[cellCenterIdx][dofIdxGlobal] += initPriVars; + auto initPriVars = asImp_().initial(scv); + asImp_().applyInititalCellCenterSolution(sol, scv, initPriVars); } // loop over faces for(auto&& scvf : scvfs(fvGeometry)) { - auto initPriVars = asImp_().initial(scvf)[faceIdx][scvf.directionIndex()]; - sol[faceIdx][scvf.dofIndex()] = initPriVars; + auto initPriVars = asImp_().initial(scvf); + asImp_().applyInititalFaceSolution(sol, scvf, initPriVars); } } } + + //! Applys the initial cell center solution + void applyInititalCellCenterSolution(SolutionVector& sol, + const SubControlVolume& scv, + const PrimaryVariables& initSol) const + { + for(auto&& i : priVarIndices_(cellCenterIdx)) + sol[cellCenterIdx][scv.dofIndex()][i] = initSol[i]; + } + + //! Applys the initial face solution + void applyInititalFaceSolution(SolutionVector& sol, + const SubControlVolumeFace& scvf, + const PrimaryVariables& initSol) const + { + for(auto&& i : priVarIndices_(faceIdx)) + sol[faceIdx][scvf.dofIndex()][i] = initSol[i]; + } + protected: //! Returns the implementation of the problem (i.e. static polymorphism) Implementation &asImp_() @@ -135,6 +156,32 @@ protected: const Implementation &asImp_() const { return *static_cast(this); } + //! 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) + { + constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); + +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) + return Dune::range(0, numEqCellCenter); +#else + return IntRange(0, numEqCellCenter); +#endif + } + + //! Helper function that returns an iterable range of primary variable indices. + //! Specialization for face dofs. + static auto priVarIndices_(typename GET_PROP(TypeTag, DofTypeIndices)::FaceIdx) + { + constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); + constexpr auto numEq = GET_PROP_VALUE(TypeTag, NumEq); +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) + return Dune::range(numEqCellCenter, numEq); +#else + return IntRange(numEqCellCenter, numEq); +#endif + } + }; } // end namespace Dumux -- GitLab From 86cd2150a265edf61a38ed8462886b13c656e5ff Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Sun, 17 Dec 2017 20:23:06 +0100 Subject: [PATCH 12/31] [navierstokes][problem] Add method to set init face solution * staggered grid specific method to set velocity --- dumux/freeflow/navierstokes/problem.hh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dumux/freeflow/navierstokes/problem.hh b/dumux/freeflow/navierstokes/problem.hh index 5046e29772..b755600aae 100644 --- a/dumux/freeflow/navierstokes/problem.hh +++ b/dumux/freeflow/navierstokes/problem.hh @@ -63,6 +63,10 @@ class NavierStokesProblem : public NavierStokesParentProblem 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 SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); + using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); + using Indices = typename GET_PROP_TYPE(TypeTag, Indices); enum { dim = Grid::dimension, @@ -113,6 +117,18 @@ public: const GlobalPosition &gravity() const { return gravity_; } + //! Applys the initial face solution. Specialization for staggered grid discretization. + template + typename std::enable_if::type + applyInititalFaceSolution(SolutionVector& sol, + 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())]; + } + // \} private: -- GitLab From 33ddaf512d4c634e2e60b1d9af422d138e31e91c Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Sun, 17 Dec 2017 20:23:42 +0100 Subject: [PATCH 13/31] [navierstokes][localResidual] Correct source method for staggered --- .../navierstokes/staggered/localresidual.hh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dumux/freeflow/navierstokes/staggered/localresidual.hh b/dumux/freeflow/navierstokes/staggered/localresidual.hh index bfb171b304..9da48e9c6f 100644 --- a/dumux/freeflow/navierstokes/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokes/staggered/localresidual.hh @@ -86,6 +86,8 @@ class NavierStokesResidualImpl using CellCenterResidual = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); using FaceResidual = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables); + static constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); + enum { // grid and world dimension dim = GridView::dimension, @@ -151,7 +153,16 @@ public: const ElementFaceVariables& elemFaceVars, const SubControlVolume &scv) const { - return problem.sourceAtPos(scv.center())[cellCenterIdx]; + CellCenterPrimaryVariables result(0.0); + + // get the values from the problem + const auto sourceValues = problem.sourceAtPos(scv.center()); + + // copy the respective cell center related values to the result + for(int i = 0; i < numEqCellCenter; ++i) + result[i] = sourceValues[i]; + + return result; } -- GitLab From 2eaef00bda7b73ce95b91ec258a8439cdade48f9 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Sun, 17 Dec 2017 20:25:42 +0100 Subject: [PATCH 14/31] [freeflow][test] Adapt test_donea to changes --- test/freeflow/staggered/doneatestproblem.hh | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/freeflow/staggered/doneatestproblem.hh b/test/freeflow/staggered/doneatestproblem.hh index 14fa28c67f..a73ae8fab3 100644 --- a/test/freeflow/staggered/doneatestproblem.hh +++ b/test/freeflow/staggered/doneatestproblem.hh @@ -303,10 +303,10 @@ public: // treat cell-center dofs const auto dofIdxCellCenter = scv.dofIndex(); const auto& posCellCenter = scv.dofPosition(); - const auto analyticalSolutionCellCenter = analyticalSolution(posCellCenter)[cellCenterIdx]; - const auto numericalSolutionCellCenter = curSol[cellCenterIdx][dofIdxCellCenter]; - sumError[cellCenterIdx] += squaredDiff_(analyticalSolutionCellCenter, numericalSolutionCellCenter) * scv.volume(); - sumReference[cellCenterIdx] += analyticalSolutionCellCenter * analyticalSolutionCellCenter * scv.volume(); + const auto analyticalSolutionCellCenter = analyticalSolution(posCellCenter)[pressureIdx]; + const auto numericalSolutionCellCenter = curSol[cellCenterIdx][dofIdxCellCenter][pressureIdx]; + sumError[pressureIdx] += squaredDiff_(analyticalSolutionCellCenter, numericalSolutionCellCenter) * scv.volume(); + sumReference[pressureIdx] += analyticalSolutionCellCenter * analyticalSolutionCellCenter * scv.volume(); totalVolume += scv.volume(); // treat face dofs @@ -314,7 +314,7 @@ public: { const int dofIdxFace = scvf.dofIndex(); const int dirIdx = scvf.directionIndex(); - const auto analyticalSolutionFace = analyticalSolution(scvf.center())[faceIdx][dirIdx]; + const auto analyticalSolutionFace = analyticalSolution(scvf.center())[Indices::velocity(dirIdx)]; const auto numericalSolutionFace = curSol[faceIdx][dofIdxFace][momentumBalanceIdx]; directionIndex[dofIdxFace] = dirIdx; errorVelocity[dofIdxFace] = squaredDiff_(analyticalSolutionFace, numericalSolutionFace); @@ -326,8 +326,8 @@ public: } // get the absolute and relative discrete L2-error for cell-center dofs - l2NormAbs[cellCenterIdx] = std::sqrt(sumError[cellCenterIdx] / totalVolume); - l2NormRel[cellCenterIdx] = std::sqrt(sumError[cellCenterIdx] / sumReference[cellCenterIdx]); + l2NormAbs[pressureIdx] = std::sqrt(sumError[pressureIdx] / totalVolume); + l2NormRel[pressureIdx] = std::sqrt(sumError[pressureIdx] / sumReference[pressureIdx]); // get the absolute and relative discrete L2-error for face dofs for(int i = 0; i < numFaceDofs; ++i) @@ -336,14 +336,14 @@ public: const auto error = errorVelocity[i]; const auto ref = velocityReference[i]; const auto volume = staggeredVolume[i]; - sumError[faceIdx][dirIdx] += error * volume; - sumReference[faceIdx][dirIdx] += ref * volume; + sumError[Indices::velocity(dirIdx)] += error * volume; + sumReference[Indices::velocity(dirIdx)] += ref * volume; } for(int dirIdx = 0; dirIdx < dimWorld; ++dirIdx) { - l2NormAbs[faceIdx][dirIdx] = std::sqrt(sumError[faceIdx][dirIdx] / totalVolume); - l2NormRel[faceIdx][dirIdx] = std::sqrt(sumError[faceIdx][dirIdx] / sumReference[faceIdx][dirIdx]); + l2NormAbs[Indices::velocity(dirIdx)] = std::sqrt(sumError[Indices::velocity(dirIdx)] / totalVolume); + l2NormRel[Indices::velocity(dirIdx)] = std::sqrt(sumError[Indices::velocity(dirIdx)] / sumReference[Indices::velocity(dirIdx)]); } return std::make_pair(l2NormAbs, l2NormRel); } -- GitLab From d5d1439ddf43419da017f58fe83808a42ef6e17b Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Sun, 17 Dec 2017 20:49:33 +0100 Subject: [PATCH 15/31] Remove dumux/implicit folder --- dumux/CMakeLists.txt | 1 - dumux/implicit/CMakeLists.txt | 0 2 files changed, 1 deletion(-) delete mode 100644 dumux/implicit/CMakeLists.txt diff --git a/dumux/CMakeLists.txt b/dumux/CMakeLists.txt index 1464208a7f..a92131ff57 100644 --- a/dumux/CMakeLists.txt +++ b/dumux/CMakeLists.txt @@ -3,7 +3,6 @@ add_subdirectory("assembly") add_subdirectory("common") add_subdirectory("discretization") add_subdirectory("freeflow") -add_subdirectory("implicit") add_subdirectory("io") add_subdirectory("linear") add_subdirectory("material") diff --git a/dumux/implicit/CMakeLists.txt b/dumux/implicit/CMakeLists.txt deleted file mode 100644 index e69de29bb2..0000000000 -- GitLab From e3cb8ae29877a621b05dd051b1bf3d484af61a5f Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Sun, 17 Dec 2017 20:50:05 +0100 Subject: [PATCH 16/31] [staggered] Fix include and missing aliases --- dumux/common/staggeredfvproblem.hh | 2 ++ dumux/discretization/staggered/properties.hh | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dumux/common/staggeredfvproblem.hh b/dumux/common/staggeredfvproblem.hh index 933cd6af64..a311c1e5dc 100644 --- a/dumux/common/staggeredfvproblem.hh +++ b/dumux/common/staggeredfvproblem.hh @@ -49,6 +49,8 @@ class StaggeredFVProblem : public FVProblem 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); enum { dim = GridView::dimension, diff --git a/dumux/discretization/staggered/properties.hh b/dumux/discretization/staggered/properties.hh index ca82217268..fe45e134f6 100644 --- a/dumux/discretization/staggered/properties.hh +++ b/dumux/discretization/staggered/properties.hh @@ -33,7 +33,6 @@ #include #include -#include #include #include -- GitLab From 62cab229a984aaf7a63a6f3fd6dc7853239d6449 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Sun, 17 Dec 2017 20:54:56 +0100 Subject: [PATCH 17/31] [staggeredlocalresidual] Remove capabilities * use specialized methods for stationary/transient problems * fix indentation of docu * TODO adapt assembler accordingly --- dumux/assembly/staggeredlocalresidual.hh | 213 +++++++++++++------- test/freeflow/staggered/doneatestproblem.hh | 7 - 2 files changed, 139 insertions(+), 81 deletions(-) diff --git a/dumux/assembly/staggeredlocalresidual.hh b/dumux/assembly/staggeredlocalresidual.hh index ac744c868d..f67a31efbe 100644 --- a/dumux/assembly/staggeredlocalresidual.hh +++ b/dumux/assembly/staggeredlocalresidual.hh @@ -103,7 +103,75 @@ public: /*! * \brief Compute the local residual, i.e. the deviation of the - * equations from zero. + * equations from zero for a stationary problem. + * + * \param element The DUNE Codim<0> entity for which the residual + * ought to be calculated + * \param fvGeometry The finite-volume geometry of the element + * \param prevVolVars The volume averaged variables for all + * sub-control volumes of the element at the previous + * time level + * \param curVolVars The volume averaged variables for all + * sub-control volumes of the element at the current + * time level + * \param bcTypes The types of the boundary conditions for all + * vertices of the element + */ + auto evalCellCenter(const Problem& problem, + const Element &element, + const FVElementGeometry& fvGeometry, + const ElementVolumeVariables& curElemVolVars, + const ElementFaceVariables& curElemFaceVars, + const ElementBoundaryTypes &bcTypes, + const ElementFluxVariablesCache& elemFluxVarsCache) const + { + CellCenterResidual residual(0.0); + + asImp_().evalVolumeTermForCellCenter_(residual, problem, element, fvGeometry, curElemVolVars, curElemFaceVars, bcTypes); + asImp_().evalFluxesForCellCenter_(residual, problem, element, fvGeometry, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); + asImp_().evalBoundaryForCellCenter_(residual, problem, element, fvGeometry, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); + + return residual; + } + + /*! + * \brief Compute the local residual, i.e. the deviation of the + * equations from zero for a stationary problem. + * + * \param element The DUNE Codim<0> entity for which the residual + * ought to be calculated + * \param fvGeometry The finite-volume geometry of the element + * \param prevVolVars The volume averaged variables for all + * sub-control volumes of the element at the previous + * time level + * \param curVolVars The volume averaged variables for all + * sub-control volumes of the element at the current + * time level + * \param bcTypes The types of the boundary conditions for all + * vertices of the element + */ + auto evalFace(const Problem& problem, + const Element &element, + const FVElementGeometry& fvGeometry, + const SubControlVolumeFace& scvf, + const ElementVolumeVariables& curElemVolVars, + const ElementFaceVariables& curElemFaceVars, + const ElementBoundaryTypes &bcTypes, + const ElementFluxVariablesCache& elemFluxVarsCache, + const bool resizeResidual = false) const + { + FaceResidual residual(0.0); + + asImp_().evalVolumeTermForFace_(residual, problem, element, fvGeometry, scvf, curElemVolVars, curElemFaceVars, bcTypes); + asImp_().evalFluxesForFace_(residual, problem, element, fvGeometry, scvf, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); + asImp_().evalBoundaryForFace_(residual, problem, element, fvGeometry, scvf, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); + + return residual; + } + + /*! + * \brief Compute the local residual, i.e. the deviation of the + * equations from zero for a transient problem. * * \param element The DUNE Codim<0> entity for which the residual * ought to be calculated @@ -127,10 +195,10 @@ public: const ElementBoundaryTypes &bcTypes, const ElementFluxVariablesCache& elemFluxVarsCache) const { - // reset all terms - CellCenterResidual residual; - residual = 0.0; - // ccStorageTerm_ = 0.0; + assert(timeLoop_ && "no time loop set for storage term evaluation"); + assert(prevSol_ && "no solution set for storage term evaluation"); + + CellCenterResidual residual(0.0); asImp_().evalVolumeTermForCellCenter_(residual, problem, element, fvGeometry, prevElemVolVars, curElemVolVars, prevElemFaceVars, curElemFaceVars, bcTypes); asImp_().evalFluxesForCellCenter_(residual, problem, element, fvGeometry, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); @@ -141,7 +209,7 @@ public: /*! * \brief Compute the local residual, i.e. the deviation of the - * equations from zero. + * equations from zero for a transient problem. * * \param element The DUNE Codim<0> entity for which the residual * ought to be calculated @@ -167,7 +235,10 @@ public: const ElementFluxVariablesCache& elemFluxVarsCache, const bool resizeResidual = false) const { - FaceResidual residual; + assert(timeLoop_ && "no time loop set for storage term evaluation"); + assert(prevSol_ && "no solution set for storage term evaluation"); + + FaceResidual residual(0.0); asImp_().evalVolumeTermForFace_(residual, problem, element, fvGeometry, scvf, prevElemVolVars, curElemVolVars, prevElemFaceVars, curElemFaceVars, bcTypes); asImp_().evalFluxesForFace_(residual, problem, element, fvGeometry, scvf, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); @@ -201,9 +272,9 @@ public: protected: - /*! - * \brief Evaluate the flux terms for cell center dofs - */ + /*! + * \brief Evaluate the flux terms for cell center dofs + */ void evalFluxesForCellCenter_(CellCenterResidual& residual, const Problem& problem, const Element& element, @@ -220,9 +291,9 @@ protected: } } - /*! - * \brief Evaluate the flux terms for face dofs - */ + /*! + * \brief Evaluate the flux terms for face dofs + */ void evalFluxesForFace_(FaceResidual& residual, const Problem& problem, const Element& element, @@ -237,9 +308,9 @@ protected: residual += asImp_().computeFluxForFace(problem, element, scvf, fvGeometry, elemVolVars, elemFaceVars, elemFluxVarsCache); } - /*! - * \brief Evaluate boundary conditions - */ + /*! + * \brief Evaluate boundary conditions + */ void evalBoundary_(const Problem& problem, const Element& element, const FVElementGeometry& fvGeometry, @@ -253,20 +324,16 @@ protected: "a evalBoundary_() method."); } - /*! - * \brief Evaluate the volume term for a cell center dof for a stationary problem - */ - template - typename std::enable_if::value, void>::type - evalVolumeTermForCellCenter_(CellCenterResidual& residual, - const Problem& problem, - const Element &element, - const FVElementGeometry& fvGeometry, - const ElementVolumeVariables& prevElemVolVars, - const ElementVolumeVariables& curElemVolVars, - const ElementFaceVariables& prevFaceVars, - const ElementFaceVariables& curFaceVars, - const ElementBoundaryTypes &bcTypes) const + /*! + * \brief Evaluate the volume term for a cell center dof for a stationary problem + */ + void evalVolumeTermForCellCenter_(CellCenterResidual& residual, + const Problem& problem, + const Element &element, + const FVElementGeometry& fvGeometry, + const ElementVolumeVariables& curElemVolVars, + const ElementFaceVariables& curFaceVars, + const ElementBoundaryTypes &bcTypes) const { for(auto&& scv : scvs(fvGeometry)) { @@ -279,21 +346,17 @@ protected: } } - /*! - * \brief Evaluate the volume term for a face dof for a stationary problem - */ - template - typename std::enable_if::value, void>::type - evalVolumeTermForFace_(FaceResidual& residual, - const Problem& problem, - const Element &element, - const FVElementGeometry& fvGeometry, - const SubControlVolumeFace& scvf, - const ElementVolumeVariables& prevElemVolVars, - const ElementVolumeVariables& curElemVolVars, - const ElementFaceVariables& prevFaceVars, - const ElementFaceVariables& curFaceVars, - const ElementBoundaryTypes &bcTypes) const + /*! + * \brief Evaluate the volume term for a face dof for a stationary problem + */ + void evalVolumeTermForFace_(FaceResidual& residual, + const Problem& problem, + const Element &element, + const FVElementGeometry& fvGeometry, + const SubControlVolumeFace& scvf, + const ElementVolumeVariables& curElemVolVars, + const ElementFaceVariables& curFaceVars, + const ElementBoundaryTypes &bcTypes) const { // the source term: auto faceSource = asImp_().computeSourceForFace(problem, scvf, curElemVolVars, curFaceVars); @@ -303,21 +366,22 @@ protected: residual -= faceSource; } - /*! - * \brief Evaluate the volume term for a cell center dof for a transient problem - */ - template - typename std::enable_if::value, void>::type - evalVolumeTermForCellCenter_(CellCenterResidual& residual, - const Problem& problem, - const Element &element, - const FVElementGeometry& fvGeometry, - const ElementVolumeVariables& prevElemVolVars, - const ElementVolumeVariables& curElemVolVars, - const ElementFaceVariables& prevFaceVars, - const ElementFaceVariables& curFaceVars, - const ElementBoundaryTypes &bcTypes) const + /*! + * \brief Evaluate the volume term for a cell center dof for a transient problem + */ + void evalVolumeTermForCellCenter_(CellCenterResidual& residual, + const Problem& problem, + const Element &element, + const FVElementGeometry& fvGeometry, + const ElementVolumeVariables& prevElemVolVars, + const ElementVolumeVariables& curElemVolVars, + const ElementFaceVariables& prevFaceVars, + const ElementFaceVariables& curFaceVars, + const ElementBoundaryTypes &bcTypes) const { + assert(timeLoop_ && "no time loop set for storage term evaluation"); + assert(prevSol_ && "no solution set for storage term evaluation"); + for(auto&& scv : scvs(fvGeometry)) { const auto& curVolVars = curElemVolVars[scv]; @@ -353,22 +417,23 @@ protected: } } - /*! - * \brief Evaluate the volume term for a face dof for a transient problem - */ - template - typename std::enable_if::value, void>::type - evalVolumeTermForFace_(FaceResidual& residual, - const Problem& problem, - const Element &element, - const FVElementGeometry& fvGeometry, - const SubControlVolumeFace& scvf, - const ElementVolumeVariables& prevElemVolVars, - const ElementVolumeVariables& curElemVolVars, - const ElementFaceVariables& prevFaceVars, - const ElementFaceVariables& curFaceVars, - const ElementBoundaryTypes &bcTypes) const + /*! + * \brief Evaluate the volume term for a face dof for a transient problem + */ + void evalVolumeTermForFace_(FaceResidual& residual, + const Problem& problem, + const Element &element, + const FVElementGeometry& fvGeometry, + const SubControlVolumeFace& scvf, + const ElementVolumeVariables& prevElemVolVars, + const ElementVolumeVariables& curElemVolVars, + const ElementFaceVariables& prevFaceVars, + const ElementFaceVariables& curFaceVars, + const ElementBoundaryTypes &bcTypes) const { + assert(timeLoop_ && "no time loop set for storage term evaluation"); + assert(prevSol_ && "no solution set for storage term evaluation"); + const auto& scv = fvGeometry.scv(scvf.insideScvIdx()); const auto& curVolVars = curElemVolVars[scv]; const auto& prevVolVars = prevElemVolVars[scv]; diff --git a/test/freeflow/staggered/doneatestproblem.hh b/test/freeflow/staggered/doneatestproblem.hh index a73ae8fab3..55b62eefea 100644 --- a/test/freeflow/staggered/doneatestproblem.hh +++ b/test/freeflow/staggered/doneatestproblem.hh @@ -40,13 +40,6 @@ namespace Dumux template class DoneaTestProblem; -namespace Capabilities -{ - template - struct isStationary> - { static const bool value = true; }; -} - namespace Properties { NEW_TYPE_TAG(DoneaTestProblem, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokes)); -- GitLab From cc1e7b6b3cb20fb284be06a0642285bc2ef014ae Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Mon, 18 Dec 2017 16:42:36 +0100 Subject: [PATCH 18/31] [staggeredlocalassembler] Fix indentation --- dumux/assembly/staggeredlocalassembler.hh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dumux/assembly/staggeredlocalassembler.hh b/dumux/assembly/staggeredlocalassembler.hh index 76078bafac..8912594d50 100644 --- a/dumux/assembly/staggeredlocalassembler.hh +++ b/dumux/assembly/staggeredlocalassembler.hh @@ -99,8 +99,11 @@ public: * to the global matrix. The element residual is written into the right hand side. */ template - static void assembleJacobianAndResidual(Assembler& assembler, JacobianMatrix& jac, SolutionVector& res, - const Element& element, const SolutionVector& curSol) + static void assembleJacobianAndResidual(Assembler& assembler, + JacobianMatrix& jac, + SolutionVector& res, + const Element& element, + const SolutionVector& curSol) { using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); typename DofTypeIndices::CellCenterIdx cellCenterIdx; -- GitLab From b007df5a4fe1d437123dec1cea57d1cafb1b5183 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Mon, 18 Dec 2017 16:43:48 +0100 Subject: [PATCH 19/31] [staggeredlocalResidual] Let the eval methods decide about isStationary --- dumux/assembly/staggeredlocalresidual.hh | 91 ++++-------------------- 1 file changed, 15 insertions(+), 76 deletions(-) diff --git a/dumux/assembly/staggeredlocalresidual.hh b/dumux/assembly/staggeredlocalresidual.hh index f67a31efbe..d92d1f7101 100644 --- a/dumux/assembly/staggeredlocalresidual.hh +++ b/dumux/assembly/staggeredlocalresidual.hh @@ -101,74 +101,6 @@ public: */ // \{ - /*! - * \brief Compute the local residual, i.e. the deviation of the - * equations from zero for a stationary problem. - * - * \param element The DUNE Codim<0> entity for which the residual - * ought to be calculated - * \param fvGeometry The finite-volume geometry of the element - * \param prevVolVars The volume averaged variables for all - * sub-control volumes of the element at the previous - * time level - * \param curVolVars The volume averaged variables for all - * sub-control volumes of the element at the current - * time level - * \param bcTypes The types of the boundary conditions for all - * vertices of the element - */ - auto evalCellCenter(const Problem& problem, - const Element &element, - const FVElementGeometry& fvGeometry, - const ElementVolumeVariables& curElemVolVars, - const ElementFaceVariables& curElemFaceVars, - const ElementBoundaryTypes &bcTypes, - const ElementFluxVariablesCache& elemFluxVarsCache) const - { - CellCenterResidual residual(0.0); - - asImp_().evalVolumeTermForCellCenter_(residual, problem, element, fvGeometry, curElemVolVars, curElemFaceVars, bcTypes); - asImp_().evalFluxesForCellCenter_(residual, problem, element, fvGeometry, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); - asImp_().evalBoundaryForCellCenter_(residual, problem, element, fvGeometry, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); - - return residual; - } - - /*! - * \brief Compute the local residual, i.e. the deviation of the - * equations from zero for a stationary problem. - * - * \param element The DUNE Codim<0> entity for which the residual - * ought to be calculated - * \param fvGeometry The finite-volume geometry of the element - * \param prevVolVars The volume averaged variables for all - * sub-control volumes of the element at the previous - * time level - * \param curVolVars The volume averaged variables for all - * sub-control volumes of the element at the current - * time level - * \param bcTypes The types of the boundary conditions for all - * vertices of the element - */ - auto evalFace(const Problem& problem, - const Element &element, - const FVElementGeometry& fvGeometry, - const SubControlVolumeFace& scvf, - const ElementVolumeVariables& curElemVolVars, - const ElementFaceVariables& curElemFaceVars, - const ElementBoundaryTypes &bcTypes, - const ElementFluxVariablesCache& elemFluxVarsCache, - const bool resizeResidual = false) const - { - FaceResidual residual(0.0); - - asImp_().evalVolumeTermForFace_(residual, problem, element, fvGeometry, scvf, curElemVolVars, curElemFaceVars, bcTypes); - asImp_().evalFluxesForFace_(residual, problem, element, fvGeometry, scvf, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); - asImp_().evalBoundaryForFace_(residual, problem, element, fvGeometry, scvf, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); - - return residual; - } - /*! * \brief Compute the local residual, i.e. the deviation of the * equations from zero for a transient problem. @@ -195,12 +127,16 @@ public: const ElementBoundaryTypes &bcTypes, const ElementFluxVariablesCache& elemFluxVarsCache) const { - assert(timeLoop_ && "no time loop set for storage term evaluation"); - assert(prevSol_ && "no solution set for storage term evaluation"); + assert( ( (timeLoop_ && !isStationary()) || (!timeLoop_ && isStationary() ) ) && "no time loop set for storage term evaluation"); + assert( ( (prevSol_ && !isStationary()) || (!prevSol_ && isStationary() ) ) && "no solution set for storage term evaluation"); CellCenterResidual residual(0.0); - asImp_().evalVolumeTermForCellCenter_(residual, problem, element, fvGeometry, prevElemVolVars, curElemVolVars, prevElemFaceVars, curElemFaceVars, bcTypes); + if(isStationary()) + asImp_().evalVolumeTermForCellCenter_(residual, problem, element, fvGeometry, curElemVolVars, curElemFaceVars, bcTypes); + else + asImp_().evalVolumeTermForCellCenter_(residual, problem, element, fvGeometry, prevElemVolVars, curElemVolVars, prevElemFaceVars, curElemFaceVars, bcTypes); + asImp_().evalFluxesForCellCenter_(residual, problem, element, fvGeometry, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); asImp_().evalBoundaryForCellCenter_(residual, problem, element, fvGeometry, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); @@ -232,15 +168,18 @@ public: const ElementFaceVariables& prevElemFaceVars, const ElementFaceVariables& curElemFaceVars, const ElementBoundaryTypes &bcTypes, - const ElementFluxVariablesCache& elemFluxVarsCache, - const bool resizeResidual = false) const + const ElementFluxVariablesCache& elemFluxVarsCache) const { - assert(timeLoop_ && "no time loop set for storage term evaluation"); - assert(prevSol_ && "no solution set for storage term evaluation"); + assert( ( (timeLoop_ && !isStationary()) || (!timeLoop_ && isStationary() ) ) && "no time loop set for storage term evaluation"); + assert( ( (prevSol_ && !isStationary()) || (!prevSol_ && isStationary() ) ) && "no solution set for storage term evaluation"); FaceResidual residual(0.0); - asImp_().evalVolumeTermForFace_(residual, problem, element, fvGeometry, scvf, prevElemVolVars, curElemVolVars, prevElemFaceVars, curElemFaceVars, bcTypes); + if(isStationary()) + asImp_().evalVolumeTermForFace_(residual, problem, element, fvGeometry, scvf, curElemVolVars, curElemFaceVars, bcTypes); + else + asImp_().evalVolumeTermForFace_(residual, problem, element, fvGeometry, scvf, prevElemVolVars, curElemVolVars, prevElemFaceVars, curElemFaceVars, bcTypes); + asImp_().evalFluxesForFace_(residual, problem, element, fvGeometry, scvf, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); asImp_().evalBoundaryForFace_(residual, problem, element, fvGeometry, scvf, curElemVolVars, curElemFaceVars, bcTypes, elemFluxVarsCache); -- GitLab From af8308dd35106a17bafc5692918ad2053946fed5 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Mon, 18 Dec 2017 17:11:15 +0100 Subject: [PATCH 20/31] [navierstokes][test] Adapt test_kovasznay to changes * make stationary --- test/freeflow/staggered/CMakeLists.txt | 2 +- .../staggered/kovasznaytestproblem.hh | 43 ++++------ test/freeflow/staggered/test_kovasznay.cc | 80 ++++--------------- .../test_navierstokes_kovasznay.input | 4 - 4 files changed, 31 insertions(+), 98 deletions(-) diff --git a/test/freeflow/staggered/CMakeLists.txt b/test/freeflow/staggered/CMakeLists.txt index 37f17e8202..e59bd2a8c4 100644 --- a/test/freeflow/staggered/CMakeLists.txt +++ b/test/freeflow/staggered/CMakeLists.txt @@ -77,7 +77,7 @@ dune_add_test(NAME test_navierstokes_kovasznay COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py CMD_ARGS --script fuzzy --files ${CMAKE_SOURCE_DIR}/test/references/test_kovasznay-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/test_kovasznay-00002.vtu + ${CMAKE_CURRENT_BINARY_DIR}/test_kovasznay-00001.vtu --command "${CMAKE_CURRENT_BINARY_DIR}/test_navierstokes_kovasznay") dune_add_test(NAME test_navierstokes_angeli diff --git a/test/freeflow/staggered/kovasznaytestproblem.hh b/test/freeflow/staggered/kovasznaytestproblem.hh index 49415b0fa1..3b04ff4342 100644 --- a/test/freeflow/staggered/kovasznaytestproblem.hh +++ b/test/freeflow/staggered/kovasznaytestproblem.hh @@ -32,22 +32,11 @@ #include #include -// solve Navier-Stokes equations -#define ENABLE_NAVIERSTOKES 1 - - namespace Dumux { template class KovasznayTestProblem; -namespace Capabilities -{ - template - struct isStationary> - { static const bool value = true; }; -} - namespace Properties { NEW_TYPE_TAG(KovasznayTestProblem, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokes)); @@ -70,11 +59,7 @@ SET_BOOL_PROP(KovasznayTestProblem, EnableFVGridGeometryCache, true); SET_BOOL_PROP(KovasznayTestProblem, EnableGridFluxVariablesCache, true); SET_BOOL_PROP(KovasznayTestProblem, EnableGridVolumeVariablesCache, true); -#if ENABLE_NAVIERSTOKES SET_BOOL_PROP(KovasznayTestProblem, EnableInertiaTerms, true); -#else -SET_BOOL_PROP(KovasznayTestProblem, EnableInertiaTerms, false); -#endif } /*! @@ -299,10 +284,10 @@ public: // treat cell-center dofs const auto dofIdxCellCenter = scv.dofIndex(); const auto& posCellCenter = scv.dofPosition(); - const auto analyticalSolutionCellCenter = dirichletAtPos(posCellCenter)[cellCenterIdx]; - const auto numericalSolutionCellCenter = curSol[cellCenterIdx][dofIdxCellCenter]; - sumError[cellCenterIdx] += squaredDiff_(analyticalSolutionCellCenter, numericalSolutionCellCenter) * scv.volume(); - sumReference[cellCenterIdx] += analyticalSolutionCellCenter * analyticalSolutionCellCenter * scv.volume(); + const auto analyticalSolutionCellCenter = dirichletAtPos(posCellCenter)[pressureIdx]; + const auto numericalSolutionCellCenter = curSol[cellCenterIdx][dofIdxCellCenter][pressureIdx]; + sumError[pressureIdx] += squaredDiff_(analyticalSolutionCellCenter, numericalSolutionCellCenter) * scv.volume(); + sumReference[pressureIdx] += analyticalSolutionCellCenter * analyticalSolutionCellCenter * scv.volume(); totalVolume += scv.volume(); // treat face dofs @@ -310,7 +295,7 @@ public: { const int dofIdxFace = scvf.dofIndex(); const int dirIdx = scvf.directionIndex(); - const auto analyticalSolutionFace = dirichletAtPos(scvf.center())[faceIdx][dirIdx]; + const auto analyticalSolutionFace = dirichletAtPos(scvf.center())[Indices::velocity(dirIdx)]; const auto numericalSolutionFace = curSol[faceIdx][dofIdxFace][momentumBalanceIdx]; directionIndex[dofIdxFace] = dirIdx; errorVelocity[dofIdxFace] = squaredDiff_(analyticalSolutionFace, numericalSolutionFace); @@ -322,8 +307,8 @@ public: } // get the absolute and relative discrete L2-error for cell-center dofs - l2NormAbs[cellCenterIdx] = std::sqrt(sumError[cellCenterIdx] / totalVolume); - l2NormRel[cellCenterIdx] = std::sqrt(sumError[cellCenterIdx] / sumReference[cellCenterIdx]); + l2NormAbs[pressureIdx] = std::sqrt(sumError[pressureIdx] / totalVolume); + l2NormRel[pressureIdx] = std::sqrt(sumError[pressureIdx] / sumReference[pressureIdx]); // get the absolute and relative discrete L2-error for face dofs for(int i = 0; i < numFaceDofs; ++i) @@ -332,14 +317,14 @@ public: const auto error = errorVelocity[i]; const auto ref = velocityReference[i]; const auto volume = staggeredVolume[i]; - sumError[faceIdx][dirIdx] += error * volume; - sumReference[faceIdx][dirIdx] += ref * volume; + sumError[Indices::velocity(dirIdx)] += error * volume; + sumReference[Indices::velocity(dirIdx)] += ref * volume; } for(int dirIdx = 0; dirIdx < dimWorld; ++dirIdx) { - l2NormAbs[faceIdx][dirIdx] = std::sqrt(sumError[faceIdx][dirIdx] / totalVolume); - l2NormRel[faceIdx][dirIdx] = std::sqrt(sumError[faceIdx][dirIdx] / sumReference[faceIdx][dirIdx]); + l2NormAbs[Indices::velocity(dirIdx)] = std::sqrt(sumError[Indices::velocity(dirIdx)] / totalVolume); + l2NormRel[Indices::velocity(dirIdx)] = std::sqrt(sumError[Indices::velocity(dirIdx)] / sumReference[Indices::velocity(dirIdx)]); } return std::make_pair(l2NormAbs, l2NormRel); } @@ -396,11 +381,13 @@ private: const auto faceDofPosition = scvf.center(); const auto dirIdx = scvf.directionIndex(); const auto analyticalSolutionAtFace = analyticalSolution(faceDofPosition); - analyticalVelocityOnFace_[faceDofIdx][dirIdx] = analyticalSolutionAtFace[faceIdx][dirIdx]; + analyticalVelocityOnFace_[faceDofIdx][dirIdx] = analyticalSolutionAtFace[Indices::velocity(dirIdx)]; } analyticalPressure_[ccDofIdx] = analyticalSolutionAtCc[pressureIdx]; - analyticalVelocity_[ccDofIdx] = analyticalSolutionAtCc[faceIdx]; + + for(int dirIdx = 0; dirIdx < dim; ++dirIdx) + analyticalVelocity_[ccDofIdx][dirIdx] = analyticalSolutionAtCc[Indices::velocity(dirIdx)]; } } } diff --git a/test/freeflow/staggered/test_kovasznay.cc b/test/freeflow/staggered/test_kovasznay.cc index b1c855a136..50afa4e0a8 100644 --- a/test/freeflow/staggered/test_kovasznay.cc +++ b/test/freeflow/staggered/test_kovasznay.cc @@ -19,7 +19,7 @@ /*! * \file * - * \brief Test for the staggered grid Stokes model (Donea et al., 2003) + * \brief Stationary test for the staggered grid Navier-Stokes model (Kovasznay 1947) */ #include @@ -119,7 +119,7 @@ int main(int argc, char** argv) try auto fvGridGeometry = std::make_shared(leafGridView); fvGridGeometry->update(); - // the problem (initial and boundary conditions) + // the problem (boundary conditions) using Problem = typename GET_PROP_TYPE(TypeTag, Problem); auto problem = std::make_shared(fvGridGeometry); @@ -133,25 +133,11 @@ int main(int argc, char** argv) try SolutionVector x; x[cellCenterIdx].resize(numDofsCellCenter); x[faceIdx].resize(numDofsFace); - problem->applyInitialSolution(x); - auto xOld = x; // the grid variables using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); auto gridVariables = std::make_shared(problem, fvGridGeometry); - gridVariables->init(x, xOld); - - // get some time loop parameters - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - const auto tEnd = getParam("TimeLoop.TEnd"); - const auto maxDivisions = getParam("TimeLoop.MaxTimeStepDivisions"); - const auto maxDt = getParam("TimeLoop.MaxTimeStepSize"); - auto dt = getParam("TimeLoop.DtInitial"); - - // check if we are about to restart a previously interrupted simulation - Scalar restartTime = 0; - if (Parameters::getTree().hasKey("Restart") || Parameters::getTree().hasKey("TimeLoop.Restart")) - restartTime = getParam("TimeLoop.Restart"); + gridVariables->init(x); // intialize the vtk output module using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); @@ -162,13 +148,9 @@ int main(int argc, char** argv) try vtkWriter.addFaceField(problem->getAnalyticalVelocitySolutionOnFace(), "faceVelocityExact"); vtkWriter.write(0.0); - // instantiate time loop - auto timeLoop = std::make_shared>(restartTime, dt, tEnd); - timeLoop->setMaxTimeStepSize(maxDt); - // the assembler with time loop for instationary problem using Assembler = StaggeredFVAssembler; - auto assembler = std::make_shared(problem, fvGridGeometry, gridVariables, timeLoop); + auto assembler = std::make_shared(problem, fvGridGeometry, gridVariables); // the linear solver using LinearSolver = Dumux::UMFPackBackend; @@ -177,55 +159,23 @@ int main(int argc, char** argv) try // the non-linear solver using NewtonController = StaggeredNewtonController; using NewtonMethod = Dumux::NewtonMethod; - auto newtonController = std::make_shared(leafGridView.comm(), timeLoop); + auto newtonController = std::make_shared(leafGridView.comm()); NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver); - // time loop - timeLoop->start(); do - { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - - // try solving the non-linear system - for (int i = 0; i < maxDivisions; ++i) - { - // linearize & solve - auto converged = nonLinearSolver.solve(x); - - if (converged) - break; - - if (!converged && i == maxDivisions-1) - DUNE_THROW(Dune::MathError, - "Newton solver didn't converge after " - << maxDivisions - << " time-step divisions. dt=" - << timeLoop->timeStepSize() - << ".\nThe solutions of the current and the previous time steps " - << "have been saved to restart files."); - } - - // make the new solution the old solution - xOld = x; - gridVariables->advanceTimeStep(); - - // advance to the time loop to the next step - timeLoop->advanceTimeStep(); - - problem->postTimeStep(x); - - // write vtk output - vtkWriter.write(timeLoop->time()); + // linearize & solve + Dune::Timer timer; + nonLinearSolver.solve(x); - // report statistics of this time step - timeLoop->reportTimeStep(); + // write vtk output + vtkWriter.write(1.0); - // set new dt as suggested by newton controller - timeLoop->setTimeStepSize(newtonController->suggestTimeStepSize(timeLoop->timeStepSize())); + timer.stop(); - } while (!timeLoop->finished()); + const auto& comm = Dune::MPIHelper::getCollectiveCommunication(); + std::cout << "Simulation took " << timer.elapsed() << " seconds on " + << comm.size() << " processes.\n" + << "The cumulative CPU time was " << timer.elapsed()*comm.size() << " seconds.\n"; - timeLoop->finalize(leafGridView.comm()); //////////////////////////////////////////////////////////// // finalize, print dumux message to say goodbye diff --git a/test/freeflow/staggered/test_navierstokes_kovasznay.input b/test/freeflow/staggered/test_navierstokes_kovasznay.input index 1bcc53d179..03029c6f46 100644 --- a/test/freeflow/staggered/test_navierstokes_kovasznay.input +++ b/test/freeflow/staggered/test_navierstokes_kovasznay.input @@ -1,7 +1,3 @@ -[TimeLoop] -DtInitial = 1 # [s] -TEnd = 2 # [s] - [Grid] LowerLeft = -0.5 -0.5 UpperRight = 2 1.5 -- GitLab From 45873409d594b1d259b7eff2c2259f605334587c Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Mon, 18 Dec 2017 17:15:51 +0100 Subject: [PATCH 21/31] [stokes][test] Make test_donea stationary --- test/freeflow/staggered/CMakeLists.txt | 2 +- test/freeflow/staggered/doneatestproblem.hh | 2 - test/freeflow/staggered/test_donea.cc | 79 ++++--------------- .../staggered/test_stokes_donea.input | 4 - 4 files changed, 15 insertions(+), 72 deletions(-) diff --git a/test/freeflow/staggered/CMakeLists.txt b/test/freeflow/staggered/CMakeLists.txt index e59bd2a8c4..2ebe3a3c9f 100644 --- a/test/freeflow/staggered/CMakeLists.txt +++ b/test/freeflow/staggered/CMakeLists.txt @@ -68,7 +68,7 @@ dune_add_test(NAME test_stokes_donea COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py CMD_ARGS --script fuzzy --files ${CMAKE_SOURCE_DIR}/test/references/stokes-donea-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/test_donea-00002.vtu + ${CMAKE_CURRENT_BINARY_DIR}/test_donea-00001.vtu --command "${CMAKE_CURRENT_BINARY_DIR}/test_stokes_donea") dune_add_test(NAME test_navierstokes_kovasznay diff --git a/test/freeflow/staggered/doneatestproblem.hh b/test/freeflow/staggered/doneatestproblem.hh index 55b62eefea..27a9db66ee 100644 --- a/test/freeflow/staggered/doneatestproblem.hh +++ b/test/freeflow/staggered/doneatestproblem.hh @@ -400,9 +400,7 @@ private: analyticalPressure_[ccDofIdx] = analyticalSolutionAtCc[pressureIdx]; for(int dirIdx = 0; dirIdx < dim; ++dirIdx) - { analyticalVelocity_[ccDofIdx][dirIdx] = analyticalSolutionAtCc[Indices::velocity(dirIdx)]; - } } } } diff --git a/test/freeflow/staggered/test_donea.cc b/test/freeflow/staggered/test_donea.cc index 173b09a2c3..4ef7f924d9 100644 --- a/test/freeflow/staggered/test_donea.cc +++ b/test/freeflow/staggered/test_donea.cc @@ -120,7 +120,7 @@ int main(int argc, char** argv) try auto fvGridGeometry = std::make_shared(leafGridView); fvGridGeometry->update(); - // the problem (initial and boundary conditions) + // the problem (boundary conditions) using Problem = typename GET_PROP_TYPE(TypeTag, Problem); auto problem = std::make_shared(fvGridGeometry); @@ -134,25 +134,11 @@ int main(int argc, char** argv) try SolutionVector x; x[cellCenterIdx].resize(numDofsCellCenter); x[faceIdx].resize(numDofsFace); - problem->applyInitialSolution(x); - auto xOld = x; // the grid variables using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); auto gridVariables = std::make_shared(problem, fvGridGeometry); - gridVariables->init(x, xOld); - - // get some time loop parameters - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - const auto tEnd = getParam("TimeLoop.TEnd"); - const auto maxDivisions = getParam("TimeLoop.MaxTimeStepDivisions"); - const auto maxDt = getParam("TimeLoop.MaxTimeStepSize"); - auto dt = getParam("TimeLoop.DtInitial"); - - // check if we are about to restart a previously interrupted simulation - Scalar restartTime = 0; - if (Parameters::getTree().hasKey("Restart") || Parameters::getTree().hasKey("TimeLoop.Restart")) - restartTime = getParam("TimeLoop.Restart"); + gridVariables->init(x); // intialize the vtk output module using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); @@ -163,13 +149,9 @@ int main(int argc, char** argv) try vtkWriter.addFaceField(problem->getAnalyticalVelocitySolutionOnFace(), "faceVelocityExact"); vtkWriter.write(0.0); - // instantiate time loop - auto timeLoop = std::make_shared>(restartTime, dt, tEnd); - timeLoop->setMaxTimeStepSize(maxDt); - // the assembler with time loop for instationary problem using Assembler = StaggeredFVAssembler; - auto assembler = std::make_shared(problem, fvGridGeometry, gridVariables, timeLoop); + auto assembler = std::make_shared(problem, fvGridGeometry, gridVariables); // the linear solver using LinearSolver = Dumux::UMFPackBackend; @@ -178,55 +160,22 @@ int main(int argc, char** argv) try // the non-linear solver using NewtonController = StaggeredNewtonController; using NewtonMethod = Dumux::NewtonMethod; - auto newtonController = std::make_shared(leafGridView.comm(), timeLoop); + auto newtonController = std::make_shared(leafGridView.comm()); NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver); - // time loop - timeLoop->start(); do - { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - - // try solving the non-linear system - for (int i = 0; i < maxDivisions; ++i) - { - // linearize & solve - auto converged = nonLinearSolver.solve(x); - - if (converged) - break; - - if (!converged && i == maxDivisions-1) - DUNE_THROW(Dune::MathError, - "Newton solver didn't converge after " - << maxDivisions - << " time-step divisions. dt=" - << timeLoop->timeStepSize() - << ".\nThe solutions of the current and the previous time steps " - << "have been saved to restart files."); - } - - // make the new solution the old solution - xOld = x; - gridVariables->advanceTimeStep(); - - // advance to the time loop to the next step - timeLoop->advanceTimeStep(); - - problem->postTimeStep(x); - - // write vtk output - vtkWriter.write(timeLoop->time()); - - // report statistics of this time step - timeLoop->reportTimeStep(); + // linearize & solve + Dune::Timer timer; + nonLinearSolver.solve(x); - // set new dt as suggested by newton controller - timeLoop->setTimeStepSize(newtonController->suggestTimeStepSize(timeLoop->timeStepSize())); + // write vtk output + vtkWriter.write(1.0); - } while (!timeLoop->finished()); + timer.stop(); - timeLoop->finalize(leafGridView.comm()); + const auto& comm = Dune::MPIHelper::getCollectiveCommunication(); + std::cout << "Simulation took " << timer.elapsed() << " seconds on " + << comm.size() << " processes.\n" + << "The cumulative CPU time was " << timer.elapsed()*comm.size() << " seconds.\n"; //////////////////////////////////////////////////////////// // finalize, print dumux message to say goodbye diff --git a/test/freeflow/staggered/test_stokes_donea.input b/test/freeflow/staggered/test_stokes_donea.input index d58cec3d52..b394c975db 100644 --- a/test/freeflow/staggered/test_stokes_donea.input +++ b/test/freeflow/staggered/test_stokes_donea.input @@ -1,7 +1,3 @@ -[TimeLoop] -DtInitial = 1 # [s] -TEnd = 2 # [s] - [Grid] UpperRight = 1 1 Cells = 40 40 -- GitLab From 370504890e9f67a1a4f78b0c11bc27ff0b16cc37 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Mon, 18 Dec 2017 17:23:01 +0100 Subject: [PATCH 22/31] [navierstokes][test] Remove capabilities from test_channel --- test/freeflow/staggered/channeltestproblem.hh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/freeflow/staggered/channeltestproblem.hh b/test/freeflow/staggered/channeltestproblem.hh index 101b184bad..51c79e4a9c 100644 --- a/test/freeflow/staggered/channeltestproblem.hh +++ b/test/freeflow/staggered/channeltestproblem.hh @@ -38,13 +38,6 @@ namespace Dumux template class ChannelTestProblem; -namespace Capabilities -{ - template - struct isStationary> - { static const bool value = false; }; -} - namespace Properties { #if !NONISOTHERMAL -- GitLab From ca13b523b6ab3c5af0efd59082cbbd511a088a8a Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Mon, 18 Dec 2017 17:23:28 +0100 Subject: [PATCH 23/31] [navierstokes][test] Adapt test_angeli to changes --- test/freeflow/staggered/angelitestproblem.hh | 35 +++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/test/freeflow/staggered/angelitestproblem.hh b/test/freeflow/staggered/angelitestproblem.hh index 816b62c756..6f62b4c04f 100644 --- a/test/freeflow/staggered/angelitestproblem.hh +++ b/test/freeflow/staggered/angelitestproblem.hh @@ -37,13 +37,6 @@ namespace Dumux template class AngeliTestProblem; -namespace Capabilities -{ - template - struct isStationary> - { static const bool value = false; }; -} - namespace Properties { NEW_TYPE_TAG(AngeliTestProblem, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokes)); @@ -286,10 +279,10 @@ public: // treat cell-center dofs const auto dofIdxCellCenter = scv.dofIndex(); const auto& posCellCenter = scv.dofPosition(); - const auto analyticalSolutionCellCenter = dirichletAtPos(posCellCenter)[cellCenterIdx]; - const auto numericalSolutionCellCenter = curSol[cellCenterIdx][dofIdxCellCenter]; - sumError[cellCenterIdx] += squaredDiff_(analyticalSolutionCellCenter, numericalSolutionCellCenter) * scv.volume(); - sumReference[cellCenterIdx] += analyticalSolutionCellCenter * analyticalSolutionCellCenter * scv.volume(); + const auto analyticalSolutionCellCenter = dirichletAtPos(posCellCenter)[pressureIdx]; + const auto numericalSolutionCellCenter = curSol[cellCenterIdx][dofIdxCellCenter][pressureIdx]; + sumError[pressureIdx] += squaredDiff_(analyticalSolutionCellCenter, numericalSolutionCellCenter) * scv.volume(); + sumReference[pressureIdx] += analyticalSolutionCellCenter * analyticalSolutionCellCenter * scv.volume(); totalVolume += scv.volume(); // treat face dofs @@ -297,7 +290,7 @@ public: { const int dofIdxFace = scvf.dofIndex(); const int dirIdx = scvf.directionIndex(); - const auto analyticalSolutionFace = dirichletAtPos(scvf.center())[faceIdx][dirIdx]; + const auto analyticalSolutionFace = dirichletAtPos(scvf.center())[Indices::velocity(dirIdx)]; const auto numericalSolutionFace = curSol[faceIdx][dofIdxFace][momentumBalanceIdx]; directionIndex[dofIdxFace] = dirIdx; errorVelocity[dofIdxFace] = squaredDiff_(analyticalSolutionFace, numericalSolutionFace); @@ -309,8 +302,8 @@ public: } // get the absolute and relative discrete L2-error for cell-center dofs - l2NormAbs[cellCenterIdx] = std::sqrt(sumError[cellCenterIdx] / totalVolume); - l2NormRel[cellCenterIdx] = std::sqrt(sumError[cellCenterIdx] / sumReference[cellCenterIdx]); + l2NormAbs[pressureIdx] = std::sqrt(sumError[pressureIdx] / totalVolume); + l2NormRel[pressureIdx] = std::sqrt(sumError[pressureIdx] / sumReference[pressureIdx]); // get the absolute and relative discrete L2-error for face dofs for(int i = 0; i < numFaceDofs; ++i) @@ -319,14 +312,14 @@ public: const auto error = errorVelocity[i]; const auto ref = velocityReference[i]; const auto volume = staggeredVolume[i]; - sumError[faceIdx][dirIdx] += error * volume; - sumReference[faceIdx][dirIdx] += ref * volume; + sumError[Indices::velocity(dirIdx)] += error * volume; + sumReference[Indices::velocity(dirIdx)] += ref * volume; } for(int dirIdx = 0; dirIdx < dimWorld; ++dirIdx) { - l2NormAbs[faceIdx][dirIdx] = std::sqrt(sumError[faceIdx][dirIdx] / totalVolume); - l2NormRel[faceIdx][dirIdx] = std::sqrt(sumError[faceIdx][dirIdx] / sumReference[faceIdx][dirIdx]); + l2NormAbs[Indices::velocity(dirIdx)] = std::sqrt(sumError[Indices::velocity(dirIdx)] / totalVolume); + l2NormRel[Indices::velocity(dirIdx)] = std::sqrt(sumError[Indices::velocity(dirIdx)] / sumReference[Indices::velocity(dirIdx)]); } return std::make_pair(l2NormAbs, l2NormRel); } @@ -392,11 +385,13 @@ public: const auto faceDofPosition = scvf.center(); const auto dirIdx = scvf.directionIndex(); const auto analyticalSolutionAtFace = analyticalSolution(faceDofPosition, time()); - analyticalVelocityOnFace_[faceDofIdx][dirIdx] = analyticalSolutionAtFace[faceIdx][dirIdx]; + analyticalVelocityOnFace_[faceDofIdx][dirIdx] = analyticalSolutionAtFace[Indices::velocity(dirIdx)]; } analyticalPressure_[ccDofIdx] = analyticalSolutionAtCc[pressureIdx]; - analyticalVelocity_[ccDofIdx] = analyticalSolutionAtCc[faceIdx]; + + for(int dirIdx = 0; dirIdx < dim; ++dirIdx) + analyticalVelocity_[ccDofIdx][dirIdx] = analyticalSolutionAtCc[Indices::velocity(dirIdx)]; } } } -- GitLab From ded12596d14fd139ffdd5e4eb4ec4b033a55ae7a Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Mon, 18 Dec 2017 17:31:58 +0100 Subject: [PATCH 24/31] [freeflow][fickslaw] Fix enums --- dumux/discretization/staggered/freeflow/fickslaw.hh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/dumux/discretization/staggered/freeflow/fickslaw.hh b/dumux/discretization/staggered/freeflow/fickslaw.hh index 58fe0a71ce..85eb80e963 100644 --- a/dumux/discretization/staggered/freeflow/fickslaw.hh +++ b/dumux/discretization/staggered/freeflow/fickslaw.hh @@ -61,21 +61,16 @@ class FicksLawImplementation static constexpr int dimWorld = GridView::dimensionworld; static constexpr int numComponents = GET_PROP_VALUE(TypeTag, NumComponents); + static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx); static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); static_assert(GET_PROP_VALUE(TypeTag, NumPhases) == 1, "Only one phase allowed supported!"); enum { - pressureIdx = Indices::pressureIdx, - velocityIdx = Indices::velocityIdx, - - massBalanceIdx = Indices::massBalanceIdx, - momentumBalanceIdx = Indices::momentumBalanceIdx, conti0EqIdx = Indices::conti0EqIdx, mainCompIdx = Indices::mainCompIdx, replaceCompEqIdx = Indices::replaceCompEqIdx, - phaseIdx = Indices::phaseIdx }; public: -- GitLab From 0b488bc92f8930492767df6a5059194ebe521d89 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Mon, 18 Dec 2017 17:32:27 +0100 Subject: [PATCH 25/31] [navierstokesnc][fluxvars] Fix enums --- .../navierstokesnc/staggered/fluxvariables.hh | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/dumux/freeflow/navierstokesnc/staggered/fluxvariables.hh b/dumux/freeflow/navierstokesnc/staggered/fluxvariables.hh index bd3eccdb5f..a2834fd481 100644 --- a/dumux/freeflow/navierstokesnc/staggered/fluxvariables.hh +++ b/dumux/freeflow/navierstokesnc/staggered/fluxvariables.hh @@ -48,7 +48,6 @@ class NavierStokesNCFluxVariablesImpl 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 Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); using ElementFaceVariables = typename GET_PROP_TYPE(TypeTag, ElementFaceVariables); @@ -68,15 +67,7 @@ class NavierStokesNCFluxVariablesImpl using ParentType = NavierStokesFluxVariables; - enum { - - pressureIdx = Indices::pressureIdx, - velocityIdx = Indices::velocityIdx, - - massBalanceIdx = Indices::massBalanceIdx, - momentumBalanceIdx = Indices::momentumBalanceIdx, - conti0EqIdx = Indices::conti0EqIdx, - }; + enum { conti0EqIdx = Indices::conti0EqIdx }; public: -- GitLab From 7474f7e5074f85a0a3b59f50ddc28cdc86bb1b03 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Mon, 18 Dec 2017 17:33:36 +0100 Subject: [PATCH 26/31] [navierstokesnc][localres] Fix dirichlet method --- dumux/freeflow/navierstokesnc/staggered/localresidual.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dumux/freeflow/navierstokesnc/staggered/localresidual.hh b/dumux/freeflow/navierstokesnc/staggered/localresidual.hh index d1d585d5f2..ed12268199 100644 --- a/dumux/freeflow/navierstokesnc/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokesnc/staggered/localresidual.hh @@ -150,7 +150,7 @@ protected: { const auto& insideVolVars = elemVolVars[insideScv]; const Scalar massOrMoleFraction = useMoles ? insideVolVars.moleFraction(phaseIdx, compIdx) : insideVolVars.massFraction(phaseIdx, compIdx); - residual[eqIdx] = massOrMoleFraction - problem.dirichletAtPos(insideScv.center())[cellCenterIdx][eqIdx]; + residual[eqIdx] = massOrMoleFraction - problem.dirichletAtPos(insideScv.center())[eqIdx]; } } -- GitLab From c048b365ee9dc9e5d4f90550538dc35f8aa3c419 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt Date: Mon, 18 Dec 2017 17:33:59 +0100 Subject: [PATCH 27/31] [navierstokesnc][test] Remove Capabilities --- test/freeflow/staggerednc/channeltestproblem.hh | 7 ------- test/freeflow/staggerednc/densityflowproblem.hh | 7 ------- 2 files changed, 14 deletions(-) diff --git a/test/freeflow/staggerednc/channeltestproblem.hh b/test/freeflow/staggerednc/channeltestproblem.hh index f7e3d6e0a0..051e0c789f 100644 --- a/test/freeflow/staggerednc/channeltestproblem.hh +++ b/test/freeflow/staggerednc/channeltestproblem.hh @@ -39,13 +39,6 @@ namespace Dumux template class ChannelNCTestProblem; -namespace Capabilities -{ - template - struct isStationary> - { static const bool value = false; }; -} - namespace Properties { diff --git a/test/freeflow/staggerednc/densityflowproblem.hh b/test/freeflow/staggerednc/densityflowproblem.hh index 6d1491b50d..99a028b53f 100644 --- a/test/freeflow/staggerednc/densityflowproblem.hh +++ b/test/freeflow/staggerednc/densityflowproblem.hh @@ -39,13 +39,6 @@ namespace Dumux template class DensityDrivenFlowProblem; -namespace Capabilities -{ - template - struct isStationary> - { static const bool value = false; }; -} - namespace Properties { NEW_TYPE_TAG(DensityDrivenFlowProblem, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokesNC)); -- GitLab From 2f490d724de55756dbe759c61931cf225d85fe84 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Mon, 18 Dec 2017 19:05:45 +0100 Subject: [PATCH 28/31] [staggered] Remove unused include --- dumux/assembly/staggeredlocalresidual.hh | 1 - 1 file changed, 1 deletion(-) diff --git a/dumux/assembly/staggeredlocalresidual.hh b/dumux/assembly/staggeredlocalresidual.hh index d92d1f7101..5c0179a669 100644 --- a/dumux/assembly/staggeredlocalresidual.hh +++ b/dumux/assembly/staggeredlocalresidual.hh @@ -24,7 +24,6 @@ #define DUMUX_STAGGERED_LOCAL_RESIDUAL_HH #include -#include #include namespace Dumux -- GitLab From 3e580f4e1b563219d221d1f7d10683d7954fc7ea Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Mon, 18 Dec 2017 19:06:30 +0100 Subject: [PATCH 29/31] [staggered] Do not set NumEqVector, it uses the default. --- dumux/discretization/staggered/freeflow/properties.hh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/dumux/discretization/staggered/freeflow/properties.hh b/dumux/discretization/staggered/freeflow/properties.hh index 49b3a176ee..8dbac411bc 100644 --- a/dumux/discretization/staggered/freeflow/properties.hh +++ b/dumux/discretization/staggered/freeflow/properties.hh @@ -44,10 +44,6 @@ namespace Properties //! Type tag for the staggered scheme specialized for free flow. NEW_TYPE_TAG(StaggeredFreeFlowModel, INHERITS_FROM(StaggeredModel)); -// TODO: Ugly hack. How can this be improved? This is needed, because otherwise the physical model overwrites the properties set here. -// This requires to include the physical model before the discretization, otherwise the type tag FreeFlow is undefined. -UNSET_PROP(FreeFlow, NumEqVector); - /*! * \brief Set the number of equations on the faces to 1. We only consider scalar values because the velocity vector * is normal to the face. @@ -103,12 +99,6 @@ public: //! The variables living on the faces SET_TYPE_PROP(StaggeredFreeFlowModel, FaceVariables, StaggeredFaceVariables); -//! A container class used to specify values for sources and Neumann BCs -SET_PROP(StaggeredFreeFlowModel, NumEqVector) -{ - using type = Dune::FieldVector; -}; - //! Boundary types at a single degree of freedom SET_PROP(StaggeredFreeFlowModel, BoundaryTypes) { -- GitLab From d7c1c5b34803d3ae85a191049eef212fdb4f47c6 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Mon, 18 Dec 2017 19:08:14 +0100 Subject: [PATCH 30/31] Remove common/capabilities.hh --- dumux/common/capabilities.hh | 49 ------------------------------------ 1 file changed, 49 deletions(-) delete mode 100644 dumux/common/capabilities.hh diff --git a/dumux/common/capabilities.hh b/dumux/common/capabilities.hh deleted file mode 100644 index dbcf989885..0000000000 --- a/dumux/common/capabilities.hh +++ /dev/null @@ -1,49 +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 . * - *****************************************************************************/ -/*! - * \ingroup Common - * \file - * \brief Defines capabilities recognized for problems in Dumux - * \note Specialize the subsequent capabilities for your problem to optimize - * your program's effeciency. - */ -#ifndef DUMUX_CAPABILITIES_HH -#define DUMUX_CAPABILITIES_HH - -#include - -namespace Dumux -{ - -namespace Capabilities -{ - -//! If a problem is stationary (not time-dependent) -template -struct DUNE_DEPRECATED_MSG("isStationary is deprecated and will be removed!") isStationary -{ - //! by default all problems are instationary - static const bool value = false; -}; - -} // namespace Capabilities - -} // namespace Dumux - -#endif -- GitLab From 7c53552fcce4d5941d5bc9472abf2e8f82c391a7 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Mon, 18 Dec 2017 19:08:41 +0100 Subject: [PATCH 31/31] [staggered][test] Remove unused capability definition --- test/freeflow/staggered/closedsystemtestproblem.hh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/freeflow/staggered/closedsystemtestproblem.hh b/test/freeflow/staggered/closedsystemtestproblem.hh index 015564f651..36990a0d86 100644 --- a/test/freeflow/staggered/closedsystemtestproblem.hh +++ b/test/freeflow/staggered/closedsystemtestproblem.hh @@ -37,13 +37,6 @@ namespace Dumux template class ClosedSystemTestProblem; -namespace Capabilities -{ - template - struct isStationary> - { static const bool value = false; }; -} - namespace Properties { NEW_TYPE_TAG(ClosedSystemTestProblem, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokes)); -- GitLab