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

cubeRootVolDelta.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 "cubeRootVolDelta.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 
00034 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00035 
00036 defineTypeNameAndDebug(cubeRootVolDelta, 0);
00037 addToRunTimeSelectionTable(LESdelta, cubeRootVolDelta, dictionary);
00038 
00039 
00040 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00041 
00042 void cubeRootVolDelta::calcDelta()
00043 {
00044     label nD = mesh().nGeometricD();
00045 
00046     if (nD == 3)
00047     {
00048         delta_.internalField() = deltaCoeff_*pow(mesh().V(), 1.0/3.0);
00049     }
00050     else if (nD == 2)
00051     {
00052         WarningIn("cubeRootVolDelta::calcDelta()")
00053             << "Case is 2D, LES is not strictly applicable\n"
00054             << endl;
00055 
00056         const Vector<label>& directions = mesh().geometricD();
00057 
00058         scalar thickness = 0.0;
00059         for (direction dir=0; dir<directions.nComponents; dir++)
00060         {
00061             if (directions[dir] == -1)
00062             {
00063                 thickness = mesh().bounds().span()[dir];
00064                 break;
00065             }
00066         }
00067 
00068         delta_.internalField() = deltaCoeff_*sqrt(mesh().V()/thickness);
00069     }
00070     else
00071     {
00072         FatalErrorIn("cubeRootVolDelta::calcDelta()")
00073             << "Case is not 3D or 2D, LES is not applicable"
00074             << exit(FatalError);
00075     }
00076 }
00077 
00078 
00079 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00080 
00081 cubeRootVolDelta::cubeRootVolDelta
00082 (
00083     const word& name,
00084     const fvMesh& mesh,
00085     const dictionary& dd
00086 )
00087 :
00088     LESdelta(name, mesh),
00089     deltaCoeff_(readScalar(dd.subDict(type() + "Coeffs").lookup("deltaCoeff")))
00090 {
00091     calcDelta();
00092 }
00093 
00094 
00095 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00096 
00097 void cubeRootVolDelta::read(const dictionary& dd)
00098 {
00099     dd.subDict(type() + "Coeffs").lookup("deltaCoeff") >> deltaCoeff_;
00100     calcDelta();
00101 }
00102 
00103 
00104 void cubeRootVolDelta::correct()
00105 {
00106     if (mesh_.changing())
00107     {
00108         calcDelta();
00109     }
00110 }
00111 
00112 
00113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00114 
00115 } // End namespace Foam
00116 
00117 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines