version 3.11-dev
Loading...
Searching...
No Matches
freeflow/navierstokes/mass/problem.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-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_NAVIERSTOKES_MASS_PROBLEM_HH
13#define DUMUX_NAVIERSTOKES_MASS_PROBLEM_HH
14
15#include <dune/common/exceptions.hh>
16#include <dune/common/typetraits.hh>
19#include <dumux/common/boundarytypes_.hh>
24
25namespace Dumux {
26
27// default implementation
28template<class TypeTag, class DiscretizationMethod>
30{
31 using ParentType = FVProblemWithSpatialParams<TypeTag>;
32 using Implementation = GetPropType<TypeTag, Properties::Problem>;
33
35 using GridView = typename GridGeometry::GridView;
36 using FVElementGeometry = typename GridGeometry::LocalView;
37 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
38 using Element = typename GridView::template Codim<0>::Entity;
39 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
40 using VelocityVector = GlobalPosition;
44
45 static constexpr bool isCoupled_ = !std::is_empty_v<CouplingManager>;
46
47public:
48
53 using InitialValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
54 using Sources = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
55 using DirichletValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
56 using BoundaryFluxes = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
57
59 using BoundaryTypes = Dumux::BoundaryTypes<ModelTraits::numEq()>;
60
62 static constexpr bool isMomentumProblem() { return false; }
63
70 NavierStokesMassProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
71 std::shared_ptr<CouplingManager> couplingManager,
72 const std::string& paramGroup = "")
73 : ParentType(gridGeometry, paramGroup)
74 , couplingManager_(couplingManager)
75 {}
76
82 NavierStokesMassProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
83 const std::string& paramGroup = "")
85 {}
86
90 template<class SubControlVolumeFace>
91 VelocityVector faceVelocity(const Element& element,
92 const FVElementGeometry& fvGeometry,
93 const SubControlVolumeFace& scvf) const
94 {
95 if constexpr (isCoupled_)
96 return couplingManager_->faceVelocity(element, scvf);
97 else
98 return asImp_().velocityAtPos(scvf.ipGlobal());
99 }
100
104 template<class IpData>
105 VelocityVector velocity(const FVElementGeometry& fvGeometry, const IpData& ipData) const
106 {
107 if constexpr (isCoupled_)
108 return couplingManager_->velocity(fvGeometry, ipData);
109 else
110 return asImp_().velocityAtPos(ipData.global());
111 }
112
116 template<class IpData>
117 Scalar velocityDivergence(const FVElementGeometry& fvGeometry, const IpData& ipData) const
118 {
119 if constexpr (isCoupled_)
120 return couplingManager_->velocityDivergence(fvGeometry, ipData);
121 else
122 return 0.0;
123 }
124
128 VelocityVector elementVelocity(const FVElementGeometry& fvGeometry) const
129 {
130 if constexpr (isCoupled_)
131 return couplingManager_->elementVelocity(fvGeometry);
132 else
133 return asImp_().velocityAtPos(fvGeometry.element().geometry().center());
134 }
135
139 VelocityVector velocityAtPos(const GlobalPosition&) const
140 {
141 DUNE_THROW(Dune::NotImplemented, "velocityAtPos not implemented");
142 }
143
144 const CouplingManager& couplingManager() const
145 {
146 if constexpr (isCoupled_)
147 return *couplingManager_;
148 else
149 DUNE_THROW(Dune::InvalidStateException,
150 "Accessing coupling manager of an uncoupled problem is not possible."
151 );
152 }
153
154private:
156 Implementation &asImp_()
157 { return *static_cast<Implementation *>(this); }
158
160 const Implementation &asImp_() const
161 { return *static_cast<const Implementation *>(this); }
162
163 std::shared_ptr<CouplingManager> couplingManager_;
164};
165
166template<class TypeTag>
168{
170 using Implementation = GetPropType<TypeTag, Properties::Problem>;
171
173 using GridView = typename GridGeometry::GridView;
174 using FVElementGeometry = typename GridGeometry::LocalView;
175 using Element = typename GridView::template Codim<0>::Entity;
176 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
177 using VelocityVector = GlobalPosition;
181
182 static constexpr bool isCoupled_ = !std::is_empty_v<CouplingManager>;
183
184public:
185
190 using InitialValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
191 using Sources = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
192 using DirichletValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
193 using BoundaryFluxes = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
194
196 using BoundaryTypes = Dumux::Experimental::BoundaryTypes<ModelTraits::numEq()>;
197
199 static constexpr bool isMomentumProblem() { return false; }
200
207 CVFENavierStokesMassProblem(std::shared_ptr<const GridGeometry> gridGeometry,
208 std::shared_ptr<CouplingManager> couplingManager,
209 const std::string& paramGroup = "")
210 : ParentType(gridGeometry, paramGroup)
211 , couplingManager_(couplingManager)
212 {}
213
219 CVFENavierStokesMassProblem(std::shared_ptr<const GridGeometry> gridGeometry,
220 const std::string& paramGroup = "")
222 {}
223
227 template<class SubControlVolumeFace>
228 VelocityVector faceVelocity(const Element& element,
229 const FVElementGeometry& fvGeometry,
230 const SubControlVolumeFace& scvf) const
231 {
232 if constexpr (isCoupled_)
233 return couplingManager_->faceVelocity(element, scvf);
234 else
235 return asImp_().velocityAtPos(scvf.ipGlobal());
236 }
237
241 template<class IpData>
242 VelocityVector velocity(const FVElementGeometry& fvGeometry, const IpData& ipData) const
243 {
244 if constexpr (isCoupled_)
245 return couplingManager_->velocity(fvGeometry, ipData);
246 else
247 return asImp_().velocityAtPos(ipData.global());
248 }
249
253 template<class IpData>
254 Scalar velocityDivergence(const FVElementGeometry& fvGeometry, const IpData& ipData) const
255 {
256 if constexpr (isCoupled_)
257 return couplingManager_->velocityDivergence(fvGeometry, ipData);
258 else
259 return 0.0;
260 }
261
265 VelocityVector elementVelocity(const FVElementGeometry& fvGeometry) const
266 {
267 if constexpr (isCoupled_)
268 return couplingManager_->elementVelocity(fvGeometry);
269 else
270 return asImp_().velocityAtPos(fvGeometry.element().geometry().center());
271 }
272
276 VelocityVector velocityAtPos(const GlobalPosition&) const
277 {
278 DUNE_THROW(Dune::NotImplemented, "velocityAtPos not implemented");
279 }
280
281 const CouplingManager& couplingManager() const
282 {
283 if constexpr (isCoupled_)
284 return *couplingManager_;
285 else
286 DUNE_THROW(Dune::InvalidStateException,
287 "Accessing coupling manager of an uncoupled problem is not possible."
288 );
289 }
290
291private:
293 Implementation &asImp_()
294 { return *static_cast<Implementation *>(this); }
295
297 const Implementation &asImp_() const
298 { return *static_cast<const Implementation *>(this); }
299
300 std::shared_ptr<CouplingManager> couplingManager_;
301};
302
309template<class TypeTag>
312>;
313
314} // end namespace Dumux
315
316#endif
Class to specify the type of a boundary.
Definition common/boundarytypes.hh:26
CVFENavierStokesMassProblem(std::shared_ptr< const GridGeometry > gridGeometry, const std::string &paramGroup="")
The constructor for usage without a coupling manager.
Definition freeflow/navierstokes/mass/problem.hh:219
CVFENavierStokesMassProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
The constructor.
Definition freeflow/navierstokes/mass/problem.hh:207
Scalar velocityDivergence(const FVElementGeometry &fvGeometry, const IpData &ipData) const
Returns the velocity divergence at a given interpolation point.
Definition freeflow/navierstokes/mass/problem.hh:254
Dune::FieldVector< Scalar, ModelTraits::numEq()> DirichletValues
Definition freeflow/navierstokes/mass/problem.hh:192
Dune::FieldVector< Scalar, ModelTraits::numEq()> Sources
Definition freeflow/navierstokes/mass/problem.hh:191
Dune::FieldVector< Scalar, ModelTraits::numEq()> BoundaryFluxes
Definition freeflow/navierstokes/mass/problem.hh:193
VelocityVector faceVelocity(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf) const
Returns the normal velocity at a given sub control volume face.
Definition freeflow/navierstokes/mass/problem.hh:228
static constexpr bool isMomentumProblem()
this problem is used for the mass balance model
Definition freeflow/navierstokes/mass/problem.hh:199
VelocityVector velocity(const FVElementGeometry &fvGeometry, const IpData &ipData) const
Returns the velocity at a given interpolation point.
Definition freeflow/navierstokes/mass/problem.hh:242
Dumux::Experimental::BoundaryTypes< ModelTraits::numEq()> BoundaryTypes
Export the boundary types.
Definition freeflow/navierstokes/mass/problem.hh:196
Dune::FieldVector< Scalar, ModelTraits::numEq()> InitialValues
Definition freeflow/navierstokes/mass/problem.hh:190
VelocityVector velocityAtPos(const GlobalPosition &) const
Returns the velocity at a given position.
Definition freeflow/navierstokes/mass/problem.hh:276
const CouplingManager & couplingManager() const
Definition freeflow/navierstokes/mass/problem.hh:281
VelocityVector elementVelocity(const FVElementGeometry &fvGeometry) const
Returns the velocity at the element center.
Definition freeflow/navierstokes/mass/problem.hh:265
const std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition common/problem.hh:301
Implementation & asImp_()
Returns the implementation of the problem (i.e. static polymorphism).
Definition common/problem.hh:306
const GridDiscretization & gridGeometry() const
The grid discretization.
Definition common/problem.hh:293
Base class for all problems using spatial parameters.
Definition problemwithspatialparams.hh:29
Implementation & asImp_()
Returns the implementation of the problem (i.e. static polymorphism).
Definition common/fvproblem.hh:529
FVProblemWithSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry, const std::string &paramGroup="")
Constructor.
Definition fvproblemwithspatialparams.hh:42
Definition freeflow/navierstokes/mass/problem.hh:30
VelocityVector elementVelocity(const FVElementGeometry &fvGeometry) const
Returns the velocity at the element center.
Definition freeflow/navierstokes/mass/problem.hh:128
Dune::FieldVector< Scalar, ModelTraits::numEq()> BoundaryFluxes
Definition freeflow/navierstokes/mass/problem.hh:56
Dumux::BoundaryTypes< ModelTraits::numEq()> BoundaryTypes
Export the boundary types.
Definition freeflow/navierstokes/mass/problem.hh:59
const CouplingManager & couplingManager() const
Definition freeflow/navierstokes/mass/problem.hh:144
VelocityVector velocity(const FVElementGeometry &fvGeometry, const IpData &ipData) const
Returns the velocity at a given interpolation point.
Definition freeflow/navierstokes/mass/problem.hh:105
Dune::FieldVector< Scalar, ModelTraits::numEq()> DirichletValues
Definition freeflow/navierstokes/mass/problem.hh:55
Scalar velocityDivergence(const FVElementGeometry &fvGeometry, const IpData &ipData) const
Returns the velocity divergence at a given interpolation point.
Definition freeflow/navierstokes/mass/problem.hh:117
NavierStokesMassProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, const std::string &paramGroup="")
The constructor for usage without a coupling manager.
Definition freeflow/navierstokes/mass/problem.hh:82
Dune::FieldVector< Scalar, ModelTraits::numEq()> Sources
Definition freeflow/navierstokes/mass/problem.hh:54
VelocityVector faceVelocity(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf) const
Returns the normal velocity at a given sub control volume face.
Definition freeflow/navierstokes/mass/problem.hh:91
NavierStokesMassProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
The constructor.
Definition freeflow/navierstokes/mass/problem.hh:70
VelocityVector velocityAtPos(const GlobalPosition &) const
Returns the velocity at a given position.
Definition freeflow/navierstokes/mass/problem.hh:139
Dune::FieldVector< Scalar, ModelTraits::numEq()> InitialValues
Definition freeflow/navierstokes/mass/problem.hh:53
static constexpr bool isMomentumProblem()
this problem is used for the mass balance model
Definition freeflow/navierstokes/mass/problem.hh:62
Defines all properties used in Dumux.
Base class for all finite volume problems that are parameterized.
NavierStokesMassProblemImpl< TypeTag, typename GetPropType< TypeTag, Properties::GridGeometry >::DiscretizationMethod > NavierStokesMassProblem
Navier-Stokes mass problem class.
Definition freeflow/navierstokes/mass/problem.hh:310
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition propertysystem.hh:296
The available discretization methods in Dumux.
Definition adapt.hh:17
A helper to deduce a vector with the same size as numbers of equations.
Base class for all problems using spatial parameters.
Quadrature rules over sub-control volumes and sub-control volume faces.