version 3.10-dev
couplingmanager_staggered_cctpfa.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_MULTIDOMAIN_BOUNDARY_FREEFLOW_POROUSMEDIUM_COUPLINGMANAGER_STAGGERED_CCTPFA_HH
14#define DUMUX_MULTIDOMAIN_BOUNDARY_FREEFLOW_POROUSMEDIUM_COUPLINGMANAGER_STAGGERED_CCTPFA_HH
15
18
19namespace Dumux {
20
26template<class MDTraits>
29{
31
32 using Scalar = typename MDTraits::Scalar;
33
34 // the sub domain type tags
35 template<std::size_t id>
36 using SubDomainTypeTag = typename MDTraits::template SubDomain<id>::TypeTag;
37
38 template<std::size_t id> using Problem = GetPropType<SubDomainTypeTag<id>, Properties::Problem>;
39 template<std::size_t id> using GridGeometry = GetPropType<SubDomainTypeTag<id>, Properties::GridGeometry>;
40 template<std::size_t id> using FVElementGeometry = typename GridGeometry<id>::LocalView;
41 template<std::size_t id> using SubControlVolumeFace = typename FVElementGeometry<id>::SubControlVolumeFace;
42 template<std::size_t id> using SubControlVolume = typename FVElementGeometry<id>::SubControlVolume;
43 template<std::size_t id> using ElementVolumeVariables = typename GetPropType<SubDomainTypeTag<id>, Properties::GridVolumeVariables>::LocalView;
44 template<std::size_t id> using NumEqVector = typename Problem<id>::Traits::NumEqVector;
45
46 template<std::size_t id> using GridView = typename GridGeometry<id>::GridView;
47 template<std::size_t id> using Element = typename GridView<id>::template Codim<0>::Entity;
48 using SolutionVector = typename MDTraits::SolutionVector;
49
51
52public:
56
57public:
61 template<std::size_t i, std::size_t j>
62 auto massCouplingCondition(Dune::index_constant<i> domainI, Dune::index_constant<j> domainJ,
63 const FVElementGeometry<i>& fvGeometry,
64 const typename FVElementGeometry<i>::SubControlVolumeFace& scvf,
65 const ElementVolumeVariables<i>& elemVolVars) const
66 {
67 static_assert(domainI != freeFlowMomentumIndex && domainJ != freeFlowMomentumIndex);
68
69 const auto& couplingContext = this->subApply(domainI, domainJ, [&](const auto& cm, auto&& ii, auto&& jj) -> const auto& {
70 return cm.couplingContext(ii, fvGeometry, scvf);
71 });
72
73 const auto& freeFlowElement = [&]
74 {
75 if constexpr (domainI == freeFlowMassIndex)
76 return fvGeometry.element();
77 else
78 return couplingContext.fvGeometry.element();
79 }();
80
81 const auto& freeFlowScvf = [&]
82 {
83 if constexpr (domainI == freeFlowMassIndex)
84 return scvf;
85 else
86 return couplingContext.fvGeometry.scvf(couplingContext.freeFlowMassScvfIdx);
87
88 }();
89
90 // todo revise velocity (see ff mom pm mgr)
91
92 couplingContext.velocity = this->subCouplingManager(freeFlowMomentumIndex, freeFlowMassIndex).faceVelocity(freeFlowElement, freeFlowScvf);
93 return CouplingConditions::massCouplingCondition(domainI, domainJ, fvGeometry, scvf, elemVolVars, couplingContext);
94 }
95
96
99
100 NumEqVector<freeFlowMomentumIndex> momentumCouplingCondition(Dune::index_constant<freeFlowMomentumIndex> domainI,
101 Dune::index_constant<porousMediumIndex> domainJ,
102 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
103 const typename FVElementGeometry<freeFlowMomentumIndex>::SubControlVolumeFace& scvf,
104 const ElementVolumeVariables<freeFlowMomentumIndex>& elemVolVars) const
105 {
106 if (scvf.isLateral())
107 return NumEqVector<freeFlowMomentumIndex>(0.0);
108
109 const auto& context = this->subCouplingManager(freeFlowMomentumIndex, porousMediumIndex).couplingContext(
110 domainI, fvGeometry, scvf
111 );
112
113 return CouplingConditions::momentumCouplingCondition(fvGeometry, scvf, elemVolVars, context);
114 }
115
119 auto darcyPermeability(const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
120 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf) const
121 {
122 if (scvf.isFrontal())
123 {
124 const auto& context = this->subCouplingManager(freeFlowMomentumIndex, porousMediumIndex).couplingContext(
125 Dune::index_constant<freeFlowMomentumIndex>(), fvGeometry, scvf
126 );
127
128 return CouplingConditions::darcyPermeability(fvGeometry, scvf, context);
129 }
130 else
131 {
132 const auto& orthogonalScvf = fvGeometry.lateralOrthogonalScvf(scvf);
133 const auto& orthogonalScv = fvGeometry.scv(orthogonalScvf.insideScvIdx());
134 const auto& frontalScvfOnBoundary = fvGeometry.frontalScvfOnBoundary(orthogonalScv);
135 const auto& context = this->subCouplingManager(freeFlowMomentumIndex, porousMediumIndex).couplingContext(
136 Dune::index_constant<freeFlowMomentumIndex>(), fvGeometry, frontalScvfOnBoundary
137 );
138
139 return CouplingConditions::darcyPermeability(fvGeometry, frontalScvfOnBoundary, context);
140 }
141 }
142
145
149 Scalar pressure(const Element<freeFlowMomentumIndex>& element,
150 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
151 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf) const
152 {
154 element, fvGeometry, scvf
155 );
156 }
157
164 Scalar cellPressure(const Element<freeFlowMomentumIndex>& element,
165 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf) const
166 {
168 element, scvf
169 );
170 }
171
175 Scalar density(const Element<freeFlowMomentumIndex>& element,
176 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
177 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf,
178 const bool considerPreviousTimeStep = false) const
179 {
181 element, fvGeometry, scvf, considerPreviousTimeStep
182 );
183 }
184
185 auto insideAndOutsideDensity(const Element<freeFlowMomentumIndex>& element,
186 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
187 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf,
188 const bool considerPreviousTimeStep = false) const
189 {
190 return this->subCouplingManager(freeFlowMomentumIndex, freeFlowMassIndex).insideAndOutsideDensity(
191 element, fvGeometry, scvf, considerPreviousTimeStep
192 );
193 }
194
198 Scalar density(const Element<freeFlowMomentumIndex>& element,
199 const SubControlVolume<freeFlowMomentumIndex>& scv,
200 const bool considerPreviousTimeStep = false) const
201 {
203 element, scv, considerPreviousTimeStep
204 );
205 }
206
210 Scalar effectiveViscosity(const Element<freeFlowMomentumIndex>& element,
211 const FVElementGeometry<freeFlowMomentumIndex>& fvGeometry,
212 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf) const
213 {
214 return this->subCouplingManager(freeFlowMomentumIndex, freeFlowMassIndex).effectiveViscosity(
215 element, fvGeometry, scvf
216 );
217 }
218
222 auto faceVelocity(const Element<freeFlowMassIndex>& element,
223 const SubControlVolumeFace<freeFlowMassIndex>& scvf) const
224 {
226 element, scvf
227 );
228 }
229
233 bool isCoupledLateralScvf(Dune::index_constant<freeFlowMomentumIndex> domainI,
234 Dune::index_constant<porousMediumIndex> domainJ,
235 const SubControlVolumeFace<freeFlowMomentumIndex>& scvf) const
236 {
237 return this->subApply(domainI, domainJ, [&](const auto& cm, auto&& ii, auto&& jj){
238 return cm.isCoupledLateralScvf(ii, scvf);
239 });
240 }
241};
242
243} // end namespace Dumux
244
245#endif
Definition: couplingconditions_staggered_cctpfa.hh:72
Base coupling manager for coupling freeflow and porous medium flow models.
Definition: couplingmanager_base.hh:146
static constexpr auto porousMediumIndex
Definition: couplingmanager_base.hh:184
static constexpr auto freeFlowMassIndex
Definition: couplingmanager_base.hh:183
static constexpr auto freeFlowMomentumIndex
Definition: couplingmanager_base.hh:182
Coupling manager for coupling freeflow and porous medium flow models specialization for staggered-cct...
Definition: couplingmanager_staggered_cctpfa.hh:29
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: couplingmanager_staggered_cctpfa.hh:175
static constexpr auto freeFlowMomentumIndex
Definition: couplingmanager_staggered_cctpfa.hh:53
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: couplingmanager_staggered_cctpfa.hh:233
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: couplingmanager_staggered_cctpfa.hh:100
static constexpr auto porousMediumIndex
Definition: couplingmanager_staggered_cctpfa.hh:55
auto darcyPermeability(const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const SubControlVolumeFace< freeFlowMomentumIndex > &scvf) const
Returns the intrinsic permeability of the coupled Darcy element.
Definition: couplingmanager_staggered_cctpfa.hh:119
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: couplingmanager_staggered_cctpfa.hh:210
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: couplingmanager_staggered_cctpfa.hh:62
auto faceVelocity(const Element< freeFlowMassIndex > &element, const SubControlVolumeFace< freeFlowMassIndex > &scvf) const
Returns the velocity at a given sub control volume face.
Definition: couplingmanager_staggered_cctpfa.hh:222
auto insideAndOutsideDensity(const Element< freeFlowMomentumIndex > &element, const FVElementGeometry< freeFlowMomentumIndex > &fvGeometry, const SubControlVolumeFace< freeFlowMomentumIndex > &scvf, const bool considerPreviousTimeStep=false) const
Definition: couplingmanager_staggered_cctpfa.hh:185
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: couplingmanager_staggered_cctpfa.hh:149
static constexpr auto freeFlowMassIndex
Definition: couplingmanager_staggered_cctpfa.hh:54
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: couplingmanager_staggered_cctpfa.hh:164
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: couplingmanager_staggered_cctpfa.hh:198
Coupling manager that combines an arbitrary number of binary coupling manager (coupling two domains e...
Definition: multibinarycouplingmanager.hh:50
Base class for coupling freeflow and porous medium flow models.
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
Definition: adapt.hh:17