Commit 9e7afdf0 authored by Thomas Fetzer's avatar Thomas Fetzer
Browse files

[zeroeq] Implement model names instead of model numbers

parent 07116203
#install headers
install(FILES
model.hh
models.hh
problem.hh
volumevariables.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/freeflow/rans/zeroeq)
......@@ -27,7 +27,10 @@
* These models calculate the eddy viscosity without solving additional PDEs,
* only based on the wall distance and the velocity gradient.
*
* \copydoc Dumux::EddyViscosityModels
* The following models are available:
* -# Prandtl's mixing length, e.g. \cite Oertel2012a
* -# Van-Driest modification, \cite vanDriest1956a and \cite Hanna1981a
* -# Baldwin-Lomax, \cite Baldwin1978a
*/
#ifndef DUMUX_ZEROEQ_MODEL_HH
......
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \ingroup ZeroEqModel
* \copydoc Dumux::EddyViscosityModels
*/
#ifndef DUMUX_ZEROEQ_MODELS_HH
#define DUMUX_ZEROEQ_MODELS_HH
namespace Dumux {
/*!
* \ingroup ZeroEqModel
* \brief The available 0-eq. eddy viscosity models.
*
* The following models are available:
* -# Prandtl's mixing length, e.g. \cite Oertel2012a
* -# Van-Driest modification, \cite vanDriest1956a and \cite Hanna1981a
* -# Baldwin-Lomax, \cite Baldwin1978a
*/
class EddyViscosityModels
{
public:
static constexpr int none = 0;
static constexpr int prandtl = 1;
static constexpr int modifiedVanDriest = 2;
static constexpr int baldwinLomax = 3;
};
} // end namespace Dumux
#endif
......@@ -24,6 +24,8 @@
#ifndef DUMUX_ZEROEQ_PROBLEM_HH
#define DUMUX_ZEROEQ_PROBLEM_HH
#include <string>
#include <dumux/common/properties.hh>
#include <dumux/common/staggeredfvproblem.hh>
#include <dumux/discretization/localview.hh>
......@@ -32,7 +34,6 @@
#include <dumux/freeflow/rans/problem.hh>
#include "model.hh"
#include "models.hh"
namespace Dumux {
......@@ -77,7 +78,7 @@ public:
ZeroEqProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, const std::string& paramGroup = "")
: ParentType(fvGridGeometry, paramGroup)
{
eddyViscosityModel_ = getParamFromGroup<int>(paramGroup, "RANS.EddyViscosityModel", 1);
eddyViscosityModel_ = getParamFromGroup<std::string>(paramGroup, "RANS.EddyViscosityModel", "vanDriest");
}
/*!
......@@ -127,7 +128,7 @@ public:
volVars.update(elemSol, asImp_(), element, scv);
Scalar ksPlus = this->sandGrainRoughness_[elementID] * volVars.uStar() / volVars.kinematicViscosity();
if (ksPlus > 0 && eddyViscosityModel_ == EddyViscosityModels::baldwinLomax)
if (ksPlus > 0 && eddyViscosityModel_.compare("baldwinLomax") == 0)
{
DUNE_THROW(Dune::NotImplemented, "Roughness is not implemented for the Baldwin-Lomax model.");
}
......@@ -151,7 +152,7 @@ public:
}
// update routine for specfic models
if (eddyViscosityModel_ == EddyViscosityModels::baldwinLomax)
if (eddyViscosityModel_.compare("baldwinLomax") == 0)
updateBaldwinLomaxProperties();
}
......@@ -265,7 +266,7 @@ public:
}
public:
int eddyViscosityModel_;
std::string eddyViscosityModel_;
std::vector<Scalar> kinematicEddyViscosity_;
std::vector<Scalar> additionalRoughnessLength_;
......
......@@ -25,9 +25,10 @@
#ifndef DUMUX_ZEROEQ_VOLUME_VARIABLES_HH
#define DUMUX_ZEROEQ_VOLUME_VARIABLES_HH
#include <string>
#include <dune/common/exceptions.hh>
#include <dumux/freeflow/rans/volumevariables.hh>
#include "models.hh"
namespace Dumux
{
......@@ -94,7 +95,7 @@ public:
RANSParentType::updateRANSProperties(elemSol, problem, element, scv);
additionalRoughnessLength_ = problem.additionalRoughnessLength_[RANSParentType::elementID()];
yPlusRough_ = wallDistanceRough() * RANSParentType::uStar() / RANSParentType::kinematicViscosity();
dynamicEddyViscosity_ = calculateEddyViscosity(elemSol, problem, element, scv);
dynamicEddyViscosity_ = calculateEddyViscosity(elemSol, problem, element, scv, problem.eddyViscosityModel_);
calculateEddyDiffusivity(problem);
}
......@@ -129,12 +130,14 @@ public:
* \param problem The object specifying the problem which ought to be simulated
* \param element An element which contains part of the control volume
* \param scv The sub-control volume
* \param modelName The name of the used model
*/
template<class ElementSolution, class Problem, class Element, class SubControlVolume>
Scalar calculateEddyViscosity(const ElementSolution &elemSol,
const Problem &problem,
const Element &element,
const SubControlVolume& scv)
const SubControlVolume& scv,
const std::string modelName)
{
using std::abs;
using std::exp;
......@@ -144,30 +147,30 @@ public:
unsigned int wallNormalAxis = problem.wallNormalAxis_[RANSParentType::elementID()];
Scalar velGrad = abs(RANSParentType::velocityGradients()[flowNormalAxis][wallNormalAxis]);
if (problem.eddyViscosityModel_ == EddyViscosityModels::none)
if (modelName.compare("none") == 0)
{
// kinematicEddyViscosity = 0.0
}
else if (problem.eddyViscosityModel_ == EddyViscosityModels::prandtl)
else if (modelName.compare("prandtl") == 0)
{
Scalar mixingLength = problem.karmanConstant() * wallDistanceRough();
kinematicEddyViscosity = mixingLength * mixingLength * velGrad;
}
else if (problem.eddyViscosityModel_ == EddyViscosityModels::modifiedVanDriest)
else if (modelName.compare("vanDriest") == 0)
{
Scalar mixingLength = problem.karmanConstant() * wallDistanceRough()
* (1.0 - exp(-yPlusRough() / 26.0))
/ sqrt(1.0 - exp(-0.26 * yPlusRough()));
kinematicEddyViscosity = mixingLength * mixingLength * velGrad;
}
else if (problem.eddyViscosityModel_ == EddyViscosityModels::baldwinLomax)
else if (modelName.compare("baldwinLomax") == 0)
{
kinematicEddyViscosity = problem.kinematicEddyViscosity_[RANSParentType::elementID()];
}
else
{
DUNE_THROW(Dune::NotImplemented,
"This eddy viscosity model is not implemented: " << problem.eddyViscosityModel_);
"The eddy viscosity model \"" << modelName << "\" is not implemented.");
}
return kinematicEddyViscosity * NavierStokesParentType::density();
......
......@@ -21,7 +21,7 @@ EnableGravity = false
SandGrainRoughness = 0.0 # [m] # not implemented for EddyViscosityModel = 3
[RANS]
EddyViscosityModel = 3
EddyViscosityModel = "baldwinLomax"
UseStoredEddyViscosity = false
[Assembly]
......
......@@ -16,7 +16,7 @@ InletVelocity = 2.5 # [m/s]
EnableGravity = false
[RANS]
EddyViscosityModel = 3
EddyViscosityModel = "baldwinLomax"
[Assembly]
NumericDifferenceMethod = 0
......
......@@ -18,7 +18,7 @@ WallTemperature = 303.15 # [K]
EnableGravity = false
[RANS]
EddyViscosityModel = 3
EddyViscosityModel = "baldwinLomax"
[Assembly]
NumericDifferenceMethod = 0
......
......@@ -16,7 +16,7 @@ InletVelocity = 0.1 # [m/s]
EnableGravity = false
[RANS]
EddyViscosityModel = 3
EddyViscosityModel = "baldwinLomax"
TurbulentSchmidtNumber = 0.7
[Assembly]
......
......@@ -16,6 +16,7 @@ InletVelocity = 0.1 # [m/s]
EnableGravity = false
[RANS]
EddyViscosityModel = "prandtl"
TurbulentSchmidtNumber = 0.7
TurbulentPrandtlNumber = 0.85
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment