24#ifndef DUMUX_BOX_FACETCOUPLING_MANAGER_HH
25#define DUMUX_BOX_FACETCOUPLING_MANAGER_HH
49template<
class MDTraits,
class CouplingMapper, std::
size_t bulkDomainId, std::
size_t lowDimDomainId>
56 using BulkIdType =
typename MDTraits::template SubDomain<bulkDomainId>::Index;
57 using LowDimIdType =
typename MDTraits::template SubDomain<lowDimDomainId>::Index;
58 static constexpr auto bulkId = BulkIdType();
59 static constexpr auto lowDimId = LowDimIdType();
62 template<std::
size_t id>
using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
72 template<std::
size_t id>
using FVElementGeometry =
typename GridGeometry<id>::LocalView;
73 template<std::
size_t id>
using SubControlVolume =
typename GridGeometry<id>::SubControlVolume;
74 template<std::
size_t id>
using SubControlVolumeFace =
typename GridGeometry<id>::SubControlVolumeFace;
75 template<std::
size_t id>
using GridView =
typename GridGeometry<id>::GridView;
76 template<std::
size_t id>
using Element =
typename GridView<id>::template Codim<0>::Entity;
77 template<std::
size_t id>
using GridIndexType =
typename GridView<id>::IndexSet::IndexType;
80 template<std::
size_t id>
using GridVolumeVariables =
typename GridVariables<id>::GridVolumeVariables;
81 template<std::
size_t id>
using ElementVolumeVariables =
typename GridVolumeVariables<id>::LocalView;
82 template<std::
size_t id>
using VolumeVariables =
typename ElementVolumeVariables<id>::VolumeVariables;
83 template<std::
size_t id>
using GridFluxVariablesCache =
typename GridVariables<id>::GridFluxVariablesCache;
84 template<std::
size_t id>
using ElementFluxVariablesCache =
typename GridFluxVariablesCache<id>::LocalView;
87 static constexpr int bulkDim = GridView<bulkDomainId>::dimension;
88 static constexpr int lowDimDim = GridView<lowDimDomainId>::dimension;
89 static constexpr auto bulkGridId = CouplingMapper::template gridId<bulkDim>();
90 static constexpr auto lowDimGridId = CouplingMapper::template gridId<lowDimDim>();
100 struct BulkCouplingContext
103 GridIndexType< bulkId > elementIdx;
104 std::vector< FVElementGeometry<lowDimId> > lowDimFvGeometries;
105 std::vector< std::vector<VolumeVariables<lowDimId>> > lowDimElemVolVars;
109 lowDimFvGeometries.clear();
110 lowDimElemVolVars.clear();
125 struct LowDimCouplingContext
131 static constexpr int bulkDimWorld = GridView<bulkId>::dimensionworld;
132 static constexpr bool bulkIsSurfaceGrid = bulkDim != bulkDimWorld;
135 using ContainerType =
typename std::conditional< bulkIsSurfaceGrid,
137 std::array< T, 2 > >::type;
141 GridIndexType< lowDimId > elementIdx;
142 ContainerType< std::unique_ptr<FVElementGeometry<bulkId>> > bulkFvGeometries;
143 ContainerType< std::unique_ptr<ElementVolumeVariables<bulkId>> > bulkElemVolVars;
144 ContainerType< std::unique_ptr<ElementFluxVariablesCache<bulkId>> > bulkElemFluxVarsCache;
145 std::unique_ptr< LocalResidual<bulkId> > bulkLocalResidual;
146 ContainerType< ElementBoundaryTypes<bulkId> > bulkElemBcTypes;
151 auto resetPtr = [&] (
auto&& uniquePtr) { uniquePtr.reset(); };
152 std::for_each(bulkFvGeometries.begin(), bulkFvGeometries.end(), resetPtr);
153 std::for_each(bulkElemVolVars.begin(), bulkElemVolVars.end(), resetPtr);
154 std::for_each(bulkElemFluxVarsCache.begin(), bulkElemFluxVarsCache.end(), resetPtr);
155 bulkLocalResidual.reset();
159 template<
bool s = bulkIsSurfaceGr
id, std::enable_if_t<s,
int> = 0>
160 void resize(std::size_t numEmbedments)
162 bulkFvGeometries.resize(numEmbedments);
163 bulkElemVolVars.resize(numEmbedments);
164 bulkElemFluxVarsCache.resize(numEmbedments);
165 bulkElemBcTypes.resize(numEmbedments);
169 template<
bool s = bulkIsSurfaceGr
id, std::enable_if_t<!s,
int> = 0>
170 void resize(std::size_t numEmbedments)
177 template<std::
size_t i, std::
size_t j = (i == bulkId) ? lowDimId : bulkId>
178 using CouplingStencilType =
typename CouplingMapper::template Stencil< CouplingMapper::template gridId<GridView<j>::dimension>() >;
191 void init(std::shared_ptr< Problem<bulkId> > bulkProblem,
192 std::shared_ptr< Problem<lowDimId> > lowDimProblem,
193 std::shared_ptr< CouplingMapper > couplingMapper,
196 couplingMapperPtr_ = couplingMapper;
199 this->setSubProblem(bulkProblem, bulkId);
200 this->setSubProblem(lowDimProblem, lowDimId);
203 ParentType::updateSolution(curSol);
206 const auto& bulkMap = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId);
207 bulkElemIsCoupled_.assign(bulkProblem->gridGeometry().gridView().size(0),
false);
208 std::for_each( bulkMap.begin(),
210 [&] (
const auto& entry) { bulkElemIsCoupled_[entry.first] = true; });
217 const Element<bulkId>& element,
218 LowDimIdType domainJ)
const
220 const auto eIdx = this->problem(domainI).gridGeometry().elementMapper().index(element);
222 if (bulkElemIsCoupled_[eIdx])
224 const auto& map = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId);
225 auto it = map.find(eIdx);
226 assert(it != map.end());
227 return it->second.couplingStencil;
230 return getEmptyStencil(lowDimId);
237 const Element<lowDimId>& element,
238 BulkIdType domainJ)
const
240 const auto eIdx = this->problem(lowDimId).gridGeometry().elementMapper().index(element);
242 const auto& map = couplingMapperPtr_->couplingMap(lowDimGridId, bulkGridId);
243 auto it = map.find(eIdx);
244 if (it != map.end())
return it->second.couplingStencil;
245 else return getEmptyStencil(bulkId);
253 const SubControlVolumeFace<bulkId>& scvf)
const
254 {
return scvf.interiorBoundary(); }
261 const SubControlVolumeFace<bulkId>& scvf)
const
262 {
return isCoupled(element, scvf); }
268 const SubControlVolumeFace<bulkId>& scvf)
const
270 const auto eIdx = this->problem(bulkId).gridGeometry().elementMapper().index(element);
271 assert(bulkContext_.isSet);
272 assert(bulkElemIsCoupled_[eIdx]);
274 const auto& map = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId);
275 const auto& couplingData = map.find(eIdx)->second;
279 unsigned int coupledScvIdx;
280 auto it = std::find_if( couplingData.elementToScvfMap.begin(),
281 couplingData.elementToScvfMap.end(),
284 const auto& scvfList = dataPair.second;
285 auto it = std::find(scvfList.begin(), scvfList.end(), scvf.index());
286 coupledScvIdx = std::distance(scvfList.begin(), it);
287 return it != scvfList.end();
290 assert(it != couplingData.elementToScvfMap.end());
291 const auto lowDimElemIdx = it->first;
292 const auto& s = map.find(bulkContext_.elementIdx)->second.couplingElementStencil;
293 const auto& idxInContext = std::distance( s.begin(), std::find(s.begin(), s.end(), lowDimElemIdx) );
294 assert(std::find(s.begin(), s.end(), lowDimElemIdx) != s.end());
297 return bulkContext_.lowDimElemVolVars[idxInContext][coupledScvIdx];
299 return bulkContext_.lowDimElemVolVars[idxInContext][0];
306 const SubControlVolumeFace<bulkId>& scvf)
const
308 const auto lowDimElemIdx = getLowDimElementIndex(element, scvf);
309 return this->problem(lowDimId).gridGeometry().element(lowDimElemIdx);
316 const SubControlVolumeFace<bulkId>& scvf)
const
318 const auto eIdx = this->problem(bulkId).gridGeometry().elementMapper().index(element);
320 assert(bulkElemIsCoupled_[eIdx]);
321 const auto& map = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId);
322 const auto& couplingData = map.at(eIdx);
325 auto it = std::find_if( couplingData.elementToScvfMap.begin(),
326 couplingData.elementToScvfMap.end(),
329 const auto& scvfList = dataPair.second;
330 auto it = std::find(scvfList.begin(), scvfList.end(), scvf.index());
331 return it != scvfList.end();
334 assert(it != couplingData.elementToScvfMap.end());
344 template<
class BulkLocalAssembler >
345 typename LocalResidual<bulkId>::ElementResidualVector
347 const BulkLocalAssembler& bulkLocalAssembler,
349 GridIndexType<lowDimId> dofIdxGlobalJ)
351 const auto& map = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId);
353 assert(bulkContext_.isSet);
354 assert(bulkElemIsCoupled_[bulkContext_.elementIdx]);
355 assert(map.find(bulkContext_.elementIdx) != map.end());
356 assert(bulkContext_.elementIdx == this->problem(bulkId).gridGeometry().elementMapper().index(bulkLocalAssembler.element()));
358 const auto& fvGeometry = bulkLocalAssembler.fvGeometry();
359 typename LocalResidual<bulkId>::ElementResidualVector res(fvGeometry.numScv());
363 const auto& couplingScvfs = map.find(bulkContext_.elementIdx)->second.dofToCouplingScvfMap.at(dofIdxGlobalJ);
364 for (
auto scvfIdx : couplingScvfs)
366 const auto& scvf = fvGeometry.scvf(scvfIdx);
367 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
368 res[insideScv.localDofIndex()] += evalBulkFluxes_( bulkLocalAssembler.element(),
369 bulkLocalAssembler.fvGeometry(),
370 bulkLocalAssembler.curElemVolVars(),
371 bulkLocalAssembler.elemBcTypes(),
372 bulkLocalAssembler.elemFluxVarsCache(),
373 bulkLocalAssembler.localResidual(),
374 std::array<GridIndexType<bulkId>, 1>({scvfIdx}) );
386 template<
class LowDimLocalAssembler >
387 typename LocalResidual<lowDimId>::ElementResidualVector
389 const LowDimLocalAssembler& lowDimLocalAssembler,
391 GridIndexType<bulkId> dofIdxGlobalJ)
394 assert(lowDimContext_.isSet);
395 assert(this->problem(lowDimId).gridGeometry().elementMapper().index(lowDimLocalAssembler.element()) == lowDimContext_.elementIdx);
398 typename LocalResidual<lowDimId>::ElementResidualVector res(lowDimLocalAssembler.fvGeometry().numScv());
400 for (
const auto& scv : scvs(lowDimLocalAssembler.fvGeometry()))
401 res[scv.localDofIndex()] -= evalSourcesFromBulk(lowDimLocalAssembler.element(),
402 lowDimLocalAssembler.fvGeometry(),
403 lowDimLocalAssembler.curElemVolVars(),
412 const FVElementGeometry<lowDimId>& fvGeometry,
413 const ElementVolumeVariables<lowDimId>& elemVolVars,
414 const SubControlVolume<lowDimId>& scv)
417 assert(this->problem(lowDimId).gridGeometry().elementMapper().index(element) == lowDimContext_.elementIdx);
419 NumEqVector<lowDimId> sources(0.0);
420 const auto& map = couplingMapperPtr_->couplingMap(lowDimGridId, bulkGridId);
421 auto it = map.find(lowDimContext_.elementIdx);
425 assert(lowDimContext_.isSet);
426 for (
unsigned int i = 0; i < it->second.embedments.size(); ++i)
428 const auto& embedment = it->second.embedments[i];
433 const auto& coincidingScvfs = embedment.second;
434 const auto& scvfList = lowDimUsesBox ? std::vector<GridIndexType<lowDimId>>{ coincidingScvfs[scv.localDofIndex()] }
437 sources += evalBulkFluxes_(this->problem(bulkId).gridGeometry().element(embedment.first),
438 *(lowDimContext_.bulkFvGeometries[i]),
439 *(lowDimContext_.bulkElemVolVars[i]),
440 lowDimContext_.bulkElemBcTypes[i],
441 *(lowDimContext_.bulkElemFluxVarsCache[i]),
442 *lowDimContext_.bulkLocalResidual,
454 template<
class Assembler >
458 bulkContext_.reset();
461 const auto bulkElemIdx = this->problem(bulkId).gridGeometry().elementMapper().index(element);
462 bulkContext_.elementIdx = bulkElemIdx;
465 if (bulkElemIsCoupled_[bulkElemIdx])
467 const auto& map = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId);
469 auto it = map.find(bulkElemIdx); assert(it != map.end());
470 const auto& elementStencil = it->second.couplingElementStencil;
471 bulkContext_.lowDimFvGeometries.reserve(elementStencil.size());
472 bulkContext_.lowDimElemVolVars.reserve(elementStencil.size());
474 for (
const auto lowDimElemIdx : elementStencil)
476 const auto& ldGridGeometry = this->problem(lowDimId).gridGeometry();
478 const auto& ldSol = Assembler::isImplicit() ? this->curSol()[lowDimId] : assembler.prevSol()[lowDimId];
479 const auto elemJ = ldGridGeometry.element(lowDimElemIdx);
481 fvGeom.bindElement(elemJ);
484 std::vector<VolumeVariables<lowDimId>> elemVolVars;
490 VolumeVariables<lowDimId> volVars;
491 volVars.update(elemSol, this->problem(lowDimId), elemJ, *scvs(fvGeom).begin());
492 elemVolVars.emplace_back( std::move(volVars) );
498 elemVolVars.resize(fvGeom.numScv());
499 for (
const auto& scv : scvs(fvGeom))
501 ldSol, fvGeom, elemJ, elemJ.geometry(), scv.center());
504 bulkContext_.isSet =
true;
505 bulkContext_.lowDimFvGeometries.emplace_back( std::move(fvGeom) );
506 bulkContext_.lowDimElemVolVars.emplace_back( std::move(elemVolVars) );
520 template<
class Assembler >
524 bulkContext_.reset();
525 lowDimContext_.reset();
528 const auto lowDimElemIdx = this->problem(lowDimId).gridGeometry().elementMapper().index(element);
529 lowDimContext_.elementIdx = lowDimElemIdx;
531 const auto& map = couplingMapperPtr_->couplingMap(lowDimGridId, bulkGridId);
532 auto it = map.find(lowDimElemIdx);
540 const auto& bulkGridGeom = this->problem(bulkId).gridGeometry();
541 const auto bulkElem = bulkGridGeom.element(it->second.embedments[0].first);
542 bindCouplingContext(bulkId, bulkElem, assembler);
545 const auto& embedments = it->second.embedments;
546 const auto numEmbedments = embedments.size();
547 lowDimContext_.resize(numEmbedments);
548 for (
unsigned int i = 0; i < numEmbedments; ++i)
550 auto bulkFvGeom =
localView(bulkGridGeom);
551 auto bulkElemVolVars =
localView(assembler.gridVariables(bulkId).curGridVolVars());
552 auto bulkElemFluxVarsCache =
localView(assembler.gridVariables(bulkId).gridFluxVarsCache());
554 const auto& bulkSol = Assembler::isImplicit() ? this->curSol()[bulkId] : assembler.prevSol()[bulkId];
555 const auto curBulkElem = bulkGridGeom.element(embedments[i].first);
556 bulkFvGeom.bind(curBulkElem);
557 bulkElemVolVars.bind(curBulkElem, bulkFvGeom, bulkSol);
558 bulkElemFluxVarsCache.bind(curBulkElem, bulkFvGeom, bulkElemVolVars);
560 lowDimContext_.isSet =
true;
561 lowDimContext_.bulkElemBcTypes[i].update(this->problem(bulkId), curBulkElem, bulkFvGeom);
562 lowDimContext_.bulkFvGeometries[i] = std::make_unique< FVElementGeometry<bulkId> >( std::move(bulkFvGeom) );
563 lowDimContext_.bulkElemVolVars[i] = std::make_unique< ElementVolumeVariables<bulkId> >( std::move(bulkElemVolVars) );
564 lowDimContext_.bulkElemFluxVarsCache[i] = std::make_unique< ElementFluxVariablesCache<bulkId> >( std::move(bulkElemFluxVarsCache) );
568 lowDimContext_.bulkLocalResidual = std::make_unique< LocalResidual<bulkId> >(assembler.localResidual(bulkId));
576 template<
class BulkLocalAssembler >
578 const BulkLocalAssembler& bulkLocalAssembler,
579 LowDimIdType domainJ,
580 GridIndexType<lowDimId> dofIdxGlobalJ,
581 const PrimaryVariables<lowDimId>& priVarsJ,
585 ParentType::updateCouplingContext(domainI, bulkLocalAssembler, domainJ, dofIdxGlobalJ, priVarsJ, pvIdxJ);
590 if (!BulkLocalAssembler::isImplicit())
594 if (bulkContext_.isSet)
596 const auto& map = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId);
597 const auto& couplingElemStencil = map.find(bulkContext_.elementIdx)->second.couplingElementStencil;
598 const auto& ldGridGeometry = this->problem(lowDimId).gridGeometry();
601 const auto couplingElements = [&] ()
605 std::vector< Element<lowDimId> > lowDimElems;
606 std::for_each( couplingElemStencil.begin(), couplingElemStencil.end(),
607 [&] (
auto lowDimElemIdx)
609 auto element = ldGridGeometry.element(lowDimElemIdx);
610 for (unsigned int i = 0; i < element.geometry().corners(); ++i)
612 const auto dofIdx = ldGridGeometry.vertexMapper().subIndex(element, i, lowDimDim);
613 if (dofIdxGlobalJ == dofIdx) { lowDimElems.emplace_back( std::move(element) ); break; }
620 return std::vector<Element<lowDimId>>( {ldGridGeometry.element(dofIdxGlobalJ)} );
624 for (
const auto& element : couplingElements)
627 const auto eIdxGlobal = ldGridGeometry.elementMapper().index(element);
628 auto it = std::find(couplingElemStencil.begin(), couplingElemStencil.end(), eIdxGlobal);
629 const auto idxInContext = std::distance(couplingElemStencil.begin(), it);
630 assert(it != couplingElemStencil.end());
632 auto& elemVolVars = bulkContext_.lowDimElemVolVars[idxInContext];
633 const auto& fvGeom = bulkContext_.lowDimFvGeometries[idxInContext];
634 auto elemSol =
elementSolution(element, this->curSol()[lowDimId], fvGeom.gridGeometry());
637 elemVolVars[0].update(elemSol, this->problem(lowDimId), element, *scvs(fvGeom).begin());
639 for (
const auto& scv : scvs(fvGeom))
641 this->curSol()[lowDimId], fvGeom, element, element.geometry(), scv.center());
650 template<
class BulkLocalAssembler >
652 const BulkLocalAssembler& bulkLocalAssembler,
654 GridIndexType<bulkId> dofIdxGlobalJ,
655 const PrimaryVariables<bulkId>& priVarsJ,
659 ParentType::updateCouplingContext(domainI, bulkLocalAssembler, domainJ, dofIdxGlobalJ, priVarsJ, pvIdxJ);
667 template<
class LowDimLocalAssembler >
669 const LowDimLocalAssembler& lowDimLocalAssembler,
671 GridIndexType<bulkId> dofIdxGlobalJ,
672 const PrimaryVariables<bulkId>& priVarsJ,
676 ParentType::updateCouplingContext(domainI, lowDimLocalAssembler, domainJ, dofIdxGlobalJ, priVarsJ, pvIdxJ);
681 if (!LowDimLocalAssembler::isImplicit())
685 if (lowDimContext_.isSet)
687 assert(lowDimContext_.elementIdx == this->problem(lowDimId).gridGeometry().elementMapper().index(lowDimLocalAssembler.element()));
689 const auto& map = couplingMapperPtr_->couplingMap(lowDimGridId, bulkGridId);
690 auto it = map.find(lowDimContext_.elementIdx);
692 assert(it != map.end());
693 const auto& embedments = it->second.embedments;
694 const auto& bulkGridGeometry = this->problem(bulkId).gridGeometry();
698 unsigned int embedmentIdx = 0;
699 for (
const auto& embedment : embedments)
701 const auto elementJ = bulkGridGeometry.element(embedment.first);
703 for (
unsigned int i = 0; i < elementJ.subEntities(bulkDim); ++i)
705 const auto dofIdx = bulkGridGeometry.vertexMapper().subIndex(elementJ, i, bulkDim);
706 if (dofIdx == dofIdxGlobalJ)
709 const auto& fvGeom = *lowDimContext_.bulkFvGeometries[embedmentIdx];
710 (*lowDimContext_.bulkElemVolVars[embedmentIdx]).bindElement(elementJ, fvGeom, this->curSol()[bulkId]);
726 template<
class LowDimLocalAssembler >
728 const LowDimLocalAssembler& lowDimLocalAssembler,
729 LowDimIdType domainJ,
730 GridIndexType<lowDimId> dofIdxGlobalJ,
731 const PrimaryVariables<lowDimId>& priVarsJ,
735 ParentType::updateCouplingContext(domainI, lowDimLocalAssembler, domainJ, dofIdxGlobalJ, priVarsJ, pvIdxJ);
740 if (!LowDimLocalAssembler::isImplicit())
744 if (lowDimContext_.isSet)
746 assert(bulkContext_.isSet);
747 assert(lowDimContext_.elementIdx == this->problem(lowDimId).gridGeometry().elementMapper().index(lowDimLocalAssembler.element()));
750 const auto& bulkMap = couplingMapperPtr_->couplingMap(bulkGridId, lowDimGridId);
751 const auto& couplingElementStencil = bulkMap.find(bulkContext_.elementIdx)->second.couplingElementStencil;
752 auto it = std::find(couplingElementStencil.begin(), couplingElementStencil.end(), lowDimContext_.elementIdx);
753 assert(it != couplingElementStencil.end());
754 const auto idxInContext = std::distance(couplingElementStencil.begin(), it);
756 auto& elemVolVars = bulkContext_.lowDimElemVolVars[idxInContext];
757 const auto& fvGeom = bulkContext_.lowDimFvGeometries[idxInContext];
758 const auto& element = lowDimLocalAssembler.element();
759 auto elemSol =
elementSolution(element, this->curSol()[lowDimId], fvGeom.gridGeometry());
762 elemVolVars[0].update(elemSol, this->problem(lowDimId), element, *scvs(fvGeom).begin());
764 for (
const auto& scv : scvs(fvGeom))
766 this->curSol()[lowDimId], fvGeom, element, element.geometry(), scv.center());
771 template<std::
size_t id, std::enable_if_t<(
id == bulkId ||
id == lowDimId),
int> = 0>
772 const typename CouplingMapper::template Stencil<id>&
774 {
return std::get<(id == bulkId ? 0 : 1)>(emptyStencilTuple_); }
778 template<
class BulkScvfIndices>
779 NumEqVector<bulkId> evalBulkFluxes_(
const Element<bulkId>& elementI,
780 const FVElementGeometry<bulkId>& fvGeometry,
781 const ElementVolumeVariables<bulkId>& elemVolVars,
782 const ElementBoundaryTypes<bulkId>& elemBcTypes,
783 const ElementFluxVariablesCache<bulkId>& elemFluxVarsCache,
784 const LocalResidual<bulkId>& localResidual,
785 const BulkScvfIndices& scvfIndices)
const
788 NumEqVector<bulkId> coupledFluxes(0.0);
789 for (
const auto& scvfIdx : scvfIndices)
790 coupledFluxes += localResidual.evalFlux(this->problem(bulkId),
796 fvGeometry.scvf(scvfIdx));
797 return coupledFluxes;
800 std::shared_ptr<CouplingMapper> couplingMapperPtr_;
804 std::vector<bool> bulkElemIsCoupled_;
807 using BulkStencil =
typename CouplingMapper::template Stencil<bulkId>;
808 using LowDimStencil =
typename CouplingMapper::template Stencil<lowDimId>;
809 std::tuple<BulkStencil, LowDimStencil> emptyStencilTuple_;
812 BulkCouplingContext bulkContext_;
813 LowDimCouplingContext lowDimContext_;
The available discretization methods in Dumux.
Element solution classes and factory functions.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
DiscretizationMethod
The available discretization methods in Dumux.
Definition: method.hh:37
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethod::box, BoxElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for box schemes.
Definition: box/elementsolution.hh:115
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
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
void resize(const Vector &v, std::size_t size)
Definition: test_isvalid.cc:26
A vector of primary variables.
Definition: common/properties.hh:59
A vector of size number equations that can be used for Neumann fluxes, sources, residuals,...
Definition: common/properties.hh:61
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:69
Definition: common/properties.hh:91
Stores the boundary types on an element.
Definition: common/properties.hh:112
Definition: common/properties.hh:150
The grid variables object managing variable data on the grid (volvars/fluxvars cache)
Definition: common/properties.hh:190
Definition: multidomain/couplingmanager.hh:46
void updateCouplingContext(LowDimIdType domainI, const LowDimLocalAssembler &lowDimLocalAssembler, LowDimIdType domainJ, GridIndexType< lowDimId > dofIdxGlobalJ, const PrimaryVariables< lowDimId > &priVarsJ, unsigned int pvIdxJ)
After deflecting the solution of the lower-dimensional domain has been deflected during the assembly ...
Definition: multidomain/facet/box/couplingmanager.hh:727
const GridIndexType< lowDimId > getLowDimElementIndex(const Element< bulkId > &element, const SubControlVolumeFace< bulkId > &scvf) const
returns the index of the lower-dimensional element coinciding with a bulk scvf.
Definition: multidomain/facet/box/couplingmanager.hh:315
bool isCoupled(const Element< bulkId > &element, const SubControlVolumeFace< bulkId > &scvf) const
returns true if a bulk scvf flux depends on data in the facet domain.
Definition: multidomain/facet/box/couplingmanager.hh:252
NumEqVector< lowDimId > evalSourcesFromBulk(const Element< lowDimId > &element, const FVElementGeometry< lowDimId > &fvGeometry, const ElementVolumeVariables< lowDimId > &elemVolVars, const SubControlVolume< lowDimId > &scv)
Computes the sources in a lower-dimensional element stemming from the bulk domain.
Definition: multidomain/facet/box/couplingmanager.hh:411
LocalResidual< bulkId >::ElementResidualVector evalCouplingResidual(BulkIdType, const BulkLocalAssembler &bulkLocalAssembler, LowDimIdType, GridIndexType< lowDimId > dofIdxGlobalJ)
Evaluates the coupling element residual of a bulk domain element with respect to a dof in the lower-d...
Definition: multidomain/facet/box/couplingmanager.hh:346
const CouplingStencilType< lowDimId > & couplingStencil(LowDimIdType domainI, const Element< lowDimId > &element, BulkIdType domainJ) const
The coupling stencil of the lower-dimensional domain with the bulk domain.
Definition: multidomain/facet/box/couplingmanager.hh:236
void bindCouplingContext(BulkIdType, const Element< bulkId > &element, const Assembler &assembler)
For the assembly of the element residual of a bulk domain element we need to prepare all variables of...
Definition: multidomain/facet/box/couplingmanager.hh:455
void updateCouplingContext(LowDimIdType domainI, const LowDimLocalAssembler &lowDimLocalAssembler, BulkIdType domainJ, GridIndexType< bulkId > dofIdxGlobalJ, const PrimaryVariables< bulkId > &priVarsJ, unsigned int pvIdxJ)
After deflecting the solution of the bulk domain, we have to update the element volume variables of t...
Definition: multidomain/facet/box/couplingmanager.hh:668
void updateCouplingContext(BulkIdType domainI, const BulkLocalAssembler &bulkLocalAssembler, BulkIdType domainJ, GridIndexType< bulkId > dofIdxGlobalJ, const PrimaryVariables< bulkId > &priVarsJ, unsigned int pvIdxJ)
Update the coupling context for a derivative bulk -> bulk. Here, we simply have to update the solutio...
Definition: multidomain/facet/box/couplingmanager.hh:651
void updateCouplingContext(BulkIdType domainI, const BulkLocalAssembler &bulkLocalAssembler, LowDimIdType domainJ, GridIndexType< lowDimId > dofIdxGlobalJ, const PrimaryVariables< lowDimId > &priVarsJ, unsigned int pvIdxJ)
After deflecting the solution of the lower-dimensional domain, we have to update the element volume v...
Definition: multidomain/facet/box/couplingmanager.hh:577
LocalResidual< lowDimId >::ElementResidualVector evalCouplingResidual(LowDimIdType, const LowDimLocalAssembler &lowDimLocalAssembler, BulkIdType, GridIndexType< bulkId > dofIdxGlobalJ)
Evaluates the coupling element residual of a lower-dimensional domain element with respect to a dof i...
Definition: multidomain/facet/box/couplingmanager.hh:388
const Element< lowDimId > getLowDimElement(const Element< bulkId > &element, const SubControlVolumeFace< bulkId > &scvf) const
returns the lower-dimensional element coinciding with a bulk scvf.
Definition: multidomain/facet/box/couplingmanager.hh:305
const VolumeVariables< lowDimId > & getLowDimVolVars(const Element< bulkId > &element, const SubControlVolumeFace< bulkId > &scvf) const
returns the vol vars of a lower-dimensional element coinciding with a bulk scvf.
Definition: multidomain/facet/box/couplingmanager.hh:267
const CouplingStencilType< bulkId > & couplingStencil(BulkIdType domainI, const Element< bulkId > &element, LowDimIdType domainJ) const
The coupling stencil of a given bulk domain element.
Definition: multidomain/facet/box/couplingmanager.hh:216
bool isOnInteriorBoundary(const Element< bulkId > &element, const SubControlVolumeFace< bulkId > &scvf) const
returns true if a bulk scvf coincides with a facet element.
Definition: multidomain/facet/box/couplingmanager.hh:260
typename CouplingMapper::template Stencil< CouplingMapper::template gridId< GridView< j >::dimension >() > CouplingStencilType
types used for coupling stencils
Definition: multidomain/facet/box/couplingmanager.hh:178
const CouplingMapper::template Stencil< id > & getEmptyStencil(Dune::index_constant< id >) const
Empty stencil to be returned for elements that aren't coupled.
Definition: multidomain/facet/box/couplingmanager.hh:773
void bindCouplingContext(LowDimIdType, const Element< lowDimId > &element, const Assembler &assembler)
For the assembly of the element residual of a bulk domain element we need to prepare the local views ...
Definition: multidomain/facet/box/couplingmanager.hh:521
void init(std::shared_ptr< Problem< bulkId > > bulkProblem, std::shared_ptr< Problem< lowDimId > > lowDimProblem, std::shared_ptr< CouplingMapper > couplingMapper, const SolutionVector &curSol)
Initialize the coupling manager.
Definition: multidomain/facet/box/couplingmanager.hh:191
typename MDTraits::SolutionVector SolutionVector
the type of the solution vector
Definition: multidomain/facet/box/couplingmanager.hh:181
Implementation for the coupling manager between two domains of dimension d and (d-1) for models consi...
Definition: multidomain/facet/couplingmanager.hh:95
Declares all properties used in Dumux.
The interface of the coupling manager for multi domain problems.