.. _program_listing_file_eddyViscosities_VanDriest_VanDriestEddyViscosity.C: Program Listing for File VanDriestEddyViscosity.C ================================================= |exhale_lsh| :ref:`Return to documentation for file ` (``eddyViscosities/VanDriest/VanDriestEddyViscosity.C``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /*---------------------------------------------------------------------------* \ License This file is part of libWallModelledLES. libWallModelledLES 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 3 of the License, or (at your option) any later version. libWallModelledLES 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 libWallModelledLES. If not, see . \*---------------------------------------------------------------------------*/ #include "VanDriestEddyViscosity.H" #include "addToRunTimeSelectionTable.H" #include #if !defined(DOXYGEN_SHOULD_SKIP_THIS) namespace Foam { defineTypeNameAndDebug(VanDriestEddyViscosity, 0); addToRunTimeSelectionTable(EddyViscosity, VanDriestEddyViscosity, Dictionary); addToRunTimeSelectionTable(EddyViscosity, VanDriestEddyViscosity, TypeAndDictionary); } #endif // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::VanDriestEddyViscosity::VanDriestEddyViscosity ( const dictionary & dict ) : EddyViscosity(dict), kappa_(constDict_.lookupOrAddDefault("kappa", 0.4)), APlus_(constDict_.lookupOrAddDefault("APlus", 18)) { if (debug) { printCoeffs(); } } Foam::VanDriestEddyViscosity::VanDriestEddyViscosity ( const word & modelName, const dictionary & dict ) : VanDriestEddyViscosity(dict) { } Foam::VanDriestEddyViscosity::VanDriestEddyViscosity ( const scalar kappa, const scalar APlus ) : EddyViscosity(), kappa_(kappa), APlus_(APlus) { constDict_.add("kappa", kappa); constDict_.add("APlus", APlus); if (debug) { printCoeffs(); } } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::VanDriestEddyViscosity::printCoeffs() const { Info<< nl << "VanDriest eddy viscosity model" << nl; Info<< token::BEGIN_BLOCK << incrIndent << nl; Info<< indent << "APlus" << indent << APlus_ << nl; Info<< indent << "kappa" << indent << kappa_ << nl; Info<< token::END_BLOCK << nl << nl; } Foam::scalarList Foam::VanDriestEddyViscosity::value ( const SingleCellSampler & sampler, const label index, const scalarList & y, const scalar uTau, const scalar nu ) const { return value(y, uTau, nu); } std::function Foam::VanDriestEddyViscosity::value ( const SingleCellSampler & sampler, const label index, const scalar uTau, const scalar nu ) const { scalar kappa = kappa_; scalar APlus = APlus_; return [kappa, APlus, uTau, nu](const scalar y) { scalar yPlus = y*uTau/nu; return kappa*uTau*y*Foam::sqr(1 - Foam::exp(-yPlus/APlus)); }; } Foam::scalarList Foam::VanDriestEddyViscosity::value ( const scalarList & y, const scalar uTau, const scalar nu ) const { const scalarList yPlus = y*uTau/nu; scalarList values(y.size(), 0.0); forAll(values, i) { values[i] = kappa_*uTau*y[i]*sqr(1 - exp(-yPlus[i]/APlus_)); } return values; } // ************************************************************************* //