1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-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 "IDDESDelta.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "wallDistReflection.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 defineTypeNameAndDebug(IDDESDelta, 0);
36 addToRunTimeSelectionTable(LESdelta, IDDESDelta, dictionary);
40 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
42 void Foam::IDDESDelta::calcDelta()
44 label nD = mesh().nGeometricD();
46 const volScalarField& hmax = hmax_();
48 // initialise wallNorm
49 wallDistReflection wallNorm(mesh());
51 const volVectorField& n = wallNorm.n();
53 tmp<volScalarField> faceToFacenMax
60 mesh().time().timeName(),
66 dimensionedScalar("zrero", dimLength, 0.0)
70 const cellList& cells = mesh().cells();
74 scalar deltaMaxTmp = 0.0;
75 const labelList& cFaces = mesh().cells()[cellI];
76 const point& faceCentre = mesh().faceCentres()[cFaces[0]];
77 const vector nCell = n[cellI];
78 forAll(cFaces, cFaceI)
80 label faceI = cFaces[cFaceI];
81 const point& faceCentreTwo = mesh().faceCentres()[faceI];
82 scalar tmp = (faceCentre - faceCentreTwo) & nCell;
83 if (tmp > deltaMaxTmp)
88 faceToFacenMax()[cellI] = deltaMaxTmp;
93 delta_.internalField() =
99 max(cw_*wallDist(mesh()).y(), cw_*hmax),
107 WarningIn("IDDESDelta::calcDelta()")
108 << "Case is 2D, LES is not strictly applicable\n"
111 delta_.internalField() =
115 max(max(cw_*wallDist(mesh()).y(), cw_*hmax), faceToFacenMax()),
121 FatalErrorIn("IDDESDelta::calcDelta()")
122 << "Case is not 3D or 2D, LES is not strictly applicable"
128 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
130 Foam::IDDESDelta::IDDESDelta
137 LESdelta(name, mesh),
138 hmax_(LESdelta::New("hmax", mesh, dd.parent())),
141 readScalar(dd.subDict(type()+"Coeffs").lookup("deltaCoeff"))
145 dd.subDict(type() + "Coeffs").readIfPresent("cw", cw_);
150 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
152 void Foam::IDDESDelta::read(const dictionary& dd)
154 dd.subDict(type() + "Coeffs").lookup("deltaCoeff") >> deltaCoeff_;
159 void Foam::IDDESDelta::correct()
161 if (mesh_.changing())
169 // ************************************************************************* //