14#ifndef DUMUX_STAGGERED_COUPLING_MANAGER_HH 
   15#define DUMUX_STAGGERED_COUPLING_MANAGER_HH 
   30template<
class MDTraits>
 
   35    template<std::
size_t id> 
using GridGeometry = 
typename MDTraits::template SubDomain<id>::GridGeometry;
 
   36    template<std::
size_t id> 
using GridView = 
typename GridGeometry<id>::GridView;
 
   38    using FVElementGeometry = 
typename GridGeometry<0>::LocalView;
 
   39    using SubControlVolumeFace = 
typename FVElementGeometry::SubControlVolumeFace;
 
   40    using Element = 
typename GridView<0>::template Codim<0>::Entity;
 
   43    using CouplingStencil = std::vector<GridIndexType>;
 
   52    static constexpr auto faceIdx = GridGeometry<0>::faceIdx();
 
   57    template<std::
size_t i, std::
size_t j, 
class LocalAssemblerI, 
class PriVarsJ>
 
   59                               const LocalAssemblerI& localAssemblerI,
 
   60                               Dune::index_constant<j> domainJ,
 
   61                               const std::size_t dofIdxGlobalJ,
 
   62                               const PriVarsJ& priVarsJ,
 
   70            curSol[dofIdxGlobalJ][pvIdxJ] = priVarsJ[pvIdxJ];
 
 
   83    const CouplingStencil& 
couplingStencil(Dune::index_constant<cellCenterIdx> domainI,
 
   84                                           const Element& elementI,
 
   85                                           Dune::index_constant<faceIdx> domainJ)
 const 
   87        const auto& connectivityMap = this->
problem(domainI).gridGeometry().connectivityMap();
 
   88        const auto eIdx = this->
problem(domainI).gridGeometry().elementMapper().index(elementI);
 
   89        return connectivityMap(domainI, domainJ, eIdx);
 
 
  102    template<std::
size_t i, std::
size_t j>
 
  104                                           const SubControlVolumeFace& scvfI,
 
  105                                           Dune::index_constant<j> domainJ)
 const 
  107        static_assert(i != j, 
"Domain i cannot be coupled to itself!");
 
  109                      "The coupling manager does not implement the couplingStencil() function" );
 
  111        return CouplingStencil(); 
 
 
  125                                           const SubControlVolumeFace& scvfI,
 
  126                                           Dune::index_constant<cellCenterIdx> domainJ)
 const 
  128        const auto& connectivityMap = this->
problem(domainI).gridGeometry().connectivityMap();
 
  129        return connectivityMap(domainI, domainJ, scvfI.index());
 
 
  138    template<
class LocalAssemblerI, std::
size_t j>
 
  140                                        const LocalAssemblerI& localAssemblerI,
 
  141                                        Dune::index_constant<j> domainJ,
 
  142                                        std::size_t dofIdxGlobalJ) 
const 
  144        static_assert(domainI != domainJ, 
"Domain i cannot be coupled to itself!");
 
  145        return localAssemblerI.evalLocalResidualForCellCenter();
 
 
  163    template<
class LocalAssemblerI, std::
size_t j>
 
  165                                        const SubControlVolumeFace& scvfI,
 
  166                                        const LocalAssemblerI& localAssemblerI,
 
  167                                        Dune::index_constant<j> domainJ,
 
  168                                        std::size_t dofIdxGlobalJ) 
const 
  170        static_assert(domainI != domainJ, 
"Domain i cannot be coupled to itself!");
 
  171        return localAssemblerI.evalLocalResidualForFace(scvfI);
 
 
  178    template<std::
size_t i, 
typename std::enable_if_t<(Gr
idGeometry<i>::discMethod != DiscretizationMethods::staggered), 
int> = 0>
 
  180                                  const std::string& paramGroup)
 const 
 
  189    template<std::
size_t i, 
typename std::enable_if_t<(Gr
idGeometry<i>::discMethod == DiscretizationMethods::staggered), 
int> = 0>
 
  191                                  const std::string& paramGroup)
 const 
  193        constexpr std::size_t numEqCellCenter = Traits::template SubDomain<cellCenterIdx>::PrimaryVariables::dimension;
 
  194        constexpr std::size_t numEqFace = Traits::template SubDomain<faceIdx>::PrimaryVariables::dimension;
 
  195        constexpr bool isCellCenter = GridGeometry<i>::isCellCenter();
 
  196        constexpr std::size_t numEq = isCellCenter ? numEqCellCenter : numEqFace;
 
  197        constexpr auto prefix = isCellCenter ? 
"CellCenter" : 
"Face";
 
  200            if(paramGroup.empty())
 
  205        catch (Dune::RangeError& e)
 
  208                        "  CellCenter.Assembly.NumericDifference.PriVarMagnitude = mCC\n" 
  209                        "  Face.Assembly.NumericDifference.PriVarMagnitude = mFace\n" 
  210                        "  CellCenter.Assembly.NumericDifference.BaseEpsilon = eCC_0 ... eCC_numEqCellCenter-1\n" 
  211                        "  Face.Assembly.NumericDifference.BaseEpsilon = eFace_0 ... eFace_numEqFace-1\n\n" 
  212                        "Wrong number of values set for " << prefix  << 
" (has " << numEq << 
" primary variable(s))\n\n" << e);
 
 
 
const Problem< i > & problem(Dune::index_constant< i > domainIdx) const
Definition multidomain/couplingmanager.hh:297
SubSolutionVector< i > & curSol(Dune::index_constant< i > domainIdx)
Definition multidomain/couplingmanager.hh:326
decltype(auto) numericEpsilon(Dune::index_constant< i >, const std::string ¶mGroup) const
Definition multidomain/couplingmanager.hh:263
CouplingManager()
Definition multidomain/couplingmanager.hh:70
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:32
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:124
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:103
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:139
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:83
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:179
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:58
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:164
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:190
static constexpr auto cellCenterIdx
Definition staggeredcouplingmanager.hh:51
MDTraits Traits
Definition staggeredcouplingmanager.hh:49
static constexpr auto faceIdx
Definition staggeredcouplingmanager.hh:52
decltype(auto) evalCouplingResidual(Dune::index_constant< i > domainI, const LocalAssemblerI &localAssemblerI, Dune::index_constant< j > domainJ, std::size_t dofIdxGlobalJ) const
Definition multidomain/couplingmanager.hh:237
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