Skip to content
Snippets Groups Projects
Commit b6cce408 authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[test][1p] Fix internal Dirichlet constraint test

parent 1f9b5d56
No related branches found
No related tags found
1 merge request!2202Feature/cc internaldirichlet
# This feature (internal Dirichlet contraints) is currently not implemented for cc models dumux_add_test(NAME test_1p_internaldirichlet_tpfa
# The compilation triggers a copmiler error (static_assert) SOURCES ${CMAKE_SOURCE_DIR}/test/porousmediumflow/1p/implicit/incompressible/main.cc
# Once its implemented replace OnePInternalDirichletBox by OnePInternalDirichletTpfa (and uncomment OnePInternalDirichletTpfa in the problem.hh) LABELS porousmediumflow 1p
# and remove the EXPECT_COMPILE_FAIL flag COMPILE_DEFINITIONS TYPETAG=OnePInternalDirichletTpfa
COMPILE_DEFINITIONS NUMDIFFMETHOD=DiffMethod::analytic
# dumux_add_test(NAME test_1p_internaldirichlet_tpfa COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
# EXPECT_COMPILE_FAIL CMD_ARGS --script fuzzy
# SOURCES ${CMAKE_SOURCE_DIR}/test/porousmediumflow/1p/implicit/incompressible/main.cc --files ${CMAKE_SOURCE_DIR}/test/references/test_1p_internaldirichlet_tpfa-reference.vtu
# LABELS porousmediumflow 1p ${CMAKE_CURRENT_BINARY_DIR}/test_1p_internaldirichlet_tpfa-00001.vtu
# COMPILE_DEFINITIONS TYPETAG=OnePInternalDirichletTpfa --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")
# 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 dumux_add_test(NAME test_1p_internaldirichlet_box
SOURCES ${CMAKE_SOURCE_DIR}/test/porousmediumflow/1p/implicit/incompressible/main.cc SOURCES ${CMAKE_SOURCE_DIR}/test/porousmediumflow/1p/implicit/incompressible/main.cc
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#ifndef DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_INTERNAL_DIRICHLET_HH #ifndef DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_INTERNAL_DIRICHLET_HH
#define 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 <dumux/common/boundarytypes.hh>
#include <test/porousmediumflow/1p/implicit/incompressible/problem.hh> #include <test/porousmediumflow/1p/implicit/incompressible/problem.hh>
...@@ -36,8 +37,7 @@ namespace Properties { ...@@ -36,8 +37,7 @@ namespace Properties {
// Create new type tags // Create new type tags
namespace TTag { namespace TTag {
struct OnePInternalDirichlet {}; 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>; }; struct OnePInternalDirichletBox { using InheritsFrom = std::tuple<OnePInternalDirichlet, OnePIncompressibleBox>; };
} // end namespace TTag } // end namespace TTag
...@@ -61,11 +61,15 @@ class OnePTestProblemInternalDirichlet : public OnePTestProblem<TypeTag> ...@@ -61,11 +61,15 @@ class OnePTestProblemInternalDirichlet : public OnePTestProblem<TypeTag>
using Scalar = GetPropType<TypeTag, Properties::Scalar>; using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using NeumannValues = GetPropType<TypeTag, Properties::NumEqVector>; 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 GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using SubControlVolume = typename GridGeometry::SubControlVolume; using SubControlVolume = typename GridGeometry::SubControlVolume;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate; using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
static constexpr auto numEq = ModelTraits::numEq();
public: public:
OnePTestProblemInternalDirichlet(std::shared_ptr<const GridGeometry> gridGeometry) OnePTestProblemInternalDirichlet(std::shared_ptr<const GridGeometry> gridGeometry)
: ParentType(gridGeometry) : ParentType(gridGeometry)
...@@ -118,11 +122,15 @@ public: ...@@ -118,11 +122,15 @@ public:
* \param element The finite element * \param element The finite element
* \param scv The sub-control volume * \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 // 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 // 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;
} }
/*! /*!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment