1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 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
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
29 Calculates and reports yPlus for all wall patches, for the specified times.
31 \*---------------------------------------------------------------------------*/
34 #include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
36 #include "nearWallDist.H"
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 int main(int argc, char *argv[])
43 timeSelector::addOptions();
44 #include "setRootCase.H"
45 # include "createTime.H"
46 instantList timeDirs = timeSelector::select0(runTime, args);
47 # include "createMesh.H"
49 forAll(timeDirs, timeI)
51 runTime.setTime(timeDirs[timeI], timeI);
52 Info<< "Time = " << runTime.timeName() << endl;
53 fvMesh::readUpdateState state = mesh.readUpdate();
56 if (timeI == 0 || state != fvMesh::UNCHANGED)
58 Info<< "Calculating wall distance\n" << endl;
59 wallDist y(mesh, true);
60 Info<< "Writing wall distance to field "
61 << y.name() << nl << endl;
77 dimensionedScalar("yPlus", dimless, 0.0)
80 Info<< "Reading field U\n" << endl;
94 # include "createPhi.H"
96 singlePhaseTransportModel laminarTransport(U, phi);
98 autoPtr<incompressible::LESModel> sgsModel
100 incompressible::LESModel::New(U, phi, laminarTransport)
103 volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y();
104 volScalarField nuEff = sgsModel->nuEff();
106 const fvPatchList& patches = mesh.boundary();
108 forAll(patches, patchi)
110 const fvPatch& currPatch = patches[patchi];
112 if (currPatch.isWall())
114 yPlus.boundaryField()[patchi] =
118 nuEff.boundaryField()[patchi]
119 *mag(U.boundaryField()[patchi].snGrad())
121 /sgsModel->nu().boundaryField()[patchi];
122 const scalarField& Yp = yPlus.boundaryField()[patchi];
124 Info<< "Patch " << patchi
125 << " named " << currPatch.name()
126 << " y+ : min: " << min(Yp) << " max: " << max(Yp)
127 << " average: " << average(Yp) << nl << endl;
131 Info<< "Writing yPlus to field "
132 << yPlus.name() << nl << endl;
137 Info<< "End\n" << endl;
143 // ************************************************************************* //