3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_NAVIERSTOKES_MASS_PROBLEM_HH
25#define DUMUX_NAVIERSTOKES_MASS_PROBLEM_HH
26
27#include <dune/common/exceptions.hh>
28#include <dune/common/typetraits.hh>
33
34namespace Dumux {
35
36// default implementation
37template<class TypeTag, class DiscretizationMethod>
39{
41 using Implementation = GetPropType<TypeTag, Properties::Problem>;
42
44 using GridView = typename GridGeometry::GridView;
45 using FVElementGeometry = typename GridGeometry::LocalView;
46 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
47 using Element = typename GridView::template Codim<0>::Entity;
48 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
49 using VelocityVector = GlobalPosition;
53
54 static constexpr bool isCoupled_ = !std::is_empty_v<CouplingManager>;
55
56public:
57
62 using InitialValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
63 using Sources = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
64 using DirichletValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
65 using BoundaryFluxes = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
66
68 using BoundaryTypes = Dumux::BoundaryTypes<ModelTraits::numEq()>;
69
71 static constexpr bool isMomentumProblem() { return false; }
72
79 NavierStokesMassProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
80 std::shared_ptr<CouplingManager> couplingManager,
81 const std::string& paramGroup = "")
83 , couplingManager_(couplingManager)
84 {}
85
91 NavierStokesMassProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
92 const std::string& paramGroup = "")
94 {}
95
99 VelocityVector faceVelocity(const Element& element,
100 const FVElementGeometry& fvGeometry,
101 const SubControlVolumeFace& scvf) const
102 {
103 if constexpr (isCoupled_)
104 return couplingManager_->faceVelocity(element, scvf);
105 else
106 return asImp_().velocityAtPos(scvf.ipGlobal());
107 }
108
112 VelocityVector elementVelocity(const FVElementGeometry& fvGeometry) const
113 {
114 if constexpr (isCoupled_)
115 return couplingManager_->elementVelocity(fvGeometry);
116 else
117 return asImp_().velocityAtPos(fvGeometry.element().geometry().center());
118 }
119
123 VelocityVector velocityAtPos(const GlobalPosition&) const
124 {
125 DUNE_THROW(Dune::NotImplemented, "velocityAtPos not implemented");
126 }
127
128 const CouplingManager& couplingManager() const
129 {
130 if constexpr (isCoupled_)
131 return *couplingManager_;
132 else
133 DUNE_THROW(Dune::InvalidStateException,
134 "Accessing coupling manager of an uncoupled problem is not possible."
135 );
136 }
137
138private:
140 Implementation &asImp_()
141 { return *static_cast<Implementation *>(this); }
142
144 const Implementation &asImp_() const
145 { return *static_cast<const Implementation *>(this); }
146
147 std::shared_ptr<CouplingManager> couplingManager_;
148};
149
156template<class TypeTag>
159>;
160
161} // end namespace Dumux
162
163#endif
A helper to deduce a vector with the same size as numbers of equations.
Base class for all finite volume problems that are parameterized.
The available discretization methods in Dumux.
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:180
Class to specify the type of a boundary.
Definition: common/boundarytypes.hh:38
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:55
const std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition: common/fvproblem.hh:544
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:540
Base class for all finite-volume problems using spatial parameters.
Definition: fvproblemwithspatialparams.hh:41
Definition: freeflow/navierstokes/mass/problem.hh:39
VelocityVector elementVelocity(const FVElementGeometry &fvGeometry) const
Returns the velocity at the element center.
Definition: freeflow/navierstokes/mass/problem.hh:112
Dune::FieldVector< Scalar, ModelTraits::numEq()> BoundaryFluxes
Definition: freeflow/navierstokes/mass/problem.hh:65
const CouplingManager & couplingManager() const
Definition: freeflow/navierstokes/mass/problem.hh:128
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:99
Dune::FieldVector< Scalar, ModelTraits::numEq()> DirichletValues
Definition: freeflow/navierstokes/mass/problem.hh:64
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:91
Dune::FieldVector< Scalar, ModelTraits::numEq()> Sources
Definition: freeflow/navierstokes/mass/problem.hh:63
NavierStokesMassProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
The constructor.
Definition: freeflow/navierstokes/mass/problem.hh:79
VelocityVector velocityAtPos(const GlobalPosition &) const
Returns the velocity at a given position.
Definition: freeflow/navierstokes/mass/problem.hh:123
Dune::FieldVector< Scalar, ModelTraits::numEq()> InitialValues
Definition: freeflow/navierstokes/mass/problem.hh:62
static constexpr bool isMomentumProblem()
this problem is used for the mass balance model
Definition: freeflow/navierstokes/mass/problem.hh:71
Declares all properties used in Dumux.