diff --git a/test/porousmediumflow/1p/implicit/internaldirichlet/CMakeLists.txt b/test/porousmediumflow/1p/implicit/internaldirichlet/CMakeLists.txt index 1b5956b7acf5a1690686c32ad1eff2eb1df8f23f..a206bda3ea01d99e2651f8af9d287e2f6fb69a27 100644 --- a/test/porousmediumflow/1p/implicit/internaldirichlet/CMakeLists.txt +++ b/test/porousmediumflow/1p/implicit/internaldirichlet/CMakeLists.txt @@ -1,20 +1,14 @@ -# This feature (internal Dirichlet contraints) is currently not implemented for cc models -# The compilation triggers a copmiler error (static_assert) -# Once its implemented replace OnePInternalDirichletBox by OnePInternalDirichletTpfa (and uncomment OnePInternalDirichletTpfa in the problem.hh) -# and remove the EXPECT_COMPILE_FAIL flag - -# dumux_add_test(NAME test_1p_internaldirichlet_tpfa -# EXPECT_COMPILE_FAIL -# SOURCES ${CMAKE_SOURCE_DIR}/test/porousmediumflow/1p/implicit/incompressible/main.cc -# LABELS porousmediumflow 1p -# COMPILE_DEFINITIONS TYPETAG=OnePInternalDirichletTpfa -# COMPILE_DEFINITIONS NUMDIFFMETHOD=DiffMethod::analytic -# COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py -# CMD_ARGS --script fuzzy -# --files ${CMAKE_SOURCE_DIR}/test/references/test_1p_internaldirichlet_tpfa-reference.vtu -# ${CMAKE_CURRENT_BINARY_DIR}/test_1p_internaldirichlet_tpfa-00001.vtu -# --command "${CMAKE_CURRENT_BINARY_DIR}/test_1p_internaldirichlet_tpfa ${CMAKE_SOURCE_DIR}/test/porousmediumflow/1p/implicit/incompressible/params.input -Problem.Name test_1p_internaldirichlet_tpfa -Problem.EnableGravity false") +dumux_add_test(NAME test_1p_internaldirichlet_tpfa + SOURCES ${CMAKE_SOURCE_DIR}/test/porousmediumflow/1p/implicit/incompressible/main.cc + LABELS porousmediumflow 1p + COMPILE_DEFINITIONS TYPETAG=OnePInternalDirichletTpfa + COMPILE_DEFINITIONS NUMDIFFMETHOD=DiffMethod::analytic + COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + CMD_ARGS --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/test_1p_internaldirichlet_tpfa-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/test_1p_internaldirichlet_tpfa-00001.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_1p_internaldirichlet_tpfa ${CMAKE_SOURCE_DIR}/test/porousmediumflow/1p/implicit/incompressible/params.input -Problem.Name test_1p_internaldirichlet_tpfa -Problem.EnableGravity false") dumux_add_test(NAME test_1p_internaldirichlet_box SOURCES ${CMAKE_SOURCE_DIR}/test/porousmediumflow/1p/implicit/incompressible/main.cc diff --git a/test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh b/test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh index e87a9c4f1db916fa2846013cecb9a080c90d7d56..864c32b0e0c7db3c875d59e1840a72be71800066 100644 --- a/test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh +++ b/test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh @@ -25,6 +25,7 @@ #ifndef DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_INTERNAL_DIRICHLET_HH #define DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_INTERNAL_DIRICHLET_HH +#include <bitset> #include <dumux/common/boundarytypes.hh> #include <test/porousmediumflow/1p/implicit/incompressible/problem.hh> @@ -36,8 +37,7 @@ namespace Properties { // Create new type tags namespace TTag { struct OnePInternalDirichlet {}; -// internal Dirichlet BC are currently not implemented for cc-models -//struct OnePInternalDirichletTpfa { using InheritsFrom = std::tuple<OnePInternalDirichlet, OnePIncompressibleTpfa>; }; +struct OnePInternalDirichletTpfa { using InheritsFrom = std::tuple<OnePInternalDirichlet, OnePIncompressibleTpfa>; }; struct OnePInternalDirichletBox { using InheritsFrom = std::tuple<OnePInternalDirichlet, OnePIncompressibleBox>; }; } // end namespace TTag @@ -61,11 +61,15 @@ class OnePTestProblemInternalDirichlet : public OnePTestProblem<TypeTag> using Scalar = GetPropType<TypeTag, Properties::Scalar>; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using NeumannValues = GetPropType<TypeTag, Properties::NumEqVector>; - using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; + using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; + using BoundaryTypes = Dumux::BoundaryTypes<ModelTraits::numEq()>; + using Indices = typename ModelTraits::Indices; using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using SubControlVolume = typename GridGeometry::SubControlVolume; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; + static constexpr auto numEq = ModelTraits::numEq(); + public: OnePTestProblemInternalDirichlet(std::shared_ptr<const GridGeometry> gridGeometry) : ParentType(gridGeometry) @@ -118,11 +122,15 @@ public: * \param element The finite element * \param scv The sub-control volume */ - bool hasInternalDirichletConstraint(const Element& element, const SubControlVolume& scv) const + std::bitset<numEq> hasInternalDirichletConstraint(const Element& element, + const SubControlVolume& scv) const { // the pure Neumann problem is only defined up to a constant // we create a well-posed problem by fixing the pressure at one dof in the middle of the domain - return (scv.dofIndex() == static_cast<std::size_t>(this->gridGeometry().numDofs()/2)); + std::bitset<numEq> values; + if (scv.dofIndex() == static_cast<std::size_t>(this->gridGeometry().numDofs()/2)) + values.set(Indices::pressureIdx); + return values; } /*!