diff --git a/dumux/discretization/box/boxgeometryhelper.hh b/dumux/discretization/box/boxgeometryhelper.hh index f10e0523833c5f36daa2c8ffebe2828ea0c50f58..9f97fe0ab68a55d4bdb10fb0a61787e98ab5be07 100644 --- a/dumux/discretization/box/boxgeometryhelper.hh +++ b/dumux/discretization/box/boxgeometryhelper.hh @@ -24,6 +24,7 @@ #ifndef DUMUX_DISCRETIZATION_BOX_GEOMETRY_HELPER_HH #define DUMUX_DISCRETIZATION_BOX_GEOMETRY_HELPER_HH +#include <array> #include <dune/geometry/multilineargeometry.hh> #include <dune/geometry/referenceelements.hh> @@ -110,7 +111,7 @@ public: private: const typename Element::Geometry& elementGeometry_; //!< Reference to the element geometry std::size_t corners_; // number of element corners - GlobalPosition p[maxPoints]; // the points needed for construction of the geometries + std::array<GlobalPosition, maxPoints> p; // the points needed for construction of the geometries }; //! A class to create sub control volume and sub control volume face geometries per element @@ -325,7 +326,7 @@ public: private: const typename Element::Geometry& elementGeometry_; //!< Reference to the element geometry std::size_t corners_; // number of element corners - GlobalPosition p[maxPoints]; // the points needed for construction of the geometries + std::array<GlobalPosition, maxPoints> p; // the points needed for construction of the geometries }; //! A class to create sub control volume and sub control volume face geometries per element @@ -594,7 +595,7 @@ public: private: const typename Element::Geometry& elementGeometry_; //!< Reference to the element geometry std::size_t corners_; // number of element corners - GlobalPosition p[maxPoints]; // the points needed for construction of the scv/scvf geometries + std::array<GlobalPosition, maxPoints> p; // the points needed for construction of the scv/scvf geometries }; } // end namespace Dumux diff --git a/dumux/discretization/cellcentered/mpfa/helper.hh b/dumux/discretization/cellcentered/mpfa/helper.hh index 3de020e6b85e2c7aa8e566f639cbc6fa72435ac1..9532272f5065706036614457c2ad2889c377c112 100644 --- a/dumux/discretization/cellcentered/mpfa/helper.hh +++ b/dumux/discretization/cellcentered/mpfa/helper.hh @@ -366,12 +366,12 @@ public: assert(gridView.size(Dune::GeometryTypes::tetrahedron) + gridView.size(Dune::GeometryTypes::pyramid) + gridView.size(Dune::GeometryTypes::prism) - + gridView.size(Dune::GeometryTypes::cube) == gridView.size(0)); + + gridView.size(Dune::GeometryTypes::hexahedron) == gridView.size(0)); return gridView.size(Dune::GeometryTypes::tetrahedron)*12 + gridView.size(Dune::GeometryTypes::pyramid)*16 + gridView.size(Dune::GeometryTypes::prism)*18 - + gridView.size(Dune::GeometryTypes::cube)*24; + + gridView.size(Dune::GeometryTypes::hexahedron)*24; #else assert(gridView.size(Dune::GeometryType(Dune::GeometryType::simplex, 3)) + gridView.size(Dune::GeometryType(Dune::GeometryType::pyramid, 3)) @@ -533,6 +533,16 @@ public: */ static std::size_t getNumLocalScvfs(const Dune::GeometryType gt) { +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) + if (gt == Dune::GeometryTypes::tetrahedron) + return 12; + else if (gt == Dune::GeometryTypes::pyramid) + return 16; + else if (gt == Dune::GeometryTypes::prism) + return 18; + else if (gt == Dune::GeometryTypes::hexahedron) + return 24; +#else if (gt == Dune::GeometryType(Dune::GeometryType::simplex, 3)) return 12; else if (gt == Dune::GeometryType(Dune::GeometryType::pyramid, 3)) @@ -541,6 +551,7 @@ public: return 18; else if (gt == Dune::GeometryType(Dune::GeometryType::cube, 3)) return 24; +#endif else DUNE_THROW(Dune::NotImplemented, "Mpfa for 3d geometry type " << gt); } diff --git a/dumux/freeflow/navierstokes/staggered/localresidual.hh b/dumux/freeflow/navierstokes/staggered/localresidual.hh index 7b9be3f06f42b8594deabdc46d99e464d17b29df..65475f8e83b3b342344906689153077245d565f9 100644 --- a/dumux/freeflow/navierstokes/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokes/staggered/localresidual.hh @@ -111,27 +111,8 @@ public: CellCenterPrimaryVariables flux = fluxVars.computeFluxForCellCenter(problem, element, fvGeometry, elemVolVars, elemFaceVars, scvf, elemFluxVarsCache[scvf]); - // add energy fluxes for non-isothermal models - Dune::Hybrid::ifElse(std::integral_constant<bool, GET_PROP_VALUE(TypeTag, EnableEnergyBalance) >(), - [&](auto IF) - { - // if we are on an inflow/outflow boundary, use the volVars of the element itself - // TODO: catch neumann and outflow in localResidual's evalBoundary_() - bool isOutflow = false; - if(scvf.boundary()) - { - const auto bcTypes = problem.boundaryTypesAtPos(scvf.center()); - if(bcTypes.isOutflow(Indices::energyBalanceIdx)) - isOutflow = true; - } - - auto upwindTerm = [](const auto& volVars) { return volVars.density() * volVars.enthalpy(); }; - using HeatConductionType = typename GET_PROP_TYPE(TypeTag, HeatConductionType); - - flux[Indices::energyBalanceIdx] = FluxVariables::advectiveFluxForCellCenter(elemVolVars, elemFaceVars, scvf, upwindTerm, isOutflow); - flux[Indices::energyBalanceIdx] += HeatConductionType::diffusiveFluxForCellCenter(problem, element, fvGeometry, elemVolVars, scvf); - - }); + computeFluxForCellCenterNonIsothermal_(std::integral_constant<bool, GET_PROP_VALUE(TypeTag, EnableEnergyBalance)>(), + problem, element, fvGeometry, elemVolVars, elemFaceVars, scvf, elemFluxVarsCache, flux); return flux; } @@ -165,12 +146,8 @@ public: CellCenterPrimaryVariables storage; storage[Indices::massBalanceIdx] = volVars.density(); - // add energy storage for non-isothermal models - Dune::Hybrid::ifElse(std::integral_constant<bool, GET_PROP_VALUE(TypeTag, EnableEnergyBalance) >(), - [&](auto IF) - { - storage[Indices::energyBalanceIdx] = volVars.density() * volVars.internalEnergy(); - }); + computeStorageForCellCenterNonIsothermal_(std::integral_constant<bool, GET_PROP_VALUE(TypeTag, EnableEnergyBalance) >(), + problem, scv, volVars, storage); return storage; } @@ -344,6 +321,51 @@ protected: } } + //! Evaluate energy fluxes entering or leaving the cell center control volume for non isothermal models + void computeFluxForCellCenterNonIsothermal_(std::true_type, + const Problem& problem, + const Element &element, + const FVElementGeometry& fvGeometry, + const ElementVolumeVariables& elemVolVars, + const ElementFaceVariables& elemFaceVars, + const SubControlVolumeFace &scvf, + const ElementFluxVariablesCache& elemFluxVarsCache, + CellCenterPrimaryVariables& flux) const + { + // if we are on an inflow/outflow boundary, use the volVars of the element itself + // TODO: catch neumann and outflow in localResidual's evalBoundary_() + bool isOutflow = false; + if(scvf.boundary()) + { + const auto bcTypes = problem.boundaryTypesAtPos(scvf.center()); + if(bcTypes.isOutflow(Indices::energyBalanceIdx)) + isOutflow = true; + } + + auto upwindTerm = [](const auto& volVars) { return volVars.density() * volVars.enthalpy(); }; + using HeatConductionType = typename GET_PROP_TYPE(TypeTag, HeatConductionType); + + flux[Indices::energyBalanceIdx] = FluxVariables::advectiveFluxForCellCenter(elemVolVars, elemFaceVars, scvf, upwindTerm, isOutflow); + flux[Indices::energyBalanceIdx] += HeatConductionType::diffusiveFluxForCellCenter(problem, element, fvGeometry, elemVolVars, scvf); + } + + //! Evaluate energy fluxes entering or leaving the cell center control volume for non isothermal models + template <typename... Args> + void computeFluxForCellCenterNonIsothermal_(std::false_type, Args&&... args) const {} + + //! Evaluate energy storage for non isothermal models + void computeStorageForCellCenterNonIsothermal_(std::true_type, + const Problem& problem, + const SubControlVolume& scv, + const VolumeVariables& volVars, + CellCenterPrimaryVariables& storage) const + { + storage[Indices::energyBalanceIdx] = volVars.density() * volVars.internalEnergy(); + } + + //! Evaluate energy storage for isothermal models + template <typename... Args> + void computeStorageForCellCenterNonIsothermal_(std::false_type, Args&&... args) const {} private: diff --git a/dumux/freeflow/navierstokesnc/staggered/localresidual.hh b/dumux/freeflow/navierstokesnc/staggered/localresidual.hh index 9515f99eedb30b48ad06f568811dba46f22f191a..d56a478e012648e9136cb288042b7f095736e697 100644 --- a/dumux/freeflow/navierstokesnc/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokesnc/staggered/localresidual.hh @@ -102,12 +102,8 @@ public: if(replaceCompEqIdx < numComponents) storage[replaceCompEqIdx] = density; - // add energy storage for non-isothermal models - Dune::Hybrid::ifElse(std::integral_constant<bool, GET_PROP_VALUE(TypeTag, EnableEnergyBalance) >(), - [&](auto IF) - { - storage[Indices::energyBalanceIdx] = volVars.density() * volVars.internalEnergy(); - }); + this->computeStorageForCellCenterNonIsothermal_(std::integral_constant<bool, GET_PROP_VALUE(TypeTag, EnableEnergyBalance) >(), + problem, scv, volVars, storage); return storage; } diff --git a/dumux/io/cakegridcreator.hh b/dumux/io/cakegridcreator.hh index c2bc79619cee491195cd4c7c3aa808040a66f33c..89aebc5bc58628b52a010ee68ace9f16d4d73d6b 100644 --- a/dumux/io/cakegridcreator.hh +++ b/dumux/io/cakegridcreator.hh @@ -30,6 +30,7 @@ #include <cmath> #include <algorithm> +#include <dune/common/version.hh> #include <dune/common/dynvector.hh> #include <dune/grid/common/gridfactory.hh> #include <dumux/common/properties.hh> @@ -274,8 +275,11 @@ public: std::vector<Scalar> dA = polarCoordinates[1]; GridFactory gridFactory; +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) + constexpr auto type = Dune::GeometryTypes::cube(dim); +#else Dune::GeometryType type; type.makeCube(dim); - +#endif // create nodes if (dim == 3) { diff --git a/dumux/material/components/co2tablereader.hh b/dumux/material/components/co2tablereader.hh index dfabfb4d82904fc9a9eac98e470ee2e6b52e1db8..4e0fddb7b87d39baa0f0807efec039eb7860cea6 100644 --- a/dumux/material/components/co2tablereader.hh +++ b/dumux/material/components/co2tablereader.hh @@ -41,7 +41,8 @@ class TabulatedCO2Properties enum { numTempSteps = Traits::numTempSteps, numPressSteps = Traits::numPressSteps }; public: - TabulatedCO2Properties() = default; + // user default constructor (we can't use "= default" here to satisfy older clang compilers since this class is used as a static data member) + TabulatedCO2Properties() {} Scalar minTemp() const { return Traits::minTemp; } diff --git a/dumux/porousmediumflow/compositional/privarswitchnewtoncontroller.hh b/dumux/porousmediumflow/compositional/privarswitchnewtoncontroller.hh index 1300445f67dee7f985d892720d5f49977782f0a9..7b9dee7443333ea3217cc56ba36432cda080b511 100644 --- a/dumux/porousmediumflow/compositional/privarswitchnewtoncontroller.hh +++ b/dumux/porousmediumflow/compositional/privarswitchnewtoncontroller.hh @@ -124,58 +124,61 @@ public: problem, fvGridGeometry); Dune::Hybrid::ifElse(std::integral_constant<bool, GET_PROP_VALUE(TypeTag, EnableGridVolumeVariablesCache)>(), - [&](auto IF) { - - std::cout << "blub"; - - // update the secondary variables if global caching is enabled - // \note we only updated if phase presence changed as the volume variables - // are already updated once by the switch - for (const auto& element : elements(fvGridGeometry.gridView())) - { - // make sure FVElementGeometry & vol vars are bound to the element - auto fvGeometry = localView(fvGridGeometry); - fvGeometry.bindElement(element); - - if (switchedInLastIteration_) - { - for (auto&& scv : scvs(fvGeometry)) - { - const auto dofIdxGlobal = scv.dofIndex(); - if (priVarSwitch_->wasSwitched(dofIdxGlobal)) - { - const auto eIdx = fvGridGeometry.elementMapper().index(element); - const ElementSolution elemSol(element, this->curSol(), fvGridGeometry); - this->nonConstCurGridVolVars().volVars(eIdx, scv.indexInElement()).update(elemSol, - problem, - element, - scv); - } - } - } - - // handle the boundary volume variables for cell-centered models - if(!isBox) - { - for (auto&& scvf : scvfs(fvGeometry)) - { - // if we are not on a boundary, skip the rest - if (!scvf.boundary()) - continue; - - // check if boundary is a pure dirichlet boundary - const auto bcTypes = problem.boundaryTypes(element, scvf); - if (bcTypes.hasOnlyDirichlet()) - { - const auto insideScvIdx = scvf.insideScvIdx(); - const auto& insideScv = fvGeometry.scv(insideScvIdx); - const ElementSolution elemSol(problem.dirichlet(element, scvf)); - - this->nonConstCurGridVolVars().volVars(scvf.outsideScvIdx(), 0/*indexInElement*/).update(elemSol, problem, element, insideScv); - } - } - } - } + [&](auto&& _if) + { + DUNE_THROW(Dune::NotImplemented, "Privar switch and volume varaible caching! Please implement!"); + + // TODO: + // std::cout << "blub"; + // + // // update the secondary variables if global caching is enabled + // // \note we only updated if phase presence changed as the volume variables + // // are already updated once by the switch + // for (const auto& element : elements(fvGridGeometry.gridView())) + // { + // // make sure FVElementGeometry & vol vars are bound to the element + // auto fvGeometry = localView(fvGridGeometry); + // fvGeometry.bindElement(element); + // + // if (switchedInLastIteration_) + // { + // for (auto&& scv : scvs(fvGeometry)) + // { + // const auto dofIdxGlobal = scv.dofIndex(); + // if (priVarSwitch_->wasSwitched(dofIdxGlobal)) + // { + // const auto eIdx = fvGridGeometry.elementMapper().index(element); + // const ElementSolution elemSol(element, this->curSol(), fvGridGeometry); + // this->nonConstCurGridVolVars().volVars(eIdx, scv.indexInElement()).update(elemSol, + // problem, + // element, + // scv); + // } + // } + // } + // + // // handle the boundary volume variables for cell-centered models + // if(!isBox) + // { + // for (auto&& scvf : scvfs(fvGeometry)) + // { + // // if we are not on a boundary, skip the rest + // if (!scvf.boundary()) + // continue; + // + // // check if boundary is a pure dirichlet boundary + // const auto bcTypes = problem.boundaryTypes(element, scvf); + // if (bcTypes.hasOnlyDirichlet()) + // { + // const auto insideScvIdx = scvf.insideScvIdx(); + // const auto& insideScv = fvGeometry.scv(insideScvIdx); + // const ElementSolution elemSol(problem.dirichlet(element, scvf)); + // + // this->nonConstCurGridVolVars().volVars(scvf.outsideScvIdx(), 0/*indexInElement*/).update(elemSol, problem, element, insideScv); + // } + // } + // } + // } }); }