initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / turbulenceModels / LES / LESdeltas / cubeRootVolDelta / cubeRootVolDelta.C
blob2002deaa2181d05711c147f2f22bccc104712631
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "cubeRootVolDelta.H"
28 #include "addToRunTimeSelectionTable.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace Foam
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(cubeRootVolDelta, 0);
38 addToRunTimeSelectionTable(LESdelta, cubeRootVolDelta, dictionary);
41 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
43 void cubeRootVolDelta::calcDelta()
45     label nD = mesh().nGeometricD();
47     if (nD == 3)
48     {
49         delta_.internalField() = deltaCoeff_*pow(mesh().V(), 1.0/3.0);
50     }
51     else if (nD == 2)
52     {
53         WarningIn("cubeRootVolDelta::calcDelta()")
54             << "Case is 2D, LES is not strictly applicable\n"
55             << endl;
57         const Vector<label>& directions = mesh().geometricD();
59         scalar thickness = 0.0;
60         for (direction dir=0; dir<directions.nComponents; dir++)
61         {
62             if (directions[dir] == -1)
63             {
64                 thickness = mesh().bounds().span()[dir];
65                 break;
66             }
67         }
69         delta_.internalField() = deltaCoeff_*sqrt(mesh().V()/thickness);
70     }
71     else
72     {
73         FatalErrorIn("cubeRootVolDelta::calcDelta()")
74             << "Case is not 3D or 2D, LES is not applicable"
75             << exit(FatalError);
76     }
80 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
82 cubeRootVolDelta::cubeRootVolDelta
84     const word& name,
85     const fvMesh& mesh,
86     const dictionary& dd
89     LESdelta(name, mesh),
90     deltaCoeff_(readScalar(dd.subDict(type() + "Coeffs").lookup("deltaCoeff")))
92     calcDelta();
96 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
98 void cubeRootVolDelta::read(const dictionary& dd)
100     dd.subDict(type() + "Coeffs").lookup("deltaCoeff") >> deltaCoeff_;
101     calcDelta();
105 void cubeRootVolDelta::correct()
107     if (mesh_.changing())
108     {
109         calcDelta();
110     }
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 } // End namespace Foam
118 // ************************************************************************* //