functionObjects::yPlus: Rationalized the functionality in 'execute' and 'write'

This commit is contained in:
Henry Weller
2016-06-09 16:06:09 +01:00
parent 4734b1af5b
commit fd734554b9

View File

@ -82,8 +82,7 @@ void Foam::functionObjects::yPlus::calcYPlus
const fvPatchList& patches = mesh.boundary(); const fvPatchList& patches = mesh.boundary();
volScalarField::Boundary& yPlusBf = volScalarField::Boundary& yPlusBf = yPlus.boundaryFieldRef();
yPlus.boundaryFieldRef();
forAll(patches, patchi) forAll(patches, patchi)
{ {
@ -98,26 +97,6 @@ void Foam::functionObjects::yPlus::calcYPlus
); );
yPlusBf[patchi] = nutPf.yPlus(); yPlusBf[patchi] = nutPf.yPlus();
const scalarField& yPlusp = yPlusBf[patchi];
const scalar minYplus = gMin(yPlusp);
const scalar maxYplus = gMax(yPlusp);
const scalar avgYplus = gAverage(yPlusp);
if (Pstream::master())
{
Log << " patch " << patch.name()
<< " y+ : min = " << minYplus << ", max = " << maxYplus
<< ", average = " << avgYplus << nl;
writeTime(file());
file()
<< token::TAB << patch.name()
<< token::TAB << minYplus
<< token::TAB << maxYplus
<< token::TAB << avgYplus
<< endl;
}
} }
else if (isA<wallFvPatch>(patch)) else if (isA<wallFvPatch>(patch))
{ {
@ -128,26 +107,6 @@ void Foam::functionObjects::yPlus::calcYPlus
nuEffBf[patchi] nuEffBf[patchi]
*mag(turbModel.U().boundaryField()[patchi].snGrad()) *mag(turbModel.U().boundaryField()[patchi].snGrad())
)/nuBf[patchi]; )/nuBf[patchi];
const scalarField& yPlusp = yPlusBf[patchi];
const scalar minYplus = gMin(yPlusp);
const scalar maxYplus = gMax(yPlusp);
const scalar avgYplus = gAverage(yPlusp);
if (Pstream::master())
{
Log << " patch " << patch.name()
<< " y+ : min = " << minYplus << ", max = " << maxYplus
<< ", average = " << avgYplus << nl;
writeTime(file());
file()
<< token::TAB << patch.name()
<< token::TAB << minYplus
<< token::TAB << maxYplus
<< token::TAB << avgYplus
<< endl;
}
} }
} }
} }
@ -182,7 +141,7 @@ Foam::functionObjects::yPlus::yPlus
mesh.time().timeName(), mesh.time().timeName(),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::AUTO_WRITE
), ),
mesh, mesh,
dimensionedScalar("0", dimless, 0.0) dimensionedScalar("0", dimless, 0.0)
@ -213,8 +172,6 @@ bool Foam::functionObjects::yPlus::read(const dictionary& dict)
bool Foam::functionObjects::yPlus::execute(const bool postProcess) bool Foam::functionObjects::yPlus::execute(const bool postProcess)
{ {
writeFiles::write();
const fvMesh& mesh = refCast<const fvMesh>(obr_); const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField& yPlus = volScalarField& yPlus =
@ -223,8 +180,6 @@ bool Foam::functionObjects::yPlus::execute(const bool postProcess)
mesh.lookupObject<volScalarField>(type()) mesh.lookupObject<volScalarField>(type())
); );
Log << type() << " " << name() << " output:" << nl;
if (mesh.foundObject<turbulenceModel>(turbulenceModel::propertiesName)) if (mesh.foundObject<turbulenceModel>(turbulenceModel::propertiesName))
{ {
const turbulenceModel& model = const turbulenceModel& model =
@ -245,15 +200,50 @@ bool Foam::functionObjects::yPlus::execute(const bool postProcess)
bool Foam::functionObjects::yPlus::write(const bool postProcess) bool Foam::functionObjects::yPlus::write(const bool postProcess)
{ {
writeFiles::write();
const volScalarField& yPlus = const volScalarField& yPlus =
obr_.lookupObject<volScalarField>(type()); obr_.lookupObject<volScalarField>(type());
Log << " writing field " << yPlus.name() << endl; Log << type() << " " << name() << " write:" << nl
<< " writing field " << yPlus.name() << endl;
yPlus.write(); yPlus.write();
writeFiles::write();
const volScalarField::Boundary& yPlusBf = yPlus.boundaryField();
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const fvPatchList& patches = mesh.boundary();
forAll(patches, patchi)
{
const fvPatch& patch = patches[patchi];
if (isA<wallFvPatch>(patch))
{
const scalarField& yPlusp = yPlusBf[patchi];
const scalar minYplus = gMin(yPlusp);
const scalar maxYplus = gMax(yPlusp);
const scalar avgYplus = gAverage(yPlusp);
if (Pstream::master())
{
Log << " patch " << patch.name()
<< " y+ : min = " << minYplus << ", max = " << maxYplus
<< ", average = " << avgYplus << nl;
writeTime(file());
file()
<< token::TAB << patch.name()
<< token::TAB << minYplus
<< token::TAB << maxYplus
<< token::TAB << avgYplus
<< endl;
}
}
}
return true; return true;
} }