1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "maxhxhyhzDelta.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 defineTypeNameAndDebug(maxhxhyhzDelta, 0);
37 addToRunTimeSelectionTable(LESdelta, maxhxhyhzDelta, dictionary);
39 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
41 void maxhxhyhzDelta::calcDelta()
43 label nD = mesh().nGeometricD();
45 tmp<volScalarField> hmax
52 mesh().time().timeName(),
58 dimensionedScalar("zrero", dimLength, 0.0)
62 const cellList& cells = mesh().cells();
66 scalar deltaMaxTmp = 0.0;
67 const labelList& cFaces = mesh().cells()[cellI];
68 const point& centrevector = mesh().cellCentres()[cellI];
70 forAll(cFaces, cFaceI)
72 label faceI = cFaces[cFaceI];
73 const point& facevector = mesh().faceCentres()[faceI];
74 scalar tmp = mag(facevector - centrevector);
75 if (tmp > deltaMaxTmp)
80 hmax()[cellI] = deltaCoeff_*deltaMaxTmp;
85 delta_.internalField() = hmax();
89 WarningIn("maxhxhyhzDelta::calcDelta()")
90 << "Case is 2D, LES is not strictly applicable\n"
93 delta_.internalField() = hmax();
97 FatalErrorIn("maxhxhyhzDelta::calcDelta()")
98 << "Case is not 3D or 2D, LES is not applicable"
104 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
106 maxhxhyhzDelta::maxhxhyhzDelta
113 LESdelta(name, mesh),
114 deltaCoeff_(readScalar(dd.subDict(type() + "Coeffs").lookup("deltaCoeff")))
120 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
122 void maxhxhyhzDelta::read(const dictionary& dd)
124 dd.subDict(type() + "Coeffs").lookup("deltaCoeff") >> deltaCoeff_;
129 void maxhxhyhzDelta::correct()
131 if (mesh_.changing())
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 } // End namespace Foam
142 // ************************************************************************* //