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

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