1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "GenSGSStress.H"
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace incompressible
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 defineTypeNameWithName(GenSGSStress, "GenSGSStress");
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 GenSGSStress::GenSGSStress
46 const volVectorField& U,
47 const surfaceScalarField& phi,
48 transportModel& transport,
49 const word& turbulenceModelName,
53 LESModel(modelName, U, phi, transport, turbulenceModelName),
57 dimensioned<scalar>::lookupOrAddToDict
67 dimensioned<scalar>::lookupOrAddToDict
99 B_.boundaryField().types()
102 if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
106 "GenSGSStress::GenSGSStress"
107 "(const volVectorField& U, const surfaceScalarField& phi,"
108 "transportModel& transport)"
109 ) << "couplingFactor = " << couplingFactor_
110 << " is not in range 0 - 1" << nl
116 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
118 tmp<volSymmTensorField> GenSGSStress::devBeff() const
120 return tmp<volSymmTensorField>
122 new volSymmTensorField
132 B_ - nu()*dev(twoSymm(fvc::grad(U())))
138 tmp<fvVectorMatrix> GenSGSStress::divDevBeff
143 if (couplingFactor_.value() > 0.0)
147 fvc::div(B_ + couplingFactor_*nuSgs_*fvc::grad(U))
150 (1.0 - couplingFactor_)*nuSgs_, U, "laplacian(nuEff,U)"
152 - fvm::laplacian(nuEff(), U)
160 + fvc::laplacian(nuSgs_, U, "laplacian(nuEff,U)")
161 - fvm::laplacian(nuEff(), U)
167 bool GenSGSStress::read()
169 if (LESModel::read())
171 ce_.readIfPresent(coeffDict());
173 couplingFactor_.readIfPresent(coeffDict());
175 if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
177 FatalErrorIn("GenSGSStress::read()")
178 << "couplingFactor = " << couplingFactor_
179 << " is not in range 0 - 1"
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 } // End namespace LESModels
195 } // End namespace incompressible
196 } // End namespace Foam
198 // ************************************************************************* //