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

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