functionObjects::wallShearStress: Added phase support

wallShearStress can now be used to calculate the phase wall shear-stress in
multiphase systems, e.g.

    multiphaseEulerFoam -postProcess -func 'wallShearStress(phase=water)' -latestTime
This commit is contained in:
Henry Weller
2021-12-03 16:28:40 +00:00
parent d10f229c4d
commit e6acc7d991
3 changed files with 32 additions and 25 deletions

View File

@ -102,9 +102,11 @@ Foam::functionObjects::wallShearStress::wallShearStress
fvMeshFunctionObject(name, runTime, dict),
logFiles(obr_, name),
writeLocalObjects(obr_, log),
phaseName_(word::null),
patchSet_()
{
read(dict);
resetLocalObjectName(IOobject::groupName(type(), phaseName_));
}
@ -121,6 +123,8 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
fvMeshFunctionObject::read(dict);
writeLocalObjects::read(dict);
phaseName_ = dict.lookupOrDefault<word>("phase", word::null);
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
patchSet_ =
@ -177,34 +181,38 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
bool Foam::functionObjects::wallShearStress::execute()
{
const word fieldName(IOobject::groupName(type(), phaseName_));
typedef compressible::momentumTransportModel cmpModel;
typedef incompressible::momentumTransportModel icoModel;
tmp<volSymmTensorField> tau;
if (mesh_.foundObject<cmpModel>(momentumTransportModel::typeName))
const word momentumTransportModelName
(
IOobject::groupName(momentumTransportModel::typeName, phaseName_)
);
if (mesh_.foundObject<cmpModel>(momentumTransportModelName))
{
const cmpModel& model =
mesh_.lookupObject<cmpModel>(momentumTransportModel::typeName);
mesh_.lookupObject<cmpModel>(momentumTransportModelName);
tau = model.devTau();
return store(fieldName, calcShearStress(model.devTau()));
}
else if (mesh_.foundObject<icoModel>(momentumTransportModel::typeName))
else if (mesh_.foundObject<icoModel>(momentumTransportModelName))
{
const icoModel& model =
mesh_.lookupObject<icoModel>(momentumTransportModel::typeName);
mesh_.lookupObject<icoModel>(momentumTransportModelName);
tau = model.devSigma();
return store(fieldName, calcShearStress(model.devSigma()));
}
else
{
FatalErrorInFunction
<< "Unable to find turbulence model in the "
<< "database" << exit(FatalError);
return false;
}
word name(type());
return store(name, calcShearStress(tau));
}
@ -216,8 +224,10 @@ bool Foam::functionObjects::wallShearStress::write()
logFiles::write();
const volVectorField& wallShearStress =
obr_.lookupObject<volVectorField>(type());
const volVectorField& wallShearStress = obr_.lookupObject<volVectorField>
(
IOobject::groupName(type(), phaseName_)
);
const fvPatchList& patches = mesh_.boundary();

View File

@ -26,7 +26,7 @@ Class
Description
Calculates and write the shear-stress at wall patches as
the volVectorField field 'wallShearStress'.
the volVectorField field 'wallShearStress' or 'wallShearStress.<phase>'.
\f[
Stress = R \dot n
@ -55,9 +55,10 @@ Description
Usage
\table
Property | Description | Required | Default value
Property | Description | Required | Default value
type | type name: wallShearStress | yes |
patches | list of patches to process | no | all wall patches
phase | phase name | no |
\endtable
Note
@ -102,16 +103,16 @@ class wallShearStress
public logFiles,
public writeLocalObjects
{
// Private Data
protected:
// Protected data
//- The name of the phase
word phaseName_;
//- Optional list of patches to process
labelHashSet patchSet_;
// Protected Member Functions
// Private Member Functions
//- File header information
virtual void writeFileHeader(const label i);

View File

@ -26,7 +26,7 @@ Class
Description
Evaluates and outputs turbulence y+ for models. Values written to
time directories as field 'yPlus' or 'yPlus.phase'.
time directories as field 'yPlus' or 'yPlus.<phase>'.
Example of function object specification:
\verbatim
@ -90,16 +90,12 @@ class yPlus
public logFiles,
public writeLocalObjects
{
protected:
// Protected data
// Private data
//- Optional phase name
word phaseName_;
private:
// Private Member Functions
//- File header information