14#ifndef DUMUX_STAGGERED_COUPLING_MANAGER_HH
15#define DUMUX_STAGGERED_COUPLING_MANAGER_HH
29template<
class MDTraits>
34 template<std::
size_t id>
using GridGeometry =
typename MDTraits::template SubDomain<id>::GridGeometry;
35 template<std::
size_t id>
using GridView =
typename GridGeometry<id>::GridView;
37 using FVElementGeometry =
typename GridGeometry<0>::LocalView;
38 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
39 using Element =
typename GridView<0>::template Codim<0>::Entity;
42 using CouplingStencil = std::vector<GridIndexType>;
51 static constexpr auto faceIdx = GridGeometry<0>::faceIdx();
56 template<std::
size_t i, std::
size_t j,
class LocalAssemblerI,
class PriVarsJ>
58 const LocalAssemblerI& localAssemblerI,
59 Dune::index_constant<j> domainJ,
60 const std::size_t dofIdxGlobalJ,
61 const PriVarsJ& priVarsJ,
69 curSol[dofIdxGlobalJ][pvIdxJ] = priVarsJ[pvIdxJ];
82 const CouplingStencil&
couplingStencil(Dune::index_constant<cellCenterIdx> domainI,
83 const Element& elementI,
84 Dune::index_constant<faceIdx> domainJ)
const
86 const auto& connectivityMap = this->
problem(domainI).gridGeometry().connectivityMap();
87 const auto eIdx = this->
problem(domainI).gridGeometry().elementMapper().index(elementI);
88 return connectivityMap(domainI, domainJ, eIdx);
101 template<std::
size_t i, std::
size_t j>
103 const SubControlVolumeFace& scvfI,
104 Dune::index_constant<j> domainJ)
const
106 static_assert(i != j,
"Domain i cannot be coupled to itself!");
108 "The coupling manager does not implement the couplingStencil() function" );
110 return CouplingStencil();
124 const SubControlVolumeFace& scvfI,
125 Dune::index_constant<cellCenterIdx> domainJ)
const
127 const auto& connectivityMap = this->
problem(domainI).gridGeometry().connectivityMap();
128 return connectivityMap(domainI, domainJ, scvfI.index());
137 template<
class LocalAssemblerI, std::
size_t j>
139 const LocalAssemblerI& localAssemblerI,
140 Dune::index_constant<j> domainJ,
141 std::size_t dofIdxGlobalJ)
const
143 static_assert(domainI != domainJ,
"Domain i cannot be coupled to itself!");
144 return localAssemblerI.evalLocalResidualForCellCenter();
162 template<
class LocalAssemblerI, std::
size_t j>
164 const SubControlVolumeFace& scvfI,
165 const LocalAssemblerI& localAssemblerI,
166 Dune::index_constant<j> domainJ,
167 std::size_t dofIdxGlobalJ)
const
169 static_assert(domainI != domainJ,
"Domain i cannot be coupled to itself!");
170 return localAssemblerI.evalLocalResidualForFace(scvfI);
177 template<std::
size_t i,
typename std::enable_if_t<(Gr
idGeometry<i>::discMethod != DiscretizationMethods::staggered),
int> = 0>
179 const std::string& paramGroup)
const
188 template<std::
size_t i,
typename std::enable_if_t<(Gr
idGeometry<i>::discMethod == DiscretizationMethods::staggered),
int> = 0>
190 const std::string& paramGroup)
const
192 constexpr std::size_t numEqCellCenter = Traits::template SubDomain<cellCenterIdx>::PrimaryVariables::dimension;
193 constexpr std::size_t numEqFace = Traits::template SubDomain<faceIdx>::PrimaryVariables::dimension;
194 constexpr bool isCellCenter = GridGeometry<i>::isCellCenter();
195 constexpr std::size_t numEq = isCellCenter ? numEqCellCenter : numEqFace;
196 constexpr auto prefix = isCellCenter ?
"CellCenter" :
"Face";
199 if(paramGroup.empty())
204 catch (Dune::RangeError& e)
207 " CellCenter.Assembly.NumericDifference.PriVarMagnitude = mCC\n"
208 " Face.Assembly.NumericDifference.PriVarMagnitude = mFace\n"
209 " CellCenter.Assembly.NumericDifference.BaseEpsilon = eCC_0 ... eCC_numEqCellCenter-1\n"
210 " Face.Assembly.NumericDifference.BaseEpsilon = eFace_0 ... eFace_numEqFace-1\n\n"
211 "Wrong number of values set for " << prefix <<
" (has " << numEq <<
" primary variable(s))\n\n" << e);
The interface of the coupling manager for multi domain problems.
Definition: multidomain/couplingmanager.hh:48
const Problem< i > & problem(Dune::index_constant< i > domainIdx) const
Return a reference to the sub problem.
Definition: multidomain/couplingmanager.hh:309
SubSolutionVector< i > & curSol(Dune::index_constant< i > domainIdx)
the solution vector of the subproblem
Definition: multidomain/couplingmanager.hh:338
decltype(auto) numericEpsilon(Dune::index_constant< i >, const std::string ¶mGroup) const
return the numeric epsilon used for deflecting primary variables of coupled domain i
Definition: multidomain/couplingmanager.hh:275
A helper class for local assemblers using numeric differentiation to determine the epsilon.
Definition: numericepsilon.hh:29
Exception thrown if a run-time parameter is not specified correctly.
Definition: exceptions.hh:48
Base coupling manager for the staggered discretization.
Definition: staggeredcouplingmanager.hh:31
const CouplingStencil & couplingStencil(Dune::index_constant< faceIdx > domainI, const SubControlVolumeFace &scvfI, Dune::index_constant< cellCenterIdx > domainJ) const
returns an iterable container of all indices of degrees of freedom of domain j that couple with / inf...
Definition: staggeredcouplingmanager.hh:123
const CouplingStencil couplingStencil(Dune::index_constant< i > domainI, const SubControlVolumeFace &scvfI, Dune::index_constant< j > domainJ) const
returns an iterable container of all indices of degrees of freedom of domain j that couple with / inf...
Definition: staggeredcouplingmanager.hh:102
decltype(auto) evalCouplingResidual(Dune::index_constant< cellCenterIdx > domainI, const LocalAssemblerI &localAssemblerI, Dune::index_constant< j > domainJ, std::size_t dofIdxGlobalJ) const
evaluates the element residual of a coupled element of domain i which depends on the variables at the...
Definition: staggeredcouplingmanager.hh:138
const CouplingStencil & couplingStencil(Dune::index_constant< cellCenterIdx > domainI, const Element &elementI, Dune::index_constant< faceIdx > domainJ) const
returns an iterable container of all indices of degrees of freedom of domain j that couple with / inf...
Definition: staggeredcouplingmanager.hh:82
decltype(auto) numericEpsilon(Dune::index_constant< i > id, const std::string ¶mGroup) const
return the numeric epsilon used for deflecting primary variables of coupled domain i.
Definition: staggeredcouplingmanager.hh:178
void updateCouplingContext(Dune::index_constant< i > domainI, const LocalAssemblerI &localAssemblerI, Dune::index_constant< j > domainJ, const std::size_t dofIdxGlobalJ, const PriVarsJ &priVarsJ, int pvIdxJ)
updates all data and variables that are necessary to evaluate the residual of the element of domain i...
Definition: staggeredcouplingmanager.hh:57
decltype(auto) evalCouplingResidual(Dune::index_constant< faceIdx > domainI, const SubControlVolumeFace &scvfI, const LocalAssemblerI &localAssemblerI, Dune::index_constant< j > domainJ, std::size_t dofIdxGlobalJ) const
evaluates the face residual of a coupled face of domain i which depends on the variables at the degre...
Definition: staggeredcouplingmanager.hh:163
decltype(auto) numericEpsilon(Dune::index_constant< i >, const std::string ¶mGroup) const
return the numeric epsilon used for deflecting primary variables of coupled domain i.
Definition: staggeredcouplingmanager.hh:189
static constexpr auto cellCenterIdx
Definition: staggeredcouplingmanager.hh:50
MDTraits Traits
Definition: staggeredcouplingmanager.hh:48
static constexpr auto faceIdx
Definition: staggeredcouplingmanager.hh:51
decltype(auto) evalCouplingResidual(Dune::index_constant< i > domainI, const LocalAssemblerI &localAssemblerI, Dune::index_constant< j > domainJ, std::size_t dofIdxGlobalJ) const
evaluates the element residual of a coupled element of domain i which depends on the variables at the...
Definition: multidomain/couplingmanager.hh:249
The available discretization methods in Dumux.
The interface of the coupling manager for multi domain problems.
An adapter class for local assemblers using numeric differentiation.
Template which always yields a false value.
Definition: common/typetraits/typetraits.hh:24
Structure to define the index types used for grid and local indices.
Definition: indextraits.hh:26