Skip to content
Snippets Groups Projects
Commit 2dce795f authored by Katharina Heck's avatar Katharina Heck
Browse files

Merge branch 'fix/disable-internal-dirichlet-cc-until-better-solution-found' into 'master'

[fix][cc] Replace faulty implementation of internal Dirichlet by error

Closes #743

See merge request !1725
parents ef73144b 011710a9
No related branches found
No related tags found
1 merge request!1725[fix][cc] Replace faulty implementation of internal Dirichlet by error
......@@ -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);
}
};
......
......@@ -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_; }
......
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
......
......@@ -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
......
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