12#ifndef DUMUX_FACETCOUPLING_MANAGER_HH
13#define DUMUX_FACETCOUPLING_MANAGER_HH
23namespace FacetCoupling{
39template<
class VolumeVariables,
class Problem,
class SolutionVector,
class FVGeometry>
41 const Problem& problem,
42 const SolutionVector& sol,
43 const FVGeometry& fvGeometry,
44 const typename FVGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
45 const typename FVGeometry::GridGeometry::GridView::template Codim<0>::Entity::Geometry& elemGeom,
46 const typename FVGeometry::GridGeometry::GridView::template Codim<0>::Entity::Geometry::GlobalCoordinate& pos)
49 auto elemSol =
elementSolution(element, sol, fvGeometry.gridGeometry());
50 const auto centerSol =
evalSolution(element, elemGeom, fvGeometry.gridGeometry(), elemSol, pos);
51 for (
unsigned int i = 0; i < fvGeometry.numScv(); ++i)
52 elemSol[i] = centerSol;
59 volVars.update(elemSol, problem, element, *scvs(fvGeometry).begin());
78template<
class MDTraits,
80 std::size_t bulkDomainId = 0,
81 std::size_t lowDimDomainId = 1,
82 class DiscretizationMethod =
typename GetPropType<typename MDTraits::template SubDomain<bulkDomainId>::TypeTag, Properties::GridGeometry>::DiscretizationMethod >
97template<
class MDTraits,
99 std::size_t bulkDomainId = 0,
100 std::size_t facetDomainId = 1,
101 std::size_t edgeDomainId = 2 >
110 using BulkIdType =
typename MDTraits::template SubDomain<bulkDomainId>::Index;
111 using FacetIdType =
typename MDTraits::template SubDomain<facetDomainId>::Index;
112 using EdgeIdType =
typename MDTraits::template SubDomain<edgeDomainId>::Index;
113 static constexpr auto bulkId = BulkIdType();
114 static constexpr auto facetId = FacetIdType();
115 static constexpr auto edgeId = EdgeIdType();
118 template<std::
size_t id>
using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
125 template<std::
size_t id>
using FVElementGeometry =
typename GridGeometry<id>::LocalView;
126 template<std::
size_t id>
using SubControlVolumeFace =
typename GridGeometry<id>::SubControlVolumeFace;
127 template<std::
size_t id>
using GridView =
typename GridGeometry<id>::GridView;
129 template<std::
size_t id>
using Element =
typename GridView<id>::template Codim<0>::Entity;
132 template<std::
size_t id>
using ElementVolumeVariables =
typename GridVariables<id>::GridVolumeVariables::LocalView;
133 template<std::
size_t id>
using ElementFluxVariablesCache =
typename GridVariables<id>::GridFluxVariablesCache::LocalView;
136 template<std::
size_t id>
137 static constexpr bool usesMpfa(Dune::index_constant<id> domainId)
142 template<std::
size_t i, std::
size_t j>
159 void init(std::shared_ptr< Problem<bulkId> > bulkProblem,
160 std::shared_ptr< Problem<facetId> > facetProblem,
161 std::shared_ptr< Problem<edgeId> > edgeProblem,
162 std::shared_ptr< CouplingMapper > couplingMapper,
165 BulkFacetManager::init(bulkProblem, facetProblem, couplingMapper, curSol);
166 FacetEdgeManager::init(facetProblem, edgeProblem, couplingMapper, curSol);
170 using BulkFacetManager::couplingStencil;
171 using FacetEdgeManager::couplingStencil;
173 using BulkFacetManager::isCoupled;
174 using FacetEdgeManager::isCoupled;
176 using BulkFacetManager::isOnInteriorBoundary;
177 using FacetEdgeManager::isOnInteriorBoundary;
179 using BulkFacetManager::getLowDimVolVars;
180 using FacetEdgeManager::getLowDimVolVars;
182 using BulkFacetManager::getLowDimElement;
183 using FacetEdgeManager::getLowDimElement;
185 using BulkFacetManager::getLowDimElementIndex;
186 using FacetEdgeManager::getLowDimElementIndex;
188 using BulkFacetManager::evalSourcesFromBulk;
189 using FacetEdgeManager::evalSourcesFromBulk;
191 using BulkFacetManager::evalCouplingResidual;
192 using FacetEdgeManager::evalCouplingResidual;
194 using BulkFacetManager::bindCouplingContext;
195 using FacetEdgeManager::bindCouplingContext;
197 using BulkFacetManager::updateCouplingContext;
198 using FacetEdgeManager::updateCouplingContext;
200 using BulkFacetManager::updateCoupledVariables;
201 using FacetEdgeManager::updateCoupledVariables;
203 using BulkFacetManager::extendJacobianPattern;
204 using FacetEdgeManager::extendJacobianPattern;
206 using BulkFacetManager::evalAdditionalDomainDerivatives;
207 using FacetEdgeManager::evalAdditionalDomainDerivatives;
211 template<
class JacobianPattern>
213 { BulkFacetManager::extendJacobianPattern(facetId, pattern); }
215 template<
class FacetLocalAssembler,
class JacobianMatrixDiagBlock,
class Gr
idVariables>
217 const FacetLocalAssembler& facetLocalAssembler,
218 const typename FacetLocalAssembler::LocalResidual::ElementResidualVector& origResiduals,
219 JacobianMatrixDiagBlock& A,
220 GridVariables& gridVariables)
221 { BulkFacetManager::evalAdditionalDomainDerivatives(facetId, facetLocalAssembler, origResiduals, A, gridVariables); }
227 const Element<bulkId>& element,
228 EdgeIdType domainJ)
const
229 {
return FacetEdgeManager::getEmptyStencil(edgeId); }
235 const Element<edgeId>& element,
236 BulkIdType domainJ)
const
237 {
return BulkFacetManager::getEmptyStencil(bulkId); }
245 BulkFacetManager::updateSolution(sol);
246 FacetEdgeManager::updateSolution(sol);
255 template<std::size_t i,
257 class LocalAssembler,
258 std::enable_if_t<((i==bulkId && j==edgeId) || ((i==edgeId && j==bulkId))),
int> = 0>
259 typename LocalAssembler::LocalResidual::ElementResidualVector
261 const LocalAssembler& localAssembler,
262 Dune::index_constant<j> domainJ,
263 GridIndexType<j> dofIdxGlobalJ)
265 typename LocalAssembler::LocalResidual::ElementResidualVector res(1);
274 template<
class Assembler >
277 BulkFacetManager::bindCouplingContext(facetId, element, assembler);
278 FacetEdgeManager::bindCouplingContext(facetId, element, assembler);
285 template<
class FacetLocalAssembler >
287 const FacetLocalAssembler& facetLocalAssembler,
289 GridIndexType<facetId> dofIdxGlobalJ,
290 const PrimaryVariables<facetId>& priVarsJ,
293 BulkFacetManager::updateCouplingContext(domainI, facetLocalAssembler, domainJ, dofIdxGlobalJ, priVarsJ, pvIdxJ);
294 FacetEdgeManager::updateCouplingContext(domainI, facetLocalAssembler, domainJ, dofIdxGlobalJ, priVarsJ, pvIdxJ);
302 template<std::size_t i,
304 class LocalAssembler,
305 std::enable_if_t<((i==bulkId && j==edgeId) || (i==edgeId && j==bulkId)),
int> = 0>
307 const LocalAssembler& localAssembler,
308 Dune::index_constant<j> domainJ,
309 GridIndexType<j> dofIdxGlobalJ,
310 const PrimaryVariables<j>& priVarsJ,
319 template<
class FacetLocalAssembler,
class UpdatableElementVolVars,
class UpdatableFluxVarCache>
321 const FacetLocalAssembler& facetLocalAssembler,
322 UpdatableElementVolVars& elemVolVars,
323 UpdatableFluxVarCache& elemFluxVarsCache)
325 BulkFacetManager::updateCoupledVariables(domainI, facetLocalAssembler, elemVolVars, elemFluxVarsCache);
326 FacetEdgeManager::updateCoupledVariables(domainI, facetLocalAssembler, elemVolVars, elemFluxVarsCache);
330 template<std::
size_t id, std::enable_if_t<(
id == bulkId ||
id == facetId),
int> = 0>
331 const Problem<id>&
problem()
const {
return BulkFacetManager::template problem<id>(); }
334 template<std::
size_t id, std::enable_if_t<(
id == bulkId ||
id == facetId),
int> = 0>
335 Problem<id>&
problem() {
return BulkFacetManager::template problem<id>(); }
338 template<std::
size_t id, std::enable_if_t<(
id == edgeId),
int> = 0>
339 const Problem<id>&
problem()
const {
return FacetEdgeManager::template problem<id>(); }
342 template<std::
size_t id, std::enable_if_t<(
id == edgeId),
int> = 0>
343 Problem<id>&
problem() {
return FacetEdgeManager::template problem<id>(); }
Implementation for the coupling manager between two domains of dimension d and (d-1) for models consi...
Definition: multidomain/facet/couplingmanager.hh:83
Class that handles the coupling between three sub-domains in models where the coupling between the tw...
Definition: multidomain/facet/couplingmanager.hh:105
void updateCouplingContext(Dune::index_constant< i > domainI, const LocalAssembler &localAssembler, Dune::index_constant< j > domainJ, GridIndexType< j > dofIdxGlobalJ, const PrimaryVariables< j > &priVarsJ, unsigned int pvIdxJ)
Interface for updating the coupling context between the bulk and the edge domain. We do nothing here ...
Definition: multidomain/facet/couplingmanager.hh:306
const Problem< id > & problem() const
Return a const reference to bulk or facet problem.
Definition: multidomain/facet/couplingmanager.hh:331
void updateCoupledVariables(FacetIdType domainI, const FacetLocalAssembler &facetLocalAssembler, UpdatableElementVolVars &elemVolVars, UpdatableFluxVarCache &elemFluxVarsCache)
Interface for updating the local views of the facet domain after updateCouplingContext the coupling c...
Definition: multidomain/facet/couplingmanager.hh:320
typename MDTraits::SolutionVector SolutionVector
the type of the solution vector
Definition: multidomain/facet/couplingmanager.hh:148
void updateSolution(const SolutionVector &sol)
updates the current solution. We have to overload this here to avoid ambiguity and update the solutio...
Definition: multidomain/facet/couplingmanager.hh:243
void evalAdditionalDomainDerivatives(FacetIdType, const FacetLocalAssembler &facetLocalAssembler, const typename FacetLocalAssembler::LocalResidual::ElementResidualVector &origResiduals, JacobianMatrixDiagBlock &A, GridVariables &gridVariables)
Definition: multidomain/facet/couplingmanager.hh:216
void updateCouplingContext(FacetIdType domainI, const FacetLocalAssembler &facetLocalAssembler, FacetIdType domainJ, GridIndexType< facetId > dofIdxGlobalJ, const PrimaryVariables< facetId > &priVarsJ, unsigned int pvIdxJ)
Interface for updating the coupling context of the facet domain. In this case we have to update both ...
Definition: multidomain/facet/couplingmanager.hh:286
Problem< id > & problem()
Return a reference to bulk or facet problem.
Definition: multidomain/facet/couplingmanager.hh:335
typename std::conditional<(j==edgeDomainId), typename FacetEdgeManager::template CouplingStencilType< i, j >, typename BulkFacetManager::template CouplingStencilType< i, j > >::type CouplingStencilType
types used for coupling stencils
Definition: multidomain/facet/couplingmanager.hh:145
const CouplingStencilType< bulkId, edgeId > & couplingStencil(BulkIdType domainI, const Element< bulkId > &element, EdgeIdType domainJ) const
The coupling stencil of the bulk with the edge domain (empty stencil).
Definition: multidomain/facet/couplingmanager.hh:226
const CouplingStencilType< edgeId, bulkId > & couplingStencil(EdgeIdType domainI, const Element< edgeId > &element, BulkIdType domainJ) const
The coupling stencil of the edge with the bulk domain (empty stencil).
Definition: multidomain/facet/couplingmanager.hh:234
void bindCouplingContext(FacetIdType, const Element< facetId > &element, const Assembler &assembler)
Interface for binding the coupling context for the facet domain. In this case we have to bind both th...
Definition: multidomain/facet/couplingmanager.hh:275
void extendJacobianPattern(FacetIdType, JacobianPattern &pattern) const
Definition: multidomain/facet/couplingmanager.hh:212
void init(std::shared_ptr< Problem< bulkId > > bulkProblem, std::shared_ptr< Problem< facetId > > facetProblem, std::shared_ptr< Problem< edgeId > > edgeProblem, std::shared_ptr< CouplingMapper > couplingMapper, const SolutionVector &curSol)
Initialize the coupling manager.
Definition: multidomain/facet/couplingmanager.hh:159
LocalAssembler::LocalResidual::ElementResidualVector evalCouplingResidual(Dune::index_constant< i > domainI, const LocalAssembler &localAssembler, Dune::index_constant< j > domainJ, GridIndexType< j > dofIdxGlobalJ)
Interface for evaluating the coupling residual between the bulk and the edge domain....
Definition: multidomain/facet/couplingmanager.hh:260
Defines all properties used in Dumux.
Element solution classes and factory functions.
free functions for the evaluation of primary variables inside elements.
PrimaryVariables evalSolution(const Element &element, const typename Element::Geometry &geometry, const typename FVElementGeometry::GridGeometry &gridGeometry, const CVFEElementSolution< FVElementGeometry, PrimaryVariables > &elemSol, const typename Element::Geometry::GlobalCoordinate &globalPos, bool ignoreState=false)
Interpolates a given box element solution at a given global position. Uses the finite element cache o...
Definition: evalsolution.hh:152
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethods::cctpfa||GridGeometry::discMethod==DiscretizationMethods::ccmpfa, CCElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for cell-centered schemes.
Definition: cellcentered/elementsolution.hh:101
void makeInterpolatedVolVars(VolumeVariables &volVars, const Problem &problem, const SolutionVector &sol, const FVGeometry &fvGeometry, const typename FVGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const typename FVGeometry::GridGeometry::GridView::template Codim< 0 >::Entity::Geometry &elemGeom, const typename FVGeometry::GridGeometry::GridView::template Codim< 0 >::Entity::Geometry::GlobalCoordinate &pos)
Free function that allows the creation of a volume variables object interpolated to a given position ...
Definition: multidomain/facet/couplingmanager.hh:40
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
The available discretization methods in Dumux.
constexpr CCMpfa ccmpfa
Definition: method.hh:146
Structure to define the index types used for grid and local indices.
Definition: indextraits.hh:26