13#ifndef DUMUX_MULTIDOMAIN_BOUNDARY_FREEFLOW_POROUSMEDIUM_COUPLINGMANAGER_BASE_HH
14#define DUMUX_MULTIDOMAIN_BOUNDARY_FREEFLOW_POROUSMEDIUM_COUPLINGMANAGER_BASE_HH
19#include <dune/common/indices.hh>
29namespace FreeFlowPorousMediumDetail {
34static constexpr auto porousMediumIndex = Dune::index_constant<2>();
38static constexpr auto freeFlowMomentumToPorousMediumIndex = Dune::index_constant<1>();
39static constexpr auto freeFlowMassToPorousMediumIndex = Dune::index_constant<2>();
40static constexpr auto noCouplingIdx = Dune::index_constant<99>();
44 auto map = std::array<std::array<std::size_t, 3>, 3>{};
61template<std::
size_t i>
72template<std::
size_t i, std::
size_t j>
75 static_assert(i <= 2 && j <= 2);
76 static_assert(i != j);
79 return std::pair<Dune::index_constant<0>, Dune::index_constant<1>>{};
81 return std::pair<Dune::index_constant<1>, Dune::index_constant<0>>{};
86 static constexpr auto managerMap()
91 template<std::
size_t i, std::
size_t j>
92 static constexpr auto globalToLocal(Dune::index_constant<i> domainI, Dune::index_constant<j> domainJ)
97 template<std::
size_t i>
98 static constexpr auto coupledDomains(Dune::index_constant<i> domainI)
104template<
class MDTraits>
105struct CouplingManagers
107 template<std::
size_t id>
108 using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
110 using FreeFlowTraits = MultiDomainTraits<
111 SubDomainTypeTag<freeFlowMomentumIndex>, SubDomainTypeTag<freeFlowMassIndex>
114 using FreeFlowMomentumPorousMediumTraits = MultiDomainTraits<
115 SubDomainTypeTag<freeFlowMomentumIndex>, SubDomainTypeTag<porousMediumIndex>
118 using FreeFlowMassPorousMediumTraits = MultiDomainTraits<
119 SubDomainTypeTag<freeFlowMassIndex>, SubDomainTypeTag<porousMediumIndex>
137template<
class MDTraits>
141 FreeFlowPorousMediumDetail::CouplingMaps,
142 typename FreeFlowPorousMediumDetail::CouplingManagers<MDTraits>::FreeFlowCouplingManager,
143 typename FreeFlowPorousMediumDetail::CouplingManagers<MDTraits>::FreeFlowMomentumPorousMediumCouplingManager,
144 typename FreeFlowPorousMediumDetail::CouplingManagers<MDTraits>::FreeFlowMassPorousMediumCouplingManager
149 FreeFlowPorousMediumDetail::CouplingMaps,
155 using Scalar =
typename MDTraits::Scalar;
158 template<std::
size_t id>
159 using SubDomainTypeTag =
typename MDTraits::template SubDomain<id>::TypeTag;
163 template<std::
size_t id>
using FVElementGeometry =
typename GridGeometry<id>::LocalView;
164 template<std::
size_t id>
using SubControlVolumeFace =
typename FVElementGeometry<id>::SubControlVolumeFace;
165 template<std::
size_t id>
using SubControlVolume =
typename FVElementGeometry<id>::SubControlVolume;
167 template<std::
size_t id>
using NumEqVector =
typename Problem<id>::Traits::NumEqVector;
169 template<std::
size_t id>
using GridView =
typename GridGeometry<id>::GridView;
170 template<std::
size_t id>
using Element =
typename GridView<id>::template Codim<0>::Entity;
171 using SolutionVector =
typename MDTraits::SolutionVector;
173 template<std::
size_t id>
174 using SubSolutionVector
175 = std::decay_t<decltype(std::declval<SolutionVector>()[Dune::index_constant<id>()])>;
179 template<std::
size_t i, std::
size_t j>
187 using ParentType::ParentType;
189 template<
class Gr
idVarsTuple>
190 void init(std::shared_ptr<Problem<freeFlowMomentumIndex>> freeFlowMomentumProblem,
191 std::shared_ptr<Problem<freeFlowMassIndex>> freeFlowMassProblem,
192 std::shared_ptr<Problem<porousMediumIndex>> porousMediumProblem,
193 GridVarsTuple&& gridVarsTuple,
194 const SolutionVector&
curSol)
197 this->init_(freeFlowMomentumProblem, freeFlowMassProblem, porousMediumProblem, std::forward<GridVarsTuple>(gridVarsTuple),
curSol);
202 freeFlowMomentumProblem, freeFlowMassProblem,
203 std::make_tuple(std::get<freeFlowMomentumIndex>(gridVarsTuple), std::get<freeFlowMassIndex>(gridVarsTuple)),
204 FFSol{ std::get<freeFlowMomentumIndex>(this->
curSol()), std::get<freeFlowMassIndex>(this->
curSol()) }
208 template<
class Gr
idVarsTuple>
209 void init(std::shared_ptr<Problem<freeFlowMomentumIndex>> freeFlowMomentumProblem,
210 std::shared_ptr<Problem<freeFlowMassIndex>> freeFlowMassProblem,
211 std::shared_ptr<Problem<porousMediumIndex>> porousMediumProblem,
212 GridVarsTuple&& gridVarsTuple,
213 const SolutionVector&
curSol,
214 const SolutionVector& prevSol)
217 this->init_(freeFlowMomentumProblem, freeFlowMassProblem, porousMediumProblem, std::forward<GridVarsTuple>(gridVarsTuple),
curSol);
220 using FFPrevSol = std::tuple<const SubSolutionVector<freeFlowMomentumIndex>*,
const SubSolutionVector<freeFlowMassIndex>*>;
222 freeFlowMomentumProblem, freeFlowMassProblem,
223 std::make_tuple(std::get<freeFlowMomentumIndex>(gridVarsTuple), std::get<freeFlowMassIndex>(gridVarsTuple)),
224 FFSol{ std::get<freeFlowMomentumIndex>(this->
curSol()), std::get<freeFlowMassIndex>(this->
curSol()) },
229 template<std::
size_t i>
230 const Problem<i>&
problem(Dune::index_constant<i> domainI)
const
232 return this->
subApply(domainI, [&](
const auto& cm,
auto&& ii) ->
const auto& {
233 return cm.problem(ii);
237 template<std::
size_t i, std::
size_t j>
239 Dune::index_constant<j> domainJ,
240 const SubControlVolumeFace<i>& scvf)
const
242 return this->
subApply(domainI, domainJ, [&](
const auto& cm,
auto&& ii,
auto&& jj){
243 return cm.isCoupled(ii, scvf);
253 template<std::
size_t i, std::
size_t j>
255 Dune::index_constant<j> domainJ,
256 const SubControlVolume<i>& scv)
const
258 return this->
subApply(domainI, domainJ, [&](
const auto& cm,
auto&& ii,
auto&& jj){
259 return cm.isCoupled(ii, scv);
273 template<std::
size_t j>
275 const Element<freeFlowMomentumIndex>& elementI,
276 const SubControlVolume<freeFlowMomentumIndex>& scvI,
277 Dune::index_constant<j> domainJ)
const
280 return this->
subApply(domainI, domainJ, [&](
const auto& cm,
auto&& ii,
auto&& jj) ->
const auto& {
281 return cm.couplingStencil(ii, elementI, scvI, jj);
288 template<
class Gr
idVarsTuple>
289 void init_(std::shared_ptr<Problem<freeFlowMomentumIndex>> freeFlowMomentumProblem,
290 std::shared_ptr<Problem<freeFlowMassIndex>> freeFlowMassProblem,
291 std::shared_ptr<Problem<porousMediumIndex>> porousMediumProblem,
292 GridVarsTuple&& gridVarsTuple,
293 const SolutionVector&
curSol)
298 using FFMassPMSol =
typename SubCouplingManager<freeFlowMassIndex, porousMediumIndex>::SolutionVectorStorage;
300 freeFlowMassProblem, porousMediumProblem,
301 FFMassPMSol{ std::get<freeFlowMassIndex>(this->
curSol()), std::get<porousMediumIndex>(this->
curSol()) }
304 using FFMomPMSol =
typename SubCouplingManager<freeFlowMomentumIndex, porousMediumIndex>::SolutionVectorStorage;
306 freeFlowMomentumProblem, porousMediumProblem,
307 FFMomPMSol{ std::get<freeFlowMomentumIndex>(this->
curSol()), std::get<porousMediumIndex>(this->
curSol()) }
Base coupling manager for coupling freeflow and porous medium flow models.
Definition: couplingmanager_base.hh:146
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: couplingmanager_base.hh:190
static constexpr auto porousMediumIndex
Definition: couplingmanager_base.hh:184
static constexpr auto freeFlowMassIndex
Definition: couplingmanager_base.hh:183
typename ParentType::template SubCouplingManager< i, j > SubCouplingManager
Definition: couplingmanager_base.hh:180
bool isCoupled(Dune::index_constant< i > domainI, Dune::index_constant< j > domainJ, const SubControlVolumeFace< i > &scvf) const
Definition: couplingmanager_base.hh:238
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: couplingmanager_base.hh:274
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, const SolutionVector &prevSol)
Definition: couplingmanager_base.hh:209
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: couplingmanager_base.hh:254
const Problem< i > & problem(Dune::index_constant< i > domainI) const
Definition: couplingmanager_base.hh:230
static constexpr auto freeFlowMomentumIndex
Definition: couplingmanager_base.hh:182
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:296
Coupling managers specialized for different discretization schemes for mass coupling.
Coupling managers specialized for different discretization schemes for momentum coupling.
Freeflow coupling managers (Navier-Stokes mass-momentum coupling)
constexpr auto coupledDomains(Dune::index_constant< i > domainI)
Definition: multidomain/boundary/freeflowporenetwork/couplingmanager.hh:64
constexpr auto globalToLocalDomainIndices(Dune::index_constant< i >, Dune::index_constant< j >)
Definition: multidomain/boundary/freeflowporenetwork/couplingmanager.hh:75
static constexpr auto freeFlowMassIndex
Definition: multidomain/boundary/freeflowporenetwork/couplingmanager.hh:35
static constexpr auto freeFlowMomentumIndex
Definition: multidomain/boundary/freeflowporenetwork/couplingmanager.hh:34
static constexpr auto noCouplingIdx
Definition: multidomain/boundary/freeflowporenetwork/couplingmanager.hh:42
static constexpr auto freeFlowMassToFreeFlowMomentumIndex
Definition: multidomain/boundary/freeflowporenetwork/couplingmanager.hh:39
constexpr auto makeCouplingManagerMap()
Definition: multidomain/boundary/freeflowporenetwork/couplingmanager.hh:44
typename FreeFlowMassPorousMediumDetail::FreeFlowMassPorousMediumCouplingManagerSelector< MDTraits >::type FreeFlowMassPorousMediumCouplingManager
Definition: multidomain/boundary/freeflowporousmedium/ffmasspm/couplingmanager.hh:40
typename FreeFlowMomentumPorousMediumDetail::FreeFlowMomentumPorousMediumCouplingManagerSelector< MDTraits >::type FreeFlowMomentumPorousMediumCouplingManager
Definition: multidomain/boundary/freeflowporousmedium/ffmomentumpm/couplingmanager.hh:40