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 VelocityVector faceVelocity(const Element& element,
91 const FVElementGeometry& fvGeometry,
92 const SubControlVolumeFace& scvf) const
93 {
94 if constexpr (isCoupled_)
95 return couplingManager_->faceVelocity(element, scvf);
96 else
97 return asImp_().velocityAtPos(scvf.ipGlobal());
98 }
99
103 template<class IpData>
104 VelocityVector velocity(const FVElementGeometry& fvGeometry, const IpData& ipData) const
105 {
106 if constexpr (isCoupled_)
107 return couplingManager_->velocity(fvGeometry, ipData);
108 else
109 return asImp_().velocityAtPos(ipData.global());
110 }
111
115 VelocityVector elementVelocity(const FVElementGeometry& fvGeometry) const
116 {
117 if constexpr (isCoupled_)
118 return couplingManager_->elementVelocity(fvGeometry);
119 else
120 return asImp_().velocityAtPos(fvGeometry.element().geometry().center());
121 }
122
126 VelocityVector velocityAtPos(const GlobalPosition&) const
127 {
128 DUNE_THROW(Dune::NotImplemented, "velocityAtPos not implemented");
129 }
130
131 const CouplingManager& couplingManager() const
132 {
133 if constexpr (isCoupled_)
134 return *couplingManager_;
135 else
136 DUNE_THROW(Dune::InvalidStateException,
137 "Accessing coupling manager of an uncoupled problem is not possible."
138 );
139 }
140
141private:
143 Implementation &asImp_()
144 { return *static_cast<Implementation *>(this); }
145
147 const Implementation &asImp_() const
148 { return *static_cast<const Implementation *>(this); }
149
150 std::shared_ptr<CouplingManager> couplingManager_;
151};
152
153template<class TypeTag>
155{
157 using Implementation = GetPropType<TypeTag, Properties::Problem>;
158
160 using GridView = typename GridGeometry::GridView;
161 using FVElementGeometry = typename GridGeometry::LocalView;
162 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
163 using Element = typename GridView::template Codim<0>::Entity;
164 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
165 using VelocityVector = GlobalPosition;
169
170 static constexpr bool isCoupled_ = !std::is_empty_v<CouplingManager>;
171
172public:
173
178 using InitialValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
179 using Sources = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
180 using DirichletValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
181 using BoundaryFluxes = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
182
184 using BoundaryTypes = Dumux::Experimental::BoundaryTypes<ModelTraits::numEq()>;
185
187 static constexpr bool isMomentumProblem() { return false; }
188
195 CVFENavierStokesMassProblem(std::shared_ptr<const GridGeometry> gridGeometry,
196 std::shared_ptr<CouplingManager> couplingManager,
197 const std::string& paramGroup = "")
198 : ParentType(gridGeometry, paramGroup)
199 , couplingManager_(couplingManager)
200 {}
201
207 CVFENavierStokesMassProblem(std::shared_ptr<const GridGeometry> gridGeometry,
208 const std::string& paramGroup = "")
210 {}
211
215 VelocityVector faceVelocity(const Element& element,
216 const FVElementGeometry& fvGeometry,
217 const SubControlVolumeFace& scvf) const
218 {
219 if constexpr (isCoupled_)
220 return couplingManager_->faceVelocity(element, scvf);
221 else
222 return asImp_().velocityAtPos(scvf.ipGlobal());
223 }
224
228 template<class IpData>
229 VelocityVector velocity(const FVElementGeometry& fvGeometry, const IpData& ipData) const
230 {
231 if constexpr (isCoupled_)
232 return couplingManager_->velocity(fvGeometry, ipData);
233 else
234 return asImp_().velocityAtPos(ipData.global());
235 }
236
240 VelocityVector elementVelocity(const FVElementGeometry& fvGeometry) const
241 {
242 if constexpr (isCoupled_)
243 return couplingManager_->elementVelocity(fvGeometry);
244 else
245 return asImp_().velocityAtPos(fvGeometry.element().geometry().center());
246 }
247
251 VelocityVector velocityAtPos(const GlobalPosition&) const
252 {
253 DUNE_THROW(Dune::NotImplemented, "velocityAtPos not implemented");
254 }
255
256 const CouplingManager& couplingManager() const
257 {
258 if constexpr (isCoupled_)
259 return *couplingManager_;
260 else
261 DUNE_THROW(Dune::InvalidStateException,
262 "Accessing coupling manager of an uncoupled problem is not possible."
263 );
264 }
265
266private:
268 Implementation &asImp_()
269 { return *static_cast<Implementation *>(this); }
270
272 const Implementation &asImp_() const
273 { return *static_cast<const Implementation *>(this); }
274
275 std::shared_ptr<CouplingManager> couplingManager_;
276};
277
284template<class TypeTag>
287>;
288
289} // end namespace Dumux
290
291#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:207
CVFENavierStokesMassProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
The constructor.
Definition freeflow/navierstokes/mass/problem.hh:195
Dune::FieldVector< Scalar, ModelTraits::numEq()> DirichletValues
Definition freeflow/navierstokes/mass/problem.hh:180
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:215
Dune::FieldVector< Scalar, ModelTraits::numEq()> Sources
Definition freeflow/navierstokes/mass/problem.hh:179
Dune::FieldVector< Scalar, ModelTraits::numEq()> BoundaryFluxes
Definition freeflow/navierstokes/mass/problem.hh:181
static constexpr bool isMomentumProblem()
this problem is used for the mass balance model
Definition freeflow/navierstokes/mass/problem.hh:187
VelocityVector velocity(const FVElementGeometry &fvGeometry, const IpData &ipData) const
Returns the velocity at a given interpolation point.
Definition freeflow/navierstokes/mass/problem.hh:229
Dumux::Experimental::BoundaryTypes< ModelTraits::numEq()> BoundaryTypes
Export the boundary types.
Definition freeflow/navierstokes/mass/problem.hh:184
Dune::FieldVector< Scalar, ModelTraits::numEq()> InitialValues
Definition freeflow/navierstokes/mass/problem.hh:178
VelocityVector velocityAtPos(const GlobalPosition &) const
Returns the velocity at a given position.
Definition freeflow/navierstokes/mass/problem.hh:251
const CouplingManager & couplingManager() const
Definition freeflow/navierstokes/mass/problem.hh:256
VelocityVector elementVelocity(const FVElementGeometry &fvGeometry) const
Returns the velocity at the element center.
Definition freeflow/navierstokes/mass/problem.hh:240
const std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition common/problem.hh:304
Implementation & asImp_()
Returns the implementation of the problem (i.e. static polymorphism).
Definition common/problem.hh:309
const GridDiscretization & gridGeometry() const
The grid discretization.
Definition common/problem.hh:296
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:115
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:131
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:90
VelocityVector velocity(const FVElementGeometry &fvGeometry, const IpData &ipData) const
Returns the velocity at a given interpolation point.
Definition freeflow/navierstokes/mass/problem.hh:104
Dune::FieldVector< Scalar, ModelTraits::numEq()> DirichletValues
Definition freeflow/navierstokes/mass/problem.hh:55
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
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:126
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:285
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.