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

oneEqEddy.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 "oneEqEddy.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 namespace incompressible
00034 {
00035 namespace LESModels
00036 {
00037 
00038 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00039 
00040 defineTypeNameAndDebug(oneEqEddy, 0);
00041 addToRunTimeSelectionTable(LESModel, oneEqEddy, dictionary);
00042 
00043 
00044 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00045 
00046 void oneEqEddy::updateSubGridScaleFields()
00047 {
00048     nuSgs_ = ck_*sqrt(k_)*delta();
00049     nuSgs_.correctBoundaryConditions();
00050 }
00051 
00052 
00053 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00054 
00055 oneEqEddy::oneEqEddy
00056 (
00057     const volVectorField& U,
00058     const surfaceScalarField& phi,
00059     transportModel& transport
00060 )
00061 :
00062     LESModel(typeName, U, phi, transport),
00063     GenEddyVisc(U, phi, transport),
00064 
00065     k_
00066     (
00067         IOobject
00068         (
00069             "k",
00070             runTime_.timeName(),
00071             mesh_,
00072             IOobject::MUST_READ,
00073             IOobject::AUTO_WRITE
00074         ),
00075         mesh_
00076     ),
00077 
00078     ck_
00079     (
00080         dimensioned<scalar>::lookupOrAddToDict
00081         (
00082             "ck",
00083             coeffDict_,
00084             0.094
00085         )
00086     )
00087 {
00088     updateSubGridScaleFields();
00089 
00090     printCoeffs();
00091 }
00092 
00093 
00094 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00095 
00096 void oneEqEddy::correct(const tmp<volTensorField>& gradU)
00097 {
00098     GenEddyVisc::correct(gradU);
00099 
00100     volScalarField G = 2.0*nuSgs_*magSqr(symm(gradU));
00101 
00102     fvScalarMatrix kEqn
00103     (
00104        fvm::ddt(k_)
00105      + fvm::div(phi(), k_)
00106      - fvm::laplacian(DkEff(), k_)
00107     ==
00108        G
00109      - fvm::Sp(ce_*sqrt(k_)/delta(), k_)
00110     );
00111 
00112     kEqn.relax();
00113     kEqn.solve();
00114 
00115     bound(k_, k0());
00116 
00117     updateSubGridScaleFields();
00118 }
00119 
00120 
00121 bool oneEqEddy::read()
00122 {
00123     if (GenEddyVisc::read())
00124     {
00125         ck_.readIfPresent(coeffDict());
00126 
00127         return true;
00128     }
00129     else
00130     {
00131         return false;
00132     }
00133 }
00134 
00135 
00136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00137 
00138 } // End namespace LESModels
00139 } // End namespace incompressible
00140 } // End namespace Foam
00141 
00142 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines