1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "GenSGSStress.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 namespace incompressible
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 GenSGSStress::GenSGSStress
42 const volVectorField& U,
43 const surfaceScalarField& phi,
44 transportModel& transport
47 LESModel(word("GenSGSStress"), U, phi, transport),
51 dimensioned<scalar>::lookupOrAddToDict
61 dimensioned<scalar>::lookupOrAddToDict
93 B_.boundaryField().types()
96 if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
100 "GenSGSStress::GenSGSStress"
101 "(const volVectorField& U, const surfaceScalarField& phi,"
102 "transportModel& lamTransportModel)"
103 ) << "couplingFactor = " << couplingFactor_
104 << " is not in range 0 - 1" << nl
110 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
112 tmp<volSymmTensorField> GenSGSStress::devBeff() const
114 return tmp<volSymmTensorField>
116 new volSymmTensorField
126 B_ - nu()*dev(twoSymm(fvc::grad(U())))
132 tmp<fvVectorMatrix> GenSGSStress::divDevBeff
137 if (couplingFactor_.value() > 0.0)
141 fvc::div(B_ + couplingFactor_*nuSgs_*fvc::grad(U))
144 (1.0 - couplingFactor_)*nuSgs_, U, "laplacian(nuEff,U)"
146 - fvm::laplacian(nuEff(), U)
154 + fvc::laplacian(nuSgs_, U, "laplacian(nuEff,U)")
155 - fvm::laplacian(nuEff(), U)
161 bool GenSGSStress::read()
163 if (LESModel::read())
165 ce_.readIfPresent(coeffDict());
167 couplingFactor_.readIfPresent(coeffDict());
169 if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
171 FatalErrorIn("GenSGSStress::read()")
172 << "couplingFactor = " << couplingFactor_
173 << " is not in range 0 - 1"
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 } // End namespace LESModels
189 } // End namespace incompressible
190 } // End namespace Foam
192 // ************************************************************************* //