24#ifndef DUMUX_FACETCOUPLING_MANAGER_HH
25#define DUMUX_FACETCOUPLING_MANAGER_HH
35namespace FacetCoupling{
51template<
class VolumeVariables,
class Problem,
class SolutionVector,
class FVGeometry>
53 const Problem& problem,
54 const SolutionVector& sol,
55 const FVGeometry& fvGeometry,
56 const typename FVGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
57 const typename FVGeometry::GridGeometry::GridView::template Codim<0>::Entity::Geometry& elemGeom,
58 const typename FVGeometry::GridGeometry::GridView::template Codim<0>::Entity::Geometry::GlobalCoordinate& pos)
61 auto elemSol =
elementSolution(element, sol, fvGeometry.gridGeometry());
62 const auto centerSol =
evalSolution(element, elemGeom, fvGeometry.gridGeometry(), elemSol, pos);
63 for (
unsigned int i = 0; i < fvGeometry.numScv(); ++i)
64 elemSol[i] = centerSol;
71 volVars.update(elemSol, problem, element, *scvs(fvGeometry).begin());
90template<
class MDTraits,
92 std::size_t bulkDomainId = 0,
93 std::size_t lowDimDomainId = 1,
94 class DiscretizationMethod =
typename GetPropType<typename MDTraits::template SubDomain<bulkDomainId>::TypeTag, Properties::GridGeometry>::DiscretizationMethod >
109template<
class MDTraits,
110 class CouplingMapper,
111 std::size_t bulkDomainId = 0,
112 std::size_t facetDomainId = 1,
113 std::size_t edgeDomainId = 2 >
122 using BulkIdType =
typename MDTraits::template SubDomain<bulkDomainId>::Index;
123 using FacetIdType =
typename MDTraits::template SubDomain<facetDomainId>::Index;
124 using EdgeIdType =
typename MDTraits::template SubDomain<edgeDomainId>::Index;
125 static constexpr auto bulkId = BulkIdType();
126 static constexpr auto facetId = FacetIdType();
127 static constexpr auto edgeId = EdgeIdType();
130 template<std::
size_t id>
using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
138 template<std::
size_t id>
using FVElementGeometry =
typename GridGeometry<id>::LocalView;
139 template<std::
size_t id>
using SubControlVolumeFace =
typename GridGeometry<id>::SubControlVolumeFace;
140 template<std::
size_t id>
using GridView =
typename GridGeometry<id>::GridView;
142 template<std::
size_t id>
using Element =
typename GridView<id>::template Codim<0>::Entity;
145 template<std::
size_t id>
using ElementVolumeVariables =
typename GridVariables<id>::GridVolumeVariables::LocalView;
146 template<std::
size_t id>
using ElementFluxVariablesCache =
typename GridVariables<id>::GridFluxVariablesCache::LocalView;
149 template<std::
size_t id>
150 static constexpr bool usesMpfa(Dune::index_constant<id> domainId)
155 template<std::
size_t i, std::
size_t j>
172 void init(std::shared_ptr< Problem<bulkId> > bulkProblem,
173 std::shared_ptr< Problem<facetId> > facetProblem,
174 std::shared_ptr< Problem<edgeId> > edgeProblem,
175 std::shared_ptr< CouplingMapper > couplingMapper,
178 BulkFacetManager::init(bulkProblem, facetProblem, couplingMapper, curSol);
179 FacetEdgeManager::init(facetProblem, edgeProblem, couplingMapper, curSol);
183 using BulkFacetManager::couplingStencil;
184 using FacetEdgeManager::couplingStencil;
186 using BulkFacetManager::isCoupled;
187 using FacetEdgeManager::isCoupled;
189 using BulkFacetManager::isOnInteriorBoundary;
190 using FacetEdgeManager::isOnInteriorBoundary;
192 using BulkFacetManager::getLowDimVolVars;
193 using FacetEdgeManager::getLowDimVolVars;
195 using BulkFacetManager::getLowDimElement;
196 using FacetEdgeManager::getLowDimElement;
198 using BulkFacetManager::getLowDimElementIndex;
199 using FacetEdgeManager::getLowDimElementIndex;
201 using BulkFacetManager::evalSourcesFromBulk;
202 using FacetEdgeManager::evalSourcesFromBulk;
204 using BulkFacetManager::evalCouplingResidual;
205 using FacetEdgeManager::evalCouplingResidual;
207 using BulkFacetManager::bindCouplingContext;
208 using FacetEdgeManager::bindCouplingContext;
210 using BulkFacetManager::updateCouplingContext;
211 using FacetEdgeManager::updateCouplingContext;
213 using BulkFacetManager::updateCoupledVariables;
214 using FacetEdgeManager::updateCoupledVariables;
216 using BulkFacetManager::extendJacobianPattern;
217 using FacetEdgeManager::extendJacobianPattern;
219 using BulkFacetManager::evalAdditionalDomainDerivatives;
220 using FacetEdgeManager::evalAdditionalDomainDerivatives;
224 template<
class JacobianPattern>
226 { BulkFacetManager::extendJacobianPattern(facetId, pattern); }
228 template<
class FacetLocalAssembler,
class JacobianMatrixDiagBlock,
class Gr
idVariables>
230 const FacetLocalAssembler& facetLocalAssembler,
231 const typename FacetLocalAssembler::LocalResidual::ElementResidualVector& origResiduals,
232 JacobianMatrixDiagBlock& A,
233 GridVariables& gridVariables)
234 { BulkFacetManager::evalAdditionalDomainDerivatives(facetId, facetLocalAssembler, origResiduals, A, gridVariables); }
240 const Element<bulkId>& element,
241 EdgeIdType domainJ)
const
242 {
return FacetEdgeManager::getEmptyStencil(edgeId); }
248 const Element<edgeId>& element,
249 BulkIdType domainJ)
const
250 {
return BulkFacetManager::getEmptyStencil(bulkId); }
258 BulkFacetManager::updateSolution(sol);
259 FacetEdgeManager::updateSolution(sol);
268 template<std::size_t i,
270 class LocalAssembler,
271 std::enable_if_t<((i==bulkId && j==edgeId) || ((i==edgeId && j==bulkId))),
int> = 0>
272 typename LocalResidual<i>::ElementResidualVector
274 const LocalAssembler& localAssembler,
275 Dune::index_constant<j> domainJ,
276 GridIndexType<j> dofIdxGlobalJ)
278 typename LocalResidual<i>::ElementResidualVector res(1);
287 template<
class Assembler >
290 BulkFacetManager::bindCouplingContext(facetId, element, assembler);
291 FacetEdgeManager::bindCouplingContext(facetId, element, assembler);
298 template<
class FacetLocalAssembler >
300 const FacetLocalAssembler& facetLocalAssembler,
302 GridIndexType<facetId> dofIdxGlobalJ,
303 const PrimaryVariables<facetId>& priVarsJ,
306 BulkFacetManager::updateCouplingContext(domainI, facetLocalAssembler, domainJ, dofIdxGlobalJ, priVarsJ, pvIdxJ);
307 FacetEdgeManager::updateCouplingContext(domainI, facetLocalAssembler, domainJ, dofIdxGlobalJ, priVarsJ, pvIdxJ);
315 template<std::size_t i,
317 class LocalAssembler,
318 std::enable_if_t<((i==bulkId && j==edgeId) || (i==edgeId && j==bulkId)),
int> = 0>
320 const LocalAssembler& localAssembler,
321 Dune::index_constant<j> domainJ,
322 GridIndexType<j> dofIdxGlobalJ,
323 const PrimaryVariables<j>& priVarsJ,
332 template<
class FacetLocalAssembler,
class UpdatableElementVolVars,
class UpdatableFluxVarCache>
334 const FacetLocalAssembler& facetLocalAssembler,
335 UpdatableElementVolVars& elemVolVars,
336 UpdatableFluxVarCache& elemFluxVarsCache)
338 BulkFacetManager::updateCoupledVariables(domainI, facetLocalAssembler, elemVolVars, elemFluxVarsCache);
339 FacetEdgeManager::updateCoupledVariables(domainI, facetLocalAssembler, elemVolVars, elemFluxVarsCache);
343 template<std::
size_t id, std::enable_if_t<(
id == bulkId ||
id == facetId),
int> = 0>
344 const Problem<id>&
problem()
const {
return BulkFacetManager::template problem<id>(); }
347 template<std::
size_t id, std::enable_if_t<(
id == bulkId ||
id == facetId),
int> = 0>
348 Problem<id>&
problem() {
return BulkFacetManager::template problem<id>(); }
351 template<std::
size_t id, std::enable_if_t<(
id == edgeId),
int> = 0>
352 const Problem<id>&
problem()
const {
return FacetEdgeManager::template problem<id>(); }
355 template<std::
size_t id, std::enable_if_t<(
id == edgeId),
int> = 0>
356 Problem<id>&
problem() {
return FacetEdgeManager::template problem<id>(); }
Defines the index types used for grid and local indices.
Element solution classes and factory functions.
free functions for the evaluation of primary variables inside elements.
The available discretization methods in Dumux.
PrimaryVariables evalSolution(const Element &element, const typename Element::Geometry &geometry, const typename FVElementGeometry::GridGeometry &gridGeometry, const BoxElementSolution< 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:165
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethods::box, BoxElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for box schemes.
Definition: box/elementsolution.hh:118
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:52
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:180
constexpr CCMpfa ccmpfa
Definition: method.hh:135
Structure to define the index types used for grid and local indices.
Definition: indextraits.hh:38
A vector of primary variables.
Definition: common/properties.hh:49
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:55
Definition: common/properties.hh:72
Definition: common/properties.hh:100
The grid variables object managing variable data on the grid (volvars/fluxvars cache)
Definition: common/properties.hh:121
Implementation for the coupling manager between two domains of dimension d and (d-1) for models consi...
Definition: multidomain/facet/couplingmanager.hh:95
Class that handles the coupling between three sub-domains in models where the coupling between the tw...
Definition: multidomain/facet/couplingmanager.hh:117
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:319
const Problem< id > & problem() const
Return a const reference to bulk or facet problem.
Definition: multidomain/facet/couplingmanager.hh:344
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:333
typename MDTraits::SolutionVector SolutionVector
the type of the solution vector
Definition: multidomain/facet/couplingmanager.hh:161
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:256
void evalAdditionalDomainDerivatives(FacetIdType, const FacetLocalAssembler &facetLocalAssembler, const typename FacetLocalAssembler::LocalResidual::ElementResidualVector &origResiduals, JacobianMatrixDiagBlock &A, GridVariables &gridVariables)
Definition: multidomain/facet/couplingmanager.hh:229
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:299
Problem< id > & problem()
Return a reference to bulk or facet problem.
Definition: multidomain/facet/couplingmanager.hh:348
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:158
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:239
LocalResidual< i >::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:273
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:247
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:288
void extendJacobianPattern(FacetIdType, JacobianPattern &pattern) const
Definition: multidomain/facet/couplingmanager.hh:225
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:172
Declares all properties used in Dumux.