OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

GenSGSStress.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "GenSGSStress.H"
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 namespace incompressible
00034 {
00035 namespace LESModels
00036 {
00037 
00038 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00039 
00040 GenSGSStress::GenSGSStress
00041 (
00042     const volVectorField& U,
00043     const surfaceScalarField& phi,
00044     transportModel& transport
00045 )
00046 :
00047     LESModel(word("GenSGSStress"), U, phi, transport),
00048 
00049     ce_
00050     (
00051         dimensioned<scalar>::lookupOrAddToDict
00052         (
00053             "ce",
00054             coeffDict_,
00055             1.048
00056         )
00057     ),
00058 
00059     couplingFactor_
00060     (
00061         dimensioned<scalar>::lookupOrAddToDict
00062         (
00063             "couplingFactor",
00064             coeffDict_,
00065             0.0
00066         )
00067     ),
00068 
00069     B_
00070     (
00071         IOobject
00072         (
00073             "B",
00074             runTime_.timeName(),
00075             mesh_,
00076             IOobject::MUST_READ,
00077             IOobject::AUTO_WRITE
00078         ),
00079         mesh_
00080     ),
00081 
00082     nuSgs_
00083     (
00084         IOobject
00085         (
00086             "nuSgs",
00087             runTime_.timeName(),
00088             mesh_,
00089             IOobject::NO_READ,
00090             IOobject::NO_WRITE
00091         ),
00092         nu(),
00093         B_.boundaryField().types()
00094     )
00095 {
00096     if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
00097     {
00098         FatalErrorIn
00099         (
00100             "GenSGSStress::GenSGSStress"
00101             "(const volVectorField& U, const surfaceScalarField& phi,"
00102             "transportModel& lamTransportModel)"
00103         )   << "couplingFactor = " << couplingFactor_
00104             << " is not in range 0 - 1" << nl
00105             << exit(FatalError);
00106     }
00107 }
00108 
00109 
00110 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00111 
00112 tmp<volSymmTensorField> GenSGSStress::devBeff() const
00113 {
00114     return tmp<volSymmTensorField>
00115     (
00116         new volSymmTensorField
00117         (
00118             IOobject
00119             (
00120                 "devRhoReff",
00121                 runTime_.timeName(),
00122                 mesh_,
00123                 IOobject::NO_READ,
00124                 IOobject::NO_WRITE
00125             ),
00126             B_ - nu()*dev(twoSymm(fvc::grad(U())))
00127         )
00128     );
00129 }
00130 
00131 
00132 tmp<fvVectorMatrix> GenSGSStress::divDevBeff
00133 (
00134     volVectorField& U
00135 ) const
00136 {
00137     if (couplingFactor_.value() > 0.0)
00138     {
00139         return
00140         (
00141             fvc::div(B_ + couplingFactor_*nuSgs_*fvc::grad(U))
00142           + fvc::laplacian
00143             (
00144                 (1.0 - couplingFactor_)*nuSgs_, U, "laplacian(nuEff,U)"
00145             )
00146           - fvm::laplacian(nuEff(), U)
00147         );
00148     }
00149     else
00150     {
00151         return
00152         (
00153             fvc::div(B_)
00154           + fvc::laplacian(nuSgs_, U, "laplacian(nuEff,U)")
00155           - fvm::laplacian(nuEff(), U)
00156         );
00157     }
00158 }
00159 
00160 
00161 bool GenSGSStress::read()
00162 {
00163     if (LESModel::read())
00164     {
00165         ce_.readIfPresent(coeffDict());
00166 
00167         couplingFactor_.readIfPresent(coeffDict());
00168 
00169         if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
00170         {
00171             FatalErrorIn("GenSGSStress::read()")
00172                 << "couplingFactor = " << couplingFactor_
00173                 << " is not in range 0 - 1"
00174                 << exit(FatalError);
00175         }
00176 
00177         return true;
00178     }
00179     else
00180     {
00181         return false;
00182     }
00183 }
00184 
00185 
00186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00187 
00188 } // End namespace LESModels
00189 } // End namespace incompressible
00190 } // End namespace Foam
00191 
00192 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd