25#ifndef DUMUX_MULTIDOMAIN_BOUNDARY_FREEFLOW_POROUSMEDIUM_COUPLINGMANAGER_HH
26#define DUMUX_MULTIDOMAIN_BOUNDARY_FREEFLOW_POROUSMEDIUM_COUPLINGMANAGER_HH
31#include <dune/common/indices.hh>
57 auto map = std::array<std::array<std::size_t, 3>, 3>{};
74template<std::
size_t i>
85template<std::
size_t i, std::
size_t j>
88 static_assert(i <= 2 && j <= 2);
89 static_assert(i != j);
92 return std::pair<Dune::index_constant<0>, Dune::index_constant<1>>{};
94 return std::pair<Dune::index_constant<1>, Dune::index_constant<0>>{};
104 template<std::
size_t i, std::
size_t j>
105 static constexpr auto globalToLocal(Dune::index_constant<i> domainI, Dune::index_constant<j> domainJ)
110 template<std::
size_t i>
117template<
class MDTraits>
120 template<std::
size_t id>
150template<
class MDTraits>
154 FreeFlowPorousMediumDetail::CouplingMaps,
155 typename FreeFlowPorousMediumDetail::CouplingManagers<MDTraits>::FreeFlowCouplingManager,
156 typename FreeFlowPorousMediumDetail::CouplingManagers<MDTraits>::FreeFlowMomentumPorousMediumCouplingManager,
157 typename FreeFlowPorousMediumDetail::CouplingManagers<MDTraits>::FreeFlowMassPorousMediumCouplingManager
168 using Scalar =
typename MDTraits::Scalar;
171 template<std::
size_t id>
172 using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
176 template<std::
size_t id>
using FVElementGeometry =
typename GridGeometry<id>::LocalView;
177 template<std::
size_t id>
using SubControlVolumeFace =
typename FVElementGeometry<id>::SubControlVolumeFace;
178 template<std::
size_t id>
using SubControlVolume =
typename FVElementGeometry<id>::SubControlVolume;
180 template<std::
size_t id>
using NumEqVector =
typename Problem<id>::Traits::NumEqVector;
182 template<std::
size_t id>
using GridView =
typename GridGeometry<id>::GridView;
183 template<std::
size_t id>
using Element =
typename GridView<id>::template Codim<0>::Entity;
184 using SolutionVector =
typename MDTraits::SolutionVector;
190 template<std::
size_t i, std::
size_t j>
198 using ParentType::ParentType;
200 template<
class Gr
idVarsTuple>
201 void init(std::shared_ptr<Problem<freeFlowMomentumIndex>> freeFlowMomentumProblem,
202 std::shared_ptr<Problem<freeFlowMassIndex>> freeFlowMassProblem,
203 std::shared_ptr<Problem<porousMediumIndex>> porousMediumProblem,
204 GridVarsTuple&& gridVarsTuple,
205 const SolutionVector&
curSol)
211 std::get<0>(ffSolVecTuple) = std::get<freeFlowMomentumIndex>(this->
curSol());
212 std::get<1>(ffSolVecTuple) = std::get<freeFlowMassIndex>(this->
curSol());
214 freeFlowMomentumProblem, freeFlowMassProblem,
215 std::make_tuple(std::get<freeFlowMomentumIndex>(gridVarsTuple), std::get<freeFlowMassIndex>(gridVarsTuple)),
220 std::get<0>(ffMassPmSolVecTuple) = std::get<freeFlowMassIndex>(this->
curSol());
221 std::get<1>(ffMassPmSolVecTuple) = std::get<porousMediumIndex>(this->
curSol());
223 freeFlowMassProblem, porousMediumProblem, ffMassPmSolVecTuple
227 std::get<0>(ffMomentumPmSolVecTuple) = std::get<freeFlowMomentumIndex>(this->
curSol());
228 std::get<1>(ffMomentumPmSolVecTuple) = std::get<porousMediumIndex>(this->
curSol());
230 freeFlowMomentumProblem, porousMediumProblem, ffMomentumPmSolVecTuple
237 template<std::
size_t i, std::
size_t j>
239 const FVElementGeometry<i>& fvGeometry,
240 const typename FVElementGeometry<i>::SubControlVolumeFace& scvf,
241 const ElementVolumeVariables<i>& elemVolVars)
const
245 const auto& couplingContext = this->
subApply(domainI, domainJ, [&](
const auto& cm,
auto&& ii,
auto&& jj) ->
const auto& {
246 return cm.couplingContext(ii, fvGeometry, scvf);
249 const auto& freeFlowElement = [&]
252 return fvGeometry.element();
254 return couplingContext.fvGeometry.element();
257 const auto& freeFlowScvf = [&]
262 return couplingContext.fvGeometry.scvf(couplingContext.freeFlowMassScvfIdx);
269 return CouplingConditions::massCouplingCondition(domainI, domainJ, fvGeometry, scvf, elemVolVars, couplingContext);
277 Dune::index_constant<porousMediumIndex> domainJ,
278 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
279 const typename FVElementGeometry<freeFlowMomentumIndex>::SubControlVolumeFace& scvf,
280 const ElementVolumeVariables<freeFlowMomentumIndex>& elemVolVars)
const
282 if (scvf.isLateral())
286 domainI, fvGeometry, scvf
289 return CouplingConditions::momentumCouplingCondition(fvGeometry, scvf, elemVolVars, context);
296 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf)
const
298 if (scvf.isFrontal())
301 Dune::index_constant<freeFlowMomentumIndex>(), fvGeometry, scvf
304 return CouplingConditions::darcyPermeability(fvGeometry, scvf, context);
308 const auto& orthogonalScvf = fvGeometry.lateralOrthogonalScvf(scvf);
309 const auto& orthogonalScv = fvGeometry.scv(orthogonalScvf.insideScvIdx());
310 const auto& frontalScvfOnBoundary = fvGeometry.frontalScvfOnBoundary(orthogonalScv);
312 Dune::index_constant<freeFlowMomentumIndex>(), fvGeometry, frontalScvfOnBoundary
315 return CouplingConditions::darcyPermeability(fvGeometry, frontalScvfOnBoundary, context);
325 Scalar
pressure(
const Element<freeFlowMomentumIndex>& element,
326 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
327 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf)
const
330 element, fvGeometry, scvf
341 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf)
const
351 Scalar
density(
const Element<freeFlowMomentumIndex>& element,
352 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
353 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf,
354 const bool considerPreviousTimeStep =
false)
const
357 element, fvGeometry, scvf, considerPreviousTimeStep
362 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
363 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf,
364 const bool considerPreviousTimeStep =
false)
const
367 element, fvGeometry, scvf, considerPreviousTimeStep
374 Scalar
density(
const Element<freeFlowMomentumIndex>& element,
375 const SubControlVolume<freeFlowMomentumIndex>& scv,
376 const bool considerPreviousTimeStep =
false)
const
379 element, scv, considerPreviousTimeStep
387 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
388 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf)
const
391 element, fvGeometry, scvf
399 const SubControlVolumeFace<freeFlowMassIndex>& scvf)
const
406 template<std::
size_t i>
407 const Problem<i>&
problem(Dune::index_constant<i> domainI)
const
409 return this->
subApply(domainI, [&](
const auto& cm,
auto&& ii) ->
const auto& {
410 return cm.problem(ii);
414 template<std::
size_t i, std::
size_t j>
416 Dune::index_constant<j> domainJ,
417 const SubControlVolumeFace<i>& scvf)
const
419 return this->
subApply(domainI, domainJ, [&](
const auto& cm,
auto&& ii,
auto&& jj){
420 return cm.isCoupled(ii, scvf);
430 template<std::
size_t i, std::
size_t j>
432 Dune::index_constant<j> domainJ,
433 const SubControlVolume<i>& scv)
const
435 return this->
subApply(domainI, domainJ, [&](
const auto& cm,
auto&& ii,
auto&& jj){
436 return cm.isCoupled(ii, scv);
444 Dune::index_constant<porousMediumIndex> domainJ,
445 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf)
const
447 return this->
subApply(domainI, domainJ, [&](
const auto& cm,
auto&& ii,
auto&& jj){
448 return cm.isCoupledLateralScvf(ii, scvf);
463 template<std::
size_t j>
465 const Element<freeFlowMomentumIndex>& elementI,
466 const SubControlVolume<freeFlowMomentumIndex>& scvI,
467 Dune::index_constant<j> domainJ)
const
470 return this->
subApply(domainI, domainJ, [&](
const auto& cm,
auto&& ii,
auto&& jj) ->
const auto& {
471 return cm.couplingStencil(ii, elementI, scvI, jj);
Coupling manager that combines an arbitrary number of binary coupling manager (coupling two domains e...
typename NumEqVectorTraits< PrimaryVariables >::type NumEqVector
A vector with the same size as numbers of equations This is the default implementation and has to be ...
Definition numeqvector.hh:46
FreeFlowPorousMediumCouplingConditionsImplementation< MDTraits, CouplingManager, GetPropType< typename MDTraits::template SubDomain< 0 >::TypeTag, Properties::ModelTraits >::enableEnergyBalance(),(GetPropType< typename MDTraits::template SubDomain< 0 >::TypeTag, Properties::ModelTraits >::numFluidComponents() > 1) > FreeFlowPorousMediumCouplingConditions
Data for the coupling of a Darcy model (cell-centered finite volume) with a (Navier-)Stokes model (st...
Definition freeflowporousmedium/couplingconditions.hh:92
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition propertysystem.hh:150
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:42
static constexpr auto freeFlowMomentumIndex
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:45
static constexpr auto freeFlowMassToFreeFlowMomentumIndex
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:50
constexpr auto globalToLocalDomainIndices(Dune::index_constant< i >, Dune::index_constant< j >)
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:86
static constexpr auto freeFlowMassToPorousMediumIndex
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:52
static constexpr auto porousMediumIndex
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:47
static constexpr auto noCouplingIdx
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:53
constexpr auto makeCouplingManagerMap()
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:55
static constexpr auto freeFlowMomentumToPorousMediumIndex
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:51
static constexpr auto freeFlowMassIndex
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:46
constexpr auto coupledDomains(Dune::index_constant< i > domainI)
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:75
Property to specify the type of a problem which has to be solved.
Definition common/properties.hh:57
Definition common/properties.hh:102
The type for a global container for the volume variables.
Definition common/properties.hh:109
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:98
static constexpr auto globalToLocal(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ)
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:105
static constexpr auto coupledDomains(Dune::index_constant< i > domainI)
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:111
static constexpr auto managerMap()
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:99
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:119
typename MDTraits::template SubDomain< id >::TypeTag SubDomainTypeTag
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:121
Dumux::FreeFlowMomentumPorousMediumCouplingManager< FreeFlowMomentumPorousMediumTraits > FreeFlowMomentumPorousMediumCouplingManager
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:136
Dumux::StaggeredFreeFlowCouplingManager< FreeFlowTraits > FreeFlowCouplingManager
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:135
Dumux::FreeFlowMassPorousMediumCouplingManager< FreeFlowMassPorousMediumTraits > FreeFlowMassPorousMediumCouplingManager
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:137
MultiDomainTraits< SubDomainTypeTag< freeFlowMassIndex >, SubDomainTypeTag< porousMediumIndex > > FreeFlowMassPorousMediumTraits
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:131
MultiDomainTraits< SubDomainTypeTag< freeFlowMomentumIndex >, SubDomainTypeTag< porousMediumIndex > > FreeFlowMomentumPorousMediumTraits
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:127
MultiDomainTraits< SubDomainTypeTag< freeFlowMomentumIndex >, SubDomainTypeTag< freeFlowMassIndex > > FreeFlowTraits
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:123
Coupling manager for coupling freeflow and porous medium flow models.
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:159
static constexpr auto freeFlowMassIndex
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:194
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:398
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:443
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:351
typename ParentType::template SubCouplingManager< i, j > SubCouplingManager
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:191
const auto & couplingStencil(Dune::index_constant< freeFlowMomentumIndex > domainI, const Element< freeFlowMomentumIndex > &elementI, const SubControlVolume< freeFlowMomentumIndex > &scvI, Dune::index_constant< j > domainJ) const
returns an iteratable container of all indices of degrees of freedom of domain j that couple with / i...
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:464
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:295
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:374
static constexpr auto porousMediumIndex
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:195
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:201
static constexpr auto freeFlowMomentumIndex
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:193
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:276
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:238
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:325
bool isCoupled(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ, const SubControlVolumeFace< i > &scvf) const
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:415
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:340
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:431
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:386
const Problem< i > & problem(Dune::index_constant< i > domainI) const
Definition multidomain/boundary/freeflowporousmedium/couplingmanager.hh:407
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:361
Coupling manager for Stokes and Darcy domains with equal dimension.
Definition multidomain/boundary/freeflowporousmedium/ffmasspm/couplingmanager.hh:47
Coupling manager for Stokes and Darcy domains with equal dimension.
Definition multidomain/boundary/freeflowporousmedium/ffmomentumpm/couplingmanager.hh:48
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:215
MultiBinaryCouplingManager()
Definition multibinarycouplingmanager.hh:115
decltype(auto) subApply(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ, Apply &&apply)
Definition multibinarycouplingmanager.hh:149
auto & subCouplingManager(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ)
Definition multibinarycouplingmanager.hh:131
SolutionVectors & curSol()
Definition multibinarycouplingmanager.hh:382
void updateSolution(const typename MDTraits::SolutionVector &curSol)
Definition multibinarycouplingmanager.hh:190
The interface of the coupling manager for free flow systems.
Definition multidomain/staggeredfreeflow/couplingmanager.hh:53
Definition multidomain/traits.hh:141
Data for the coupling of a Darcy model (cell-centered finite volume) with a (Navier-)Stokes model (st...
Coupling manager for Stokes and Darcy domains with equal dimension.
Coupling manager for Stokes and Darcy domains with equal dimension.
The interface of the coupling manager for multi domain problems.
Declares all properties used in Dumux.