From d646abebb953b190b9ee3f21981b7de6f71168e2 Mon Sep 17 00:00:00 2001 From: Thomas Fetzer <thomas.fetzer@iws.uni-stuttgart.de> Date: Tue, 3 Apr 2018 12:07:41 +0200 Subject: [PATCH] [zeroeq] Improve model (reduce number of parameters) --- dumux/common/parameters.hh | 3 --- dumux/freeflow/rans/zeroeq/models.hh | 6 ++--- dumux/freeflow/rans/zeroeq/problem.hh | 12 ++++----- dumux/freeflow/rans/zeroeq/volumevariables.hh | 25 ++++++++----------- 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/dumux/common/parameters.hh b/dumux/common/parameters.hh index 86bb0fc14c..d954c3e98f 100644 --- a/dumux/common/parameters.hh +++ b/dumux/common/parameters.hh @@ -259,9 +259,6 @@ private: // parameters in the mpfa group params["Mpfa.Q"] = "0.0"; - - // parameters in the RANS group - params["RANS.EddyViscosityModel"] = "1"; } }; diff --git a/dumux/freeflow/rans/zeroeq/models.hh b/dumux/freeflow/rans/zeroeq/models.hh index 9a51b55fce..15fa56e090 100644 --- a/dumux/freeflow/rans/zeroeq/models.hh +++ b/dumux/freeflow/rans/zeroeq/models.hh @@ -21,14 +21,14 @@ * \ingroup ZeroEqModel * \copydoc Dumux::EddyViscosityModels */ -#ifndef DUMUX_EDDYVISCOSITY_MODELS_HH -#define DUMUX_EDDYVISCOSITY_MODELS_HH +#ifndef DUMUX_ZEROEQ_MODELS_HH +#define DUMUX_ZEROEQ_MODELS_HH namespace Dumux { /*! * \ingroup ZeroEqModel - * \brief The available eddy viscosity models + * \brief The available 0-eq. eddy viscosity models. * * The following models are available: * -# Prandtl's mixing length, e.g. \cite Oertel2012a diff --git a/dumux/freeflow/rans/zeroeq/problem.hh b/dumux/freeflow/rans/zeroeq/problem.hh index 6144277a31..5e12a5fc9e 100644 --- a/dumux/freeflow/rans/zeroeq/problem.hh +++ b/dumux/freeflow/rans/zeroeq/problem.hh @@ -74,7 +74,9 @@ public: //! The constructor sets the gravity, if desired by the user. ZeroEqProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) : ParentType(fvGridGeometry) - { } + { + eddyViscosityModel_ = getParamFromGroup<int>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "RANS.EddyViscosityModel", 1); + } /*! * \brief Correct size of the static (solution independent) wall variables @@ -99,9 +101,6 @@ public: { ParentType::updateDynamicWallProperties(curSol); - static const auto eddyViscosityModel - = getParamFromGroup<int>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "RANS.EddyViscosityModel"); - // calculate additional roughness bool printedRangeWarning = false; for (const auto& element : elements(this->fvGridGeometry().gridView())) @@ -122,7 +121,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_ == EddyViscosityModels::baldwinLomax) { DUNE_THROW(Dune::NotImplemented, "Roughness is not implemented for the Baldwin-Lomax model."); } @@ -146,7 +145,7 @@ public: } // update routine for specfic models - if (eddyViscosityModel == EddyViscosityModels::baldwinLomax) + if (eddyViscosityModel_ == EddyViscosityModels::baldwinLomax) updateBaldwinLomaxProperties(); } @@ -260,6 +259,7 @@ public: } public: + int 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 cb3b92ee96..3379f4a63d 100644 --- a/dumux/freeflow/rans/zeroeq/volumevariables.hh +++ b/dumux/freeflow/rans/zeroeq/volumevariables.hh @@ -105,8 +105,8 @@ public: const SubControlVolume& scv) { ParentType::updateRANSProperties(elemSol, problem, element, scv); - additionalRoughnessLength_ = problem.additionalRoughnessLength_[this->elementID()]; - yPlusRough_ = wallDistanceRough() * this->uStar() / this->kinematicViscosity(); + additionalRoughnessLength_ = problem.additionalRoughnessLength_[ParentType::elementID()]; + yPlusRough_ = wallDistanceRough() * ParentType::uStar() / ParentType::kinematicViscosity(); calculateEddyViscosity(elemSol, problem, element, scv); } @@ -128,37 +128,34 @@ public: using std::exp; using std::sqrt; Scalar kinematicEddyViscosity = 0.0; - static const auto eddyViscosityModel - = getParamFromGroup<int>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "RANS.EddyViscosityModel"); - unsigned int elementID = problem.fvGridGeometry().elementMapper().index(element); - unsigned int flowNormalAxis = problem.flowNormalAxis_[elementID]; - unsigned int wallNormalAxis = problem.wallNormalAxis_[elementID]; + unsigned int flowNormalAxis = problem.flowNormalAxis_[ParentType::elementID()]; + unsigned int wallNormalAxis = problem.wallNormalAxis_[ParentType::elementID()]; Scalar velGrad = abs(ParentType::velocityGradients()[flowNormalAxis][wallNormalAxis]); - if (eddyViscosityModel == EddyViscosityModels::none) + if (problem.eddyViscosityModel_ == EddyViscosityModels::none) { // kinematicEddyViscosity = 0.0 } - else if (eddyViscosityModel == EddyViscosityModels::prandtl) + else if (problem.eddyViscosityModel_ == EddyViscosityModels::prandtl) { Scalar mixingLength = problem.karmanConstant() * wallDistanceRough(); kinematicEddyViscosity = mixingLength * mixingLength * velGrad; } - else if (eddyViscosityModel == EddyViscosityModels::modifiedVanDriest) + else if (problem.eddyViscosityModel_ == EddyViscosityModels::modifiedVanDriest) { Scalar mixingLength = problem.karmanConstant() * wallDistanceRough() * (1.0 - exp(-yPlusRough() / 26.0)) / sqrt(1.0 - exp(-0.26 * yPlusRough())); kinematicEddyViscosity = mixingLength * mixingLength * velGrad; } - else if (eddyViscosityModel == EddyViscosityModels::baldwinLomax) + else if (problem.eddyViscosityModel_ == EddyViscosityModels::baldwinLomax) { - kinematicEddyViscosity = problem.kinematicEddyViscosity_[elementID]; + kinematicEddyViscosity = problem.kinematicEddyViscosity_[ParentType::elementID()]; } else { DUNE_THROW(Dune::NotImplemented, - "This eddy viscosity model is not implemented: " << eddyViscosityModel); + "This eddy viscosity model is not implemented: " << problem.eddyViscosityModel_); } ParentType::setDynamicEddyViscosity(kinematicEddyViscosity * ParentType::density()); } @@ -167,7 +164,7 @@ public: * \brief Return the wall distance \f$\mathrm{[m]}\f$ including an additional roughness length */ Scalar wallDistanceRough() const - { return this->wallDistance() + additionalRoughnessLength_; } + { return ParentType::wallDistance() + additionalRoughnessLength_; } /*! * \brief Return the dimensionless wall distance \f$\mathrm{[-]}\f$ including an additional roughness length -- GitLab