yPlusLES.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "fvCFD.H"
00034 #include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
00035 #include "LESModel.H"
00036 #include "nearWallDist.H"
00037 #include "wallDist.H"
00038
00039
00040
00041 int main(int argc, char *argv[])
00042 {
00043 timeSelector::addOptions();
00044 #include "setRootCase.H"
00045 # include "createTime.H"
00046 instantList timeDirs = timeSelector::select0(runTime, args);
00047 # include "createMesh.H"
00048
00049 forAll(timeDirs, timeI)
00050 {
00051 runTime.setTime(timeDirs[timeI], timeI);
00052 Info<< "Time = " << runTime.timeName() << endl;
00053 fvMesh::readUpdateState state = mesh.readUpdate();
00054
00055
00056 if (timeI == 0 || state != fvMesh::UNCHANGED)
00057 {
00058 Info<< "Calculating wall distance\n" << endl;
00059 wallDist y(mesh, true);
00060 Info<< "Writing wall distance to field "
00061 << y.name() << nl << endl;
00062 y.write();
00063 }
00064
00065
00066 volScalarField yPlus
00067 (
00068 IOobject
00069 (
00070 "yPlus",
00071 runTime.timeName(),
00072 mesh,
00073 IOobject::NO_READ,
00074 IOobject::NO_WRITE
00075 ),
00076 mesh,
00077 dimensionedScalar("yPlus", dimless, 0.0)
00078 );
00079
00080 Info<< "Reading field U\n" << endl;
00081 volVectorField U
00082 (
00083 IOobject
00084 (
00085 "U",
00086 runTime.timeName(),
00087 mesh,
00088 IOobject::MUST_READ,
00089 IOobject::NO_WRITE
00090 ),
00091 mesh
00092 );
00093
00094 # include "createPhi.H"
00095
00096 singlePhaseTransportModel laminarTransport(U, phi);
00097
00098 autoPtr<incompressible::LESModel> sgsModel
00099 (
00100 incompressible::LESModel::New(U, phi, laminarTransport)
00101 );
00102
00103 volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y();
00104 volScalarField nuEff = sgsModel->nuEff();
00105
00106 const fvPatchList& patches = mesh.boundary();
00107
00108 forAll(patches, patchi)
00109 {
00110 const fvPatch& currPatch = patches[patchi];
00111
00112 if (typeid(currPatch) == typeid(wallFvPatch))
00113 {
00114 yPlus.boundaryField()[patchi] =
00115 d[patchi]
00116 *sqrt
00117 (
00118 nuEff.boundaryField()[patchi]
00119 *mag(U.boundaryField()[patchi].snGrad())
00120 )
00121 /sgsModel->nu().boundaryField()[patchi];
00122 const scalarField& Yp = yPlus.boundaryField()[patchi];
00123
00124 Info<< "Patch " << patchi
00125 << " named " << currPatch.name()
00126 << " y+ : min: " << min(Yp) << " max: " << max(Yp)
00127 << " average: " << average(Yp) << nl << endl;
00128 }
00129 }
00130
00131 Info<< "Writing yPlus to field "
00132 << yPlus.name() << nl << endl;
00133
00134 yPlus.write();
00135 }
00136
00137 Info<< "End\n" << endl;
00138
00139 return 0;
00140 }
00141
00142
00143
Copyright © 2000-2009 OpenCFD Ltd