12#ifndef DUMUX_NAVIERSTOKES_MASS_PROBLEM_HH
13#define DUMUX_NAVIERSTOKES_MASS_PROBLEM_HH
15#include <dune/common/exceptions.hh>
16#include <dune/common/typetraits.hh>
25template<
class TypeTag,
class DiscretizationMethod>
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;
42 static constexpr bool isCoupled_ = !std::is_empty_v<CouplingManager>;
51 using Sources = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
88 const FVElementGeometry& fvGeometry,
89 const SubControlVolumeFace& scvf)
const
91 if constexpr (isCoupled_)
92 return couplingManager_->faceVelocity(element, scvf);
94 return asImp_().velocityAtPos(scvf.ipGlobal());
102 if constexpr (isCoupled_)
103 return couplingManager_->elementVelocity(fvGeometry);
105 return asImp_().velocityAtPos(fvGeometry.element().geometry().center());
113 DUNE_THROW(Dune::NotImplemented,
"velocityAtPos not implemented");
118 if constexpr (isCoupled_)
119 return *couplingManager_;
121 DUNE_THROW(Dune::InvalidStateException,
122 "Accessing coupling manager of an uncoupled problem is not possible."
128 Implementation &asImp_()
129 {
return *
static_cast<Implementation *
>(
this); }
132 const Implementation &asImp_()
const
133 {
return *
static_cast<const Implementation *
>(
this); }
135 std::shared_ptr<CouplingManager> couplingManager_;
138template<
class TypeTag>
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;
155 static constexpr bool isCoupled_ = !std::is_empty_v<CouplingManager>;
164 using Sources = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
213 template<
class ElementVariables,
class IpData>
215 const ElementVariables& elemVars,
216 const IpData& ipData)
const
218 return asImp_().sourceAtPos(ipData.global());
228 template<
class Intersection>
230 const Intersection& intersection)
const
233 return asImp_().boundaryTypesAtPos(intersection.geometry().center());
244 template<
class FaceIpData>
246 const FaceIpData& faceIpData)
const
249 return asImp_().dirichletAtPos(faceIpData.global());
260 template<
class ElementVariables,
class ElementFluxVariablesCache,
class FaceIpData>
262 const ElementVariables& elemVars,
263 const ElementFluxVariablesCache& elemFluxVarsCache,
264 const FaceIpData& faceIpData)
const
266 return asImp_().boundaryFluxAtPos(faceIpData.global());
279 const FVElementGeometry& fvGeometry,
280 const SubControlVolumeFace& scvf)
const
282 if constexpr (isCoupled_)
283 return couplingManager_->faceVelocity(element, scvf);
285 return asImp_().velocityAtPos(scvf.ipGlobal());
293 if constexpr (isCoupled_)
294 return couplingManager_->elementVelocity(fvGeometry);
296 return asImp_().velocityAtPos(fvGeometry.element().geometry().center());
304 DUNE_THROW(Dune::NotImplemented,
"velocityAtPos not implemented");
309 if constexpr (isCoupled_)
310 return *couplingManager_;
312 DUNE_THROW(Dune::InvalidStateException,
313 "Accessing coupling manager of an uncoupled problem is not possible."
319 Implementation &asImp_()
320 {
return *
static_cast<Implementation *
>(
this); }
323 const Implementation &asImp_()
const
324 {
return *
static_cast<const Implementation *
>(
this); }
326 std::shared_ptr<CouplingManager> couplingManager_;
335template<
class TypeTag>
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 ¶mGroup="")
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 ¶mGroup="")
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 ¶mGroup="")
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 ¶mGroup="")
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.
A helper to deduce a vector with the same size as numbers of equations.