wallDist: now a MeshObject cached and updated automatically with a run-time selected algorithm

When using models which require the wallDist e.g. kOmegaSST it will
request the method to be used from the wallDist sub-dictionary in
fvSchemes e.g.

wallDist
{
    method meshWave;
}

specifies the mesh-wave method as hard-coded in previous OpenFOAM versions.
This commit is contained in:
Henry
2015-01-08 10:40:23 +00:00
parent 9dc6b54c3d
commit 69ff8aa4d2
76 changed files with 778 additions and 294 deletions

View File

@ -45,29 +45,7 @@ Foam::wallDependentModel::~wallDependentModel()
const Foam::volScalarField& Foam::wallDependentModel::yWall() const
{
if (!mesh_.foundObject<volScalarField>("yWall"))
{
volScalarField* yPtr
(
new volScalarField
(
IOobject
(
"yWall",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
true
),
wallDist(mesh_).y()
)
);
yPtr->checkIn();
}
return mesh_.lookupObject<volScalarField>("yWall");
return wallDist::New(mesh_).y();
}
@ -77,28 +55,6 @@ const Foam::volVectorField& Foam::wallDependentModel::nWall() const
{
wallDistReflection w(mesh_);
if (!mesh_.foundObject<volScalarField>("yWall"))
{
volScalarField* yPtr
(
new volScalarField
(
IOobject
(
"yWall",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
true
),
w.y()
)
);
yPtr->checkIn();
}
volVectorField* nPtr
(
new volVectorField

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,46 +26,36 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "argList.H"
#include "Time.H"
#include "fvMesh.H"
#include "wallDist.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
Info<< "Mesh read in = "
<< runTime.cpuTimeIncrement()
<< " s\n" << endl << endl;
Info<< "Time now = " << runTime.timeName() << endl;
// Wall distance
wallDist y(mesh, true);
if (y.nUnset() != 0)
{
WarningIn(args.executable())
<< "There are " << y.nUnset()
<< " remaining unset cells and/or boundary values" << endl;
}
const volScalarField& y = wallDist::New(mesh).y();
y.write();
runTime++;
Info<< "Time now = " << runTime.timeName() << endl;
// Move points
boundBox meshBb(mesh.points());
@ -83,14 +73,11 @@ int main(int argc, char *argv[])
}
mesh.movePoints(newPoints);
mesh.write();
y.correct();
y.write();
Info<< "End\n" << endl;
return 0;

View File

@ -34,7 +34,6 @@ Description
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "LESModel.H"
#include "nearWallDist.H"
#include "wallDist.H"
#include "wallFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,17 +52,6 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << endl;
fvMesh::readUpdateState state = mesh.readUpdate();
// Wall distance
if (timeI == 0 || state != fvMesh::UNCHANGED)
{
Info<< "Calculating wall distance\n" << endl;
wallDist y(mesh);
Info<< "Writing wall distance to field "
<< y.name() << nl << endl;
y.write();
}
volScalarField yPlus
(
IOobject

View File

@ -43,8 +43,6 @@ Description
#include "compressible/RAS/RASModel/RASModel.H"
#include "mutWallFunction/mutWallFunctionFvPatchScalarField.H"
#include "wallDist.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void calcIncompressibleYPlus
@ -204,15 +202,6 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << endl;
fvMesh::readUpdateState state = mesh.readUpdate();
// Wall distance
if (timeI == 0 || state != fvMesh::UNCHANGED)
{
Info<< "Calculating wall distance\n" << endl;
wallDist y(mesh);
Info<< "Writing wall distance to field " << y.name() << nl << endl;
y.write();
}
volScalarField yPlus
(
IOobject

View File

@ -38,7 +38,7 @@ volVectorField U
);
Info<< "Calculating wall distance field" << endl;
volScalarField y(wallDist(mesh).y());
const volScalarField& y(wallDist::New(mesh).y());
// Set the mean boundary-layer thickness
dimensionedScalar ybl("ybl", dimLength, 0);