diff --git a/src/turbulenceModels/LES/LESdeltas/maxEdgeLengthDelta/maxEdgeLengthDelta.C b/src/turbulenceModels/LES/LESdeltas/maxEdgeLengthDelta/maxEdgeLengthDelta.C new file mode 100644 index 000000000..8efff7189 --- /dev/null +++ b/src/turbulenceModels/LES/LESdeltas/maxEdgeLengthDelta/maxEdgeLengthDelta.C @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "maxEdgeLengthDelta.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(maxEdgeLengthDelta, 0); +addToRunTimeSelectionTable(LESdelta, maxEdgeLengthDelta, dictionary); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void maxEdgeLengthDelta::calcDelta() +{ + label nD = mesh().nGeometricD(); + + const cellList& cells = mesh().cells(); + const faceList& faces = mesh().faces(); + const pointField& points = mesh().points(); + + scalarField& d = delta_.internalField(); + + // Initialise d to a large number + d = 0; + + + if (nD == 3) + { + forAll (cells, cellI) + { + edgeList ce = cells[cellI].edges(faces); + + forAll (ce, ceI) + { + d[cellI] = Foam::max(d[cellI], ce[ceI].mag(points)); + } + } + } + else if (nD == 2) + { + WarningIn("maxEdgeLengthDelta::calcDelta()") + << "Case is 2D, LES is not strictly applicable\n" + << endl; + + // Find the dead direction + const Vector