diff --git a/dumux/assembly/cclocalassembler.hh b/dumux/assembly/cclocalassembler.hh index 8c8166a1daf0652aad69a071655e21efebf80e89..36dce650919f8a0f5cec996c8ea54c9ef1fc7466 100644 --- a/dumux/assembly/cclocalassembler.hh +++ b/dumux/assembly/cclocalassembler.hh @@ -63,6 +63,8 @@ class CCLocalAssemblerBase : public FVLocalAssemblerBase<TypeTag, Assembler, Imp using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; using NumEqVector = GetPropType<TypeTag, Properties::NumEqVector>; + static_assert(!Assembler::Problem::enableInternalDirichletConstraints(), "Internal Dirichlet constraints are currently not implemented for cc-methods!"); + public: using ParentType::ParentType; @@ -86,20 +88,6 @@ public: { res[globalI] = this->asImp_().assembleJacobianAndResidualImpl(jac, gridVariables); // forward to the internal implementation } - - auto applyDirichlet = [&] (const auto& scvI, - const auto& dirichletValues, - const auto eqIdx, - const auto pvIdx) - { - res[scvI.dofIndex()][eqIdx] = this->curElemVolVars()[scvI].priVars()[pvIdx] - dirichletValues[pvIdx]; - auto& row = jac[scvI.dofIndex()]; - for (auto col = row.begin(); col != row.end(); ++col) - row[col.index()][eqIdx] = 0.0; - row[scvI.dofIndex()][eqIdx][pvIdx] = 1.0; - }; - - this->asImp_().enforceDirichletConstraints(applyDirichlet); } /*! @@ -110,19 +98,6 @@ public: { this->asImp_().bindLocalViews(); this->asImp_().assembleJacobianAndResidualImpl(jac, gridVariables); // forward to the internal implementation - - auto applyDirichlet = [&] (const auto& scvI, - const auto& dirichletValues, - const auto eqIdx, - const auto pvIdx) - { - auto& row = jac[scvI.dofIndex()]; - for (auto col = row.begin(); col != row.end(); ++col) - row[col.index()][eqIdx] = 0.0; - row[scvI.dofIndex()][eqIdx][pvIdx] = 1.0; - }; - - this->asImp_().enforceDirichletConstraints(applyDirichlet); } /*! @@ -133,25 +108,6 @@ public: this->asImp_().bindLocalViews(); const auto globalI = this->assembler().fvGridGeometry().elementMapper().index(this->element()); res[globalI] = this->asImp_().evalLocalResidual()[0]; // forward to the internal implementation - - auto applyDirichlet = [&] (const auto& scvI, - const auto& dirichletValues, - const auto eqIdx, - const auto pvIdx) - { - res[scvI.dofIndex()][eqIdx] = this->curElemVolVars()[scvI].priVars()[pvIdx] - dirichletValues[pvIdx]; - }; - - this->asImp_().enforceDirichletConstraints(applyDirichlet); - } - - //! Enforce Dirichlet constraints - template<typename ApplyFunction> - void enforceDirichletConstraints(const ApplyFunction& applyDirichlet) - { - // currently Dirichlet boundary conditions are weakly enforced for cc-schemes - // so here, we only take care of internal Dirichlet constraints (if enabled) - this->asImp_().enforceInternalDirichletConstraints(applyDirichlet); } }; diff --git a/dumux/multidomain/subdomaincclocalassembler.hh b/dumux/multidomain/subdomaincclocalassembler.hh index 3cee0f4353902d97051aa6afd46374d678bf89ca..e96c2f4729dc7f07262d3569438fdaf753ab8fe5 100644 --- a/dumux/multidomain/subdomaincclocalassembler.hh +++ b/dumux/multidomain/subdomaincclocalassembler.hh @@ -82,6 +82,8 @@ class SubDomainCCLocalAssemblerBase : public FVLocalAssemblerBase<TypeTag, Assem using CouplingManager = typename Assembler::CouplingManager; using ElementResidualVector = typename ParentType::LocalResidual::ElementResidualVector; + static_assert(!Assembler::Problem::enableInternalDirichletConstraints(), "Internal Dirichlet constraints are currently not implemented for cc-methods!"); + public: //! export the domain id of this sub-domain static constexpr auto domainId = typename Dune::index_constant<id>(); @@ -127,20 +129,6 @@ public: if (i != id) this->assembleJacobianCoupling(i, jacRow, res[globalI], gridVariables); }); - - auto applyDirichlet = [&] (const auto& scvI, - const auto& dirichletValues, - const auto eqIdx, - const auto pvIdx) - { - res[scvI.dofIndex()][eqIdx] = this->curElemVolVars()[scvI].priVars()[pvIdx] - dirichletValues[pvIdx]; - auto& row = jacRow[domainId][scvI.dofIndex()]; - for (auto col = row.begin(); col != row.end(); ++col) - row[col.index()][eqIdx] = 0.0; - row[scvI.dofIndex()][eqIdx][pvIdx] = 1.0; - }; - - this->asImp_().enforceDirichletConstraints(applyDirichlet); } /*! @@ -172,16 +160,6 @@ public: this->asImp_().bindLocalViews(); const auto globalI = this->fvGeometry().fvGridGeometry().elementMapper().index(this->element()); res[globalI] = this->evalLocalResidual()[0]; // forward to the internal implementation - - auto applyDirichlet = [&] (const auto& scvI, - const auto& dirichletValues, - const auto eqIdx, - const auto pvIdx) - { - res[scvI.dofIndex()][eqIdx] = this->curElemVolVars()[scvI].priVars()[pvIdx] - dirichletValues[pvIdx]; - }; - - this->asImp_().enforceDirichletConstraints(applyDirichlet); } /*! @@ -267,15 +245,6 @@ public: const Problem& problem() const { return this->assembler().problem(domainId); } - //! Enforce Dirichlet constraints - template<typename ApplyFunction> - void enforceDirichletConstraints(const ApplyFunction& applyDirichlet) - { - // currently Dirichlet boundary conditions are weakly enforced for cc-schemes - // so here, we only take care of internal Dirichlet constraints (if enabled) - this->asImp_().enforceInternalDirichletConstraints(applyDirichlet); - } - //! return reference to the coupling manager CouplingManager& couplingManager() { return couplingManager_; } diff --git a/test/porousmediumflow/1p/implicit/internaldirichlet/CMakeLists.txt b/test/porousmediumflow/1p/implicit/internaldirichlet/CMakeLists.txt index 4ec99b479b7301168ad8f0beee51ec65ade3b548..3c5254749d1f4836f5ae588fe9fc53773e98fd10 100644 --- a/test/porousmediumflow/1p/implicit/internaldirichlet/CMakeLists.txt +++ b/test/porousmediumflow/1p/implicit/internaldirichlet/CMakeLists.txt @@ -1,13 +1,20 @@ -dune_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") + +# 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 + +# dune_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") dune_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 51eba68c36b9c1b52ccd56c98266c380df6e9169..1b10e790583df697856e7776a3566c16a8360472 100644 --- a/test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh +++ b/test/porousmediumflow/1p/implicit/internaldirichlet/problem.hh @@ -35,7 +35,8 @@ namespace Properties { // Create new type tags namespace TTag { struct OnePInternalDirichlet {}; -struct OnePInternalDirichletTpfa { using InheritsFrom = std::tuple<OnePInternalDirichlet, OnePIncompressibleTpfa>; }; +// internal Dirichlet BC are currently not implemented for cc-models +//struct OnePInternalDirichletTpfa { using InheritsFrom = std::tuple<OnePInternalDirichlet, OnePIncompressibleTpfa>; }; struct OnePInternalDirichletBox { using InheritsFrom = std::tuple<OnePInternalDirichlet, OnePIncompressibleBox>; }; } // end namespace TTag