version 3.8
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-FileCopyrightInfo: 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
144template<class TypeTag>
147>;
148
149} // end namespace Dumux
150
151#endif
Class to specify the type of a boundary.
Definition: common/boundarytypes.hh:26
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:528
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:524
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.