diff --git a/dumux/freeflow/rans/zeroeq/CMakeLists.txt b/dumux/freeflow/rans/zeroeq/CMakeLists.txt index 379e2f5d0a69ddb283fea0c3ba95604a24813f89..24c5d3e332d68b052fc221df413c8cf9e4b0aec6 100644 --- a/dumux/freeflow/rans/zeroeq/CMakeLists.txt +++ b/dumux/freeflow/rans/zeroeq/CMakeLists.txt @@ -1,7 +1,6 @@ #install headers install(FILES model.hh -models.hh problem.hh volumevariables.hh DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/freeflow/rans/zeroeq) diff --git a/dumux/freeflow/rans/zeroeq/model.hh b/dumux/freeflow/rans/zeroeq/model.hh index 07b55e954a409db7aa5fd8840940635103053664..b0d647ba4d0f9fb127dc5b03093499d13619f182 100644 --- a/dumux/freeflow/rans/zeroeq/model.hh +++ b/dumux/freeflow/rans/zeroeq/model.hh @@ -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 diff --git a/dumux/freeflow/rans/zeroeq/models.hh b/dumux/freeflow/rans/zeroeq/models.hh deleted file mode 100644 index 15fa56e090ec3b0d72cfaa9731ca3301f0b821a1..0000000000000000000000000000000000000000 --- a/dumux/freeflow/rans/zeroeq/models.hh +++ /dev/null @@ -1,49 +0,0 @@ -// -*- 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 diff --git a/dumux/freeflow/rans/zeroeq/problem.hh b/dumux/freeflow/rans/zeroeq/problem.hh index 5382d415af736b60e2d4590a6011cf79b78c84be..4db036eb3310a333030ab7c9e846d5561f0ce961 100644 --- a/dumux/freeflow/rans/zeroeq/problem.hh +++ b/dumux/freeflow/rans/zeroeq/problem.hh @@ -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_; diff --git a/dumux/freeflow/rans/zeroeq/volumevariables.hh b/dumux/freeflow/rans/zeroeq/volumevariables.hh index aabe2bcbce0c6bb245b3fc8d916c7a5fb203b39b..4f61a3d95f3eca7099053bef421956e3b9ecf374 100644 --- a/dumux/freeflow/rans/zeroeq/volumevariables.hh +++ b/dumux/freeflow/rans/zeroeq/volumevariables.hh @@ -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(); diff --git a/test/freeflow/rans/test_pipe_laufer.input b/test/freeflow/rans/test_pipe_laufer.input index f11416bc5e421ece71de718dd61395f5decd2ef2..20eba371cd6346cf8e36120fb1e68b51c01236de 100644 --- a/test/freeflow/rans/test_pipe_laufer.input +++ b/test/freeflow/rans/test_pipe_laufer.input @@ -21,7 +21,7 @@ EnableGravity = false SandGrainRoughness = 0.0 # [m] # not implemented for EddyViscosityModel = 3 [RANS] -EddyViscosityModel = 3 +EddyViscosityModel = "baldwinLomax" UseStoredEddyViscosity = false [Assembly] diff --git a/test/freeflow/rans/test_pipe_laufer_reference.input b/test/freeflow/rans/test_pipe_laufer_reference.input index 262dceb9fe3d8f24e99d50df255f9d4828c8d417..daedf5780a50ae6f23e8d3bb9d4bc9febd3898b9 100644 --- a/test/freeflow/rans/test_pipe_laufer_reference.input +++ b/test/freeflow/rans/test_pipe_laufer_reference.input @@ -16,7 +16,7 @@ InletVelocity = 2.5 # [m/s] EnableGravity = false [RANS] -EddyViscosityModel = 3 +EddyViscosityModel = "baldwinLomax" [Assembly] NumericDifferenceMethod = 0 diff --git a/test/freeflow/rans/test_pipe_zeroeqni.input b/test/freeflow/rans/test_pipe_zeroeqni.input index 77273d9aedd52417e2845b762f3858c1799c78a0..924d1259068a63aa870eca9865b69c759c6b2e03 100644 --- a/test/freeflow/rans/test_pipe_zeroeqni.input +++ b/test/freeflow/rans/test_pipe_zeroeqni.input @@ -18,7 +18,7 @@ WallTemperature = 303.15 # [K] EnableGravity = false [RANS] -EddyViscosityModel = 3 +EddyViscosityModel = "baldwinLomax" [Assembly] NumericDifferenceMethod = 0 diff --git a/test/freeflow/ransnc/test_flatplate2c.input b/test/freeflow/ransnc/test_flatplate2c.input index 0098301d0693d90cb8bcf3fdc05ce13d2d3fef9d..0651ae51e6d6b266766d4468903d87a2940b4fb5 100644 --- a/test/freeflow/ransnc/test_flatplate2c.input +++ b/test/freeflow/ransnc/test_flatplate2c.input @@ -16,7 +16,7 @@ InletVelocity = 0.1 # [m/s] EnableGravity = false [RANS] -EddyViscosityModel = 3 +EddyViscosityModel = "baldwinLomax" TurbulentSchmidtNumber = 0.7 [Assembly] diff --git a/test/freeflow/ransnc/test_flatplate2cni.input b/test/freeflow/ransnc/test_flatplate2cni.input index d3640ff2e28f0fff9c953e1fbe598a44926d5594..b23acfd7ee636916bc0126169bb926412cb8b552 100644 --- a/test/freeflow/ransnc/test_flatplate2cni.input +++ b/test/freeflow/ransnc/test_flatplate2cni.input @@ -16,6 +16,7 @@ InletVelocity = 0.1 # [m/s] EnableGravity = false [RANS] +EddyViscosityModel = "prandtl" TurbulentSchmidtNumber = 0.7 TurbulentPrandtlNumber = 0.85