mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
functionObjects: Further simplification and rationalization using the fvMeshFunctionObject base-class
This commit is contained in:
@ -52,6 +52,18 @@ Foam::functionObjects::fvMeshFunctionObject::fvMeshFunctionObject
|
||||
{}
|
||||
|
||||
|
||||
Foam::functionObjects::fvMeshFunctionObject::fvMeshFunctionObject
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
regionFunctionObject(name, obr, dict),
|
||||
mesh_(refCast<const fvMesh>(obr_))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::fvMeshFunctionObject::~fvMeshFunctionObject()
|
||||
|
||||
@ -100,6 +100,14 @@ public:
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from the region objectRegistry and dictionary
|
||||
fvMeshFunctionObject
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~fvMeshFunctionObject();
|
||||
|
||||
@ -103,18 +103,12 @@ Foam::functionObjects::fieldMinMax::fieldMinMax
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
regionFunctionObject(name, runTime, dict),
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
logFiles(obr_, name),
|
||||
location_(true),
|
||||
mode_(mdMag),
|
||||
fieldSet_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
resetName(typeName);
|
||||
}
|
||||
@ -130,7 +124,7 @@ Foam::functionObjects::fieldMinMax::~fieldMinMax()
|
||||
|
||||
bool Foam::functionObjects::fieldMinMax::read(const dictionary& dict)
|
||||
{
|
||||
regionFunctionObject::read(dict);
|
||||
fvMeshFunctionObject::read(dict);
|
||||
|
||||
location_ = dict.lookupOrDefault<Switch>("location", true);
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ Usage
|
||||
Output data is written to the file \<timeDir\>/fieldMinMax.dat
|
||||
|
||||
See also
|
||||
Foam::functionObjects::regionFunctionObject
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
Foam::functionObjects::logFiles
|
||||
|
||||
SourceFiles
|
||||
@ -78,7 +78,7 @@ SourceFiles
|
||||
#ifndef functionObjects_fieldMinMax_H
|
||||
#define functionObjects_fieldMinMax_H
|
||||
|
||||
#include "regionFunctionObject.H"
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "logFiles.H"
|
||||
#include "vector.H"
|
||||
|
||||
@ -95,7 +95,7 @@ namespace functionObjects
|
||||
|
||||
class fieldMinMax
|
||||
:
|
||||
public regionFunctionObject,
|
||||
public fvMeshFunctionObject,
|
||||
public logFiles
|
||||
{
|
||||
public:
|
||||
|
||||
@ -109,10 +109,9 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
|
||||
const label proci = Pstream::myProcNo();
|
||||
|
||||
const fieldType& field = obr_.lookupObject<fieldType>(fieldName);
|
||||
const fvMesh& mesh = field.mesh();
|
||||
|
||||
const volVectorField::Boundary& CfBoundary =
|
||||
mesh.C().boundaryField();
|
||||
mesh_.C().boundaryField();
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
@ -126,7 +125,7 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
|
||||
List<vector> minCs(Pstream::nProcs());
|
||||
label minProci = findMin(magField);
|
||||
minVs[proci] = magField[minProci];
|
||||
minCs[proci] = field.mesh().C()[minProci];
|
||||
minCs[proci] = mesh_.C()[minProci];
|
||||
|
||||
|
||||
labelList maxIs(Pstream::nProcs());
|
||||
@ -134,7 +133,7 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
|
||||
List<vector> maxCs(Pstream::nProcs());
|
||||
label maxProci = findMax(magField);
|
||||
maxVs[proci] = magField[maxProci];
|
||||
maxCs[proci] = field.mesh().C()[maxProci];
|
||||
maxCs[proci] = mesh_.C()[maxProci];
|
||||
|
||||
forAll(magFieldBoundary, patchi)
|
||||
{
|
||||
@ -198,7 +197,7 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
|
||||
List<vector> minCs(Pstream::nProcs());
|
||||
label minProci = findMin(field);
|
||||
minVs[proci] = field[minProci];
|
||||
minCs[proci] = field.mesh().C()[minProci];
|
||||
minCs[proci] = mesh_.C()[minProci];
|
||||
|
||||
Pstream::gatherList(minVs);
|
||||
Pstream::gatherList(minCs);
|
||||
@ -207,7 +206,7 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
|
||||
List<vector> maxCs(Pstream::nProcs());
|
||||
label maxProci = findMax(field);
|
||||
maxVs[proci] = field[maxProci];
|
||||
maxCs[proci] = field.mesh().C()[maxProci];
|
||||
maxCs[proci] = mesh_.C()[maxProci];
|
||||
|
||||
forAll(fieldBoundary, patchi)
|
||||
{
|
||||
|
||||
@ -49,7 +49,7 @@ Foam::functionObjects::fieldValue::fieldValue
|
||||
const word& valueType
|
||||
)
|
||||
:
|
||||
regionFunctionObject(name, runTime, dict),
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
logFiles(obr_, name),
|
||||
dict_(dict),
|
||||
regionName_(word::null),
|
||||
@ -68,7 +68,7 @@ Foam::functionObjects::fieldValue::fieldValue
|
||||
const word& valueType
|
||||
)
|
||||
:
|
||||
regionFunctionObject(name, obr, dict),
|
||||
fvMeshFunctionObject(name, obr, dict),
|
||||
logFiles(obr_, name),
|
||||
dict_(dict),
|
||||
regionName_(word::null),
|
||||
@ -88,9 +88,13 @@ Foam::functionObjects::fieldValue::~fieldValue()
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::fieldValue::read(const dictionary& dict)
|
||||
{
|
||||
if (dict != dict_)
|
||||
{
|
||||
dict_ = dict;
|
||||
regionFunctionObject::read(dict);
|
||||
}
|
||||
|
||||
fvMeshFunctionObject::read(dict);
|
||||
|
||||
dict.lookup("fields") >> fields_;
|
||||
dict.lookup("writeFields") >> writeFields_;
|
||||
|
||||
@ -32,7 +32,7 @@ Description
|
||||
|
||||
See also
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::regionFunctionObject
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
Foam::functionObjects::logFiles
|
||||
|
||||
SourceFiles
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
#ifndef functionObjects_fieldValue_H
|
||||
#define functionObjects_fieldValue_H
|
||||
|
||||
#include "regionFunctionObject.H"
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "logFiles.H"
|
||||
#include "Switch.H"
|
||||
#include "Field.H"
|
||||
@ -65,7 +65,7 @@ namespace functionObjects
|
||||
|
||||
class fieldValue
|
||||
:
|
||||
public regionFunctionObject,
|
||||
public fvMeshFunctionObject,
|
||||
public logFiles
|
||||
{
|
||||
|
||||
@ -169,9 +169,6 @@ public:
|
||||
//- Return the output field values flag
|
||||
inline const Switch& writeFields() const;
|
||||
|
||||
//- Helper function to return the reference to the mesh
|
||||
inline const fvMesh& mesh() const;
|
||||
|
||||
//- Return access to the latest set of results
|
||||
inline const dictionary& resultDict() const;
|
||||
|
||||
|
||||
@ -53,12 +53,6 @@ Foam::functionObjects::fieldValue::writeFields() const
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::fvMesh& Foam::functionObjects::fieldValue::mesh() const
|
||||
{
|
||||
return refCast<const fvMesh>(obr_);
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::dictionary&
|
||||
Foam::functionObjects::fieldValue::resultDict() const
|
||||
{
|
||||
|
||||
@ -112,12 +112,6 @@ Foam::functionObjects::fieldValues::fieldValueDelta::fieldValueDelta
|
||||
region1Ptr_(nullptr),
|
||||
region2Ptr_(nullptr)
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
resetName(typeName);
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ const Foam::NamedEnum
|
||||
|
||||
void Foam::functionObjects::fieldValues::surfaceRegion::setFaceZoneFaces()
|
||||
{
|
||||
label zoneId = mesh().faceZones().findZoneID(regionName_);
|
||||
label zoneId = mesh_.faceZones().findZoneID(regionName_);
|
||||
|
||||
if (zoneId < 0)
|
||||
{
|
||||
@ -110,11 +110,11 @@ void Foam::functionObjects::fieldValues::surfaceRegion::setFaceZoneFaces()
|
||||
<< type() << " " << name() << ": "
|
||||
<< regionTypeNames_[regionType_] << "(" << regionName_ << "):" << nl
|
||||
<< " Unknown face zone name: " << regionName_
|
||||
<< ". Valid face zones are: " << mesh().faceZones().names()
|
||||
<< ". Valid face zones are: " << mesh_.faceZones().names()
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
|
||||
const faceZone& fZone = mesh().faceZones()[zoneId];
|
||||
const faceZone& fZone = mesh_.faceZones()[zoneId];
|
||||
|
||||
DynamicList<label> faceIds(fZone.size());
|
||||
DynamicList<label> facePatchIds(fZone.size());
|
||||
@ -126,15 +126,15 @@ void Foam::functionObjects::fieldValues::surfaceRegion::setFaceZoneFaces()
|
||||
|
||||
label faceId = -1;
|
||||
label facePatchId = -1;
|
||||
if (mesh().isInternalFace(facei))
|
||||
if (mesh_.isInternalFace(facei))
|
||||
{
|
||||
faceId = facei;
|
||||
facePatchId = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
facePatchId = mesh().boundaryMesh().whichPatch(facei);
|
||||
const polyPatch& pp = mesh().boundaryMesh()[facePatchId];
|
||||
facePatchId = mesh_.boundaryMesh().whichPatch(facei);
|
||||
const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
|
||||
if (isA<coupledPolyPatch>(pp))
|
||||
{
|
||||
if (refCast<const coupledPolyPatch>(pp).owner())
|
||||
@ -187,7 +187,7 @@ void Foam::functionObjects::fieldValues::surfaceRegion::setFaceZoneFaces()
|
||||
|
||||
void Foam::functionObjects::fieldValues::surfaceRegion::setPatchFaces()
|
||||
{
|
||||
const label patchid = mesh().boundaryMesh().findPatchID(regionName_);
|
||||
const label patchid = mesh_.boundaryMesh().findPatchID(regionName_);
|
||||
|
||||
if (patchid < 0)
|
||||
{
|
||||
@ -196,11 +196,11 @@ void Foam::functionObjects::fieldValues::surfaceRegion::setPatchFaces()
|
||||
<< regionTypeNames_[regionType_] << "(" << regionName_ << "):" << nl
|
||||
<< " Unknown patch name: " << regionName_
|
||||
<< ". Valid patch names are: "
|
||||
<< mesh().boundaryMesh().names() << nl
|
||||
<< mesh_.boundaryMesh().names() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const polyPatch& pp = mesh().boundaryMesh()[patchid];
|
||||
const polyPatch& pp = mesh_.boundaryMesh()[patchid];
|
||||
|
||||
label nFaces = pp.size();
|
||||
if (isA<emptyPolyPatch>(pp))
|
||||
@ -230,7 +230,7 @@ void Foam::functionObjects::fieldValues::surfaceRegion::sampledSurfaceFaces
|
||||
surfacePtr_ = sampledSurface::New
|
||||
(
|
||||
name(),
|
||||
mesh(),
|
||||
mesh_,
|
||||
dict.subDict("sampledSurfaceDict")
|
||||
);
|
||||
surfacePtr_().update();
|
||||
@ -253,15 +253,15 @@ void Foam::functionObjects::fieldValues::surfaceRegion::combineMeshGeometry
|
||||
if (facePatchId_[i] != -1)
|
||||
{
|
||||
label patchi = facePatchId_[i];
|
||||
globalFacesIs[i] += mesh().boundaryMesh()[patchi].start();
|
||||
globalFacesIs[i] += mesh_.boundaryMesh()[patchi].start();
|
||||
}
|
||||
}
|
||||
|
||||
// Add local faces and points to the all* lists
|
||||
indirectPrimitivePatch pp
|
||||
(
|
||||
IndirectList<face>(mesh().faces(), globalFacesIs),
|
||||
mesh().points()
|
||||
IndirectList<face>(mesh_.faces(), globalFacesIs),
|
||||
mesh_.points()
|
||||
);
|
||||
allFaces[Pstream::myProcNo()] = pp.localFaces();
|
||||
allPoints[Pstream::myProcNo()] = pp.localPoints();
|
||||
@ -372,7 +372,7 @@ void Foam::functionObjects::fieldValues::surfaceRegion::combineSurfaceGeometry
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Dimension as fraction of mesh bounding box
|
||||
scalar mergeDim = 1e-10*mesh().bounds().mag();
|
||||
scalar mergeDim = 1e-10*mesh_.bounds().mag();
|
||||
|
||||
labelList pointsMap;
|
||||
|
||||
@ -409,7 +409,7 @@ Foam::functionObjects::fieldValues::surfaceRegion::totalArea() const
|
||||
}
|
||||
else
|
||||
{
|
||||
totalArea = gSum(filterField(mesh().magSf(), false));
|
||||
totalArea = gSum(filterField(mesh_.magSf(), false));
|
||||
}
|
||||
|
||||
return totalArea;
|
||||
@ -664,12 +664,6 @@ Foam::functionObjects::fieldValues::surfaceRegion::surfaceRegion
|
||||
facePatchId_(),
|
||||
faceSign_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
@ -694,12 +688,6 @@ Foam::functionObjects::fieldValues::surfaceRegion::surfaceRegion
|
||||
facePatchId_(),
|
||||
faceSign_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
@ -291,7 +291,7 @@ bool Foam::functionObjects::fieldValues::surfaceRegion::writeValues
|
||||
else
|
||||
{
|
||||
// Get oriented Sf
|
||||
Sf = filterField(mesh().Sf(), true);
|
||||
Sf = filterField(mesh_.Sf(), true);
|
||||
}
|
||||
|
||||
// Combine onto master
|
||||
|
||||
@ -95,24 +95,24 @@ void Foam::functionObjects::fieldValues::volRegion::setCellZoneCells()
|
||||
{
|
||||
dict().lookup("name") >> regionName_;
|
||||
|
||||
label zoneId = mesh().cellZones().findZoneID(regionName_);
|
||||
label zoneId = mesh_.cellZones().findZoneID(regionName_);
|
||||
|
||||
if (zoneId < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown cell zone name: " << regionName_
|
||||
<< ". Valid cell zones are: " << mesh().cellZones().names()
|
||||
<< ". Valid cell zones are: " << mesh_.cellZones().names()
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
|
||||
cellId_ = mesh().cellZones()[zoneId];
|
||||
cellId_ = mesh_.cellZones()[zoneId];
|
||||
nCells_ = returnReduce(cellId_.size(), sumOp<label>());
|
||||
break;
|
||||
}
|
||||
|
||||
case stAll:
|
||||
{
|
||||
cellId_ = identity(mesh().nCells());
|
||||
cellId_ = identity(mesh_.nCells());
|
||||
nCells_ = returnReduce(cellId_.size(), sumOp<label>());
|
||||
break;
|
||||
}
|
||||
@ -134,7 +134,7 @@ void Foam::functionObjects::fieldValues::volRegion::setCellZoneCells()
|
||||
|
||||
Foam::scalar Foam::functionObjects::fieldValues::volRegion::volume() const
|
||||
{
|
||||
return gSum(filterField(mesh().V()));
|
||||
return gSum(filterField(mesh_.V()));
|
||||
}
|
||||
|
||||
|
||||
@ -218,12 +218,6 @@ Foam::functionObjects::fieldValues::volRegion::volRegion
|
||||
weightFieldName_("none"),
|
||||
writeVolume_(dict.lookupOrDefault("writeVolume", false))
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
@ -243,12 +237,6 @@ Foam::functionObjects::fieldValues::volRegion::volRegion
|
||||
weightFieldName_("none"),
|
||||
writeVolume_(dict.lookupOrDefault("writeVolume", false))
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
@ -165,7 +165,7 @@ bool Foam::functionObjects::fieldValues::volRegion::writeValues
|
||||
if (ok)
|
||||
{
|
||||
Field<Type> values(setFieldValues<Type>(fieldName));
|
||||
scalarField V(filterField(mesh().V()));
|
||||
scalarField V(filterField(mesh_.V()));
|
||||
scalarField weightField(values.size(), 1.0);
|
||||
|
||||
if (weightFieldName_ != "none")
|
||||
|
||||
@ -75,15 +75,9 @@ Foam::functionObjects::histogram::histogram
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
regionFunctionObject(name, runTime, dict),
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
file_(obr_, name)
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
@ -120,8 +114,6 @@ bool Foam::functionObjects::histogram::write()
|
||||
{
|
||||
Log << type() << " " << name() << " write:" << nl;
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
autoPtr<volScalarField> fieldPtr;
|
||||
if (obr_.foundObject<volScalarField>(fieldName_))
|
||||
{
|
||||
@ -137,12 +129,12 @@ bool Foam::functionObjects::histogram::write()
|
||||
IOobject
|
||||
(
|
||||
fieldName_,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh
|
||||
mesh_
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -166,7 +158,7 @@ bool Foam::functionObjects::histogram::write()
|
||||
}
|
||||
|
||||
scalarField volFrac(nBins_, 0);
|
||||
const scalarField& V = mesh.V();
|
||||
const scalarField& V = mesh_.V();
|
||||
|
||||
forAll(field, celli)
|
||||
{
|
||||
|
||||
@ -59,7 +59,7 @@ Usage
|
||||
|
||||
See also
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::regionFunctionObject
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
Foam::functionObjects::writeFile
|
||||
|
||||
SourceFiles
|
||||
@ -70,7 +70,7 @@ SourceFiles
|
||||
#ifndef functionObjects_histogram_H
|
||||
#define functionObjects_histogram_H
|
||||
|
||||
#include "regionFunctionObject.H"
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "writeFile.H"
|
||||
#include "writer.H"
|
||||
|
||||
@ -87,7 +87,7 @@ namespace functionObjects
|
||||
|
||||
class histogram
|
||||
:
|
||||
public regionFunctionObject
|
||||
public fvMeshFunctionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
|
||||
@ -355,8 +355,6 @@ bool Foam::functionObjects::nearWallFields::write()
|
||||
vtf_[i].write();
|
||||
}
|
||||
|
||||
Log << endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -173,7 +173,6 @@ void Foam::functionObjects::regionSizeDistribution::writeAlphaFields
|
||||
Foam::Map<Foam::label>
|
||||
Foam::functionObjects::regionSizeDistribution::findPatchRegions
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const regionSplit& regions
|
||||
) const
|
||||
{
|
||||
@ -181,19 +180,19 @@ Foam::functionObjects::regionSizeDistribution::findPatchRegions
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Count number of patch faces (just for initial sizing)
|
||||
const labelHashSet patchIDs(mesh.boundaryMesh().patchSet(patchNames_));
|
||||
const labelHashSet patchIDs(mesh_.boundaryMesh().patchSet(patchNames_));
|
||||
|
||||
label nPatchFaces = 0;
|
||||
forAllConstIter(labelHashSet, patchIDs, iter)
|
||||
{
|
||||
nPatchFaces += mesh.boundaryMesh()[iter.key()].size();
|
||||
nPatchFaces += mesh_.boundaryMesh()[iter.key()].size();
|
||||
}
|
||||
|
||||
|
||||
Map<label> patchRegions(nPatchFaces);
|
||||
forAllConstIter(labelHashSet, patchIDs, iter)
|
||||
{
|
||||
const polyPatch& pp = mesh.boundaryMesh()[iter.key()];
|
||||
const polyPatch& pp = mesh_.boundaryMesh()[iter.key()];
|
||||
|
||||
// Collect all regions on the patch
|
||||
const labelList& faceCells = pp.faceCells();
|
||||
@ -330,17 +329,11 @@ Foam::functionObjects::regionSizeDistribution::regionSizeDistribution
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
regionFunctionObject(name, runTime, dict),
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
file_(obr_, name),
|
||||
alphaName_(dict.lookup("field")),
|
||||
patchNames_(dict.lookup("patches"))
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
@ -389,8 +382,6 @@ bool Foam::functionObjects::regionSizeDistribution::write()
|
||||
{
|
||||
Info<< type() << " " << name() << " write:" << nl;
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
autoPtr<volScalarField> alphaPtr;
|
||||
if (obr_.foundObject<volScalarField>(alphaName_))
|
||||
{
|
||||
@ -406,12 +397,12 @@ bool Foam::functionObjects::regionSizeDistribution::write()
|
||||
IOobject
|
||||
(
|
||||
alphaName_,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh
|
||||
mesh_
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -428,7 +419,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
|
||||
<< fvc::domainIntegrate(alpha).value()
|
||||
<< endl;
|
||||
|
||||
const scalar meshVol = gSum(mesh.V());
|
||||
const scalar meshVol = gSum(mesh_.V());
|
||||
const scalar maxDropletVol = 1.0/6.0*pow(maxDiam_, 3);
|
||||
const scalar delta = (maxDiam_-minDiam_)/nBins_;
|
||||
|
||||
@ -438,14 +429,14 @@ bool Foam::functionObjects::regionSizeDistribution::write()
|
||||
|
||||
|
||||
// Determine blocked faces
|
||||
boolList blockedFace(mesh.nFaces(), false);
|
||||
boolList blockedFace(mesh_.nFaces(), false);
|
||||
label nBlocked = 0;
|
||||
|
||||
{
|
||||
for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
|
||||
for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
|
||||
{
|
||||
scalar ownVal = alpha[mesh.faceOwner()[facei]];
|
||||
scalar neiVal = alpha[mesh.faceNeighbour()[facei]];
|
||||
scalar ownVal = alpha[mesh_.faceOwner()[facei]];
|
||||
scalar neiVal = alpha[mesh_.faceNeighbour()[facei]];
|
||||
|
||||
if
|
||||
(
|
||||
@ -491,7 +482,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
|
||||
}
|
||||
|
||||
|
||||
regionSplit regions(mesh, blockedFace);
|
||||
regionSplit regions(mesh_, blockedFace);
|
||||
|
||||
Info<< " Determined " << regions.nRegions()
|
||||
<< " disconnected regions" << endl;
|
||||
@ -504,12 +495,12 @@ bool Foam::functionObjects::regionSizeDistribution::write()
|
||||
IOobject
|
||||
(
|
||||
"region",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimless, 0)
|
||||
);
|
||||
Info<< " Dumping region as volScalarField to " << region.name()
|
||||
@ -525,20 +516,19 @@ bool Foam::functionObjects::regionSizeDistribution::write()
|
||||
|
||||
|
||||
// Determine regions connected to supplied patches
|
||||
Map<label> patchRegions(findPatchRegions(mesh, regions));
|
||||
|
||||
Map<label> patchRegions(findPatchRegions(regions));
|
||||
|
||||
|
||||
// Sum all regions
|
||||
const scalarField alphaVol(alpha.primitiveField()*mesh.V());
|
||||
Map<scalar> allRegionVolume(regionSum(regions, mesh.V()));
|
||||
const scalarField alphaVol(alpha.primitiveField()*mesh_.V());
|
||||
Map<scalar> allRegionVolume(regionSum(regions, mesh_.V()));
|
||||
Map<scalar> allRegionAlphaVolume(regionSum(regions, alphaVol));
|
||||
Map<label> allRegionNumCells
|
||||
(
|
||||
regionSum
|
||||
(
|
||||
regions,
|
||||
labelField(mesh.nCells(), 1.0)
|
||||
labelField(mesh_.nCells(), 1.0)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ Usage
|
||||
|
||||
See also
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::regionFunctionObject
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
Foam::functionObjects::writeFile
|
||||
|
||||
SourceFiles
|
||||
@ -107,7 +107,7 @@ SourceFiles
|
||||
#ifndef functionObjects_regionSizeDistribution_H
|
||||
#define functionObjects_regionSizeDistribution_H
|
||||
|
||||
#include "regionFunctionObject.H"
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "writeFile.H"
|
||||
#include "writer.H"
|
||||
#include "Map.H"
|
||||
@ -132,7 +132,7 @@ namespace functionObjects
|
||||
|
||||
class regionSizeDistribution
|
||||
:
|
||||
public regionFunctionObject
|
||||
public fvMeshFunctionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -194,7 +194,7 @@ class regionSizeDistribution
|
||||
) const;
|
||||
|
||||
//- Mark all regions starting at patches
|
||||
Map<label> findPatchRegions(const polyMesh&, const regionSplit&) const;
|
||||
Map<label> findPatchRegions(const regionSplit&) const;
|
||||
|
||||
//- Helper: divide if denom != 0
|
||||
static tmp<scalarField> divide(const scalarField&, const scalarField&);
|
||||
|
||||
@ -26,7 +26,6 @@ License
|
||||
#include "Pstream.H"
|
||||
#include "functionObjectList.H"
|
||||
#include "streamLine.H"
|
||||
#include "fvMesh.H"
|
||||
#include "streamLineParticleCloud.H"
|
||||
#include "ReadFields.H"
|
||||
#include "meshSearch.H"
|
||||
@ -55,9 +54,7 @@ namespace functionObjects
|
||||
Foam::autoPtr<Foam::indirectPrimitivePatch>
|
||||
Foam::functionObjects::streamLine::wallPatch() const
|
||||
{
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
label nFaces = 0;
|
||||
|
||||
@ -92,10 +89,10 @@ Foam::functionObjects::streamLine::wallPatch() const
|
||||
(
|
||||
IndirectList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
mesh_.faces(),
|
||||
addressing
|
||||
),
|
||||
mesh.points()
|
||||
mesh_.points()
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -103,12 +100,10 @@ Foam::functionObjects::streamLine::wallPatch() const
|
||||
|
||||
void Foam::functionObjects::streamLine::track()
|
||||
{
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
IDLList<streamLineParticle> initialParticles;
|
||||
streamLineParticleCloud particles
|
||||
(
|
||||
mesh,
|
||||
mesh_,
|
||||
cloudName_,
|
||||
initialParticles
|
||||
);
|
||||
@ -121,7 +116,7 @@ void Foam::functionObjects::streamLine::track()
|
||||
(
|
||||
new streamLineParticle
|
||||
(
|
||||
mesh,
|
||||
mesh_,
|
||||
seedPoints[i],
|
||||
seedPoints.cells()[i],
|
||||
lifeTime_
|
||||
@ -146,11 +141,11 @@ void Foam::functionObjects::streamLine::track()
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
if (mesh_.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
nScalar++;
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
else if (mesh_.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
nVector++;
|
||||
}
|
||||
@ -159,9 +154,9 @@ void Foam::functionObjects::streamLine::track()
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find field " << fields_[i] << nl
|
||||
<< "Valid scalar fields are:"
|
||||
<< mesh.names(volScalarField::typeName) << nl
|
||||
<< mesh_.names(volScalarField::typeName) << nl
|
||||
<< "Valid vector fields are:"
|
||||
<< mesh.names(volVectorField::typeName)
|
||||
<< mesh_.names(volVectorField::typeName)
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
@ -172,9 +167,9 @@ void Foam::functionObjects::streamLine::track()
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
if (mesh_.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
const volScalarField& f = mesh.lookupObject<volScalarField>
|
||||
const volScalarField& f = mesh_.lookupObject<volScalarField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
@ -188,9 +183,9 @@ void Foam::functionObjects::streamLine::track()
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
else if (mesh_.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
const volVectorField& f = mesh.lookupObject<volVectorField>
|
||||
const volVectorField& f = mesh_.lookupObject<volVectorField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
@ -290,23 +285,10 @@ Foam::functionObjects::streamLine::streamLine
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
dict_(dict),
|
||||
nSubCycle_(0)
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
@ -321,6 +303,11 @@ Foam::functionObjects::streamLine::~streamLine()
|
||||
|
||||
bool Foam::functionObjects::streamLine::read(const dictionary& dict)
|
||||
{
|
||||
if (dict != dict_)
|
||||
{
|
||||
dict_ = dict;
|
||||
}
|
||||
|
||||
Info<< type() << " " << name() << ":" << nl;
|
||||
|
||||
dict.lookup("fields") >> fields_;
|
||||
@ -402,15 +389,13 @@ bool Foam::functionObjects::streamLine::read(const dictionary& dict)
|
||||
cloudName_ = dict.lookupOrDefault<word>("cloudName", "streamLine");
|
||||
dict.lookup("seedSampleSet") >> seedSet_;
|
||||
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
meshSearchPtr_.reset(new meshSearch(mesh));
|
||||
meshSearchPtr_.reset(new meshSearch(mesh_));
|
||||
|
||||
const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs");
|
||||
sampledSetPtr_ = sampledSet::New
|
||||
(
|
||||
seedSet_,
|
||||
mesh,
|
||||
mesh_,
|
||||
meshSearchPtr_(),
|
||||
coeffsDict
|
||||
);
|
||||
@ -434,8 +419,6 @@ bool Foam::functionObjects::streamLine::write()
|
||||
Info<< type() << " " << name() << " write:" << nl;
|
||||
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
|
||||
// Do all injection and tracking
|
||||
track();
|
||||
@ -562,11 +545,11 @@ bool Foam::functionObjects::streamLine::write()
|
||||
? runTime.path()/".."/"postProcessing"/"sets"/name()
|
||||
: runTime.path()/"postProcessing"/"sets"/name()
|
||||
);
|
||||
if (mesh.name() != fvMesh::defaultRegion)
|
||||
if (mesh_.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
vtkPath = vtkPath/mesh.name();
|
||||
vtkPath = vtkPath/mesh_.name();
|
||||
}
|
||||
vtkPath = vtkPath/mesh.time().timeName();
|
||||
vtkPath = vtkPath/mesh_.time().timeName();
|
||||
|
||||
mkDir(vtkPath);
|
||||
|
||||
@ -674,8 +657,6 @@ bool Foam::functionObjects::streamLine::write()
|
||||
|
||||
void Foam::functionObjects::streamLine::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
const fvMesh& mesh_ = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
if (&mpm.mesh() == &mesh_)
|
||||
{
|
||||
read(dict_);
|
||||
@ -685,8 +666,6 @@ void Foam::functionObjects::streamLine::updateMesh(const mapPolyMesh& mpm)
|
||||
|
||||
void Foam::functionObjects::streamLine::movePoints(const polyMesh& mesh)
|
||||
{
|
||||
const fvMesh& mesh_ = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
if (&mesh == &mesh_)
|
||||
{
|
||||
// Moving mesh affects the search tree
|
||||
|
||||
@ -102,7 +102,7 @@ SourceFiles
|
||||
#ifndef functionObjects_streamLine_H
|
||||
#define functionObjects_streamLine_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "DynamicList.H"
|
||||
#include "scalarList.H"
|
||||
@ -116,7 +116,6 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class meshSearch;
|
||||
class sampledSet;
|
||||
|
||||
@ -129,13 +128,10 @@ namespace functionObjects
|
||||
|
||||
class streamLine
|
||||
:
|
||||
public functionObject
|
||||
public fvMeshFunctionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Database this class is registered to
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Input dictionary
|
||||
dictionary dict_;
|
||||
|
||||
|
||||
@ -63,9 +63,7 @@ namespace functionObjects
|
||||
Foam::autoPtr<Foam::indirectPrimitivePatch>
|
||||
Foam::functionObjects::wallBoundedStreamLine::wallPatch() const
|
||||
{
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
label nFaces = 0;
|
||||
|
||||
@ -102,10 +100,10 @@ Foam::functionObjects::wallBoundedStreamLine::wallPatch() const
|
||||
(
|
||||
IndirectList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
mesh_.faces(),
|
||||
addressing
|
||||
),
|
||||
mesh.points()
|
||||
mesh_.points()
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -118,9 +116,7 @@ Foam::tetIndices Foam::functionObjects::wallBoundedStreamLine::findNearestTet
|
||||
const label celli
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
const cell& cFaces = mesh.cells()[celli];
|
||||
const cell& cFaces = mesh_.cells()[celli];
|
||||
|
||||
label minFacei = -1;
|
||||
label minTetPtI = -1;
|
||||
@ -132,16 +128,16 @@ Foam::tetIndices Foam::functionObjects::wallBoundedStreamLine::findNearestTet
|
||||
|
||||
if (isWallPatch[facei])
|
||||
{
|
||||
const face& f = mesh.faces()[facei];
|
||||
const label fp0 = mesh.tetBasePtIs()[facei];
|
||||
const point& basePoint = mesh.points()[f[fp0]];
|
||||
const face& f = mesh_.faces()[facei];
|
||||
const label fp0 = mesh_.tetBasePtIs()[facei];
|
||||
const point& basePoint = mesh_.points()[f[fp0]];
|
||||
|
||||
label fp = f.fcIndex(fp0);
|
||||
for (label i = 2; i < f.size(); i++)
|
||||
{
|
||||
const point& thisPoint = mesh.points()[f[fp]];
|
||||
const point& thisPoint = mesh_.points()[f[fp]];
|
||||
label nextFp = f.fcIndex(fp);
|
||||
const point& nextPoint = mesh.points()[f[nextFp]];
|
||||
const point& nextPoint = mesh_.points()[f[nextFp]];
|
||||
|
||||
const triPointRef tri(basePoint, thisPoint, nextPoint);
|
||||
|
||||
@ -163,22 +159,19 @@ Foam::tetIndices Foam::functionObjects::wallBoundedStreamLine::findNearestTet
|
||||
celli,
|
||||
minFacei,
|
||||
minTetPtI,
|
||||
mesh
|
||||
mesh_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::wallBoundedStreamLine::track()
|
||||
{
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
|
||||
// Determine the 'wall' patches
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// These are the faces that need to be followed
|
||||
|
||||
autoPtr<indirectPrimitivePatch> boundaryPatch(wallPatch());
|
||||
PackedBoolList isWallPatch(mesh.nFaces());
|
||||
PackedBoolList isWallPatch(mesh_.nFaces());
|
||||
forAll(boundaryPatch().addressing(), i)
|
||||
{
|
||||
isWallPatch[boundaryPatch().addressing()[i]] = 1;
|
||||
@ -192,7 +185,7 @@ void Foam::functionObjects::wallBoundedStreamLine::track()
|
||||
IDLList<wallBoundedStreamLineParticle> initialParticles;
|
||||
wallBoundedStreamLineParticleCloud particles
|
||||
(
|
||||
mesh,
|
||||
mesh_,
|
||||
cloudName_,
|
||||
initialParticles
|
||||
);
|
||||
@ -216,16 +209,16 @@ void Foam::functionObjects::wallBoundedStreamLine::track()
|
||||
//Pout<< "Seeding particle :" << nl
|
||||
// << " seedPt:" << seedPt << nl
|
||||
// << " face :" << ids.face() << nl
|
||||
// << " at :" << mesh.faceCentres()[ids.face()] << nl
|
||||
// << " cell :" << mesh.cellCentres()[ids.cell()] << nl
|
||||
// << " at :" << mesh_.faceCentres()[ids.face()] << nl
|
||||
// << " cell :" << mesh_.cellCentres()[ids.cell()] << nl
|
||||
// << endl;
|
||||
|
||||
particles.addParticle
|
||||
(
|
||||
new wallBoundedStreamLineParticle
|
||||
(
|
||||
mesh,
|
||||
ids.faceTri(mesh).centre(),
|
||||
mesh_,
|
||||
ids.faceTri(mesh_).centre(),
|
||||
ids.cell(),
|
||||
ids.face(), // tetFace
|
||||
ids.tetPt(),
|
||||
@ -262,11 +255,11 @@ void Foam::functionObjects::wallBoundedStreamLine::track()
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
if (mesh_.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
nScalar++;
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
else if (mesh_.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
nVector++;
|
||||
}
|
||||
@ -275,9 +268,9 @@ void Foam::functionObjects::wallBoundedStreamLine::track()
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find field " << fields_[i] << endl
|
||||
<< "Valid scalar fields are:"
|
||||
<< mesh.names(volScalarField::typeName) << endl
|
||||
<< mesh_.names(volScalarField::typeName) << endl
|
||||
<< "Valid vector fields are:"
|
||||
<< mesh.names(volVectorField::typeName)
|
||||
<< mesh_.names(volVectorField::typeName)
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
@ -289,9 +282,9 @@ void Foam::functionObjects::wallBoundedStreamLine::track()
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
if (mesh_.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
const volScalarField& f = mesh.lookupObject<volScalarField>
|
||||
const volScalarField& f = mesh_.lookupObject<volScalarField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
@ -305,9 +298,9 @@ void Foam::functionObjects::wallBoundedStreamLine::track()
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
else if (mesh_.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
const volVectorField& f = mesh.lookupObject<volVectorField>
|
||||
const volVectorField& f = mesh_.lookupObject<volVectorField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
@ -409,22 +402,9 @@ Foam::functionObjects::wallBoundedStreamLine::wallBoundedStreamLine
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
dict_(dict)
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
@ -439,7 +419,13 @@ Foam::functionObjects::wallBoundedStreamLine::~wallBoundedStreamLine()
|
||||
|
||||
bool Foam::functionObjects::wallBoundedStreamLine::read(const dictionary& dict)
|
||||
{
|
||||
//dict_ = dict;
|
||||
if (dict != dict_)
|
||||
{
|
||||
dict_ = dict;
|
||||
}
|
||||
|
||||
Info<< type() << " " << name() << ":" << nl;
|
||||
|
||||
dict.lookup("fields") >> fields_;
|
||||
if (dict.found("U"))
|
||||
{
|
||||
@ -502,15 +488,13 @@ bool Foam::functionObjects::wallBoundedStreamLine::read(const dictionary& dict)
|
||||
);
|
||||
dict.lookup("seedSampleSet") >> seedSet_;
|
||||
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs");
|
||||
|
||||
sampledSetPtr_ = sampledSet::New
|
||||
(
|
||||
seedSet_,
|
||||
mesh,
|
||||
meshSearchMeshObject::New(mesh),
|
||||
mesh_,
|
||||
meshSearchMeshObject::New(mesh_),
|
||||
coeffsDict
|
||||
);
|
||||
coeffsDict.lookup("axis") >> sampledSetAxis_;
|
||||
@ -523,12 +507,12 @@ bool Foam::functionObjects::wallBoundedStreamLine::read(const dictionary& dict)
|
||||
if (debug)
|
||||
{
|
||||
// 1. positive volume decomposition tets
|
||||
faceSet faces(mesh, "lowQualityTetFaces", mesh.nFaces()/100+1);
|
||||
faceSet faces(mesh_, "lowQualityTetFaces", mesh_.nFaces()/100+1);
|
||||
if
|
||||
(
|
||||
polyMeshTetDecomposition::checkFaceTets
|
||||
(
|
||||
mesh,
|
||||
mesh_,
|
||||
polyMeshTetDecomposition::minTetQuality,
|
||||
true,
|
||||
&faces
|
||||
@ -546,16 +530,16 @@ bool Foam::functionObjects::wallBoundedStreamLine::read(const dictionary& dict)
|
||||
|
||||
// 2. all edges on a cell having two faces
|
||||
EdgeMap<label> numFacesPerEdge;
|
||||
forAll(mesh.cells(), celli)
|
||||
forAll(mesh_.cells(), celli)
|
||||
{
|
||||
const cell& cFaces = mesh.cells()[celli];
|
||||
const cell& cFaces = mesh_.cells()[celli];
|
||||
|
||||
numFacesPerEdge.clear();
|
||||
|
||||
forAll(cFaces, cFacei)
|
||||
{
|
||||
label facei = cFaces[cFacei];
|
||||
const face& f = mesh.faces()[facei];
|
||||
const face& f = mesh_.faces()[facei];
|
||||
forAll(f, fp)
|
||||
{
|
||||
const edge e(f[fp], f.nextLabel(fp));
|
||||
@ -597,8 +581,6 @@ bool Foam::functionObjects::wallBoundedStreamLine::execute()
|
||||
bool Foam::functionObjects::wallBoundedStreamLine::write()
|
||||
{
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
|
||||
// Do all injection and tracking
|
||||
track();
|
||||
@ -724,11 +706,11 @@ bool Foam::functionObjects::wallBoundedStreamLine::write()
|
||||
? runTime.path()/".."/"postProcessing"/"sets"/name()
|
||||
: runTime.path()/"postProcessing"/"sets"/name()
|
||||
);
|
||||
if (mesh.name() != fvMesh::defaultRegion)
|
||||
if (mesh_.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
vtkPath = vtkPath/mesh.name();
|
||||
vtkPath = vtkPath/mesh_.name();
|
||||
}
|
||||
vtkPath = vtkPath/mesh.time().timeName();
|
||||
vtkPath = vtkPath/mesh_.time().timeName();
|
||||
|
||||
mkDir(vtkPath);
|
||||
|
||||
@ -839,8 +821,6 @@ void Foam::functionObjects::wallBoundedStreamLine::updateMesh
|
||||
const mapPolyMesh& mpm
|
||||
)
|
||||
{
|
||||
const fvMesh& mesh_ = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
if (&mpm.mesh() == &mesh_)
|
||||
{
|
||||
read(dict_);
|
||||
@ -853,8 +833,6 @@ void Foam::functionObjects::wallBoundedStreamLine::movePoints
|
||||
const polyMesh& mesh
|
||||
)
|
||||
{
|
||||
const fvMesh& mesh_ = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
if (&mesh == &mesh_)
|
||||
{
|
||||
// Moving mesh affects the search tree
|
||||
|
||||
@ -94,7 +94,7 @@ Note
|
||||
option should be used
|
||||
|
||||
See also
|
||||
Foam::functionObject
|
||||
Foam::fvMeshFunctionObject
|
||||
Foam::functionObjects::timeControl
|
||||
Foam::sampledSet
|
||||
Foam::streamLine
|
||||
@ -107,7 +107,7 @@ SourceFiles
|
||||
#ifndef functionObjects_wallBoundedStreamLine_H
|
||||
#define functionObjects_wallBoundedStreamLine_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "DynamicList.H"
|
||||
#include "scalarList.H"
|
||||
@ -122,7 +122,6 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class meshSearch;
|
||||
class sampledSet;
|
||||
|
||||
@ -135,13 +134,10 @@ namespace functionObjects
|
||||
|
||||
class wallBoundedStreamLine
|
||||
:
|
||||
public functionObject
|
||||
public fvMeshFunctionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Database this class is registered to
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Input dictionary
|
||||
dictionary dict_;
|
||||
|
||||
|
||||
@ -102,18 +102,10 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
regionFunctionObject(name, runTime, dict),
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
logFiles(obr_, name),
|
||||
patchSet_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
volScalarField* wallHeatFluxPtr
|
||||
(
|
||||
new volScalarField
|
||||
@ -121,17 +113,17 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
|
||||
IOobject
|
||||
(
|
||||
type(),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
mesh_,
|
||||
dimensionedScalar("0", dimMass/pow3(dimTime), 0)
|
||||
)
|
||||
);
|
||||
|
||||
mesh.objectRegistry::store(wallHeatFluxPtr);
|
||||
mesh_.objectRegistry::store(wallHeatFluxPtr);
|
||||
|
||||
read(dict);
|
||||
resetName(typeName);
|
||||
@ -148,13 +140,12 @@ Foam::functionObjects::wallHeatFlux::~wallHeatFlux()
|
||||
|
||||
bool Foam::functionObjects::wallHeatFlux::read(const dictionary& dict)
|
||||
{
|
||||
regionFunctionObject::read(dict);
|
||||
fvMeshFunctionObject::read(dict);
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
||||
|
||||
patchSet_ =
|
||||
mesh.boundaryMesh().patchSet
|
||||
mesh_.boundaryMesh().patchSet
|
||||
(
|
||||
wordReList(dict.lookupOrDefault("patches", wordReList()))
|
||||
);
|
||||
@ -248,11 +239,10 @@ bool Foam::functionObjects::wallHeatFlux::write()
|
||||
|
||||
wallHeatFlux.write();
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
const fvPatchList& patches = mesh.boundary();
|
||||
const fvPatchList& patches = mesh_.boundary();
|
||||
|
||||
const surfaceScalarField::Boundary& magSf =
|
||||
mesh.magSf().boundaryField();
|
||||
mesh_.magSf().boundaryField();
|
||||
|
||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||
{
|
||||
@ -268,7 +258,8 @@ bool Foam::functionObjects::wallHeatFlux::write()
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
file() << mesh.time().value()
|
||||
file()
|
||||
<< mesh_.time().value()
|
||||
<< token::TAB << pp.name()
|
||||
<< token::TAB << minHfp
|
||||
<< token::TAB << maxHfp
|
||||
|
||||
@ -54,7 +54,7 @@ Usage
|
||||
|
||||
See also
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::regionFunctionObject
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
Foam::functionObjects::logFiles
|
||||
Foam::functionObjects::pressureTools
|
||||
Foam::functionObjects::timeControl
|
||||
@ -67,7 +67,7 @@ SourceFiles
|
||||
#ifndef functionObjects_wallHeatFlux_H
|
||||
#define functionObjects_wallHeatFlux_H
|
||||
|
||||
#include "regionFunctionObject.H"
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "logFiles.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
@ -78,10 +78,6 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class fvMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
@ -91,7 +87,7 @@ namespace functionObjects
|
||||
|
||||
class wallHeatFlux
|
||||
:
|
||||
public regionFunctionObject,
|
||||
public fvMeshFunctionObject,
|
||||
public logFiles
|
||||
{
|
||||
|
||||
|
||||
@ -59,7 +59,6 @@ void Foam::functionObjects::wallShearStress::writeFileHeader(const label i)
|
||||
|
||||
void Foam::functionObjects::wallShearStress::calcShearStress
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const volSymmTensorField& Reff,
|
||||
volVectorField& shearStress
|
||||
)
|
||||
@ -71,8 +70,8 @@ void Foam::functionObjects::wallShearStress::calcShearStress
|
||||
label patchi = iter.key();
|
||||
|
||||
vectorField& ssp = shearStress.boundaryFieldRef()[patchi];
|
||||
const vectorField& Sfp = mesh.Sf().boundaryField()[patchi];
|
||||
const scalarField& magSfp = mesh.magSf().boundaryField()[patchi];
|
||||
const vectorField& Sfp = mesh_.Sf().boundaryField()[patchi];
|
||||
const scalarField& magSfp = mesh_.magSf().boundaryField()[patchi];
|
||||
const symmTensorField& Reffp = Reff.boundaryField()[patchi];
|
||||
|
||||
ssp = (-Sfp/magSfp) & Reffp;
|
||||
@ -89,18 +88,10 @@ Foam::functionObjects::wallShearStress::wallShearStress
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
regionFunctionObject(name, runTime, dict),
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
logFiles(obr_, name),
|
||||
patchSet_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
volVectorField* wallShearStressPtr
|
||||
(
|
||||
new volVectorField
|
||||
@ -108,12 +99,12 @@ Foam::functionObjects::wallShearStress::wallShearStress
|
||||
IOobject
|
||||
(
|
||||
type(),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
mesh_,
|
||||
dimensionedVector
|
||||
(
|
||||
"0",
|
||||
@ -123,7 +114,7 @@ Foam::functionObjects::wallShearStress::wallShearStress
|
||||
)
|
||||
);
|
||||
|
||||
mesh.objectRegistry::store(wallShearStressPtr);
|
||||
mesh_.objectRegistry::store(wallShearStressPtr);
|
||||
|
||||
read(dict);
|
||||
resetName(typeName);
|
||||
@ -140,13 +131,12 @@ Foam::functionObjects::wallShearStress::~wallShearStress()
|
||||
|
||||
bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
|
||||
{
|
||||
regionFunctionObject::read(dict);
|
||||
fvMeshFunctionObject::read(dict);
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
||||
|
||||
patchSet_ =
|
||||
mesh.boundaryMesh().patchSet
|
||||
mesh_.boundaryMesh().patchSet
|
||||
(
|
||||
wordReList(dict.lookupOrDefault("patches", wordReList()))
|
||||
);
|
||||
@ -199,26 +189,24 @@ bool Foam::functionObjects::wallShearStress::execute()
|
||||
typedef compressible::turbulenceModel cmpModel;
|
||||
typedef incompressible::turbulenceModel icoModel;
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
volVectorField& wallShearStress =
|
||||
const_cast<volVectorField&>
|
||||
(
|
||||
mesh.lookupObject<volVectorField>(type())
|
||||
mesh_.lookupObject<volVectorField>(type())
|
||||
);
|
||||
|
||||
tmp<volSymmTensorField> Reff;
|
||||
if (mesh.foundObject<cmpModel>(turbulenceModel::propertiesName))
|
||||
if (mesh_.foundObject<cmpModel>(turbulenceModel::propertiesName))
|
||||
{
|
||||
const cmpModel& model =
|
||||
mesh.lookupObject<cmpModel>(turbulenceModel::propertiesName);
|
||||
mesh_.lookupObject<cmpModel>(turbulenceModel::propertiesName);
|
||||
|
||||
Reff = model.devRhoReff();
|
||||
}
|
||||
else if (mesh.foundObject<icoModel>(turbulenceModel::propertiesName))
|
||||
else if (mesh_.foundObject<icoModel>(turbulenceModel::propertiesName))
|
||||
{
|
||||
const icoModel& model =
|
||||
mesh.lookupObject<icoModel>(turbulenceModel::propertiesName);
|
||||
mesh_.lookupObject<icoModel>(turbulenceModel::propertiesName);
|
||||
|
||||
Reff = model.devReff();
|
||||
}
|
||||
@ -229,7 +217,7 @@ bool Foam::functionObjects::wallShearStress::execute()
|
||||
<< "database" << exit(FatalError);
|
||||
}
|
||||
|
||||
calcShearStress(mesh, Reff(), wallShearStress);
|
||||
calcShearStress(Reff(), wallShearStress);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -247,8 +235,7 @@ bool Foam::functionObjects::wallShearStress::write()
|
||||
|
||||
wallShearStress.write();
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
const fvPatchList& patches = mesh.boundary();
|
||||
const fvPatchList& patches = mesh_.boundary();
|
||||
|
||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||
{
|
||||
@ -262,7 +249,7 @@ bool Foam::functionObjects::wallShearStress::write()
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
file() << mesh.time().value()
|
||||
file() << mesh_.time().value()
|
||||
<< token::TAB << pp.name()
|
||||
<< token::TAB << minSsp
|
||||
<< token::TAB << maxSsp
|
||||
|
||||
@ -65,7 +65,7 @@ Usage
|
||||
|
||||
See also
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::regionFunctionObject
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
Foam::functionObjects::logFiles
|
||||
Foam::functionObjects::pressureTools
|
||||
Foam::functionObjects::timeControl
|
||||
@ -78,7 +78,7 @@ SourceFiles
|
||||
#ifndef functionObjects_wallShearStress_H
|
||||
#define functionObjects_wallShearStress_H
|
||||
|
||||
#include "regionFunctionObject.H"
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "logFiles.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "HashSet.H"
|
||||
@ -87,10 +87,6 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class fvMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
@ -100,7 +96,7 @@ namespace functionObjects
|
||||
|
||||
class wallShearStress
|
||||
:
|
||||
public regionFunctionObject,
|
||||
public fvMeshFunctionObject,
|
||||
public logFiles
|
||||
{
|
||||
|
||||
@ -120,7 +116,6 @@ protected:
|
||||
//- Calculate the shear-stress
|
||||
void calcShearStress
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const volSymmTensorField& Reff,
|
||||
volVectorField& shearStress
|
||||
);
|
||||
|
||||
@ -65,11 +65,10 @@ void Foam::functionObjects::yPlus::writeFileHeader(const label i)
|
||||
void Foam::functionObjects::yPlus::calcYPlus
|
||||
(
|
||||
const turbulenceModel& turbModel,
|
||||
const fvMesh& mesh,
|
||||
volScalarField& yPlus
|
||||
)
|
||||
{
|
||||
volScalarField::Boundary d = nearWallDist(mesh).y();
|
||||
volScalarField::Boundary d = nearWallDist(mesh_).y();
|
||||
|
||||
const volScalarField::Boundary nutBf =
|
||||
turbModel.nut()().boundaryField();
|
||||
@ -80,7 +79,7 @@ void Foam::functionObjects::yPlus::calcYPlus
|
||||
const volScalarField::Boundary nuBf =
|
||||
turbModel.nu()().boundaryField();
|
||||
|
||||
const fvPatchList& patches = mesh.boundary();
|
||||
const fvPatchList& patches = mesh_.boundary();
|
||||
|
||||
volScalarField::Boundary& yPlusBf = yPlus.boundaryFieldRef();
|
||||
|
||||
@ -121,17 +120,9 @@ Foam::functionObjects::yPlus::yPlus
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
regionFunctionObject(name, runTime, dict),
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
logFiles(obr_, name)
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
volScalarField* yPlusPtr
|
||||
(
|
||||
new volScalarField
|
||||
@ -139,17 +130,17 @@ Foam::functionObjects::yPlus::yPlus
|
||||
IOobject
|
||||
(
|
||||
type(),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
mesh_,
|
||||
dimensionedScalar("0", dimless, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
mesh.objectRegistry::store(yPlusPtr);
|
||||
mesh_.objectRegistry::store(yPlusPtr);
|
||||
|
||||
resetName(typeName);
|
||||
}
|
||||
@ -165,7 +156,7 @@ Foam::functionObjects::yPlus::~yPlus()
|
||||
|
||||
bool Foam::functionObjects::yPlus::read(const dictionary& dict)
|
||||
{
|
||||
regionFunctionObject::read(dict);
|
||||
fvMeshFunctionObject::read(dict);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -173,20 +164,20 @@ bool Foam::functionObjects::yPlus::read(const dictionary& dict)
|
||||
|
||||
bool Foam::functionObjects::yPlus::execute()
|
||||
{
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
volScalarField& yPlus =
|
||||
const_cast<volScalarField&>
|
||||
(
|
||||
mesh.lookupObject<volScalarField>(type())
|
||||
mesh_.lookupObject<volScalarField>(type())
|
||||
);
|
||||
|
||||
if (mesh.foundObject<turbulenceModel>(turbulenceModel::propertiesName))
|
||||
if (mesh_.foundObject<turbulenceModel>(turbulenceModel::propertiesName))
|
||||
{
|
||||
const turbulenceModel& model =
|
||||
mesh.lookupObject<turbulenceModel>(turbulenceModel::propertiesName);
|
||||
const turbulenceModel& model = mesh_.lookupObject<turbulenceModel>
|
||||
(
|
||||
turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
calcYPlus(model, mesh, yPlus);
|
||||
calcYPlus(model, yPlus);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -212,9 +203,7 @@ bool Foam::functionObjects::yPlus::write()
|
||||
logFiles::write();
|
||||
|
||||
const volScalarField::Boundary& yPlusBf = yPlus.boundaryField();
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
const fvPatchList& patches = mesh.boundary();
|
||||
const fvPatchList& patches = mesh_.boundary();
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
|
||||
@ -33,7 +33,7 @@ Description
|
||||
|
||||
See also
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::regionFunctionObject
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
Foam::functionObjects::logFiles
|
||||
Foam::functionObjects::timeControl
|
||||
|
||||
@ -45,7 +45,7 @@ SourceFiles
|
||||
#ifndef functionObjects_yPlus_H
|
||||
#define functionObjects_yPlus_H
|
||||
|
||||
#include "regionFunctionObject.H"
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "logFiles.H"
|
||||
#include "volFieldsFwd.H"
|
||||
|
||||
@ -55,7 +55,6 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class fvMesh;
|
||||
class turbulenceModel;
|
||||
|
||||
namespace functionObjects
|
||||
@ -67,7 +66,7 @@ namespace functionObjects
|
||||
|
||||
class yPlus
|
||||
:
|
||||
public regionFunctionObject,
|
||||
public fvMeshFunctionObject,
|
||||
public logFiles
|
||||
{
|
||||
// Private Member Functions
|
||||
@ -79,7 +78,6 @@ class yPlus
|
||||
void calcYPlus
|
||||
(
|
||||
const turbulenceModel& turbModel,
|
||||
const fvMesh& mesh,
|
||||
volScalarField& yPlus
|
||||
);
|
||||
|
||||
|
||||
@ -315,8 +315,6 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::forces::rho() const
|
||||
{
|
||||
if (rhoName_ == "rhoInf")
|
||||
{
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
@ -324,10 +322,10 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::forces::rho() const
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
mesh.time().timeName(),
|
||||
mesh
|
||||
mesh_.time().timeName(),
|
||||
mesh_
|
||||
),
|
||||
mesh,
|
||||
mesh_,
|
||||
dimensionedScalar("rho", dimDensity, rhoRef_)
|
||||
)
|
||||
);
|
||||
@ -529,7 +527,7 @@ Foam::functionObjects::forces::forces
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
regionFunctionObject(name, runTime, dict),
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
logFiles(obr_, name),
|
||||
force_(3),
|
||||
moment_(3),
|
||||
@ -552,12 +550,6 @@ Foam::functionObjects::forces::forces
|
||||
binCumulative_(true),
|
||||
initialised_(false)
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
resetNames(createFileNames(dict));
|
||||
}
|
||||
@ -570,7 +562,7 @@ Foam::functionObjects::forces::forces
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
regionFunctionObject(name, obr, dict),
|
||||
fvMeshFunctionObject(name, obr, dict),
|
||||
logFiles(obr_, name),
|
||||
force_(3),
|
||||
moment_(3),
|
||||
@ -593,12 +585,6 @@ Foam::functionObjects::forces::forces
|
||||
binCumulative_(true),
|
||||
initialised_(false)
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
resetNames(createFileNames(dict));
|
||||
}
|
||||
@ -614,7 +600,7 @@ Foam::functionObjects::forces::~forces()
|
||||
|
||||
bool Foam::functionObjects::forces::read(const dictionary& dict)
|
||||
{
|
||||
regionFunctionObject::read(dict);
|
||||
fvMeshFunctionObject::read(dict);
|
||||
|
||||
initialised_ = false;
|
||||
|
||||
@ -622,8 +608,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
|
||||
|
||||
directForceDensity_ = dict.lookupOrDefault("directForceDensity", false);
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
||||
|
||||
patchSet_ = pbm.patchSet(wordReList(dict.lookup("patches")));
|
||||
|
||||
@ -763,10 +748,8 @@ void Foam::functionObjects::forces::calcForcesMoment()
|
||||
{
|
||||
const volVectorField& fD = obr_.lookupObject<volVectorField>(fDName_);
|
||||
|
||||
const fvMesh& mesh = fD.mesh();
|
||||
|
||||
const surfaceVectorField::Boundary& Sfb =
|
||||
mesh.Sf().boundaryField();
|
||||
mesh_.Sf().boundaryField();
|
||||
|
||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||
{
|
||||
@ -774,7 +757,7 @@ void Foam::functionObjects::forces::calcForcesMoment()
|
||||
|
||||
vectorField Md
|
||||
(
|
||||
mesh.C().boundaryField()[patchi] - coordSys_.origin()
|
||||
mesh_.C().boundaryField()[patchi] - coordSys_.origin()
|
||||
);
|
||||
|
||||
scalarField sA(mag(Sfb[patchi]));
|
||||
@ -794,18 +777,15 @@ void Foam::functionObjects::forces::calcForcesMoment()
|
||||
//- Porous force
|
||||
vectorField fP(Md.size(), Zero);
|
||||
|
||||
applyBins(Md, fN, fT, fP, mesh.C().boundaryField()[patchi]);
|
||||
applyBins(Md, fN, fT, fP, mesh_.C().boundaryField()[patchi]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
|
||||
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
|
||||
|
||||
const fvMesh& mesh = U.mesh();
|
||||
|
||||
const surfaceVectorField::Boundary& Sfb =
|
||||
mesh.Sf().boundaryField();
|
||||
mesh_.Sf().boundaryField();
|
||||
|
||||
tmp<volSymmTensorField> tdevRhoReff = devRhoReff();
|
||||
const volSymmTensorField::Boundary& devRhoReffb
|
||||
@ -820,7 +800,7 @@ void Foam::functionObjects::forces::calcForcesMoment()
|
||||
|
||||
vectorField Md
|
||||
(
|
||||
mesh.C().boundaryField()[patchi] - coordSys_.origin()
|
||||
mesh_.C().boundaryField()[patchi] - coordSys_.origin()
|
||||
);
|
||||
|
||||
vectorField fN
|
||||
@ -832,7 +812,7 @@ void Foam::functionObjects::forces::calcForcesMoment()
|
||||
|
||||
vectorField fP(Md.size(), Zero);
|
||||
|
||||
applyBins(Md, fN, fT, fP, mesh.C().boundaryField()[patchi]);
|
||||
applyBins(Md, fN, fT, fP, mesh_.C().boundaryField()[patchi]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -842,8 +822,6 @@ void Foam::functionObjects::forces::calcForcesMoment()
|
||||
const volScalarField rho(this->rho());
|
||||
const volScalarField mu(this->mu());
|
||||
|
||||
const fvMesh& mesh = U.mesh();
|
||||
|
||||
const HashTable<const porosityModel*> models =
|
||||
obr_.lookupClass<porosityModel>();
|
||||
|
||||
@ -867,9 +845,9 @@ void Foam::functionObjects::forces::calcForcesMoment()
|
||||
forAll(cellZoneIDs, i)
|
||||
{
|
||||
label zoneI = cellZoneIDs[i];
|
||||
const cellZone& cZone = mesh.cellZones()[zoneI];
|
||||
const cellZone& cZone = mesh_.cellZones()[zoneI];
|
||||
|
||||
const vectorField d(mesh.C(), cZone);
|
||||
const vectorField d(mesh_.C(), cZone);
|
||||
const vectorField fP(fPTot, cZone);
|
||||
const vectorField Md(d - coordSys_.origin());
|
||||
|
||||
|
||||
@ -101,7 +101,7 @@ Note
|
||||
|
||||
See also
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::regionFunctionObject
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
Foam::functionObjects::logFiles
|
||||
Foam::functionObjects::timeControl
|
||||
Foam::forceCoeffs
|
||||
@ -114,7 +114,7 @@ SourceFiles
|
||||
#ifndef functionObjects_forces_H
|
||||
#define functionObjects_forces_H
|
||||
|
||||
#include "regionFunctionObject.H"
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "logFiles.H"
|
||||
#include "coordinateSystem.H"
|
||||
#include "volFieldsFwd.H"
|
||||
@ -133,7 +133,7 @@ namespace functionObjects
|
||||
|
||||
class forces
|
||||
:
|
||||
public regionFunctionObject,
|
||||
public fvMeshFunctionObject,
|
||||
public logFiles
|
||||
{
|
||||
|
||||
|
||||
@ -59,21 +59,8 @@ Foam::functionObjects::dsmcFields::dsmcFields
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
)
|
||||
fvMeshFunctionObject(name, runTime, dict)
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
@ -215,13 +202,11 @@ bool Foam::functionObjects::dsmcFields::write()
|
||||
physicoChemical::k.value()*rhoNMean*translationalT
|
||||
);
|
||||
|
||||
const fvMesh& mesh = fDMean.mesh();
|
||||
|
||||
volScalarField::Boundary& pBf = p.boundaryFieldRef();
|
||||
|
||||
forAll(mesh.boundaryMesh(), i)
|
||||
forAll(mesh_.boundaryMesh(), i)
|
||||
{
|
||||
const polyPatch& patch = mesh.boundaryMesh()[i];
|
||||
const polyPatch& patch = mesh_.boundaryMesh()[i];
|
||||
|
||||
if (isA<wallPolyPatch>(patch))
|
||||
{
|
||||
|
||||
@ -35,6 +35,9 @@ Description
|
||||
- overallT
|
||||
from averaged extensive fields from a DSMC calculation.
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
|
||||
SourceFiles
|
||||
dsmcFields.C
|
||||
|
||||
@ -43,16 +46,12 @@ SourceFiles
|
||||
#ifndef functionObjects_dsmcFields_H
|
||||
#define functionObjects_dsmcFields_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "fvMeshFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
@ -62,13 +61,8 @@ namespace functionObjects
|
||||
|
||||
class dsmcFields
|
||||
:
|
||||
public functionObject
|
||||
public fvMeshFunctionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
|
||||
@ -53,16 +53,10 @@ Foam::functionObjects::residuals::residuals
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
regionFunctionObject(name, runTime, dict),
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
logFiles(obr_, name),
|
||||
fieldSet_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
resetName(typeName);
|
||||
}
|
||||
@ -78,7 +72,7 @@ Foam::functionObjects::residuals::~residuals()
|
||||
|
||||
bool Foam::functionObjects::residuals::read(const dictionary& dict)
|
||||
{
|
||||
regionFunctionObject::read(dict);
|
||||
fvMeshFunctionObject::read(dict);
|
||||
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ Description
|
||||
|
||||
See also
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::regionFunctionObject
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
Foam::functionObjects::logFiles
|
||||
Foam::functionObjects::timeControl
|
||||
|
||||
@ -63,7 +63,7 @@ SourceFiles
|
||||
#ifndef functionObjects_residuals_H
|
||||
#define functionObjects_residuals_H
|
||||
|
||||
#include "regionFunctionObject.H"
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "logFiles.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -79,7 +79,7 @@ namespace functionObjects
|
||||
|
||||
class residuals
|
||||
:
|
||||
public regionFunctionObject,
|
||||
public fvMeshFunctionObject,
|
||||
public logFiles
|
||||
{
|
||||
protected:
|
||||
|
||||
@ -36,12 +36,9 @@ void Foam::functionObjects::residuals::writeFileHeader(const word& fieldName)
|
||||
|
||||
if (obr_.foundObject<fieldType>(fieldName))
|
||||
{
|
||||
const fieldType& field = obr_.lookupObject<fieldType>(fieldName);
|
||||
const fvMesh& mesh = field.mesh();
|
||||
|
||||
typename pTraits<Type>::labelType validComponents
|
||||
(
|
||||
mesh.validComponents<Type>()
|
||||
mesh_.validComponents<Type>()
|
||||
);
|
||||
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
@ -66,9 +63,7 @@ void Foam::functionObjects::residuals::writeResidual(const word& fieldName)
|
||||
|
||||
if (obr_.foundObject<fieldType>(fieldName))
|
||||
{
|
||||
const fieldType& field = obr_.lookupObject<fieldType>(fieldName);
|
||||
const fvMesh& mesh = field.mesh();
|
||||
const Foam::dictionary& solverDict = mesh.solverPerformanceDict();
|
||||
const Foam::dictionary& solverDict = mesh_.solverPerformanceDict();
|
||||
|
||||
if (solverDict.found(fieldName))
|
||||
{
|
||||
@ -81,7 +76,7 @@ void Foam::functionObjects::residuals::writeResidual(const word& fieldName)
|
||||
|
||||
typename pTraits<Type>::labelType validComponents
|
||||
(
|
||||
mesh.validComponents<Type>()
|
||||
mesh_.validComponents<Type>()
|
||||
);
|
||||
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
|
||||
Reference in New Issue
Block a user