3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
freeflow/rans/twoeq/lowrekepsilon/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_LOWREKEPSILON_PROBLEM_HH
25#define DUMUX_LOWREKEPSILON_PROBLEM_HH
26
34
35#include "model.hh"
36
37namespace Dumux {
38
45template<class TypeTag>
47{
48 using ParentType = RANSProblemBase<TypeTag>;
49 using Implementation = GetPropType<TypeTag, Properties::Problem>;
51
53 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
54
58 using CellCenterPrimaryVariables = GetPropType<TypeTag, Properties::CellCenterPrimaryVariables>;
60
61public:
63 RANSProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry, const std::string& paramGroup = "")
64 : ParentType(gridGeometry, paramGroup)
65 {
66 useStoredEddyViscosity_ = getParamFromGroup<bool>(this->paramGroup(), "RANS.UseStoredEddyViscosity", true);
67 }
68
73 {
74 ParentType::updateStaticWallProperties();
75
76 // update size and initial values of the global vectors
77 storedDissipationTilde_.resize(this->gridGeometry().elementMapper().size(), 0.0);
78 storedDynamicEddyViscosity_.resize(this->gridGeometry().elementMapper().size(), 0.0);
79 storedTurbulentKineticEnergy_.resize(this->gridGeometry().elementMapper().size(), 0.0);
80 }
81
87 void updateDynamicWallProperties(const SolutionVector& curSol)
88 {
89 ParentType::updateDynamicWallProperties(curSol);
90
91 for (const auto& element : elements(this->gridGeometry().gridView()))
92 {
93 unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
94
95 auto fvGeometry = localView(this->gridGeometry());
96 fvGeometry.bindElement(element);
97 for (auto&& scv : scvs(fvGeometry))
98 {
99 const int dofIdx = scv.dofIndex();
100 const auto& cellCenterPriVars = curSol[GridGeometry::cellCenterIdx()][dofIdx];
101 PrimaryVariables priVars = makePriVarsFromCellCenterPriVars<PrimaryVariables>(cellCenterPriVars);
102 auto elemSol = elementSolution<typename GridGeometry::LocalView>(std::move(priVars));
103 // NOTE: first update the turbulence quantities
104 storedDissipationTilde_[elementIdx] = elemSol[0][Indices::dissipationEqIdx];
105 storedTurbulentKineticEnergy_[elementIdx] = elemSol[0][Indices::turbulentKineticEnergyEqIdx];
106 // NOTE: then update the volVars
107 VolumeVariables volVars;
108 volVars.update(elemSol, asImp_(), element, scv);
109 storedDynamicEddyViscosity_[elementIdx] = volVars.calculateEddyViscosity();
110 }
111 }
112 }
113
114public:
115 std::vector<Scalar> storedDissipationTilde_;
116 std::vector<Scalar> storedDynamicEddyViscosity_;
117 std::vector<Scalar> storedTurbulentKineticEnergy_;
119
120private:
122 Implementation &asImp_()
123 { return *static_cast<Implementation *>(this); }
124
126 const Implementation &asImp_() const
127 { return *static_cast<const Implementation *>(this); }
128};
129
130}
131
132#endif
Base class for all staggered fv problems.
Free function to get the local view of a grid cache object.
The available discretization methods in Dumux.
The available free flow turbulence models in Dumux.
TurbulenceModel
The available free flow turbulence models in Dumux.
Definition: turbulencemodel.hh:37
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
forward declare
Definition: freeflow/rans/problem.hh:41
Reynolds-Averaged Navier-Stokes problem base class.
Definition: freeflow/rans/problem.hh:57
bool useStoredEddyViscosity_
Definition: freeflow/rans/twoeq/lowrekepsilon/problem.hh:118
void updateStaticWallProperties()
Correct size of the static (solution independent) wall variables.
Definition: freeflow/rans/twoeq/lowrekepsilon/problem.hh:72
std::vector< Scalar > storedTurbulentKineticEnergy_
Definition: freeflow/rans/twoeq/lowrekepsilon/problem.hh:117
RANSProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, const std::string &paramGroup="")
The constructor sets the gravity, if desired by the user.
Definition: freeflow/rans/twoeq/lowrekepsilon/problem.hh:63
std::vector< Scalar > storedDissipationTilde_
Definition: freeflow/rans/twoeq/lowrekepsilon/problem.hh:115
void updateDynamicWallProperties(const SolutionVector &curSol)
Update the dynamic (solution dependent) relations to the walls.
Definition: freeflow/rans/twoeq/lowrekepsilon/problem.hh:87
std::vector< Scalar > storedDynamicEddyViscosity_
Definition: freeflow/rans/twoeq/lowrekepsilon/problem.hh:116
Declares all properties used in Dumux.
Adaption of the fully implicit scheme to the tracer transport model.
The local element solution class for staggered methods.