version 3.11-dev
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>
21
22namespace Dumux {
23
24// default implementation
25template<class TypeTag, class DiscretizationMethod>
27{
29 using Implementation = GetPropType<TypeTag, Properties::Problem>;
30
32 using GridView = typename GridGeometry::GridView;
33 using FVElementGeometry = typename GridGeometry::LocalView;
34 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
35 using Element = typename GridView::template Codim<0>::Entity;
36 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
37 using VelocityVector = GlobalPosition;
41
42 static constexpr bool isCoupled_ = !std::is_empty_v<CouplingManager>;
43
44public:
45
50 using InitialValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
51 using Sources = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
52 using DirichletValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
53 using BoundaryFluxes = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
54
56 using BoundaryTypes = Dumux::BoundaryTypes<ModelTraits::numEq()>;
57
59 static constexpr bool isMomentumProblem() { return false; }
60
67 NavierStokesMassProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
68 std::shared_ptr<CouplingManager> couplingManager,
69 const std::string& paramGroup = "")
71 , couplingManager_(couplingManager)
72 {}
73
79 NavierStokesMassProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
80 const std::string& paramGroup = "")
82 {}
83
87 VelocityVector faceVelocity(const Element& element,
88 const FVElementGeometry& fvGeometry,
89 const SubControlVolumeFace& scvf) const
90 {
91 if constexpr (isCoupled_)
92 return couplingManager_->faceVelocity(element, scvf);
93 else
94 return asImp_().velocityAtPos(scvf.ipGlobal());
95 }
96
100 VelocityVector elementVelocity(const FVElementGeometry& fvGeometry) const
101 {
102 if constexpr (isCoupled_)
103 return couplingManager_->elementVelocity(fvGeometry);
104 else
105 return asImp_().velocityAtPos(fvGeometry.element().geometry().center());
106 }
107
111 VelocityVector velocityAtPos(const GlobalPosition&) const
112 {
113 DUNE_THROW(Dune::NotImplemented, "velocityAtPos not implemented");
114 }
115
116 const CouplingManager& couplingManager() const
117 {
118 if constexpr (isCoupled_)
119 return *couplingManager_;
120 else
121 DUNE_THROW(Dune::InvalidStateException,
122 "Accessing coupling manager of an uncoupled problem is not possible."
123 );
124 }
125
126private:
128 Implementation &asImp_()
129 { return *static_cast<Implementation *>(this); }
130
132 const Implementation &asImp_() const
133 { return *static_cast<const Implementation *>(this); }
134
135 std::shared_ptr<CouplingManager> couplingManager_;
136};
137
138template<class TypeTag>
140{
142 using Implementation = GetPropType<TypeTag, Properties::Problem>;
143
145 using GridView = typename GridGeometry::GridView;
146 using FVElementGeometry = typename GridGeometry::LocalView;
147 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
148 using Element = typename GridView::template Codim<0>::Entity;
149 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
150 using VelocityVector = GlobalPosition;
154
155 static constexpr bool isCoupled_ = !std::is_empty_v<CouplingManager>;
156
157public:
158
163 using InitialValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
164 using Sources = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
165 using DirichletValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
166 using BoundaryFluxes = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
167
169 using BoundaryTypes = Dumux::BoundaryTypes<ModelTraits::numEq()>;
170
172 static constexpr bool isMomentumProblem() { return false; }
173
180 CVFENavierStokesMassProblem(std::shared_ptr<const GridGeometry> gridGeometry,
181 std::shared_ptr<CouplingManager> couplingManager,
182 const std::string& paramGroup = "")
184 , couplingManager_(couplingManager)
185 {}
186
192 CVFENavierStokesMassProblem(std::shared_ptr<const GridGeometry> gridGeometry,
193 const std::string& paramGroup = "")
195 {}
196
197 using ParentType::source;
213 template<class ElementVariables, class IpData>
214 Sources source(const FVElementGeometry& fvGeometry,
215 const ElementVariables& elemVars,
216 const IpData& ipData) const
217 {
218 return asImp_().sourceAtPos(ipData.global());
219 }
220
228 template<class Intersection>
229 BoundaryTypes boundaryTypes(const FVElementGeometry& fvGeometry,
230 const Intersection& intersection) const
231 {
232 // forward it to the method which only takes the global coordinate
233 return asImp_().boundaryTypesAtPos(intersection.geometry().center());
234 }
235
244 template<class FaceIpData>
245 DirichletValues dirichlet(const FVElementGeometry& fvGeometry,
246 const FaceIpData& faceIpData) const
247 {
248 // forward it to the method which only takes the global coordinate
249 return asImp_().dirichletAtPos(faceIpData.global());
250 }
251
260 template<class ElementVariables, class ElementFluxVariablesCache, class FaceIpData>
261 BoundaryFluxes boundaryFlux(const FVElementGeometry& fvGeometry,
262 const ElementVariables& elemVars,
263 const ElementFluxVariablesCache& elemFluxVarsCache,
264 const FaceIpData& faceIpData) const
265 {
266 return asImp_().boundaryFluxAtPos(faceIpData.global());
267 }
268
272 BoundaryFluxes boundaryFluxAtPos(const GlobalPosition& globalPos) const
273 { return BoundaryFluxes(0.0); }
274
278 VelocityVector faceVelocity(const Element& element,
279 const FVElementGeometry& fvGeometry,
280 const SubControlVolumeFace& scvf) const
281 {
282 if constexpr (isCoupled_)
283 return couplingManager_->faceVelocity(element, scvf);
284 else
285 return asImp_().velocityAtPos(scvf.ipGlobal());
286 }
287
291 VelocityVector elementVelocity(const FVElementGeometry& fvGeometry) const
292 {
293 if constexpr (isCoupled_)
294 return couplingManager_->elementVelocity(fvGeometry);
295 else
296 return asImp_().velocityAtPos(fvGeometry.element().geometry().center());
297 }
298
302 VelocityVector velocityAtPos(const GlobalPosition&) const
303 {
304 DUNE_THROW(Dune::NotImplemented, "velocityAtPos not implemented");
305 }
306
307 const CouplingManager& couplingManager() const
308 {
309 if constexpr (isCoupled_)
310 return *couplingManager_;
311 else
312 DUNE_THROW(Dune::InvalidStateException,
313 "Accessing coupling manager of an uncoupled problem is not possible."
314 );
315 }
316
317private:
319 Implementation &asImp_()
320 { return *static_cast<Implementation *>(this); }
321
323 const Implementation &asImp_() const
324 { return *static_cast<const Implementation *>(this); }
325
326 std::shared_ptr<CouplingManager> couplingManager_;
327};
328
335template<class TypeTag>
338>;
339
340} // end namespace Dumux
341
342#endif
Class to specify the type of a boundary.
Definition: common/boundarytypes.hh:26
Definition: freeflow/navierstokes/mass/problem.hh:140
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:192
CVFENavierStokesMassProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
The constructor.
Definition: freeflow/navierstokes/mass/problem.hh:180
Dune::FieldVector< Scalar, ModelTraits::numEq()> DirichletValues
Definition: freeflow/navierstokes/mass/problem.hh:165
VelocityVector faceVelocity(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf) const
A default, i.e. if the user's does not overload any boundaryFlux method.
Definition: freeflow/navierstokes/mass/problem.hh:278
Dune::FieldVector< Scalar, ModelTraits::numEq()> Sources
Definition: freeflow/navierstokes/mass/problem.hh:164
Dune::FieldVector< Scalar, ModelTraits::numEq()> BoundaryFluxes
Definition: freeflow/navierstokes/mass/problem.hh:166
static constexpr bool isMomentumProblem()
this problem is used for the mass balance model
Definition: freeflow/navierstokes/mass/problem.hh:172
BoundaryFluxes boundaryFlux(const FVElementGeometry &fvGeometry, const ElementVariables &elemVars, const ElementFluxVariablesCache &elemFluxVarsCache, const FaceIpData &faceIpData) const
Evaluates the boundary flux related to a localDof at a given interpolation point.
Definition: freeflow/navierstokes/mass/problem.hh:261
DirichletValues dirichlet(const FVElementGeometry &fvGeometry, const FaceIpData &faceIpData) const
Evaluate the boundary conditions for a Dirichlet control volume.
Definition: freeflow/navierstokes/mass/problem.hh:245
Sources source(const FVElementGeometry &fvGeometry, const ElementVariables &elemVars, const IpData &ipData) const
Evaluate the source term at a given interpolation point, related to the residual of a local dof.
Definition: freeflow/navierstokes/mass/problem.hh:214
Dune::FieldVector< Scalar, ModelTraits::numEq()> InitialValues
Definition: freeflow/navierstokes/mass/problem.hh:163
BoundaryFluxes boundaryFluxAtPos(const GlobalPosition &globalPos) const
Returns the boundary flux at a given position.
Definition: freeflow/navierstokes/mass/problem.hh:272
VelocityVector velocityAtPos(const GlobalPosition &) const
Returns the velocity at a given position.
Definition: freeflow/navierstokes/mass/problem.hh:302
const CouplingManager & couplingManager() const
Definition: freeflow/navierstokes/mass/problem.hh:307
BoundaryTypes boundaryTypes(const FVElementGeometry &fvGeometry, const Intersection &intersection) const
Specifies which kind of boundary condition should be used for which equation on a given boundary face...
Definition: freeflow/navierstokes/mass/problem.hh:229
VelocityVector elementVelocity(const FVElementGeometry &fvGeometry) const
Returns the velocity at the element center.
Definition: freeflow/navierstokes/mass/problem.hh:291
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:43
const std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition: common/fvproblem.hh:524
PrimaryVariables dirichlet(const Element &element, const SubControlVolumeFace &scvf) const
Evaluate the boundary conditions for a dirichlet control volume face.
Definition: common/fvproblem.hh:178
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:520
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluate the source term for all phases within a given sub-control-volume.
Definition: common/fvproblem.hh:307
Base class for all finite-volume problems using spatial parameters.
Definition: fvproblemwithspatialparams.hh:29
Definition: freeflow/navierstokes/mass/problem.hh:27
VelocityVector elementVelocity(const FVElementGeometry &fvGeometry) const
Returns the velocity at the element center.
Definition: freeflow/navierstokes/mass/problem.hh:100
Dune::FieldVector< Scalar, ModelTraits::numEq()> BoundaryFluxes
Definition: freeflow/navierstokes/mass/problem.hh:53
const CouplingManager & couplingManager() const
Definition: freeflow/navierstokes/mass/problem.hh:116
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:87
Dune::FieldVector< Scalar, ModelTraits::numEq()> DirichletValues
Definition: freeflow/navierstokes/mass/problem.hh:52
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:79
Dune::FieldVector< Scalar, ModelTraits::numEq()> Sources
Definition: freeflow/navierstokes/mass/problem.hh:51
NavierStokesMassProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
The constructor.
Definition: freeflow/navierstokes/mass/problem.hh:67
VelocityVector velocityAtPos(const GlobalPosition &) const
Returns the velocity at a given position.
Definition: freeflow/navierstokes/mass/problem.hh:111
Dune::FieldVector< Scalar, ModelTraits::numEq()> InitialValues
Definition: freeflow/navierstokes/mass/problem.hh:50
static constexpr bool isMomentumProblem()
this problem is used for the mass balance model
Definition: freeflow/navierstokes/mass/problem.hh:59
Defines all properties used in Dumux.
Base class for all finite volume problems that are parameterized.
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.