FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include <incompressibleLESModels/GenSGSStress.H>
00027 
00028 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00029 
00030 namespace Foam
00031 {
00032 namespace incompressible
00033 {
00034 namespace LESModels
00035 {
00036 
00037 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00038 
00039 GenSGSStress::GenSGSStress
00040 (
00041     const volVectorField& U,
00042     const surfaceScalarField& phi,
00043     transportModel& transport
00044 )
00045 :
00046     LESModel(word("GenSGSStress"), U, phi, transport),
00047 
00048     ce_
00049     (
00050         dimensioned<scalar>::lookupOrAddToDict
00051         (
00052             "ce",
00053             coeffDict_,
00054             1.048
00055         )
00056     ),
00057 
00058     couplingFactor_
00059     (
00060         dimensioned<scalar>::lookupOrAddToDict
00061         (
00062             "couplingFactor",
00063             coeffDict_,
00064             0.0
00065         )
00066     ),
00067 
00068     B_
00069     (
00070         IOobject
00071         (
00072             "B",
00073             runTime_.timeName(),
00074             mesh_,
00075             IOobject::MUST_READ,
00076             IOobject::AUTO_WRITE
00077         ),
00078         mesh_
00079     ),
00080 
00081     nuSgs_
00082     (
00083         IOobject
00084         (
00085             "nuSgs",
00086             runTime_.timeName(),
00087             mesh_,
00088             IOobject::NO_READ,
00089             IOobject::NO_WRITE
00090         ),
00091         nu(),
00092         B_.boundaryField().types()
00093     )
00094 {
00095     if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
00096     {
00097         FatalErrorIn
00098         (
00099             "GenSGSStress::GenSGSStress"
00100             "(const volVectorField& U, const surfaceScalarField& phi,"
00101             "transportModel& lamTransportModel)"
00102         )   << "couplingFactor = " << couplingFactor_
00103             << " is not in range 0 - 1" << nl
00104             << exit(FatalError);
00105     }
00106 }
00107 
00108 
00109 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00110 
00111 tmp<volSymmTensorField> GenSGSStress::devBeff() const
00112 {
00113     return tmp<volSymmTensorField>
00114     (
00115         new volSymmTensorField
00116         (
00117             IOobject
00118             (
00119                 "devRhoReff",
00120                 runTime_.timeName(),
00121                 mesh_,
00122                 IOobject::NO_READ,
00123                 IOobject::NO_WRITE
00124             ),
00125             B_ - nu()*dev(twoSymm(fvc::grad(U())))
00126         )
00127     );
00128 }
00129 
00130 
00131 tmp<fvVectorMatrix> GenSGSStress::divDevBeff
00132 (
00133     volVectorField& U
00134 ) const
00135 {
00136     if (couplingFactor_.value() > 0.0)
00137     {
00138         return
00139         (
00140             fvc::div(B_ + couplingFactor_*nuSgs_*fvc::grad(U))
00141           + fvc::laplacian
00142             (
00143                 (1.0 - couplingFactor_)*nuSgs_, U, "laplacian(nuEff,U)"
00144             )
00145           - fvm::laplacian(nuEff(), U)
00146         );
00147     }
00148     else
00149     {
00150         return
00151         (
00152             fvc::div(B_)
00153           + fvc::laplacian(nuSgs_, U, "laplacian(nuEff,U)")
00154           - fvm::laplacian(nuEff(), U)
00155         );
00156     }
00157 }
00158 
00159 
00160 bool GenSGSStress::read()
00161 {
00162     if (LESModel::read())
00163     {
00164         ce_.readIfPresent(coeffDict());
00165 
00166         couplingFactor_.readIfPresent(coeffDict());
00167 
00168         if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
00169         {
00170             FatalErrorIn("GenSGSStress::read()")
00171                 << "couplingFactor = " << couplingFactor_
00172                 << " is not in range 0 - 1"
00173                 << exit(FatalError);
00174         }
00175 
00176         return true;
00177     }
00178     else
00179     {
00180         return false;
00181     }
00182 }
00183 
00184 
00185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00186 
00187 } // End namespace LESModels
00188 } // End namespace incompressible
00189 } // End namespace Foam
00190 
00191 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines