functionObjects: Simply functionObjects requiring access to the fvMesh using fvMeshFunctionObject
This commit is contained in:
@ -47,27 +47,13 @@ namespace functionObjects
|
|||||||
Foam::functionObjects::writeVTK::writeVTK
|
Foam::functionObjects::writeVTK::writeVTK
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const Time& t,
|
const Time& runTime,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObject(name),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
time_(t),
|
|
||||||
obr_
|
|
||||||
(
|
|
||||||
time_.lookupObject<objectRegistry>
|
|
||||||
(
|
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
objectNames_()
|
objectNames_()
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr_))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,20 +84,16 @@ bool Foam::functionObjects::writeVTK::write(const bool postProcess)
|
|||||||
{
|
{
|
||||||
Info<< type() << " " << name() << " output:" << nl;
|
Info<< type() << " " << name() << " output:" << nl;
|
||||||
|
|
||||||
fvMesh& mesh = const_cast<fvMesh&>(refCast<const fvMesh>(obr_));
|
Info<< "Time: " << time_.timeName() << endl;
|
||||||
|
|
||||||
const Time& runTime = mesh.time();
|
word timeDesc = time_.timeName();
|
||||||
|
|
||||||
Info<< "Time: " << runTime.timeName() << endl;
|
|
||||||
|
|
||||||
word timeDesc = runTime.timeName();
|
|
||||||
|
|
||||||
// VTK/ directory in the case
|
// VTK/ directory in the case
|
||||||
fileName fvPath(runTime.path()/"VTK");
|
fileName fvPath(time_.path()/"VTK");
|
||||||
|
|
||||||
mkDir(fvPath);
|
mkDir(fvPath);
|
||||||
|
|
||||||
string vtkName = runTime.caseName();
|
string vtkName = time_.caseName();
|
||||||
|
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
@ -135,7 +117,7 @@ bool Foam::functionObjects::writeVTK::write(const bool postProcess)
|
|||||||
|
|
||||||
Info<< " Internal : " << vtkFileName << endl;
|
Info<< " Internal : " << vtkFileName << endl;
|
||||||
|
|
||||||
vtkMesh vMesh(mesh);
|
vtkMesh vMesh(const_cast<fvMesh&>(mesh_));
|
||||||
|
|
||||||
// Write mesh
|
// Write mesh
|
||||||
internalWriter writer(vMesh, false, vtkFileName);
|
internalWriter writer(vMesh, false, vtkFileName);
|
||||||
|
|||||||
@ -54,7 +54,7 @@ Description
|
|||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
Foam::functionObjects::timeControl
|
Foam::functionObjects::timeControl
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -66,18 +66,13 @@ SourceFiles
|
|||||||
#ifndef functionObjects_writeVTK_H
|
#ifndef functionObjects_writeVTK_H
|
||||||
#define functionObjects_writeVTK_H
|
#define functionObjects_writeVTK_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "wordReList.H"
|
#include "wordReList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class Time;
|
|
||||||
class objectRegistry;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -87,16 +82,10 @@ namespace functionObjects
|
|||||||
|
|
||||||
class writeVTK
|
class writeVTK
|
||||||
:
|
:
|
||||||
public functionObject
|
public fvMeshFunctionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to the Time
|
|
||||||
const Time& time_;
|
|
||||||
|
|
||||||
//- Refererence to objectRegistry
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- Names of objects
|
//- Names of objects
|
||||||
wordReList objectNames_;
|
wordReList objectNames_;
|
||||||
|
|
||||||
|
|||||||
@ -131,10 +131,10 @@ bool Foam::functionObjects::div::execute(const bool postProcess)
|
|||||||
|
|
||||||
bool Foam::functionObjects::div::write(const bool postProcess)
|
bool Foam::functionObjects::div::write(const bool postProcess)
|
||||||
{
|
{
|
||||||
if (obr_.foundObject<regIOobject>(resultName_))
|
if (mesh_.foundObject<regIOobject>(resultName_))
|
||||||
{
|
{
|
||||||
const regIOobject& field =
|
const regIOobject& field =
|
||||||
obr_.lookupObject<regIOobject>(resultName_);
|
mesh_.lookupObject<regIOobject>(resultName_);
|
||||||
|
|
||||||
Info<< type() << " " << name() << " output:" << nl
|
Info<< type() << " " << name() << " output:" << nl
|
||||||
<< " writing field " << field.name() << nl << endl;
|
<< " writing field " << field.name() << nl << endl;
|
||||||
|
|||||||
@ -32,6 +32,9 @@ Description
|
|||||||
limited to surfaceScalarFields and volVectorFields, and the output is a
|
limited to surfaceScalarFields and volVectorFields, and the output is a
|
||||||
volScalarField.
|
volScalarField.
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
div.C
|
div.C
|
||||||
|
|
||||||
@ -62,7 +65,7 @@ class div
|
|||||||
:
|
:
|
||||||
public fvMeshFunctionObject
|
public fvMeshFunctionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private member data
|
||||||
|
|
||||||
//- Name of field to process
|
//- Name of field to process
|
||||||
word fieldName_;
|
word fieldName_;
|
||||||
|
|||||||
@ -32,6 +32,9 @@ Description
|
|||||||
limited to scalar and vector volume or surface fields, and the output is a
|
limited to scalar and vector volume or surface fields, and the output is a
|
||||||
volume vector or tensor field.
|
volume vector or tensor field.
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
grad.C
|
grad.C
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,9 @@ Description
|
|||||||
can be applied to any volume or surface fieldsm and the output is a
|
can be applied to any volume or surface fieldsm and the output is a
|
||||||
volume or surface scalar field.
|
volume or surface scalar field.
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
mag.C
|
mag.C
|
||||||
|
|
||||||
|
|||||||
@ -46,14 +46,12 @@ namespace functionObjects
|
|||||||
|
|
||||||
void Foam::functionObjects::nearWallFields::calcAddressing()
|
void Foam::functionObjects::nearWallFields::calcAddressing()
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
// Count number of faces
|
// Count number of faces
|
||||||
label nPatchFaces = 0;
|
label nPatchFaces = 0;
|
||||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||||
{
|
{
|
||||||
label patchi = iter.key();
|
label patchi = iter.key();
|
||||||
nPatchFaces += mesh.boundary()[patchi].size();
|
nPatchFaces += mesh_.boundary()[patchi].size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Global indexing
|
// Global indexing
|
||||||
@ -65,7 +63,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct cloud
|
// Construct cloud
|
||||||
Cloud<findCellParticle> cloud(mesh, IDLList<findCellParticle>());
|
Cloud<findCellParticle> cloud(mesh_, IDLList<findCellParticle>());
|
||||||
|
|
||||||
// Add particles to track to sample locations
|
// Add particles to track to sample locations
|
||||||
nPatchFaces = 0;
|
nPatchFaces = 0;
|
||||||
@ -73,7 +71,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||||
{
|
{
|
||||||
label patchi = iter.key();
|
label patchi = iter.key();
|
||||||
const fvPatch& patch = mesh.boundary()[patchi];
|
const fvPatch& patch = mesh_.boundary()[patchi];
|
||||||
|
|
||||||
vectorField nf(patch.nf());
|
vectorField nf(patch.nf());
|
||||||
vectorField faceCellCentres(patch.patch().faceCellCentres());
|
vectorField faceCellCentres(patch.patch().faceCellCentres());
|
||||||
@ -88,7 +86,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
(
|
(
|
||||||
mappedPatchBase::facePoint
|
mappedPatchBase::facePoint
|
||||||
(
|
(
|
||||||
mesh,
|
mesh_,
|
||||||
meshFacei,
|
meshFacei,
|
||||||
polyMesh::FACE_DIAG_TRIS
|
polyMesh::FACE_DIAG_TRIS
|
||||||
)
|
)
|
||||||
@ -112,14 +110,14 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
label celli = -1;
|
label celli = -1;
|
||||||
label tetFacei = -1;
|
label tetFacei = -1;
|
||||||
label tetPtI = -1;
|
label tetPtI = -1;
|
||||||
mesh.findCellFacePt(start, celli, tetFacei, tetPtI);
|
mesh_.findCellFacePt(start, celli, tetFacei, tetPtI);
|
||||||
|
|
||||||
// Add to cloud. Add originating face as passive data
|
// Add to cloud. Add originating face as passive data
|
||||||
cloud.addParticle
|
cloud.addParticle
|
||||||
(
|
(
|
||||||
new findCellParticle
|
new findCellParticle
|
||||||
(
|
(
|
||||||
mesh,
|
mesh_,
|
||||||
start,
|
start,
|
||||||
celli,
|
celli,
|
||||||
tetFacei,
|
tetFacei,
|
||||||
@ -140,8 +138,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
// Dump particles
|
// Dump particles
|
||||||
OBJstream str
|
OBJstream str
|
||||||
(
|
(
|
||||||
mesh.time().path()
|
mesh_.time().path()
|
||||||
/"wantedTracks_" + mesh.time().timeName() + ".obj"
|
/"wantedTracks_" + mesh_.time().timeName() + ".obj"
|
||||||
);
|
);
|
||||||
InfoInFunction << "Dumping tracks to " << str.name() << endl;
|
InfoInFunction << "Dumping tracks to " << str.name() << endl;
|
||||||
|
|
||||||
@ -155,14 +153,14 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
|
|
||||||
|
|
||||||
// Per cell: empty or global wall index and end location
|
// Per cell: empty or global wall index and end location
|
||||||
cellToWalls_.setSize(mesh.nCells());
|
cellToWalls_.setSize(mesh_.nCells());
|
||||||
cellToSamples_.setSize(mesh.nCells());
|
cellToSamples_.setSize(mesh_.nCells());
|
||||||
|
|
||||||
// Database to pass into findCellParticle::move
|
// Database to pass into findCellParticle::move
|
||||||
findCellParticle::trackingData td(cloud, cellToWalls_, cellToSamples_);
|
findCellParticle::trackingData td(cloud, cellToWalls_, cellToSamples_);
|
||||||
|
|
||||||
// Track all particles to their end position.
|
// Track all particles to their end position.
|
||||||
scalar maxTrackLen = 2.0*mesh.bounds().mag();
|
scalar maxTrackLen = 2.0*mesh_.bounds().mag();
|
||||||
|
|
||||||
|
|
||||||
//Debug: collect start points
|
//Debug: collect start points
|
||||||
@ -202,8 +200,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
{
|
{
|
||||||
OBJstream str
|
OBJstream str
|
||||||
(
|
(
|
||||||
mesh.time().path()
|
mesh_.time().path()
|
||||||
/"obtainedTracks_" + mesh.time().timeName() + ".obj"
|
/"obtainedTracks_" + mesh_.time().timeName() + ".obj"
|
||||||
);
|
);
|
||||||
InfoInFunction << "Dumping obtained to " << str.name() << endl;
|
InfoInFunction << "Dumping obtained to " << str.name() << endl;
|
||||||
|
|
||||||
@ -230,22 +228,9 @@ Foam::functionObjects::nearWallFields::nearWallFields
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObject(name),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
obr_
|
|
||||||
(
|
|
||||||
runTime.lookupObject<objectRegistry>
|
|
||||||
(
|
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
fieldSet_()
|
fieldSet_()
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr_))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,11 +255,9 @@ bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
|||||||
InfoInFunction << endl;
|
InfoInFunction << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
dict.lookup("fields") >> fieldSet_;
|
dict.lookup("fields") >> fieldSet_;
|
||||||
patchSet_ =
|
patchSet_ =
|
||||||
mesh.boundaryMesh().patchSet(wordReList(dict.lookup("patches")));
|
mesh_.boundaryMesh().patchSet(wordReList(dict.lookup("patches")));
|
||||||
distance_ = readScalar(dict.lookup("distance"));
|
distance_ = readScalar(dict.lookup("distance"));
|
||||||
|
|
||||||
|
|
||||||
@ -343,7 +326,7 @@ bool Foam::functionObjects::nearWallFields::execute(const bool postProcess)
|
|||||||
|
|
||||||
Info<< type() << " " << name() << " output:" << nl;
|
Info<< type() << " " << name() << " output:" << nl;
|
||||||
|
|
||||||
Info<< " Sampling fields to " << obr_.time().timeName()
|
Info<< " Sampling fields to " << time_.timeName()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
sampleFields(vsf_);
|
sampleFields(vsf_);
|
||||||
@ -363,7 +346,7 @@ bool Foam::functionObjects::nearWallFields::write(const bool postProcess)
|
|||||||
InfoInFunction << endl;
|
InfoInFunction << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< " Writing sampled fields to " << obr_.time().timeName()
|
Info<< " Writing sampled fields to " << time_.timeName()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
forAll(vsf_, i)
|
forAll(vsf_, i)
|
||||||
|
|||||||
@ -61,7 +61,7 @@ Description
|
|||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
nearWallFields.C
|
nearWallFields.C
|
||||||
@ -71,7 +71,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_nearWallFields_H
|
#ifndef functionObjects_nearWallFields_H
|
||||||
#define functionObjects_nearWallFields_H
|
#define functionObjects_nearWallFields_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "Tuple2.H"
|
#include "Tuple2.H"
|
||||||
#include "interpolationCellPoint.H"
|
#include "interpolationCellPoint.H"
|
||||||
@ -80,10 +80,6 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -93,14 +89,11 @@ namespace functionObjects
|
|||||||
|
|
||||||
class nearWallFields
|
class nearWallFields
|
||||||
:
|
:
|
||||||
public functionObject
|
public fvMeshFunctionObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected member data
|
||||||
|
|
||||||
//- Reference to the objectRegistry
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
// Read from dictionary
|
// Read from dictionary
|
||||||
|
|
||||||
|
|||||||
@ -48,25 +48,10 @@ Foam::functionObjects::processorField::processorField
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObject(name),
|
fvMeshFunctionObject(name, runTime, dict)
|
||||||
obr_
|
|
||||||
(
|
|
||||||
runTime.lookupObject<objectRegistry>
|
|
||||||
(
|
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr_))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
volScalarField* procFieldPtr
|
volScalarField* procFieldPtr
|
||||||
(
|
(
|
||||||
new volScalarField
|
new volScalarField
|
||||||
@ -74,17 +59,17 @@ Foam::functionObjects::processorField::processorField
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"processorID",
|
"processorID",
|
||||||
mesh.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh_,
|
||||||
dimensionedScalar("0", dimless, 0.0)
|
dimensionedScalar("0", dimless, 0.0)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
mesh.objectRegistry::store(procFieldPtr);
|
mesh_.objectRegistry::store(procFieldPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -105,7 +90,7 @@ bool Foam::functionObjects::processorField::read(const dictionary& dict)
|
|||||||
bool Foam::functionObjects::processorField::execute(const bool postProcess)
|
bool Foam::functionObjects::processorField::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
const volScalarField& procField =
|
const volScalarField& procField =
|
||||||
obr_.lookupObject<volScalarField>("processorID");
|
mesh_.lookupObject<volScalarField>("processorID");
|
||||||
|
|
||||||
const_cast<volScalarField&>(procField) ==
|
const_cast<volScalarField&>(procField) ==
|
||||||
dimensionedScalar("proci", dimless, Pstream::myProcNo());
|
dimensionedScalar("proci", dimless, Pstream::myProcNo());
|
||||||
@ -117,7 +102,7 @@ bool Foam::functionObjects::processorField::execute(const bool postProcess)
|
|||||||
bool Foam::functionObjects::processorField::write(const bool postProcess)
|
bool Foam::functionObjects::processorField::write(const bool postProcess)
|
||||||
{
|
{
|
||||||
const volScalarField& procField =
|
const volScalarField& procField =
|
||||||
obr_.lookupObject<volScalarField>("processorID");
|
mesh_.lookupObject<volScalarField>("processorID");
|
||||||
|
|
||||||
procField.write();
|
procField.write();
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@ Description
|
|||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
processorField.C
|
processorField.C
|
||||||
@ -58,16 +58,12 @@ SourceFiles
|
|||||||
#ifndef functionObjects_processorField_H
|
#ifndef functionObjects_processorField_H
|
||||||
#define functionObjects_processorField_H
|
#define functionObjects_processorField_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -77,18 +73,8 @@ namespace functionObjects
|
|||||||
|
|
||||||
class processorField
|
class processorField
|
||||||
:
|
:
|
||||||
public functionObject
|
public fvMeshFunctionObject
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
|
|
||||||
// Protected data
|
|
||||||
|
|
||||||
//- Reference to the objectRegistry
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
|
|||||||
@ -49,22 +49,9 @@ Foam::functionObjects::readFields::readFields
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObject(name),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
obr_
|
|
||||||
(
|
|
||||||
runTime.lookupObject<objectRegistry>
|
|
||||||
(
|
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
fieldSet_()
|
fieldSet_()
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr_))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ Description
|
|||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
readFields.C
|
readFields.C
|
||||||
@ -64,7 +64,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_readFields_H
|
#ifndef functionObjects_readFields_H
|
||||||
#define functionObjects_readFields_H
|
#define functionObjects_readFields_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "surfaceFieldsFwd.H"
|
#include "surfaceFieldsFwd.H"
|
||||||
|
|
||||||
@ -72,10 +72,6 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -85,15 +81,12 @@ namespace functionObjects
|
|||||||
|
|
||||||
class readFields
|
class readFields
|
||||||
:
|
:
|
||||||
public functionObject
|
public fvMeshFunctionObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Reference to the objectRegistry
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- Fields to load
|
//- Fields to load
|
||||||
wordList fieldSet_;
|
wordList fieldSet_;
|
||||||
|
|
||||||
|
|||||||
@ -59,13 +59,11 @@ void Foam::functionObjects::readFields::loadField
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
IOobject fieldHeader
|
IOobject fieldHeader
|
||||||
(
|
(
|
||||||
fieldName,
|
fieldName,
|
||||||
mesh.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh,
|
mesh_,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
);
|
);
|
||||||
@ -80,7 +78,7 @@ void Foam::functionObjects::readFields::loadField
|
|||||||
Info<< " Reading " << fieldName << endl;
|
Info<< " Reading " << fieldName << endl;
|
||||||
label sz = vflds.size();
|
label sz = vflds.size();
|
||||||
vflds.setSize(sz+1);
|
vflds.setSize(sz+1);
|
||||||
vflds.set(sz, new vfType(fieldHeader, mesh));
|
vflds.set(sz, new vfType(fieldHeader, mesh_));
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
@ -92,7 +90,7 @@ void Foam::functionObjects::readFields::loadField
|
|||||||
Info<< " Reading " << fieldName << endl;
|
Info<< " Reading " << fieldName << endl;
|
||||||
label sz = sflds.size();
|
label sz = sflds.size();
|
||||||
sflds.setSize(sz+1);
|
sflds.setSize(sz+1);
|
||||||
sflds.set(sz, new sfType(fieldHeader, mesh));
|
sflds.set(sz, new sfType(fieldHeader, mesh_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -129,8 +129,6 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressureTools::pDyn
|
|||||||
const volScalarField& p
|
const volScalarField& p
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
tmp<volScalarField> tpDyn
|
tmp<volScalarField> tpDyn
|
||||||
(
|
(
|
||||||
new volScalarField
|
new volScalarField
|
||||||
@ -138,12 +136,12 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressureTools::pDyn
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"pDyn",
|
"pDyn",
|
||||||
mesh.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh_,
|
||||||
dimensionedScalar("zero", dimPressure, 0.0)
|
dimensionedScalar("zero", dimPressure, 0.0)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -191,14 +189,7 @@ Foam::functionObjects::pressureTools::pressureTools
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObject(name),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
obr_
|
|
||||||
(
|
|
||||||
runTime.lookupObject<objectRegistry>
|
|
||||||
(
|
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
pName_("p"),
|
pName_("p"),
|
||||||
UName_("U"),
|
UName_("U"),
|
||||||
rhoName_("rho"),
|
rhoName_("rho"),
|
||||||
@ -209,12 +200,6 @@ Foam::functionObjects::pressureTools::pressureTools
|
|||||||
UInf_(Zero),
|
UInf_(Zero),
|
||||||
rhoInf_(0.0)
|
rhoInf_(0.0)
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr_))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
dimensionSet pDims(dimPressure);
|
dimensionSet pDims(dimPressure);
|
||||||
@ -224,8 +209,6 @@ Foam::functionObjects::pressureTools::pressureTools
|
|||||||
pDims /= dimPressure;
|
pDims /= dimPressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
volScalarField* pPtr
|
volScalarField* pPtr
|
||||||
(
|
(
|
||||||
new volScalarField
|
new volScalarField
|
||||||
@ -233,17 +216,17 @@ Foam::functionObjects::pressureTools::pressureTools
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
pName(),
|
pName(),
|
||||||
mesh.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh_,
|
||||||
dimensionedScalar("0", pDims, 0.0)
|
dimensionedScalar("0", pDims, 0.0)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
mesh.objectRegistry::store(pPtr);
|
mesh_.objectRegistry::store(pPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -100,6 +100,9 @@ Description
|
|||||||
rhoInf | Freestream density for coefficient calculation | no |
|
rhoInf | Freestream density for coefficient calculation | no |
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
pressureTools.C
|
pressureTools.C
|
||||||
|
|
||||||
@ -108,7 +111,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_pressureTools_H
|
#ifndef functionObjects_pressureTools_H
|
||||||
#define functionObjects_pressureTools_H
|
#define functionObjects_pressureTools_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "dimensionedScalar.H"
|
#include "dimensionedScalar.H"
|
||||||
|
|
||||||
@ -116,10 +119,6 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -129,13 +128,10 @@ namespace functionObjects
|
|||||||
|
|
||||||
class pressureTools
|
class pressureTools
|
||||||
:
|
:
|
||||||
public functionObject
|
public fvMeshFunctionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to the objectRegistry
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- Name of pressure field, default is "p"
|
//- Name of pressure field, default is "p"
|
||||||
word pName_;
|
word pName_;
|
||||||
|
|
||||||
|
|||||||
@ -75,27 +75,10 @@ Foam::functionObjects::CourantNo::CourantNo
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObject(name),
|
fvMeshFunctionObject(name, runTime, dict)
|
||||||
obr_
|
|
||||||
(
|
|
||||||
runTime.lookupObject<objectRegistry>
|
|
||||||
(
|
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
phiName_("phi"),
|
|
||||||
rhoName_("rho")
|
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr_))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
volScalarField* CourantNoPtr
|
volScalarField* CourantNoPtr
|
||||||
(
|
(
|
||||||
new volScalarField
|
new volScalarField
|
||||||
@ -103,18 +86,18 @@ Foam::functionObjects::CourantNo::CourantNo
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
type(),
|
type(),
|
||||||
mesh.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh_,
|
||||||
dimensionedScalar("0", dimless, 0.0),
|
dimensionedScalar("0", dimless, 0.0),
|
||||||
zeroGradientFvPatchScalarField::typeName
|
zeroGradientFvPatchScalarField::typeName
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
mesh.objectRegistry::store(CourantNoPtr);
|
mesh_.objectRegistry::store(CourantNoPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -137,21 +120,19 @@ bool Foam::functionObjects::CourantNo::read(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::functionObjects::CourantNo::execute(const bool postProcess)
|
bool Foam::functionObjects::CourantNo::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
const surfaceScalarField& phi =
|
const surfaceScalarField& phi =
|
||||||
mesh.lookupObject<surfaceScalarField>(phiName_);
|
mesh_.lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
volScalarField& Co = const_cast<volScalarField&>
|
volScalarField& Co = const_cast<volScalarField&>
|
||||||
(
|
(
|
||||||
mesh.lookupObject<volScalarField>(type())
|
mesh_.lookupObject<volScalarField>(type())
|
||||||
);
|
);
|
||||||
|
|
||||||
Co.ref() = byRho
|
Co.ref() = byRho
|
||||||
(
|
(
|
||||||
(0.5*mesh.time().deltaT())
|
(0.5*mesh_.time().deltaT())
|
||||||
*fvc::surfaceSum(mag(phi))()()
|
*fvc::surfaceSum(mag(phi))()()
|
||||||
/mesh.V()
|
/mesh_.V()
|
||||||
);
|
);
|
||||||
Co.correctBoundaryConditions();
|
Co.correctBoundaryConditions();
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,9 @@ Description
|
|||||||
volScalarField. The field is stored on the mesh database so that it can
|
volScalarField. The field is stored on the mesh database so that it can
|
||||||
be retrieved and used for other applications.
|
be retrieved and used for other applications.
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
CourantNo.C
|
CourantNo.C
|
||||||
|
|
||||||
@ -40,7 +43,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_CourantNo_H
|
#ifndef functionObjects_CourantNo_H
|
||||||
#define functionObjects_CourantNo_H
|
#define functionObjects_CourantNo_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -56,13 +59,10 @@ namespace functionObjects
|
|||||||
|
|
||||||
class CourantNo
|
class CourantNo
|
||||||
:
|
:
|
||||||
public functionObject
|
public fvMeshFunctionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to the database
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- Name of flux field, default is "phi"
|
//- Name of flux field, default is "phi"
|
||||||
word phiName_;
|
word phiName_;
|
||||||
|
|
||||||
|
|||||||
@ -56,26 +56,10 @@ Foam::functionObjects::Lambda2::Lambda2
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObject(name),
|
fvMeshFunctionObject(name, runTime, dict)
|
||||||
obr_
|
|
||||||
(
|
|
||||||
runTime.lookupObject<objectRegistry>
|
|
||||||
(
|
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
UName_("U")
|
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr_))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
volScalarField* Lambda2Ptr
|
volScalarField* Lambda2Ptr
|
||||||
(
|
(
|
||||||
new volScalarField
|
new volScalarField
|
||||||
@ -83,17 +67,17 @@ Foam::functionObjects::Lambda2::Lambda2
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
type(),
|
type(),
|
||||||
mesh.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh_,
|
||||||
dimensionedScalar("0", dimless/sqr(dimTime), 0.0)
|
dimensionedScalar("0", dimless/sqr(dimTime), 0.0)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
mesh.objectRegistry::store(Lambda2Ptr);
|
mesh_.objectRegistry::store(Lambda2Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -115,10 +99,8 @@ bool Foam::functionObjects::Lambda2::read(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::functionObjects::Lambda2::execute(const bool postProcess)
|
bool Foam::functionObjects::Lambda2::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
const volVectorField& U =
|
const volVectorField& U =
|
||||||
mesh.lookupObject<volVectorField>(UName_);
|
mesh_.lookupObject<volVectorField>(UName_);
|
||||||
|
|
||||||
const volTensorField gradU(fvc::grad(U));
|
const volTensorField gradU(fvc::grad(U));
|
||||||
|
|
||||||
@ -131,7 +113,7 @@ bool Foam::functionObjects::Lambda2::execute(const bool postProcess)
|
|||||||
volScalarField& Lambda2 =
|
volScalarField& Lambda2 =
|
||||||
const_cast<volScalarField&>
|
const_cast<volScalarField&>
|
||||||
(
|
(
|
||||||
mesh.lookupObject<volScalarField>(type())
|
mesh_.lookupObject<volScalarField>(type())
|
||||||
);
|
);
|
||||||
|
|
||||||
Lambda2 = -eigenValues(SSplusWW)().component(vector::Y);
|
Lambda2 = -eigenValues(SSplusWW)().component(vector::Y);
|
||||||
|
|||||||
@ -32,6 +32,9 @@ Description
|
|||||||
of the sum of the square of the symmetrical and anti-symmetrical parts of
|
of the sum of the square of the symmetrical and anti-symmetrical parts of
|
||||||
the velocity gradient tensor.
|
the velocity gradient tensor.
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
Lambda2.C
|
Lambda2.C
|
||||||
|
|
||||||
@ -40,17 +43,13 @@ SourceFiles
|
|||||||
#ifndef functionObjects_Lambda2_H
|
#ifndef functionObjects_Lambda2_H
|
||||||
#define functionObjects_Lambda2_H
|
#define functionObjects_Lambda2_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -60,13 +59,10 @@ namespace functionObjects
|
|||||||
|
|
||||||
class Lambda2
|
class Lambda2
|
||||||
:
|
:
|
||||||
public functionObject
|
public fvMeshFunctionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to the database
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- Name of velocity field, default is "U"
|
//- Name of velocity field, default is "U"
|
||||||
word UName_;
|
word UName_;
|
||||||
|
|
||||||
|
|||||||
@ -59,27 +59,10 @@ Foam::functionObjects::Peclet::Peclet
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObject(name),
|
fvMeshFunctionObject(name, runTime, dict)
|
||||||
obr_
|
|
||||||
(
|
|
||||||
runTime.lookupObject<objectRegistry>
|
|
||||||
(
|
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
phiName_("phi"),
|
|
||||||
rhoName_("rho")
|
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr_))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
surfaceScalarField* PecletPtr
|
surfaceScalarField* PecletPtr
|
||||||
(
|
(
|
||||||
new surfaceScalarField
|
new surfaceScalarField
|
||||||
@ -87,17 +70,17 @@ Foam::functionObjects::Peclet::Peclet
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
type(),
|
type(),
|
||||||
mesh.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh_,
|
||||||
dimensionedScalar("0", dimless, 0.0)
|
dimensionedScalar("0", dimless, 0.0)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
mesh.objectRegistry::store(PecletPtr);
|
mesh_.objectRegistry::store(PecletPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,39 +106,37 @@ bool Foam::functionObjects::Peclet::execute(const bool postProcess)
|
|||||||
typedef compressible::turbulenceModel cmpTurbModel;
|
typedef compressible::turbulenceModel cmpTurbModel;
|
||||||
typedef incompressible::turbulenceModel icoTurbModel;
|
typedef incompressible::turbulenceModel icoTurbModel;
|
||||||
|
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
tmp<volScalarField> nuEff;
|
tmp<volScalarField> nuEff;
|
||||||
if (mesh.foundObject<cmpTurbModel>(turbulenceModel::propertiesName))
|
if (mesh_.foundObject<cmpTurbModel>(turbulenceModel::propertiesName))
|
||||||
{
|
{
|
||||||
const cmpTurbModel& model =
|
const cmpTurbModel& model =
|
||||||
mesh.lookupObject<cmpTurbModel>
|
mesh_.lookupObject<cmpTurbModel>
|
||||||
(
|
(
|
||||||
turbulenceModel::propertiesName
|
turbulenceModel::propertiesName
|
||||||
);
|
);
|
||||||
|
|
||||||
const volScalarField& rho =
|
const volScalarField& rho =
|
||||||
mesh.lookupObject<volScalarField>(rhoName_);
|
mesh_.lookupObject<volScalarField>(rhoName_);
|
||||||
|
|
||||||
nuEff = model.muEff()/rho;
|
nuEff = model.muEff()/rho;
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
mesh.foundObject<icoTurbModel>(turbulenceModel::propertiesName)
|
mesh_.foundObject<icoTurbModel>(turbulenceModel::propertiesName)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const icoTurbModel& model =
|
const icoTurbModel& model =
|
||||||
mesh.lookupObject<icoTurbModel>
|
mesh_.lookupObject<icoTurbModel>
|
||||||
(
|
(
|
||||||
turbulenceModel::propertiesName
|
turbulenceModel::propertiesName
|
||||||
);
|
);
|
||||||
|
|
||||||
nuEff = model.nuEff();
|
nuEff = model.nuEff();
|
||||||
}
|
}
|
||||||
else if (mesh.foundObject<dictionary>("transportProperties"))
|
else if (mesh_.foundObject<dictionary>("transportProperties"))
|
||||||
{
|
{
|
||||||
const dictionary& model =
|
const dictionary& model =
|
||||||
mesh.lookupObject<dictionary>("transportProperties");
|
mesh_.lookupObject<dictionary>("transportProperties");
|
||||||
|
|
||||||
nuEff =
|
nuEff =
|
||||||
tmp<volScalarField>
|
tmp<volScalarField>
|
||||||
@ -165,12 +146,12 @@ bool Foam::functionObjects::Peclet::execute(const bool postProcess)
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"nuEff",
|
"nuEff",
|
||||||
mesh.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh_,
|
||||||
dimensionedScalar(model.lookup("nu"))
|
dimensionedScalar(model.lookup("nu"))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -183,19 +164,19 @@ bool Foam::functionObjects::Peclet::execute(const bool postProcess)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const surfaceScalarField& phi =
|
const surfaceScalarField& phi =
|
||||||
mesh.lookupObject<surfaceScalarField>(phiName_);
|
mesh_.lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
surfaceScalarField& Peclet =
|
surfaceScalarField& Peclet =
|
||||||
const_cast<surfaceScalarField&>
|
const_cast<surfaceScalarField&>
|
||||||
(
|
(
|
||||||
mesh.lookupObject<surfaceScalarField>(type())
|
mesh_.lookupObject<surfaceScalarField>(type())
|
||||||
);
|
);
|
||||||
|
|
||||||
Peclet =
|
Peclet =
|
||||||
mag(phi)
|
mag(phi)
|
||||||
/(
|
/(
|
||||||
mesh.magSf()
|
mesh_.magSf()
|
||||||
*mesh.surfaceInterpolation::deltaCoeffs()
|
*mesh_.surfaceInterpolation::deltaCoeffs()
|
||||||
*fvc::interpolate(nuEff)
|
*fvc::interpolate(nuEff)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -206,7 +187,7 @@ bool Foam::functionObjects::Peclet::execute(const bool postProcess)
|
|||||||
bool Foam::functionObjects::Peclet::write(const bool postProcess)
|
bool Foam::functionObjects::Peclet::write(const bool postProcess)
|
||||||
{
|
{
|
||||||
const surfaceScalarField& Peclet =
|
const surfaceScalarField& Peclet =
|
||||||
obr_.lookupObject<surfaceScalarField>(type());
|
mesh_.lookupObject<surfaceScalarField>(type());
|
||||||
|
|
||||||
Info<< type() << " " << name() << " output:" << nl
|
Info<< type() << " " << name() << " output:" << nl
|
||||||
<< " writing field " << Peclet.name() << nl
|
<< " writing field " << Peclet.name() << nl
|
||||||
|
|||||||
@ -31,6 +31,9 @@ Description
|
|||||||
This function object calculates and outputs the Peclet number as a
|
This function object calculates and outputs the Peclet number as a
|
||||||
surfaceScalarField.
|
surfaceScalarField.
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
Peclet.C
|
Peclet.C
|
||||||
|
|
||||||
@ -39,17 +42,13 @@ SourceFiles
|
|||||||
#ifndef functionObjects_Peclet_H
|
#ifndef functionObjects_Peclet_H
|
||||||
#define functionObjects_Peclet_H
|
#define functionObjects_Peclet_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -59,13 +58,10 @@ namespace functionObjects
|
|||||||
|
|
||||||
class Peclet
|
class Peclet
|
||||||
:
|
:
|
||||||
public functionObject
|
public fvMeshFunctionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to the database
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- Name of flux field, default is "phi"
|
//- Name of flux field, default is "phi"
|
||||||
word phiName_;
|
word phiName_;
|
||||||
|
|
||||||
|
|||||||
@ -55,26 +55,10 @@ Foam::functionObjects::Q::Q
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObject(name),
|
fvMeshFunctionObject(name, runTime, dict)
|
||||||
obr_
|
|
||||||
(
|
|
||||||
runTime.lookupObject<objectRegistry>
|
|
||||||
(
|
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
UName_("U")
|
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr_))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
volScalarField* QPtr
|
volScalarField* QPtr
|
||||||
(
|
(
|
||||||
new volScalarField
|
new volScalarField
|
||||||
@ -82,17 +66,17 @@ Foam::functionObjects::Q::Q
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
type(),
|
type(),
|
||||||
mesh.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh_,
|
||||||
dimensionedScalar("0", dimless/sqr(dimTime), 0.0)
|
dimensionedScalar("0", dimless/sqr(dimTime), 0.0)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
mesh.objectRegistry::store(QPtr);
|
mesh_.objectRegistry::store(QPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,17 +98,15 @@ bool Foam::functionObjects::Q::read(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::functionObjects::Q::execute(const bool postProcess)
|
bool Foam::functionObjects::Q::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
const volVectorField& U =
|
const volVectorField& U =
|
||||||
mesh.lookupObject<volVectorField>(UName_);
|
mesh_.lookupObject<volVectorField>(UName_);
|
||||||
|
|
||||||
const volTensorField gradU(fvc::grad(U));
|
const volTensorField gradU(fvc::grad(U));
|
||||||
|
|
||||||
volScalarField& Q =
|
volScalarField& Q =
|
||||||
const_cast<volScalarField&>
|
const_cast<volScalarField&>
|
||||||
(
|
(
|
||||||
mesh.lookupObject<volScalarField>(type())
|
mesh_.lookupObject<volScalarField>(type())
|
||||||
);
|
);
|
||||||
|
|
||||||
Q = 0.5*(sqr(tr(gradU)) - tr(((gradU) & (gradU))));
|
Q = 0.5*(sqr(tr(gradU)) - tr(((gradU) & (gradU))));
|
||||||
@ -136,7 +118,7 @@ bool Foam::functionObjects::Q::execute(const bool postProcess)
|
|||||||
bool Foam::functionObjects::Q::write(const bool postProcess)
|
bool Foam::functionObjects::Q::write(const bool postProcess)
|
||||||
{
|
{
|
||||||
const volScalarField& Q =
|
const volScalarField& Q =
|
||||||
obr_.lookupObject<volScalarField>(type());
|
mesh_.lookupObject<volScalarField>(type());
|
||||||
|
|
||||||
Info<< type() << " " << name() << " output:" << nl
|
Info<< type() << " " << name() << " output:" << nl
|
||||||
<< " writing field " << Q.name() << nl
|
<< " writing field " << Q.name() << nl
|
||||||
|
|||||||
@ -35,6 +35,9 @@ Description
|
|||||||
Q = 0.5(sqr(tr(\nabla U)) - tr(((\nabla U) \cdot (\nabla U))))
|
Q = 0.5(sqr(tr(\nabla U)) - tr(((\nabla U) \cdot (\nabla U))))
|
||||||
\f]
|
\f]
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
Q.C
|
Q.C
|
||||||
|
|
||||||
@ -43,17 +46,13 @@ SourceFiles
|
|||||||
#ifndef functionObjects_Q_H
|
#ifndef functionObjects_Q_H
|
||||||
#define functionObjects_Q_H
|
#define functionObjects_Q_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -63,13 +62,10 @@ namespace functionObjects
|
|||||||
|
|
||||||
class Q
|
class Q
|
||||||
:
|
:
|
||||||
public functionObject
|
public fvMeshFunctionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to the database
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- Name of velocity field, default is "U"
|
//- Name of velocity field, default is "U"
|
||||||
word UName_;
|
word UName_;
|
||||||
|
|
||||||
|
|||||||
@ -33,8 +33,7 @@ Description
|
|||||||
value is calculated via the maximum blending factor for any cell face.
|
value is calculated via the maximum blending factor for any cell face.
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::fvMeshFunctionObject
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
Foam::functionObject
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
blendingFactor.C
|
blendingFactor.C
|
||||||
|
|||||||
@ -38,22 +38,20 @@ Foam::volScalarField& Foam::functionObjects::blendingFactor::factor
|
|||||||
{
|
{
|
||||||
const word fieldName = "blendingFactor:" + field.name();
|
const word fieldName = "blendingFactor:" + field.name();
|
||||||
|
|
||||||
if (!obr_.foundObject<volScalarField>(fieldName))
|
if (!mesh_.foundObject<volScalarField>(fieldName))
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
volScalarField* factorPtr =
|
volScalarField* factorPtr =
|
||||||
new volScalarField
|
new volScalarField
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fieldName,
|
fieldName,
|
||||||
mesh.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh_,
|
||||||
dimensionedScalar("0", dimless, 0.0),
|
dimensionedScalar("0", dimless, 0.0),
|
||||||
zeroGradientFvPatchScalarField::typeName
|
zeroGradientFvPatchScalarField::typeName
|
||||||
);
|
);
|
||||||
@ -64,7 +62,7 @@ Foam::volScalarField& Foam::functionObjects::blendingFactor::factor
|
|||||||
return
|
return
|
||||||
const_cast<volScalarField&>
|
const_cast<volScalarField&>
|
||||||
(
|
(
|
||||||
obr_.lookupObject<volScalarField>(fieldName)
|
mesh_.lookupObject<volScalarField>(fieldName)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,23 +72,21 @@ void Foam::functionObjects::blendingFactor::calc()
|
|||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
if (!obr_.foundObject<fieldType>(fieldName_))
|
if (!mesh_.foundObject<fieldType>(fieldName_))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
const fieldType& field = mesh_.lookupObject<fieldType>(fieldName_);
|
||||||
|
|
||||||
const fieldType& field = mesh.lookupObject<fieldType>(fieldName_);
|
|
||||||
|
|
||||||
const word divScheme("div(" + phiName_ + ',' + fieldName_ + ')');
|
const word divScheme("div(" + phiName_ + ',' + fieldName_ + ')');
|
||||||
ITstream& its = mesh.divScheme(divScheme);
|
ITstream& its = mesh_.divScheme(divScheme);
|
||||||
|
|
||||||
const surfaceScalarField& phi =
|
const surfaceScalarField& phi =
|
||||||
mesh.lookupObject<surfaceScalarField>(phiName_);
|
mesh_.lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
tmp<fv::convectionScheme<Type>> cs =
|
tmp<fv::convectionScheme<Type>> cs =
|
||||||
fv::convectionScheme<Type>::New(mesh, phi, its);
|
fv::convectionScheme<Type>::New(mesh_, phi, its);
|
||||||
|
|
||||||
const fv::gaussConvectionScheme<Type>& gcs =
|
const fv::gaussConvectionScheme<Type>& gcs =
|
||||||
refCast<const fv::gaussConvectionScheme<Type>>(cs());
|
refCast<const fv::gaussConvectionScheme<Type>>(cs());
|
||||||
|
|||||||
@ -157,25 +157,9 @@ Foam::functionObjects::scalarTransport::scalarTransport
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObject(name),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
mesh_
|
|
||||||
(
|
|
||||||
refCast<const fvMesh>
|
|
||||||
(
|
|
||||||
runTime.lookupObject<objectRegistry>
|
|
||||||
(
|
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
phiName_(dict.lookupOrDefault<word>("phiName", "phi")),
|
|
||||||
UName_(dict.lookupOrDefault<word>("UName", "U")),
|
|
||||||
rhoName_(dict.lookupOrDefault<word>("rhoName", "rho")),
|
|
||||||
DT_(0.0),
|
DT_(0.0),
|
||||||
userDT_(false),
|
|
||||||
resetOnStartUp_(false),
|
|
||||||
nCorr_(0),
|
nCorr_(0),
|
||||||
autoSchemes_(false),
|
|
||||||
fvOptions_(mesh_),
|
fvOptions_(mesh_),
|
||||||
T_
|
T_
|
||||||
(
|
(
|
||||||
|
|||||||
@ -39,6 +39,9 @@ Description
|
|||||||
- the diffusivity can be set manually using the DT entry, or retrieved
|
- the diffusivity can be set manually using the DT entry, or retrieved
|
||||||
from the turbulence model (if applicable)
|
from the turbulence model (if applicable)
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
scalarTransport.C
|
scalarTransport.C
|
||||||
|
|
||||||
@ -47,7 +50,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_scalarTransport_H
|
#ifndef functionObjects_scalarTransport_H
|
||||||
#define functionObjects_scalarTransport_H
|
#define functionObjects_scalarTransport_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "surfaceFieldsFwd.H"
|
#include "surfaceFieldsFwd.H"
|
||||||
#include "fvOptionList.H"
|
#include "fvOptionList.H"
|
||||||
@ -56,10 +59,6 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -69,13 +68,10 @@ namespace functionObjects
|
|||||||
|
|
||||||
class scalarTransport
|
class scalarTransport
|
||||||
:
|
:
|
||||||
public functionObject
|
public fvMeshFunctionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to the mesh database
|
|
||||||
const fvMesh& mesh_;
|
|
||||||
|
|
||||||
//- Name of flux field (optional)
|
//- Name of flux field (optional)
|
||||||
word phiName_;
|
word phiName_;
|
||||||
|
|
||||||
|
|||||||
@ -55,27 +55,11 @@ Foam::functionObjects::vorticity::vorticity
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObject(name),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
obr_
|
|
||||||
(
|
|
||||||
runTime.lookupObject<objectRegistry>
|
|
||||||
(
|
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
UName_("U"),
|
|
||||||
outputName_(typeName)
|
outputName_(typeName)
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr_))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
volVectorField* vorticityPtr
|
volVectorField* vorticityPtr
|
||||||
(
|
(
|
||||||
new volVectorField
|
new volVectorField
|
||||||
@ -83,17 +67,17 @@ Foam::functionObjects::vorticity::vorticity
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
outputName_,
|
outputName_,
|
||||||
mesh.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh_,
|
||||||
dimensionedVector("0", dimless/dimTime, Zero)
|
dimensionedVector("0", dimless/dimTime, Zero)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
mesh.objectRegistry::store(vorticityPtr);
|
mesh_.objectRegistry::store(vorticityPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -119,11 +103,11 @@ bool Foam::functionObjects::vorticity::read(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::functionObjects::vorticity::execute(const bool postProcess)
|
bool Foam::functionObjects::vorticity::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
|
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
|
||||||
|
|
||||||
volVectorField& vorticity = const_cast<volVectorField&>
|
volVectorField& vorticity = const_cast<volVectorField&>
|
||||||
(
|
(
|
||||||
obr_.lookupObject<volVectorField>(outputName_)
|
mesh_.lookupObject<volVectorField>(outputName_)
|
||||||
);
|
);
|
||||||
|
|
||||||
vorticity = fvc::curl(U);
|
vorticity = fvc::curl(U);
|
||||||
@ -135,7 +119,7 @@ bool Foam::functionObjects::vorticity::execute(const bool postProcess)
|
|||||||
bool Foam::functionObjects::vorticity::write(const bool postProcess)
|
bool Foam::functionObjects::vorticity::write(const bool postProcess)
|
||||||
{
|
{
|
||||||
const volVectorField& vorticity =
|
const volVectorField& vorticity =
|
||||||
obr_.lookupObject<volVectorField>(outputName_);
|
mesh_.lookupObject<volVectorField>(outputName_);
|
||||||
|
|
||||||
Info<< type() << " " << name() << " output:" << nl
|
Info<< type() << " " << name() << " output:" << nl
|
||||||
<< " writing field " << vorticity.name() << nl
|
<< " writing field " << vorticity.name() << nl
|
||||||
|
|||||||
@ -30,6 +30,9 @@ Group
|
|||||||
Description
|
Description
|
||||||
This function object calculates the vorticity, the curl of the velocity.
|
This function object calculates the vorticity, the curl of the velocity.
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
vorticity.C
|
vorticity.C
|
||||||
|
|
||||||
@ -38,17 +41,13 @@ SourceFiles
|
|||||||
#ifndef functionObjects_vorticity_H
|
#ifndef functionObjects_vorticity_H
|
||||||
#define functionObjects_vorticity_H
|
#define functionObjects_vorticity_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -58,13 +57,10 @@ namespace functionObjects
|
|||||||
|
|
||||||
class vorticity
|
class vorticity
|
||||||
:
|
:
|
||||||
public functionObject
|
public fvMeshFunctionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to the database
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- Name of velocity field, default is "U"
|
//- Name of velocity field, default is "U"
|
||||||
word UName_;
|
word UName_;
|
||||||
|
|
||||||
|
|||||||
@ -51,12 +51,11 @@ template<class ThermoType>
|
|||||||
Foam::moleFractions<ThermoType>::moleFractions
|
Foam::moleFractions<ThermoType>::moleFractions
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const Time& t,
|
const Time& runTime,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
writeFiles(name, t, dict, typeName),
|
fvMeshFunctionObject(name, runTime, dict)
|
||||||
mesh_(refCast<const fvMesh>(obr_))
|
|
||||||
{
|
{
|
||||||
if (mesh_.foundObject<ThermoType>(basicThermo::dictName))
|
if (mesh_.foundObject<ThermoType>(basicThermo::dictName))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -49,7 +49,7 @@ Description
|
|||||||
depending on the thermodynamics package used in the solver.
|
depending on the thermodynamics package used in the solver.
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
moleFractions.C
|
moleFractions.C
|
||||||
@ -59,8 +59,8 @@ SourceFiles
|
|||||||
#ifndef moleFractions_H
|
#ifndef moleFractions_H
|
||||||
#define moleFractions_H
|
#define moleFractions_H
|
||||||
|
|
||||||
#include "writeFiles.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "volFields.H"
|
#include "volFieldsFwd.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -74,13 +74,10 @@ namespace Foam
|
|||||||
template<class ThermoType>
|
template<class ThermoType>
|
||||||
class moleFractions
|
class moleFractions
|
||||||
:
|
:
|
||||||
public functionObjects::writeFiles
|
public functionObjects::fvMeshFunctionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to the mesh
|
|
||||||
const fvMesh& mesh_;
|
|
||||||
|
|
||||||
//- Species mole fractions
|
//- Species mole fractions
|
||||||
PtrList<volScalarField> X_;
|
PtrList<volScalarField> X_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user