CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   How to calculate yPlus in DNS (https://www.cfd-online.com/Forums/openfoam-post-processing/160409-how-calculate-yplus-dns.html)

tzqfly October 7, 2015 10:52

How to calculate yPlus in DNS
 
Hello,
everybody, I'm a new openFoamer and I want to calculate the yPlus of inter cell in DNS. I read threads but they all about LES's yPlus, so I want to change it into DNS's yPlus. Fortunately, I found a perfect unity to calculate LES's yPlus, the codes are:


#include "fvCFD.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/LES/LESModel/LESModel.H"
#include "LESModel.H"

//aali
//#include "compressible/LES/LESModel/LESModel.H"

//#include "basicThermo.H"
//ali
#include "wallFvPatch.H"

#include "nearWallDist.H"
#include "wallDist.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
timeSelector::addOptions();
#include "setRootCase.H"
# include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H"

forAll(timeDirs, timeI)
{
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
fvMesh::readUpdateState state = mesh.readUpdate();

// Wall distance
wallDist y(mesh, true);
if (timeI == 0 || state != fvMesh::UNCHANGED)
{
Info<< "Calculating wall distance\n" << endl;

Info<< "Writing wall distance to field "
<< y.name() << nl << endl;
y.write();
}

#include "createFields.H"

volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y();
volScalarField nuEff(sgsModel->nuEff());

const fvPatchList& patches = mesh.boundary();

dimensionedScalar uTauAvg("uTauAvg", dimVelocity, 0);

const volScalarField nuLam(sgsModel->nu());

scalar nPatch = 0;

Info<< "Summary: " << nl << endl;

forAll(patches, patchi)
{
const fvPatch& currPatch = patches[patchi];

if (typeid(currPatch) == typeid(wallFvPatch))//isA<wallFvPatch>(currPatch))
{
yPlusTemp.boundaryField()[patchi] =
d[patchi]
*sqrt
(
nuEff.boundaryField()[patchi]
*mag(U.boundaryField()[patchi].snGrad())
)
/nuLam.boundaryField()[patchi];
const scalarField& YpTemp = yPlusTemp.boundaryField()[patchi];

//effective viscosity used in the calculation of u*
uTau.boundaryField()[patchi] =
sqrt
(
sgsModel->nuEff()
*mag(U.boundaryField()[patchi].snGrad())
);
const fvPatchScalarField& uTauWall = uTau.boundaryField()[patchi];

dimensionedScalar uTauTmp("uTauTmp", dimVelocity, average(uTauWall));

uTauAvg += uTauTmp;

nPatch ++;

Info<< "Patch " << patchi
<< " named " << currPatch.name()
<< " y+ : min: " << min(YpTemp) << " max: " << max(YpTemp)
<< " average: " << average(YpTemp)
<< " avgUGradWall: " << average(mag(U.boundaryField()[patchi].snGrad()))
<< nl << endl;

}
}

uTauAvg /= nPatch;

Info << " avg. friction velocity uTau is: "
<< uTauAvg.value() << " (averaged over " << nPatch << " wall(s))" << nl <<endl;
//yPlus is = u* x y/nu
yPlus = y.y() * uTauAvg / ((sgsModel->nu()));

uPlus = U / uTauAvg;

Info << "Writing yPlus and uPlus to corresponding fields." << nl <<endl;
yPlus.write();
uPlus.write();

// Info<< "Writing yPlus to field "
// << yPlus.name() << nl << endl;
//
// yPlus.write();
}

Info<< "End\n" << endl;

return 0;
}


and now, the problem is how to chang it into calculate DNS's yPlus. and I make some effort, I know "sgsModel->nuEff() " is using in LES and DNS has nothing about model. So I don't know how to deal with "sgsModel->nuEff()“、”nuEff.boundaryField()[patchi]“ and " sgsModel->nuEff()*mag(U.boundaryField()[patchi].snGrad())"

Can someone help me ? Or somebody has the unity about calculating DNS's yPlus ,please show me!!


Thank you all.

Dan Pearce April 15, 2016 10:37

Hi tzqfly,
Did you make any progress on this issue? I am trying to modify the LES yplus utility and I'm trying to understand the difference between nuLam and nuEff....

calf.Z June 25, 2019 23:01

is the postProcess yPlus tool available for DNS?


All times are GMT -4. The time now is 04:41.