functionObjects::wallHeatFlux: Added phase support

wallHeatFlux can now be used to calculate the phase wall heat-flux in
multiphase systems, e.g.

    multiphaseEulerFoam -postProcess -func 'wallHeatFlux(phase=water)' -latestTime
This commit is contained in:
Henry Weller
2021-12-03 16:45:46 +00:00
parent e6acc7d991
commit 7d4dcacbd4
2 changed files with 22 additions and 11 deletions

View File

@ -117,9 +117,11 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
logFiles(obr_, name), logFiles(obr_, name),
writeLocalObjects(obr_, log), writeLocalObjects(obr_, log),
phaseName_(word::null),
patchSet_() patchSet_()
{ {
read(dict); read(dict);
resetLocalObjectName(IOobject::groupName(type(), phaseName_));
} }
@ -136,6 +138,8 @@ bool Foam::functionObjects::wallHeatFlux::read(const dictionary& dict)
fvMeshFunctionObject::read(dict); fvMeshFunctionObject::read(dict);
writeLocalObjects::read(dict); writeLocalObjects::read(dict);
phaseName_ = dict.lookupOrDefault<word>("phase", word::null);
const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
patchSet_ = patchSet_ =
@ -192,30 +196,35 @@ bool Foam::functionObjects::wallHeatFlux::read(const dictionary& dict)
bool Foam::functionObjects::wallHeatFlux::execute() bool Foam::functionObjects::wallHeatFlux::execute()
{ {
word name(type()); const word fieldName(IOobject::groupName(type(), phaseName_));
const word thermophysicalTransportModelName
(
IOobject::groupName(thermophysicalTransportModel::typeName, phaseName_)
);
if if
( (
foundObject<thermophysicalTransportModel> foundObject<thermophysicalTransportModel>
( (
thermophysicalTransportModel::typeName thermophysicalTransportModelName
) )
) )
{ {
const thermophysicalTransportModel& ttm = const thermophysicalTransportModel& ttm =
lookupObject<thermophysicalTransportModel> lookupObject<thermophysicalTransportModel>
( (
thermophysicalTransportModel::typeName thermophysicalTransportModelName
); );
return store(name, calcWallHeatFlux(ttm.q())); return store(fieldName, calcWallHeatFlux(ttm.q()));
} }
else if (foundObject<solidThermo>(physicalProperties::typeName)) else if (foundObject<solidThermo>(physicalProperties::typeName))
{ {
const solidThermo& thermo = const solidThermo& thermo =
lookupObject<solidThermo>(physicalProperties::typeName); lookupObject<solidThermo>(physicalProperties::typeName);
return store(name, calcWallHeatFlux(thermo.q())); return store(fieldName, calcWallHeatFlux(thermo.q()));
} }
else else
{ {
@ -236,8 +245,10 @@ bool Foam::functionObjects::wallHeatFlux::write()
logFiles::write(); logFiles::write();
const volScalarField& wallHeatFlux = const volScalarField& wallHeatFlux = obr_.lookupObject<volScalarField>
obr_.lookupObject<volScalarField>(type()); (
IOobject::groupName(type(), phaseName_)
);
const fvPatchList& patches = mesh_.boundary(); const fvPatchList& patches = mesh_.boundary();

View File

@ -94,16 +94,16 @@ class wallHeatFlux
public logFiles, public logFiles,
public writeLocalObjects public writeLocalObjects
{ {
// Private Data
protected: //- The name of the phase
word phaseName_;
// Protected data
//- Optional list of patches to process //- Optional list of patches to process
labelHashSet patchSet_; labelHashSet patchSet_;
// Protected Member Functions // Private Member Functions
//- File header information //- File header information
virtual void writeFileHeader(const label i); virtual void writeFileHeader(const label i);