Reorganisation of improved wall functions

Instead of calculating pressure gradient and convection terms in each
wall function (for each patch), function objects pressureGradient and
velocityConvection will update them and register them in the database and we
only fetch the data when updating wall functions.
This commit is contained in:
Vuko Vukcevic 2017-06-12 14:50:25 +02:00 committed by Vuko Vukcevic
parent 391e98828f
commit d9690e81ae
9 changed files with 816 additions and 120 deletions

View file

@ -51,6 +51,9 @@ $(kqRWallFunctions)/kNonEqWallFunction/kNonEqWallFunctionFvPatchScalarField.C
RWallFunctions = $(wallFunctions)/RWallFunctions RWallFunctions = $(wallFunctions)/RWallFunctions
$(RWallFunctions)/RWallFunction/RWallFunctionFvPatchSymmTensorField.C $(RWallFunctions)/RWallFunction/RWallFunctionFvPatchSymmTensorField.C
wallFunctionFunctionObjects = $(wallFunctions)/functionObjects
$(wallFunctionFunctionObjects)/pressureGradient/pressureGradientFunctionObject.C
$(wallFunctionFunctionObjects)/velocityConvection/velocityConvectionFunctionObject.C
/* Patch fields */ /* Patch fields */
derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C

View file

@ -0,0 +1,150 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Author
Vuko Vukcevic, Wikki Ltd. All rights reserved
\*---------------------------------------------------------------------------*/
#include "pressureGradientFunctionObject.H"
#include "addToRunTimeSelectionTable.H"
#include "fvcGrad.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(pressureGradientFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
pressureGradientFunctionObject,
dictionary
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pressureGradientFunctionObject::pressureGradientFunctionObject
(
const word& name,
const Time& t,
const dictionary& dict
)
:
functionObject(name),
name_(name),
time_(t),
regionName_(dict.lookupOrDefault<word>("region", polyMesh::defaultRegion)),
pName_(dict.lookup("pName")),
gradp_
(
IOobject
(
"pressureGradient",
time_.timeName(),
time_.lookupObject<fvMesh>(regionName_),
IOobject::NO_READ,
IOobject::NO_WRITE
),
time_.lookupObject<fvMesh>(regionName_),
// Note: dimensions reset in the constructor body
dimensionedVector("zero", dimless, vector::zero)
)
{
Info<< "Creating pressureGradientFunctionObject for "
<< pName_ << " field." << endl;
// Reset dimensions
const fvMesh& mesh = time_.lookupObject<fvMesh>(regionName_);
if (mesh.foundObject<volScalarField>(pName_))
{
// Found pressure, reset dimensions for pressure gradient
const volScalarField& p =
mesh.lookupObject<volScalarField>(pName_);
gradp_.dimensions().reset(p.dimensions()/dimLength);
}
else
{
WarningIn
(
"pressureGradientFunctionObject::"
"pressureGradientFunctionObject"
"\n("
"\n const word& name,"
"\n const Time& t,"
"\n const dictionary& dict"
"\n)"
) << "Could not find " << pName_ << " field."
<< " Possible dimensions mismatch."
<< endl;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::pressureGradientFunctionObject::start()
{
return true;
}
bool Foam::pressureGradientFunctionObject::execute()
{
const fvMesh& mesh =
time_.lookupObject<fvMesh>(regionName_);
if (mesh.foundObject<volScalarField>(pName_))
{
const volScalarField& p =
mesh.lookupObject<volScalarField>(pName_);
gradp_ = fvc::grad(p);
return true;
}
else
{
InfoIn("bool pressureGradientFunctionObject::execute()")
<< "Field " << pName_ << " not found. Returning."
<< endl;
return false;
}
}
bool Foam::pressureGradientFunctionObject::read(const dictionary& dict)
{
pName_ = word(dict.lookup("pName"));
return false;
}
// ************************************************************************* //

View file

@ -0,0 +1,131 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
pressureGradientFunctionObject
Description
FunctionObject that calculates the pressure gradient given a name for the
pressure field and registers it into the database. Useful for pressure
sensitised wall functions (see omega/nutCWT/MEWT wall functions).
Author
Vuko Vukcevic, Wikki Ltd. All rights reserved
SourceFiles
pressureGradientFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef pressureGradientFunctionObject_H
#define pressureGradientFunctionObject_H
#include "functionObject.H"
#include "dictionary.H"
#include "fvMesh.H"
#include "volFields.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class pressureGradientFunctionObject Declaration
\*---------------------------------------------------------------------------*/
class pressureGradientFunctionObject
:
public functionObject
{
// Private data
//- Name
const word name_;
//- Reference to main object registry
const Time& time_;
//- Region name
word regionName_;
//- Name of the pressure field
word pName_;
//- Pressure gradient field
volVectorField gradp_;
// Private Member Functions
//- Disallow default bitwise copy construct
pressureGradientFunctionObject
(
const pressureGradientFunctionObject&
);
//- Disallow default bitwise assignment
void operator=(const pressureGradientFunctionObject&);
public:
//- Runtime type information
TypeName("pressureGradient");
// Constructors
//- Construct from components
pressureGradientFunctionObject
(
const word& name,
const Time&,
const dictionary&
);
// Member Functions
//- start is called at the start of the time-loop
virtual bool start();
//- execute is called at each ++ or += of the time-loop
virtual bool execute();
//- Read and set the function object if its data has changed
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,170 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Author
Vuko Vukcevic, Wikki Ltd. All rights reserved
\*---------------------------------------------------------------------------*/
#include "velocityConvectionFunctionObject.H"
#include "addToRunTimeSelectionTable.H"
#include "fvcDiv.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(velocityConvectionFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
velocityConvectionFunctionObject,
dictionary
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::velocityConvectionFunctionObject::velocityConvectionFunctionObject
(
const word& name,
const Time& t,
const dictionary& dict
)
:
functionObject(name),
name_(name),
time_(t),
regionName_(dict.lookupOrDefault<word>("region", polyMesh::defaultRegion)),
UName_(dict.lookup("UName")),
phiName_(dict.lookup("phiName")),
convection_
(
IOobject
(
"velocityConvection",
time_.timeName(),
time_.lookupObject<fvMesh>(regionName_),
IOobject::NO_READ,
IOobject::NO_WRITE
),
time_.lookupObject<fvMesh>(regionName_),
// Note: dimensions will be overwritten on start
dimensionedVector("zero", dimless, vector::zero)
)
{
Info<< "Creating velocityConvectionFunctionObject for "
<< UName_ << " and " << phiName_ << " field." << endl;
// Reset dimensions
const fvMesh& mesh = time_.lookupObject<fvMesh>(regionName_);
if
(
mesh.foundObject<volVectorField>(UName_)
&& mesh.foundObject<surfaceScalarField>(phiName_)
)
{
// Found velocity and flux, reset dimensions for convection
const volVectorField& U =
mesh.lookupObject<volVectorField>(UName_);
const surfaceScalarField& phi =
mesh.lookupObject<surfaceScalarField>(phiName_);
convection_.dimensions().reset
(
phi.dimensions()*U.dimensions()/dimArea/dimLength
);
}
else
{
WarningIn
(
"velocityConvectionFunctionObject::"
"velocityConvectionFunctionObject"
"\n("
"\n const word& name,"
"\n const Time& t,"
"\n const dictionary& dict"
"\n)"
) << "Could not find " << UName_ << " and " << phiName_
<< " fields. Possible dimensions mismatch."
<< endl;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::velocityConvectionFunctionObject::start()
{
return true;
}
bool Foam::velocityConvectionFunctionObject::execute()
{
const fvMesh& mesh = time_.lookupObject<fvMesh>(regionName_);
if
(
mesh.foundObject<volVectorField>(UName_)
&& mesh.foundObject<surfaceScalarField>(phiName_)
)
{
// Found velocity and flux, reset dimensions for convection
const volVectorField& U =
mesh.lookupObject<volVectorField>(UName_);
const surfaceScalarField& phi =
mesh.lookupObject<surfaceScalarField>(phiName_);
convection_ = fvc::div(phi, U);
return true;
}
else
{
InfoIn("bool velocityConvectionFunctionObject::execute()")
<< "Field " << UName_ << " or " << phiName_ << " not found."
<< " Returning."
<< endl;
return false;
}
}
bool Foam::velocityConvectionFunctionObject::read(const dictionary& dict)
{
UName_ = word(dict.lookup("UName"));
phiName_ = word(dict.lookup("phiName"));
return false;
}
// ************************************************************************* //

View file

@ -0,0 +1,135 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
velocityConvectionFunctionObject
Description
FunctionObject that calculates the velocity convection given names for the
velocity field and the flux field and registers it into the database. Useful
for convection sensitised wall functions (see omega/nutCWT/MEWT wall
functions).
Author
Vuko Vukcevic, Wikki Ltd. All rights reserved
SourceFiles
velocityConvectionFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef velocityConvectionFunctionObject_H
#define velocityConvectionFunctionObject_H
#include "functionObject.H"
#include "dictionary.H"
#include "fvMesh.H"
#include "volFields.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class velocityConvectionFunctionObject Declaration
\*---------------------------------------------------------------------------*/
class velocityConvectionFunctionObject
:
public functionObject
{
// Private data
//- Name
const word name_;
//- Reference to main object registry
const Time& time_;
//- Region name
word regionName_;
//- Name of the velocity field
word UName_;
//- Name of the flux field
word phiName_;
//- Convection field
volVectorField convection_;
// Private Member Functions
//- Disallow default bitwise copy construct
velocityConvectionFunctionObject
(
const velocityConvectionFunctionObject&
);
//- Disallow default bitwise assignment
void operator=(const velocityConvectionFunctionObject&);
public:
//- Runtime type information
TypeName("velocityConvection");
// Constructors
//- Construct from components
velocityConvectionFunctionObject
(
const word& name,
const Time&,
const dictionary&
);
// Member Functions
//- start is called at the start of the time-loop
virtual bool start();
//- execute is called at each ++ or += of the time-loop
virtual bool execute();
//- Read and set the function object if its data has changed
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -98,53 +98,79 @@ tmp<scalarField> nutCWTWallFunctionFvPatchScalarField::calcNut() const
const scalarField magUwInTang = mag(UwInTang); const scalarField magUwInTang = mag(UwInTang);
// Calculate tangential direction for patch cells // Calculate tangential direction for patch cells
const vectorField tDir = UwInTang/magUwInTang; const vectorField tDir = UwInTang/(magUwInTang + SMALL);
// Wall-velocity vector field tangential to the wall // Wall-velocity vector field tangential to the wall
const vectorField UwTang = Uw - (Uw & n)*n; const vectorField UwTang = Uw - (Uw & n)*n;
const scalarField magUwTang = mag(UwTang); const scalarField magUwTang = mag(UwTang);
// Pressure terms // Pressure effects. Lookup the pressure gradient field from the registry
const volScalarField& p = // (created with pressureGradient function object)
this->dimensionedInternalField().mesh().lookupObject
<
volScalarField
>(pName_);
// Pressure gradient // Pressure gradient projected on the wall parallel velocity direction
const volVectorField gradp = fvc::grad(p); scalarField gradpTang(magGradUw.size(), 0.0);
// Pressure gradient in wall adjacent cell if
const vectorField gradPIn = (
gradp.boundaryField()[this->patch().index()].patchInternalField(); this->dimensionedInternalField().mesh().foundObject
// Pressure gradient projected on the wall parallel velocity
const scalarField gradpTang= gradPIn & tDir;
// Convective terms
const volVectorField& U =
this->dimensionedInternalField().mesh().lookupObject
< <
volVectorField volVectorField
>(UName_); >("pressureGradient")
)
const surfaceScalarField& phi = {
const volVectorField& gradP =
this->dimensionedInternalField().mesh().lookupObject this->dimensionedInternalField().mesh().lookupObject
<volVectorField>("pressureGradient");
// Update pressure gradient projected on the wall parallel velocity
gradpTang =
gradP.boundaryField()[this->patch().index()].patchInternalField()
& tDir;
}
else
{
Info<< "Field pressureGradient not found. Neglecting pressure gradient "
<< "effects for wall functions at patch: " << patch().name()
<< endl;
}
// Convective terms. Lookup the convection field from the registry (created
// with velocityConvection function object)
// Velocity convection projected on the wall parallel velocity direction
scalarField convectionTang(magGradUw.size(), 0.0);
if
(
this->dimensionedInternalField().mesh().foundObject
< <
surfaceScalarField volVectorField
>("phi"); >("velocityConvection")
)
{
const volVectorField& convection =
this->dimensionedInternalField().mesh().lookupObject
<volVectorField>("velocityConvection");
const volVectorField convection = fvc::div(phi, U); // Upate convection term projected on the wall parallel velocity
convectionTang =
convection.boundaryField()
[
this->patch().index()
].patchInternalField()
& tDir;
}
else
{
Info<< "Field velocityConvection not found. Neglecting convection "
<< "effects for wall functions at patch: " << patch().name()
<< endl;
}
const vectorField convectionIn =
convection.boundaryField()[this->patch().index()].patchInternalField();
// Convection term projected on the wall parallel velocity tmp<scalarField> tnutw(new scalarField(patch().size(), SMALL));
const scalarField convectionTang = convectionIn & tDir;
tmp<scalarField> tnutw(new scalarField(patch().size()));
scalarField& nutw = tnutw(); scalarField& nutw = tnutw();
// Get face cells // Get face cells
@ -171,7 +197,7 @@ tmp<scalarField> nutCWTWallFunctionFvPatchScalarField::calcNut() const
const scalar gamma = -0.01*pow(yPlus, 4)/(1.0 + 5.0*yPlus); const scalar gamma = -0.01*pow(yPlus, 4)/(1.0 + 5.0*yPlus);
const scalar tauw = tauwVis*exp(gamma) + tauwLog*exp(1.0/gamma); const scalar tauw = tauwVis*exp(gamma) + tauwLog*exp(1.0/gamma);
nutw[faceI] = tauw/magGradUw[faceI] - nuw[faceI]; nutw[faceI] = tauw/(magGradUw[faceI] + SMALL) - nuw[faceI];
} }
return tnutw; return tnutw;

View file

@ -109,51 +109,76 @@ tmp<scalarField> nutMEWTWallFunctionFvPatchScalarField::calcNut() const
const scalarField magUwInTang = mag(UwInTang); const scalarField magUwInTang = mag(UwInTang);
// Calculate tangential direction for patch cells // Calculate tangential direction for patch cells
const vectorField tDir = UwInTang/magUwInTang; const vectorField tDir = UwInTang/(magUwInTang + SMALL);
// Wall-velocity vector field tangential to the wall // Wall-velocity vector field tangential to the wall
const vectorField UwTang = Uw - (Uw & n)*n; const vectorField UwTang = Uw - (Uw & n)*n;
const scalarField magUwTang = mag(UwTang); const scalarField magUwTang = mag(UwTang);
// Pressure terms // Pressure effects. Lookup the pressure gradient field from the registry
const volScalarField& p = // (created with pressureGradient function object)
this->dimensionedInternalField().mesh().lookupObject
<
volScalarField
>(pName_);
// Pressure gradient // Pressure gradient projected on the wall parallel velocity direction
const volVectorField gradp = fvc::grad(p); scalarField gradpTang(magGradUw.size(), 0.0);
// Pressure gradient in wall adjacent cell if
const vectorField gradPIn = (
gradp.boundaryField()[this->patch().index()].patchInternalField(); this->dimensionedInternalField().mesh().foundObject
// Pressure gradient projected on the wall parallel velocity
const scalarField gradpTang= gradPIn & tDir;
// Convective terms
const volVectorField& U =
this->dimensionedInternalField().mesh().lookupObject
< <
volVectorField volVectorField
>(UName_); >("pressureGradient")
)
const surfaceScalarField& phi = {
const volVectorField& gradP =
this->dimensionedInternalField().mesh().lookupObject this->dimensionedInternalField().mesh().lookupObject
<volVectorField>("pressureGradient");
// Update pressure gradient projected on the wall parallel velocity
gradpTang =
gradP.boundaryField()[this->patch().index()].patchInternalField()
& tDir;
}
else
{
Info<< "Field pressureGradient not found. Neglecting pressure gradient "
<< "effects for wall functions at patch: " << patch().name()
<< endl;
}
// Convective terms. Lookup the convection field from the registry (created
// with velocityConvection function object)
// Velocity convection projected on the wall parallel velocity direction
scalarField convectionTang(magGradUw.size(), 0.0);
if
(
this->dimensionedInternalField().mesh().foundObject
< <
surfaceScalarField volVectorField
>("phi"); >("velocityConvection")
)
{
const volVectorField& convection =
this->dimensionedInternalField().mesh().lookupObject
<volVectorField>("velocityConvection");
const volVectorField convection = fvc::div(phi, U); // Upate convection term projected on the wall parallel velocity
convectionTang =
const vectorField convectionIn = convection.boundaryField()
convection.boundaryField()[this->patch().index()].patchInternalField(); [
this->patch().index()
// Convection term projected on the wall parallel velocity ].patchInternalField()
const scalarField convectionTang = convectionIn & tDir; & tDir;
}
else
{
Info<< "Field velocityConvection not found. Neglecting convection "
<< "effects for wall functions at patch: " << patch().name()
<< endl;
}
// Needed to calculate yPlus // Needed to calculate yPlus
const scalarField& eddyVis = const scalarField& eddyVis =

View file

@ -227,48 +227,76 @@ void omegaCWTWallFunctionFvPatchScalarField::updateCoeffs()
const scalarField magUwInTang = mag(UwInTang); const scalarField magUwInTang = mag(UwInTang);
// Calculate tangential direction for patch cells // Calculate tangential direction for patch cells
const vectorField tDir = UwInTang/magUwInTang; const vectorField tDir = UwInTang/(magUwInTang + SMALL);
// Magnitude of the surface normal gradient velocity // Magnitude of the surface normal gradient velocity
const scalarField magGradUw = mag(Uw.snGrad()); const scalarField magGradUw = mag(Uw.snGrad());
// Pressure effects // Pressure effects. Lookup the pressure gradient field from the registry
const volScalarField& p = // (created with pressureGradient function object)
this->dimensionedInternalField().mesh().lookupObject
<volScalarField>(pName_);
// Pressure gradient
const volVectorField gradp = fvc::grad(p);
// Pressure gradient in wall adjacent cell
const vectorField gradPIn =
gradp.boundaryField()[this->patch().index()].patchInternalField();
// Pressure gradient projected on the wall parallel velocity direction // Pressure gradient projected on the wall parallel velocity direction
const scalarField gradpTang= gradPIn & tDir; scalarField gradpTang(magGradUw.size(), 0.0);
if
// Convective terms (
const volVectorField& U = this->dimensionedInternalField().mesh().foundObject
this->dimensionedInternalField().mesh().lookupObject
< <
volVectorField volVectorField
>(UName_); >("pressureGradient")
)
const surfaceScalarField& phi = {
const volVectorField& gradP =
this->dimensionedInternalField().mesh().lookupObject this->dimensionedInternalField().mesh().lookupObject
<volVectorField>("pressureGradient");
// Update pressure gradient projected on the wall parallel velocity
gradpTang =
gradP.boundaryField()[this->patch().index()].patchInternalField()
& tDir;
}
else
{
Info<< "Field pressureGradient not found. Neglecting pressure gradient "
<< "effects for wall functions at patch: " << patch().name()
<< endl;
}
// Convective terms. Lookup the convection field from the registry (created
// with velocityConvection function object)
// Velocity convection projected on the wall parallel velocity direction
scalarField convectionTang(magGradUw.size(), 0.0);
if
(
this->dimensionedInternalField().mesh().foundObject
< <
surfaceScalarField volVectorField
>("phi"); >("velocityConvection")
)
{
const volVectorField& convection =
this->dimensionedInternalField().mesh().lookupObject
<volVectorField>("velocityConvection");
const volVectorField convection = fvc::div(phi, U); // Upate convection term projected on the wall parallel velocity
convectionTang =
convection.boundaryField()
[
this->patch().index()
].patchInternalField()
& tDir;
}
else
{
Info<< "Field velocityConvection not found. Neglecting convection "
<< "effects for wall functions at patch: " << patch().name()
<< endl;
}
const vectorField convectionIn =
convection.boundaryField()[this->patch().index()].patchInternalField();
// Convection term projected on the wall parallel velocity
const scalarField convectionTang = convectionIn & tDir;
// Get face cells // Get face cells
const unallocLabelList& fc = patch().faceCells(); const unallocLabelList& fc = patch().faceCells();

View file

@ -229,42 +229,70 @@ void omegaMEWTWallFunctionFvPatchScalarField::updateCoeffs()
const scalarField magGradUw = mag(Uw.snGrad()); const scalarField magGradUw = mag(Uw.snGrad());
// Pressure effects // Pressure effects. Lookup the pressure gradient field from the registry
const volScalarField& p = // (created with pressureGradient function object)
this->dimensionedInternalField().mesh().lookupObject
<volScalarField>(pName_);
// Pressure gradient
const volVectorField gradp = fvc::grad(p);
// Pressure gradient in wall adjacent cell
const vectorField gradPIn =
gradp.boundaryField()[this->patch().index()].patchInternalField();
// Pressure gradient projected on the wall parallel velocity direction // Pressure gradient projected on the wall parallel velocity direction
const scalarField gradpTang= gradPIn & tDir; scalarField gradpTang(magGradUw.size(), 0.0);
if
// Convective terms (
const volVectorField& U = this->dimensionedInternalField().mesh().foundObject
this->dimensionedInternalField().mesh().lookupObject
< <
volVectorField volVectorField
>(UName_); >("pressureGradient")
)
const surfaceScalarField& phi = {
const volVectorField& gradP =
this->dimensionedInternalField().mesh().lookupObject this->dimensionedInternalField().mesh().lookupObject
<volVectorField>("pressureGradient");
// Update pressure gradient projected on the wall parallel velocity
gradpTang =
gradP.boundaryField()[this->patch().index()].patchInternalField()
& tDir;
}
else
{
Info<< "Field pressureGradient not found. Neglecting pressure gradient "
<< "effects for wall functions at patch: " << patch().name()
<< endl;
}
// Convective terms. Lookup the convection field from the registry (created
// with velocityConvection function object)
// Velocity convection projected on the wall parallel velocity direction
scalarField convectionTang(magGradUw.size(), 0.0);
if
(
this->dimensionedInternalField().mesh().foundObject
< <
surfaceScalarField volVectorField
>("phi"); >("velocityConvection")
)
{
const volVectorField& convection =
this->dimensionedInternalField().mesh().lookupObject
<volVectorField>("velocityConvection");
const volVectorField convection = fvc::div(phi, U); // Upate convection term projected on the wall parallel velocity
convectionTang =
convection.boundaryField()
[
this->patch().index()
].patchInternalField()
& tDir;
}
else
{
Info<< "Field velocityConvection not found. Neglecting convection "
<< "effects for wall functions at patch: " << patch().name()
<< endl;
}
const vectorField convectionIn =
convection.boundaryField()[this->patch().index()].patchInternalField();
// Convection term projected on the wall parallel velocity
const scalarField convectionTang = convectionIn & tDir;
// Get face cells // Get face cells
const unallocLabelList& fc = patch().faceCells(); const unallocLabelList& fc = patch().faceCells();