45 Stencils& darcyToStokesCellCenterStencils,
46 Stencils& darcyToStokesFaceStencils,
47 Stencils& stokesCellCenterToDarcyStencils,
48 Stencils& stokesFaceToDarcyStencils)
50 const auto& stokesFvGridGeometry = couplingManager.
problem(CouplingManager::stokesIdx).gridGeometry();
51 const auto& darcyFvGridGeometry = couplingManager.
problem(CouplingManager::darcyIdx).gridGeometry();
54 "The free flow domain must use the staggered discretization");
57 "The Darcy domain must use the CCTpfa discretization");
59 isCoupledDarcyScvf_.resize(darcyFvGridGeometry.numScvf(),
false);
61 const auto& stokesGridView = stokesFvGridGeometry.gridView();
62 auto stokesFvGeometry =
localView(stokesFvGridGeometry);
63 for (
const auto& stokesElement : elements(stokesGridView))
65 stokesFvGeometry.bindElement(stokesElement);
67 for (
const auto& scvf : scvfs(stokesFvGeometry))
75 const auto eps = (scvf.center() - stokesElement.geometry().center()).two_norm()*1e-8;
76 auto globalPos = scvf.center(); globalPos.axpy(eps, scvf.unitOuterNormal());
77 const auto darcyElementIdx =
intersectingEntities(globalPos, darcyFvGridGeometry.boundingBoxTree());
80 if (darcyElementIdx.empty())
84 if (darcyElementIdx.size() > 1)
85 DUNE_THROW(Dune::InvalidStateException,
"Stokes face dof should only intersect with one Darcy element");
87 const auto stokesElementIdx = stokesFvGridGeometry.elementMapper().index(stokesElement);
89 const auto darcyDofIdx = darcyElementIdx[0];
91 stokesFaceToDarcyStencils[scvf.dofIndex()].push_back(darcyDofIdx);
92 stokesCellCenterToDarcyStencils[stokesElementIdx].push_back(darcyDofIdx);
94 darcyToStokesFaceStencils[darcyElementIdx[0]].push_back(scvf.dofIndex());
95 darcyToStokesCellCenterStencils[darcyElementIdx[0]].push_back(stokesElementIdx);
97 const auto& darcyElement = darcyFvGridGeometry.element(darcyElementIdx[0]);
98 const auto darcyFvGeometry =
localView(darcyFvGridGeometry).bindElement(darcyElement);
101 for (
const auto& darcyScvf : scvfs(darcyFvGeometry))
103 const auto distance = (darcyScvf.center() - scvf.center()).two_norm();
107 isCoupledDarcyScvf_[darcyScvf.index()] =
true;
108 darcyElementToStokesElementMap_[darcyElementIdx[0]].push_back({stokesElementIdx, scvf.index(), darcyScvf.index()});
109 stokesElementToDarcyElementMap_[stokesElementIdx].push_back({darcyElementIdx[0], darcyScvf.index(), scvf.index()});