.. _program_listing_file_explicitLawsOfTheWall_SpaldingExplicitLawOfTheWall_SpaldingExplicitLawOfTheWall.H: Program Listing for File SpaldingExplicitLawOfTheWall.H ======================================================= |exhale_lsh| :ref:`Return to documentation for file ` (``explicitLawsOfTheWall/SpaldingExplicitLawOfTheWall/SpaldingExplicitLawOfTheWall.H``) .. |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 . Class Foam::SpaldingExplicitLawOfTheWall @brief An explicit approximation of Spalding's law. \f[ y^+ = u^+ + \exp(-\kappa B) \left( \exp (\kappa B) - 1 - \kappa u^+ - \frac{1}{2}(\kappa u^+)^2 - \frac{1}{6}(\kappa u^+)^3 \right) \f] Spalding's law is implicit in the wall stress. In a wall model this means that every wall face requires an iterative solve for \f$u_\tau\f$ at every update. This class replaces that nonlinear solve by the explicit approximation of Nuca, Mukha, and Parsani. The approximation is constructed by adding a Gaussian perturbation to the explicit law of Cai and Sagaut, which makes the wall-stress evaluation algebraic while retaining the accuracy of the original implicit Spalding relation. The approximation coefficients depend on the logarithmic-law constants. The \c approximant entry controls which coefficient set is used: \verbatim auto Select highRe for kappa=0.387, B=4.21; select classical for kappa=0.4, B=5.5; otherwise select global. highRe Fixed three-Gaussian fit for high-Re constants kappa=0.387, B=4.21. The reported maximum relative error with respect to the original Spalding law is below 0.04%. classical Fixed three-Gaussian fit for classical constants kappa=0.4, B=5.5. The reported maximum relative error with respect to the original Spalding law is below 0.04%. global One-Gaussian regression in kappa and B for other constants. This is the fallback for user-selected constants and is constructed to remain within the 1% relative-error target. \endverbatim The errors above are relative to the wall stress obtained from the original implicit Spalding relation solved iteratively. Usage: \verbatim Law { type Spalding; kappa value; (default 0.4) B value; (default 5.5) approximant auto; (default auto; highRe, classical or global) } \endverbatim Reference for the original law: \verbatim Spalding, D. B. (1961). A single formula for the 'law of the wall'. Journal of Applied Mechanics, 28(3), 455-458. \endverbatim Reference for the explicit approximation: \verbatim Nuca, R., Mukha, T., and Parsani, M. (2025). Explicit formulations of widely used wall models for large-eddy simulation. Physics of Fluids, 37, 035215. https://doi.org/10.1063/5.0253882 \endverbatim Contributors/Copyright: 2024-2026 Timofey Mukha SourceFiles SpaldingExplicitLawOfTheWall.C \*---------------------------------------------------------------------------*/ #ifndef SpaldingExplicitLawOfTheWall_H #define SpaldingExplicitLawOfTheWall_H #include "scalar.H" #include "typeInfo.H" #include "dictionary.H" #include "ExplicitLawOfTheWall.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ Class SpaldingExplicitLawOfTheWall Declaration \*---------------------------------------------------------------------------*/ class SpaldingExplicitLawOfTheWall: public ExplicitLawOfTheWall { // Private data //- The kappa model constant scalar kappa_; //- The B model constant scalar B_; //- Approximation family: auto, highRe, classical or global word approximant_; //- Cai-Sagaut blending parameters scalar p_; scalar s_; //- Gaussian perturbation coefficients label nGaussians_; scalar mu_[3]; scalar sigma_[3]; scalar xi_[3]; //- Select and store the approximation coefficients void setApproximantCoeffs(const word& approximant); //- Return whether two constants should be considered matching static bool approxEqual(const scalar a, const scalar b); //- Compute the Cai-Sagaut component of u+ scalar CaiSagautUPlus(const scalar Re) const; //- Compute the perturbation component of u+ scalar deltaUPlus(const scalar log10Re) const; public: #if !defined(DOXYGEN_SHOULD_SKIP_THIS) TypeName("Spalding"); #endif // Constructors //- Construct provided dictionary SpaldingExplicitLawOfTheWall(const dictionary &); //- Construct provided TypeName and dictionary SpaldingExplicitLawOfTheWall ( const word & lawname, const dictionary & ); //- Construct from model constants SpaldingExplicitLawOfTheWall ( const scalar kappa, const scalar B ); //- Copy constructor SpaldingExplicitLawOfTheWall ( const SpaldingExplicitLawOfTheWall & ) = default; //- Assignment SpaldingExplicitLawOfTheWall & operator= ( const SpaldingExplicitLawOfTheWall & ) = default; //- Clone virtual autoPtr clone() const override { return autoPtr ( new SpaldingExplicitLawOfTheWall(*this) ); } // Destructor virtual ~SpaldingExplicitLawOfTheWall() {}; // Member Functions //- Return the kappa constant scalar kappa() const { return kappa_; } //- Return the B constant scalar B() const { return B_; } //- Return the selected approximant word approximant() const { return approximant_; } //- Return the Cai-Sagaut p coefficient scalar p() const { return p_; } //- Return the Cai-Sagaut s coefficient scalar s() const { return s_; } //- Print info to terminal virtual void printCoeffs() const override; //- Return the value of the implicit function defining the law virtual scalar uTau ( const SingleCellSampler & sampler, label index, scalar nu ) const override; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif