Commit 0ca50edd authored by Timo Koch's avatar Timo Koch
Browse files

[boundarytypes] Deprecate BoundaryTypes property

parent ed1d34ea
......@@ -25,9 +25,11 @@
#define DUMUX_GRIDADAPTINITIALIZATIONINDICATOR_HH
#include <memory>
#include <dune/geometry/type.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
#include <dumux/common/typetraits/problem.hh>
#include <dumux/discretization/method.hh>
namespace Dumux {
......@@ -49,7 +51,6 @@ class GridAdaptInitializationIndicator
using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
static constexpr bool isBox = GetPropType<TypeTag, Properties::GridGeometry>::discMethod == DiscretizationMethod::box;
......@@ -225,6 +226,7 @@ public:
else
{
// container to store bcTypes
using BoundaryTypes = typename ProblemTraits<Problem>::BoundaryTypes;
std::vector<BoundaryTypes> bcTypes(fvGeometry.numScv());
// Get bcTypes and maybe mark for refinement on Dirichlet boundaries
......
......@@ -32,6 +32,7 @@
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
#include <dumux/common/boundarytypes.hh>
#include <dumux/discretization/method.hh>
#include <dumux/assembly/initialsolution.hh>
......@@ -73,7 +74,7 @@ class FVProblem
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using NumEqVector = GetPropType<TypeTag, Properties::NumEqVector>;
using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
using BoundaryTypes = Dumux::BoundaryTypes<PrimaryVariables::size()>;
public:
//! export traits of this problem
......@@ -82,7 +83,6 @@ public:
using Scalar = FVProblem::Scalar;
using PrimaryVariables = FVProblem::PrimaryVariables;
using NumEqVector = FVProblem::NumEqVector;
using BoundaryTypes = FVProblem::BoundaryTypes;
};
/*!
......@@ -136,8 +136,8 @@ public:
* \param element The finite element
* \param scv The sub control volume
*/
BoundaryTypes boundaryTypes(const Element &element,
const SubControlVolume &scv) const
auto boundaryTypes(const Element &element,
const SubControlVolume &scv) const
{
if (!isBox)
DUNE_THROW(Dune::InvalidStateException,
......@@ -154,8 +154,8 @@ public:
* \param element The finite element
* \param scvf The sub control volume face
*/
BoundaryTypes boundaryTypes(const Element &element,
const SubControlVolumeFace &scvf) const
auto boundaryTypes(const Element &element,
const SubControlVolumeFace &scvf) const
{
if (isBox)
DUNE_THROW(Dune::InvalidStateException,
......
......@@ -67,8 +67,9 @@ template<class TypeTag, class MyTypeTag>
struct JacobianMatrix { using type = UndefinedProperty; }; //!< Type of the global jacobian matrix
template<class TypeTag, class MyTypeTag>
struct SolutionVector { using type = UndefinedProperty; }; //!< Vector containing all primary variable vector of the grid
template<class TypeTag, class MyTypeTag>
struct BoundaryTypes { using type = UndefinedProperty; }; //!< Stores the boundary types of a single degree of freedom
struct [[deprecated("BoundaryTypes will be removed after 3.3. Deduce boundary types from Problem.")]] BoundaryTypes { using type = UndefinedProperty; }; //!< Stores the boundary types of a single degree of freedom
//! The type of the local residual function, i.e. the equation to be solved. Must inherit
//! from the BaseLocalResidual property and fulfill its interfaces.
......
......@@ -25,6 +25,8 @@
#ifndef DUMUX_DISCRETIZTAION_BOX_HH
#define DUMUX_DISCRETIZTAION_BOX_HH
#include <type_traits>
#include <dune/common/fvector.hh>
#include <dune/geometry/multilineargeometry.hh>
......@@ -90,7 +92,14 @@ public:
//! Set the default for the ElementBoundaryTypes
template<class TypeTag>
struct ElementBoundaryTypes<TypeTag, TTag::BoxModel> { using type = BoxElementBoundaryTypes<GetPropType<TypeTag, Properties::BoundaryTypes>>; };
struct ElementBoundaryTypes<TypeTag, TTag::BoxModel>
{
private:
using Problem = GetPropType<TypeTag, Properties::Problem>;
using BoundaryTypes = typename ProblemTraits<Problem>::BoundaryTypes;
public:
using type = BoxElementBoundaryTypes<BoundaryTypes>;
};
//! Set the BaseLocalResidual to BoxLocalResidual
template<class TypeTag>
......
......@@ -28,6 +28,7 @@
#include <dune/istl/bvector.hh>
#include <dune/istl/bcrsmatrix.hh>
#include <dumux/common/deprecated.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/properties/grid.hh>
#include <dumux/common/boundarytypes.hh>
......@@ -67,10 +68,12 @@ struct EnableGridVolumeVariablesCache<TypeTag, TTag::FiniteVolumeModel> { static
template<class TypeTag>
struct EnableGridFluxVariablesCache<TypeTag, TTag::FiniteVolumeModel> { static constexpr bool value = false; };
DUNE_NO_DEPRECATED_BEGIN
//! Boundary types at a single degree of freedom
template<class TypeTag>
struct BoundaryTypes<TypeTag, TTag::FiniteVolumeModel> { using type = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; };
struct BoundaryTypes<TypeTag, TTag::FiniteVolumeModel>
{ using type = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; };
DUNE_NO_DEPRECATED_END
// TODO: bundle SolutionVector, JacobianMatrix
// in LinearAlgebra traits
......
......@@ -47,6 +47,7 @@
#include <dune/istl/multitypeblockvector.hh>
#include <dune/istl/multitypeblockmatrix.hh>
#include <dumux/common/deprecated.hh>
namespace Dumux {
......@@ -138,10 +139,11 @@ struct FacePrimaryVariables<TypeTag, TTag::StaggeredModel>
getPropValue<TypeTag, Properties::NumEqFace>()>;
};
DUNE_NO_DEPRECATED_BEGIN
//! Boundary types at a single degree of freedom
template<class TypeTag>
struct BoundaryTypes<TypeTag, TTag::StaggeredModel> { using type = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; };
DUNE_NO_DEPRECATED_END
// TODO: bundle SolutionVector, JacobianMatrix
// in LinearAlgebra traits
......
......@@ -42,6 +42,8 @@
#include "fvgridgeometrytraits.hh"
#include "gridvolumevariables.hh"
#include <dumux/common/deprecated.hh>
namespace Dumux {
namespace Properties {
......@@ -114,13 +116,14 @@ public:
using type = StaggeredGridVolumeVariables<Traits, enableCache>;
};
DUNE_NO_DEPRECATED_BEGIN
//! Boundary types at a single degree of freedom
template<class TypeTag>
struct BoundaryTypes<TypeTag, TTag::StaggeredFreeFlowModel>
{
using type = NavierStokesBoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
};
DUNE_NO_DEPRECATED_END
//! The velocity output
template<class TypeTag>
......
......@@ -26,16 +26,17 @@
#include <array>
#include <optional>
#include <type_traits>
#include <dumux/common/math.hh>
#include <dumux/common/exceptions.hh>
#include <dumux/common/parameters.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/typetraits/problem.hh>
#include <dumux/flux/fluxvariablesbase.hh>
#include <dumux/discretization/method.hh>
#include "staggeredupwindhelper.hh"
#include "velocitygradients.hh"
......@@ -82,7 +83,7 @@ class NavierStokesFluxVariablesImpl<TypeTag, DiscretizationMethod::staggered>
using FaceLateralSubControlVolumeFace = typename GridGeometry::Traits::FaceLateralSubControlVolumeFace;
using CellCenterPrimaryVariables = GetPropType<TypeTag, Properties::CellCenterPrimaryVariables>;
using FacePrimaryVariables = GetPropType<TypeTag, Properties::FacePrimaryVariables>;
using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
using BoundaryTypes = typename ProblemTraits<Problem>::BoundaryTypes;
using VelocityGradients = StaggeredVelocityGradients<Scalar, GridGeometry, BoundaryTypes, Indices>;
static constexpr bool normalizePressure = getPropValue<TypeTag, Properties::NormalizePressure>();
......@@ -504,7 +505,7 @@ private:
else
{
// Create a boundaryTypes object. Get the boundary conditions. We sample the type of BC at the center of the current scvf.
const BoundaryTypes bcTypes = problem.boundaryTypes(element, scvf);
const auto bcTypes = problem.boundaryTypes(element, scvf);
if (bcTypes.isDirichlet(Indices::velocity(lateralFace.directionIndex())))
{
......
......@@ -31,6 +31,7 @@
#include <dumux/common/exceptions.hh>
#include <dumux/common/parameters.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/typetraits/problem.hh>
#include <dumux/discretization/method.hh>
#include <dumux/freeflow/staggeredupwindmethods.hh>
......@@ -71,7 +72,7 @@ class StaggeredUpwindHelper
using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
using CellCenterPrimaryVariables = GetPropType<TypeTag, Properties::CellCenterPrimaryVariables>;
using FacePrimaryVariables = GetPropType<TypeTag, Properties::FacePrimaryVariables>;
using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
using BoundaryTypes = typename ProblemTraits<Problem>::BoundaryTypes;
using VelocityGradients = StaggeredVelocityGradients<Scalar, GridGeometry, BoundaryTypes, Indices>;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
......
......@@ -67,7 +67,6 @@ class OneEqResidualImpl<TypeTag, BaseLocalResidual, DiscretizationMethod::stagge
using SubControlVolume = typename FVElementGeometry::SubControlVolume;
using CellCenterPrimaryVariables = GetPropType<TypeTag, Properties::CellCenterPrimaryVariables>;
using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
static constexpr int viscosityTildeEqIdx = Indices::viscosityTildeEqIdx - ModelTraits::dim();
......
......@@ -67,7 +67,6 @@ class KEpsilonResidualImpl<TypeTag, BaseLocalResidual, DiscretizationMethod::sta
using SubControlVolume = typename FVElementGeometry::SubControlVolume;
using CellCenterPrimaryVariables = GetPropType<TypeTag, Properties::CellCenterPrimaryVariables>;
using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
using CellCenterResidual = CellCenterPrimaryVariables;
......
......@@ -67,7 +67,6 @@ class KOmegaResidualImpl<TypeTag, BaseLocalResidual, DiscretizationMethod::stagg
using CellCenterPrimaryVariables = GetPropType<TypeTag, Properties::CellCenterPrimaryVariables>;
using CellCenterResidual = CellCenterPrimaryVariables;
using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
static constexpr int turbulentKineticEnergyEqIdx = Indices::turbulentKineticEnergyEqIdx - ModelTraits::dim();
......
......@@ -66,7 +66,6 @@ class LowReKEpsilonResidualImpl<TypeTag, BaseLocalResidual, DiscretizationMethod
using SubControlVolume = typename FVElementGeometry::SubControlVolume;
using CellCenterPrimaryVariables = GetPropType<TypeTag, Properties::CellCenterPrimaryVariables>;
using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
static constexpr int turbulentKineticEnergyEqIdx = Indices::turbulentKineticEnergyEqIdx - ModelTraits::dim();
......
......@@ -69,7 +69,6 @@ class PorousMediumFlowVelocity
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
using Problem = typename GridVolumeVariables::Problem;
using BoundaryTypes = typename Problem::Traits::BoundaryTypes;
public:
static constexpr int numFluidPhases = VolumeVariables::numFluidPhases();
......@@ -86,7 +85,7 @@ public:
, gridVariables_(gridVariables)
{
// set the number of scvs the vertices are connected to
if (isBox && dim > 1)
if constexpr (isBox && dim > 1)
{
// resize to the number of vertices of the grid
cellNum_.assign(gridGeometry_.gridView().size(dim), 0);
......@@ -114,7 +113,7 @@ public:
// the upwind term to be used for the volume flux evaluation
auto upwindTerm = [phaseIdx](const auto& volVars) { return volVars.mobility(phaseIdx); };
if(isBox && dim == 1)
if constexpr (isBox && dim == 1)
{
Velocity tmpVelocity(0.0);
tmpVelocity = (geometry.corner(1) - geometry.corner(0));
......@@ -148,7 +147,7 @@ public:
const auto& localPos = refElement.position(0, 0);
const auto jacobianT2 = geometry.jacobianTransposed(localPos);
if(isBox)
if constexpr (isBox)
{
using ScvVelocities = Dune::BlockVector<Velocity>;
ScvVelocities scvVelocities(fvGeometry.numScv());
......@@ -257,7 +256,7 @@ public:
}
else
{
auto bcTypes = problemBoundaryTypes_(element, scvf);
auto bcTypes = problem_.boundaryTypes(element, scvf);
if (bcTypes.hasOnlyDirichlet())
{
FluxVariables fluxVars;
......@@ -281,7 +280,7 @@ public:
{
if (scvf.boundary())
{
auto bcTypes = problemBoundaryTypes_(element, scvf);
auto bcTypes = problem_.boundaryTypes(element, scvf);
if (bcTypes.hasNeumann())
{
// for stationary velocity fields we can easily compute the correct velocity
......@@ -420,29 +419,6 @@ private:
}
private:
// The following SFINAE enable_if usage allows compilation, even if only a
//
// boundaryTypes(const Element&, const scv&)
//
// is provided in the problem file. In that case, the compiler cannot detect
// (without additional measures like "using...") the signature
//
// boundaryTypes(const Element&, const scvf&)
//
// in the problem base class. Therefore, calls to this method trigger a
// compiler error. However, that call is needed for calculating velocities
// if the cell-centered discretization is used. By proceeding as in the
// following lines, that call will only be compiled if cell-centered
// actually is used.
template <bool enable = isBox, typename std::enable_if_t<!enable, int> = 0>
BoundaryTypes problemBoundaryTypes_(const Element& element, const SubControlVolumeFace& scvf) const
{ return problem_.boundaryTypes(element, scvf); }
//! we should never call this method for box models
template <bool enable = isBox, typename std::enable_if_t<enable, int> = 0>
BoundaryTypes problemBoundaryTypes_(const Element& element, const SubControlVolumeFace& scvf) const
{ return BoundaryTypes(); }
const Problem& problem_;
const GridGeometry& gridGeometry_;
const GridVariables& gridVariables_;
......
......@@ -65,7 +65,6 @@ class PorousMediumFlowVelocityOutput : public VelocityOutput<GridVariables>
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
using Problem = typename GridVolumeVariables::Problem;
using BoundaryTypes = typename Problem::Traits::BoundaryTypes;
using VelocityBackend = PorousMediumFlowVelocity<GridVariables, FluxVariables>;
public:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment