13#ifndef DUMUX_MULTIDOMAIN_BOUNDARY_FREEFLOW_POROUSMEDIUM_COUPLINGMANAGER_HH
14#define DUMUX_MULTIDOMAIN_BOUNDARY_FREEFLOW_POROUSMEDIUM_COUPLINGMANAGER_HH
19#include <dune/common/indices.hh>
30namespace FreeFlowPorousMediumDetail {
45 auto map = std::array<std::array<std::size_t, 3>, 3>{};
62template<std::
size_t i>
73template<std::
size_t i, std::
size_t j>
76 static_assert(i <= 2 && j <= 2);
77 static_assert(i != j);
80 return std::pair<Dune::index_constant<0>, Dune::index_constant<1>>{};
82 return std::pair<Dune::index_constant<1>, Dune::index_constant<0>>{};
92 template<std::
size_t i, std::
size_t j>
93 static constexpr auto globalToLocal(Dune::index_constant<i> domainI, Dune::index_constant<j> domainJ)
98 template<std::
size_t i>
105template<
class MDTraits>
108 template<std::
size_t id>
138template<
class MDTraits>
142 FreeFlowPorousMediumDetail::CouplingMaps,
143 typename FreeFlowPorousMediumDetail::CouplingManagers<MDTraits>::FreeFlowCouplingManager,
144 typename FreeFlowPorousMediumDetail::CouplingManagers<MDTraits>::FreeFlowMomentumPorousMediumCouplingManager,
145 typename FreeFlowPorousMediumDetail::CouplingManagers<MDTraits>::FreeFlowMassPorousMediumCouplingManager
156 using Scalar =
typename MDTraits::Scalar;
159 template<std::
size_t id>
160 using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
164 template<std::
size_t id>
using FVElementGeometry =
typename GridGeometry<id>::LocalView;
165 template<std::
size_t id>
using SubControlVolumeFace =
typename FVElementGeometry<id>::SubControlVolumeFace;
166 template<std::
size_t id>
using SubControlVolume =
typename FVElementGeometry<id>::SubControlVolume;
168 template<std::
size_t id>
using NumEqVector =
typename Problem<id>::Traits::NumEqVector;
170 template<std::
size_t id>
using GridView =
typename GridGeometry<id>::GridView;
171 template<std::
size_t id>
using Element =
typename GridView<id>::template Codim<0>::Entity;
172 using SolutionVector =
typename MDTraits::SolutionVector;
178 template<std::
size_t i, std::
size_t j>
186 using ParentType::ParentType;
188 template<
class Gr
idVarsTuple>
189 void init(std::shared_ptr<Problem<freeFlowMomentumIndex>> freeFlowMomentumProblem,
190 std::shared_ptr<Problem<freeFlowMassIndex>> freeFlowMassProblem,
191 std::shared_ptr<Problem<porousMediumIndex>> porousMediumProblem,
192 GridVarsTuple&& gridVarsTuple,
193 const SolutionVector&
curSol)
199 std::get<0>(ffSolVecTuple) = std::get<freeFlowMomentumIndex>(this->
curSol());
200 std::get<1>(ffSolVecTuple) = std::get<freeFlowMassIndex>(this->
curSol());
202 freeFlowMomentumProblem, freeFlowMassProblem,
203 std::make_tuple(std::get<freeFlowMomentumIndex>(gridVarsTuple), std::get<freeFlowMassIndex>(gridVarsTuple)),
208 std::get<0>(ffMassPmSolVecTuple) = std::get<freeFlowMassIndex>(this->
curSol());
209 std::get<1>(ffMassPmSolVecTuple) = std::get<porousMediumIndex>(this->
curSol());
211 freeFlowMassProblem, porousMediumProblem, ffMassPmSolVecTuple
215 std::get<0>(ffMomentumPmSolVecTuple) = std::get<freeFlowMomentumIndex>(this->
curSol());
216 std::get<1>(ffMomentumPmSolVecTuple) = std::get<porousMediumIndex>(this->
curSol());
218 freeFlowMomentumProblem, porousMediumProblem, ffMomentumPmSolVecTuple
225 template<std::
size_t i, std::
size_t j>
227 const FVElementGeometry<i>& fvGeometry,
228 const typename FVElementGeometry<i>::SubControlVolumeFace& scvf,
229 const ElementVolumeVariables<i>& elemVolVars)
const
233 const auto& couplingContext = this->
subApply(domainI, domainJ, [&](
const auto& cm,
auto&& ii,
auto&& jj) ->
const auto& {
234 return cm.couplingContext(ii, fvGeometry, scvf);
237 const auto& freeFlowElement = [&]
240 return fvGeometry.element();
242 return couplingContext.fvGeometry.element();
245 const auto& freeFlowScvf = [&]
250 return couplingContext.fvGeometry.scvf(couplingContext.freeFlowMassScvfIdx);
257 return CouplingConditions::massCouplingCondition(domainI, domainJ, fvGeometry, scvf, elemVolVars, couplingContext);
265 Dune::index_constant<porousMediumIndex> domainJ,
266 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
267 const typename FVElementGeometry<freeFlowMomentumIndex>::SubControlVolumeFace& scvf,
268 const ElementVolumeVariables<freeFlowMomentumIndex>& elemVolVars)
const
270 if (scvf.isLateral())
271 return NumEqVector<freeFlowMomentumIndex>(0.0);
274 domainI, fvGeometry, scvf
277 return CouplingConditions::momentumCouplingCondition(fvGeometry, scvf, elemVolVars, context);
284 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf)
const
286 if (scvf.isFrontal())
289 Dune::index_constant<freeFlowMomentumIndex>(), fvGeometry, scvf
292 return CouplingConditions::darcyPermeability(fvGeometry, scvf, context);
296 const auto& orthogonalScvf = fvGeometry.lateralOrthogonalScvf(scvf);
297 const auto& orthogonalScv = fvGeometry.scv(orthogonalScvf.insideScvIdx());
298 const auto& frontalScvfOnBoundary = fvGeometry.frontalScvfOnBoundary(orthogonalScv);
300 Dune::index_constant<freeFlowMomentumIndex>(), fvGeometry, frontalScvfOnBoundary
303 return CouplingConditions::darcyPermeability(fvGeometry, frontalScvfOnBoundary, context);
313 Scalar
pressure(
const Element<freeFlowMomentumIndex>& element,
314 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
315 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf)
const
318 element, fvGeometry, scvf
329 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf)
const
339 Scalar
density(
const Element<freeFlowMomentumIndex>& element,
340 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
341 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf,
342 const bool considerPreviousTimeStep =
false)
const
345 element, fvGeometry, scvf, considerPreviousTimeStep
350 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
351 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf,
352 const bool considerPreviousTimeStep =
false)
const
355 element, fvGeometry, scvf, considerPreviousTimeStep
362 Scalar
density(
const Element<freeFlowMomentumIndex>& element,
363 const SubControlVolume<freeFlowMomentumIndex>& scv,
364 const bool considerPreviousTimeStep =
false)
const
367 element, scv, considerPreviousTimeStep
375 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
376 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf)
const
379 element, fvGeometry, scvf
387 const SubControlVolumeFace<freeFlowMassIndex>& scvf)
const
394 template<std::
size_t i>
395 const Problem<i>&
problem(Dune::index_constant<i> domainI)
const
397 return this->
subApply(domainI, [&](
const auto& cm,
auto&& ii) ->
const auto& {
398 return cm.problem(ii);
402 template<std::
size_t i, std::
size_t j>
404 Dune::index_constant<j> domainJ,
405 const SubControlVolumeFace<i>& scvf)
const
407 return this->
subApply(domainI, domainJ, [&](
const auto& cm,
auto&& ii,
auto&& jj){
408 return cm.isCoupled(ii, scvf);
418 template<std::
size_t i, std::
size_t j>
420 Dune::index_constant<j> domainJ,
421 const SubControlVolume<i>& scv)
const
423 return this->
subApply(domainI, domainJ, [&](
const auto& cm,
auto&& ii,
auto&& jj){
424 return cm.isCoupled(ii, scv);
432 Dune::index_constant<porousMediumIndex> domainJ,
433 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf)
const
435 return this->
subApply(domainI, domainJ, [&](
const auto& cm,
auto&& ii,
auto&& jj){
436 return cm.isCoupledLateralScvf(ii, scvf);
451 template<std::
size_t j>
453 const Element<freeFlowMomentumIndex>& elementI,
454 const SubControlVolume<freeFlowMomentumIndex>& scvI,
455 Dune::index_constant<j> domainJ)
const
458 return this->
subApply(domainI, domainJ, [&](
const auto& cm,
auto&& ii,
auto&& jj) ->
const auto& {
459 return cm.couplingStencil(ii, elementI, scvI, jj);
Coupling manager for Stokes and Darcy domains with equal dimension.
Definition: multidomain/boundary/freeflowporousmedium/ffmasspm/couplingmanager.hh:35
Coupling manager for Stokes and Darcy domains with equal dimension.
Definition: multidomain/boundary/freeflowporousmedium/ffmomentumpm/couplingmanager.hh:36
Definition: freeflowporousmedium/couplingconditions.hh:72
Coupling manager for coupling freeflow and porous medium flow models.
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:147
static constexpr auto freeFlowMassIndex
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:182
auto faceVelocity(const Element< freeFlowMassIndex > &element, const SubControlVolumeFace< freeFlowMassIndex > &scvf) const
Returns the velocity at a given sub control volume face.
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:386
bool isCoupledLateralScvf(Dune::index_constant< freeFlowMomentumIndex > domainI, Dune::index_constant< porousMediumIndex > domainJ, const SubControlVolumeFace< freeFlowMomentumIndex > &scvf) const
Returns whether a given scvf is coupled to the other domain.
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:431
Scalar density(const Element< freeFlowMomentumIndex > &element, const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const SubControlVolumeFace< freeFlowMomentumIndex > &scvf, const bool considerPreviousTimeStep=false) const
Returns the density at a given sub control volume face.
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:339
typename ParentType::template SubCouplingManager< i, j > SubCouplingManager
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:179
const auto & couplingStencil(Dune::index_constant< freeFlowMomentumIndex > domainI, const Element< freeFlowMomentumIndex > &elementI, const SubControlVolume< freeFlowMomentumIndex > &scvI, 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: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:452
auto darcyPermeability(const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const SubControlVolumeFace< freeFlowMomentumIndex > &scvf) const
Returns the intrinsic permeability of the coupled Darcy element.
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:283
Scalar density(const Element< freeFlowMomentumIndex > &element, const SubControlVolume< freeFlowMomentumIndex > &scv, const bool considerPreviousTimeStep=false) const
Returns the density at a given sub control volume.
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:362
static constexpr auto porousMediumIndex
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:183
void init(std::shared_ptr< Problem< freeFlowMomentumIndex > > freeFlowMomentumProblem, std::shared_ptr< Problem< freeFlowMassIndex > > freeFlowMassProblem, std::shared_ptr< Problem< porousMediumIndex > > porousMediumProblem, GridVarsTuple &&gridVarsTuple, const SolutionVector &curSol)
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:189
static constexpr auto freeFlowMomentumIndex
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:181
NumEqVector< freeFlowMomentumIndex > momentumCouplingCondition(Dune::index_constant< freeFlowMomentumIndex > domainI, Dune::index_constant< porousMediumIndex > domainJ, const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const typename FVElementGeometry< freeFlowMomentumIndex >::SubControlVolumeFace &scvf, const ElementVolumeVariables< freeFlowMomentumIndex > &elemVolVars) const
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:264
auto massCouplingCondition(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ, const FVElementGeometry< i > &fvGeometry, const typename FVElementGeometry< i >::SubControlVolumeFace &scvf, const ElementVolumeVariables< i > &elemVolVars) const
Returns the mass flux across the coupling boundary.
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:226
Scalar pressure(const Element< freeFlowMomentumIndex > &element, const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const SubControlVolumeFace< freeFlowMomentumIndex > &scvf) const
Returns the pressure at a given sub control volume face.
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:313
bool isCoupled(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ, const SubControlVolumeFace< i > &scvf) const
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:403
Scalar cellPressure(const Element< freeFlowMomentumIndex > &element, const SubControlVolumeFace< freeFlowMomentumIndex > &scvf) const
Returns the pressure at the center of a sub control volume corresponding to a given sub control volum...
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:328
bool isCoupled(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ, const SubControlVolume< i > &scv) const
If the boundary entity is on a coupling boundary.
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:419
Scalar effectiveViscosity(const Element< freeFlowMomentumIndex > &element, const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const SubControlVolumeFace< freeFlowMomentumIndex > &scvf) const
Returns the pressure at a given sub control volume face.
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:374
const Problem< i > & problem(Dune::index_constant< i > domainI) const
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:395
auto insideAndOutsideDensity(const Element< freeFlowMomentumIndex > &element, const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const SubControlVolumeFace< freeFlowMomentumIndex > &scvf, const bool considerPreviousTimeStep=false) const
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:349
Coupling manager that combines an arbitrary number of binary coupling manager (coupling two domains e...
Definition: multibinarycouplingmanager.hh:50
const auto & couplingStencil(Dune::index_constant< i > domainI, const Entity &entity, Dune::index_constant< j > domainJ) const
Return the coupling element stencil for a given bulk domain element.
Definition: multibinarycouplingmanager.hh:203
decltype(auto) subApply(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ, Apply &&apply)
apply a function to the domainI-domainJ sub coupling manager using its local indices
Definition: multibinarycouplingmanager.hh:137
auto & subCouplingManager(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ)
return the binary sub-coupling manager
Definition: multibinarycouplingmanager.hh:119
SolutionVectors & curSol()
Definition: multibinarycouplingmanager.hh:370
void updateSolution(const typename MDTraits::SolutionVector &curSol)
Update the solution vector before assembly.
Definition: multibinarycouplingmanager.hh:178
Defines all properties used in Dumux.
typename Detail::FreeFlowCouplingManagerSelector< Traits >::type FreeFlowCouplingManager
The interface of the coupling manager for free flow systems.
Definition: multidomain/freeflow/couplingmanager.hh:47
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:267
Freeflow coupling managers (Navier-Stokes mass-momentum coupling)
static constexpr auto freeFlowMomentumIndex
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:33
static constexpr auto freeFlowMassToFreeFlowMomentumIndex
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:38
constexpr auto globalToLocalDomainIndices(Dune::index_constant< i >, Dune::index_constant< j >)
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:74
static constexpr auto freeFlowMassToPorousMediumIndex
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:40
static constexpr auto porousMediumIndex
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:35
static constexpr auto noCouplingIdx
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:41
constexpr auto makeCouplingManagerMap()
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:43
static constexpr auto freeFlowMomentumToPorousMediumIndex
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:39
static constexpr auto freeFlowMassIndex
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:34
constexpr auto coupledDomains(Dune::index_constant< i > domainI)
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:63
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:107
typename MDTraits::template SubDomain< id >::TypeTag SubDomainTypeTag
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:109
Dumux::FreeFlowCouplingManager< FreeFlowTraits > FreeFlowCouplingManager
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:124
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:86
static constexpr auto globalToLocal(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ)
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:93
static constexpr auto coupledDomains(Dune::index_constant< i > domainI)
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:99
static constexpr auto managerMap()
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:87
Definition: multidomain/traits.hh:134