mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
functionObjects: Moved into the functionObjects namespace and rationalized and simplified failable construction
Rather than requiring each functionObject to handle failed construction internally (using the active_ flag) the static member function "viable" is provided which returns true if construction of the functionObject is likely to be successful. Failed construction is then handled by the wrapper-class which constructs the functionObject, e.g. "OutputFilterFunctionObject".
This commit is contained in:
@ -138,7 +138,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||
return;
|
||||
}
|
||||
|
||||
dsmcFields dF
|
||||
functionObjects::dsmcFields dF
|
||||
(
|
||||
"dsmcFieldsUtility",
|
||||
mesh,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -76,6 +76,18 @@ ${typeName}FunctionObject::${typeName}FunctionObject
|
||||
}
|
||||
|
||||
|
||||
bool ${typeName}FunctionObject::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FunctionObject::~${typeName}FunctionObject()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -102,6 +102,16 @@ public:
|
||||
const bool loadFromFilesUnused = false
|
||||
);
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& unused,
|
||||
const dictionary&,
|
||||
const bool loadFromFilesUnused = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~${typeName}FunctionObject();
|
||||
|
||||
@ -71,21 +71,15 @@ void Foam::FUNCTIONOBJECT::read(const dictionary& dict)
|
||||
|
||||
|
||||
void Foam::FUNCTIONOBJECT::execute()
|
||||
{
|
||||
// Do nothing - only valid on write
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::FUNCTIONOBJECT::end()
|
||||
{
|
||||
// Do nothing - only valid on write
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::FUNCTIONOBJECT::timeSet()
|
||||
{
|
||||
// Do nothing - only valid on write
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::FUNCTIONOBJECT::write()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -66,6 +66,32 @@ Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
|
||||
{}
|
||||
|
||||
|
||||
template<class OutputFilter>
|
||||
bool Foam::IOOutputFilter<OutputFilter>::viable
|
||||
(
|
||||
const word& outputFilterName,
|
||||
const objectRegistry& obr,
|
||||
const word& dictName,
|
||||
const IOobject::readOption rOpt,
|
||||
const bool readFromFiles
|
||||
)
|
||||
{
|
||||
IOdictionary dict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
dictName,
|
||||
obr.time().system(),
|
||||
obr,
|
||||
rOpt,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
return OutputFilter::viable(outputFilterName, obr, dict, readFromFiles);
|
||||
}
|
||||
|
||||
|
||||
template<class OutputFilter>
|
||||
Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
|
||||
(
|
||||
@ -99,6 +125,13 @@ Foam::IOOutputFilter<OutputFilter>::~IOOutputFilter()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class OutputFilter>
|
||||
const Foam::word& Foam::IOOutputFilter<OutputFilter>::name() const
|
||||
{
|
||||
return IOdictionary::name();
|
||||
}
|
||||
|
||||
|
||||
template<class OutputFilter>
|
||||
bool Foam::IOOutputFilter<OutputFilter>::read()
|
||||
{
|
||||
@ -121,4 +154,20 @@ void Foam::IOOutputFilter<OutputFilter>::write()
|
||||
}
|
||||
|
||||
|
||||
template<class OutputFilter>
|
||||
void Foam::IOOutputFilter<OutputFilter>::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
read();
|
||||
OutputFilter::updateMesh(mpm);
|
||||
}
|
||||
|
||||
|
||||
template<class OutputFilter>
|
||||
void Foam::IOOutputFilter<OutputFilter>::movePoints(const polyMesh& mesh)
|
||||
{
|
||||
read();
|
||||
OutputFilter::movePoints(mesh);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -94,6 +94,16 @@ public:
|
||||
const bool loadFromFile = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
static bool viable
|
||||
(
|
||||
const word& outputFilterName,
|
||||
const objectRegistry&,
|
||||
const word& dictName = OutputFilter::typeName() + "Dict",
|
||||
const IOobject::readOption rOpt = IOobject::MUST_READ_IF_MODIFIED,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Construct for given objectRegistry and dictionary
|
||||
// Dictionary read from full path.
|
||||
// Allow the possibility to load fields from files
|
||||
@ -114,10 +124,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return name
|
||||
virtual const word& name() const
|
||||
{
|
||||
return IOdictionary::name();
|
||||
}
|
||||
virtual const word& name() const;
|
||||
|
||||
//- Inherit read from OutputFilter
|
||||
using OutputFilter::read;
|
||||
@ -132,18 +139,10 @@ public:
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
read();
|
||||
OutputFilter::updateMesh(mpm);
|
||||
}
|
||||
virtual void updateMesh(const mapPolyMesh& mpm);
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh& mesh)
|
||||
{
|
||||
read();
|
||||
OutputFilter::movePoints(mesh);
|
||||
}
|
||||
virtual void movePoints(const polyMesh& mesh);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -55,32 +55,64 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::active() const
|
||||
|
||||
|
||||
template<class OutputFilter>
|
||||
void Foam::OutputFilterFunctionObject<OutputFilter>::allocateFilter()
|
||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::allocateFilter()
|
||||
{
|
||||
if (dictName_.size())
|
||||
{
|
||||
ptr_.reset
|
||||
if
|
||||
(
|
||||
new IOOutputFilter<OutputFilter>
|
||||
IOOutputFilter<OutputFilter>::viable
|
||||
(
|
||||
name(),
|
||||
time_.lookupObject<objectRegistry>(regionName_),
|
||||
dictName_
|
||||
)
|
||||
);
|
||||
)
|
||||
{
|
||||
ptr_.reset
|
||||
(
|
||||
new IOOutputFilter<OutputFilter>
|
||||
(
|
||||
name(),
|
||||
time_.lookupObject<objectRegistry>(regionName_),
|
||||
dictName_
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
enabled_ = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_.reset
|
||||
if
|
||||
(
|
||||
new OutputFilter
|
||||
OutputFilter::viable
|
||||
(
|
||||
name(),
|
||||
time_.lookupObject<objectRegistry>(regionName_),
|
||||
dict_
|
||||
)
|
||||
);
|
||||
)
|
||||
{
|
||||
ptr_.reset
|
||||
(
|
||||
new OutputFilter
|
||||
(
|
||||
name(),
|
||||
time_.lookupObject<objectRegistry>(regionName_),
|
||||
dict_
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
enabled_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
return enabled_;
|
||||
}
|
||||
|
||||
|
||||
@ -144,10 +176,12 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::start()
|
||||
|
||||
if (enabled_ && storeFilter_)
|
||||
{
|
||||
allocateFilter();
|
||||
return allocateFilter();
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -159,9 +193,9 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute
|
||||
{
|
||||
if (active())
|
||||
{
|
||||
if (!storeFilter_)
|
||||
if (!storeFilter_ && !allocateFilter())
|
||||
{
|
||||
allocateFilter();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (evaluateControl_.output())
|
||||
@ -189,9 +223,9 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::end()
|
||||
{
|
||||
if (enabled_)
|
||||
{
|
||||
if (!storeFilter_)
|
||||
if (!storeFilter_ && !allocateFilter())
|
||||
{
|
||||
allocateFilter();
|
||||
return false;
|
||||
}
|
||||
|
||||
ptr_->end();
|
||||
|
||||
@ -111,7 +111,7 @@ class OutputFilterFunctionObject
|
||||
void readDict();
|
||||
|
||||
//- Creates most of the data associated with this object.
|
||||
void allocateFilter();
|
||||
bool allocateFilter();
|
||||
|
||||
//- Destroys most of the data associated with this object.
|
||||
void destroyFilter();
|
||||
|
||||
@ -96,7 +96,6 @@ void Foam::fv::rotorDiskSource::checkData()
|
||||
}
|
||||
case ifLocal:
|
||||
{
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@ -58,8 +58,7 @@ Foam::functionObjects::partialWrite::partialWrite
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::functionObjects::partialWrite>
|
||||
Foam::functionObjects::partialWrite::New
|
||||
bool Foam::functionObjects::partialWrite::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -67,17 +66,8 @@ Foam::functionObjects::partialWrite::New
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
if (isA<fvMesh>(obr))
|
||||
{
|
||||
return autoPtr<partialWrite>
|
||||
(
|
||||
new partialWrite(name, obr, dict, loadFromFiles)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return autoPtr<partialWrite>();
|
||||
}
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::partialWrite
|
||||
Foam::functionObjects::partialWrite
|
||||
|
||||
Group
|
||||
grpIOFunctionObjects
|
||||
@ -171,9 +171,9 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Construct on free-store and return pointer if successful
|
||||
// otherwise return a null-pointer
|
||||
static autoPtr<partialWrite> New
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
|
||||
@ -56,8 +56,7 @@ Foam::functionObjects::removeRegisteredObject::removeRegisteredObject
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::functionObjects::removeRegisteredObject>
|
||||
Foam::functionObjects::removeRegisteredObject::New
|
||||
bool Foam::functionObjects::removeRegisteredObject::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -65,10 +64,7 @@ Foam::functionObjects::removeRegisteredObject::New
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
return autoPtr<removeRegisteredObject>
|
||||
(
|
||||
new removeRegisteredObject(name, obr, dict, loadFromFiles)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::removeRegisteredObject
|
||||
Foam::functionObjects::removeRegisteredObject
|
||||
|
||||
Group
|
||||
grpIOFunctionObjects
|
||||
@ -128,9 +128,9 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Construct on free-store and return pointer if successful
|
||||
// otherwise return a null-pointer
|
||||
static autoPtr<removeRegisteredObject> New
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
|
||||
@ -107,8 +107,7 @@ Foam::functionObjects::writeDictionary::writeDictionary
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::functionObjects::writeDictionary>
|
||||
Foam::functionObjects::writeDictionary::New
|
||||
bool Foam::functionObjects::writeDictionary::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -116,10 +115,7 @@ Foam::functionObjects::writeDictionary::New
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
return autoPtr<writeDictionary>
|
||||
(
|
||||
new writeDictionary(name, obr, dict, loadFromFiles)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::writeDictionary
|
||||
Foam::functionObjects::writeDictionary
|
||||
|
||||
Group
|
||||
grpUtilitiesFunctionObjects
|
||||
@ -120,9 +120,9 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Construct on free-store and return pointer if successful
|
||||
// otherwise return a null-pointer
|
||||
static autoPtr<writeDictionary> New
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
|
||||
@ -57,8 +57,7 @@ Foam::functionObjects::writeRegisteredObject::writeRegisteredObject
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::functionObjects::writeRegisteredObject>
|
||||
Foam::functionObjects::writeRegisteredObject::New
|
||||
bool Foam::functionObjects::writeRegisteredObject::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -66,10 +65,7 @@ Foam::functionObjects::writeRegisteredObject::New
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
return autoPtr<writeRegisteredObject>
|
||||
(
|
||||
new writeRegisteredObject(name, obr, dict, loadFromFiles)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::writeRegisteredObject
|
||||
Foam::functionObjects::writeRegisteredObject
|
||||
|
||||
Group
|
||||
grpIOFunctionObjects
|
||||
@ -143,9 +143,9 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Construct on free-store and return pointer if successful
|
||||
// otherwise return a null-pointer
|
||||
static autoPtr<writeRegisteredObject> New
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
|
||||
@ -62,15 +62,13 @@ Foam::functionObjects::cloudInfo::cloudInfo
|
||||
:
|
||||
functionObjectFiles(obr, name),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true)
|
||||
obr_(obr)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::functionObjects::cloudInfo>
|
||||
Foam::functionObjects::cloudInfo::New
|
||||
bool Foam::functionObjects::cloudInfo::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -78,10 +76,7 @@ Foam::functionObjects::cloudInfo::New
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
return autoPtr<cloudInfo>
|
||||
(
|
||||
new cloudInfo(name, obr, dict, loadFromFiles)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -95,24 +90,21 @@ Foam::functionObjects::cloudInfo::~cloudInfo()
|
||||
|
||||
void Foam::functionObjects::cloudInfo::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
functionObjectFiles::resetNames(dict.lookup("clouds"));
|
||||
functionObjectFiles::resetNames(dict.lookup("clouds"));
|
||||
|
||||
Info<< type() << " " << name_ << ": ";
|
||||
if (names().size())
|
||||
Info<< type() << " " << name_ << ": ";
|
||||
if (names().size())
|
||||
{
|
||||
Info<< "applying to clouds:" << nl;
|
||||
forAll(names(), i)
|
||||
{
|
||||
Info<< "applying to clouds:" << nl;
|
||||
forAll(names(), i)
|
||||
{
|
||||
Info<< " " << names()[i] << nl;
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "no clouds to be processed" << nl << endl;
|
||||
Info<< " " << names()[i] << nl;
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "no clouds to be processed" << nl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,29 +123,26 @@ void Foam::functionObjects::cloudInfo::timeSet()
|
||||
|
||||
void Foam::functionObjects::cloudInfo::write()
|
||||
{
|
||||
if (active_)
|
||||
functionObjectFiles::write();
|
||||
|
||||
forAll(names(), i)
|
||||
{
|
||||
functionObjectFiles::write();
|
||||
const word& cloudName = names()[i];
|
||||
|
||||
forAll(names(), i)
|
||||
const kinematicCloud& cloud =
|
||||
obr_.lookupObject<kinematicCloud>(cloudName);
|
||||
|
||||
label nParcels = returnReduce(cloud.nParcels(), sumOp<label>());
|
||||
scalar massInSystem =
|
||||
returnReduce(cloud.massInSystem(), sumOp<scalar>());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
const word& cloudName = names()[i];
|
||||
|
||||
const kinematicCloud& cloud =
|
||||
obr_.lookupObject<kinematicCloud>(cloudName);
|
||||
|
||||
label nParcels = returnReduce(cloud.nParcels(), sumOp<label>());
|
||||
scalar massInSystem =
|
||||
returnReduce(cloud.massInSystem(), sumOp<scalar>());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeTime(file(i));
|
||||
file(i)
|
||||
<< token::TAB
|
||||
<< nParcels << token::TAB
|
||||
<< massInSystem << endl;
|
||||
}
|
||||
writeTime(file(i));
|
||||
file(i)
|
||||
<< token::TAB
|
||||
<< nParcels << token::TAB
|
||||
<< massInSystem << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::cloudInfo
|
||||
Foam::functionObjects::cloudInfo
|
||||
|
||||
Group
|
||||
grpCloudFunctionObjects
|
||||
@ -109,9 +109,6 @@ protected:
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
@ -148,9 +145,9 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Construct on free-store and return pointer if successful
|
||||
// otherwise return a null-pointer
|
||||
static autoPtr<cloudInfo> New
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,7 +39,7 @@ Description
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef IOOutputFilter<fieldAverage> IOFieldAverage;
|
||||
typedef IOOutputFilter<functionObjects::fieldAverage> IOFieldAverage;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -26,20 +26,22 @@ License
|
||||
#include "fieldAverage.H"
|
||||
#include "volFields.H"
|
||||
#include "Time.H"
|
||||
|
||||
#include "fieldAverageItem.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(fieldAverage, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldAverage::resetFields()
|
||||
void Foam::functionObjects::fieldAverage::resetFields()
|
||||
{
|
||||
forAll(faItems_, i)
|
||||
{
|
||||
@ -62,7 +64,7 @@ void Foam::fieldAverage::resetFields()
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldAverage::initialize()
|
||||
void Foam::functionObjects::fieldAverage::initialize()
|
||||
{
|
||||
resetFields();
|
||||
|
||||
@ -85,16 +87,6 @@ void Foam::fieldAverage::initialize()
|
||||
addPrime2MeanField<vector, symmTensor>(fieldI);
|
||||
}
|
||||
|
||||
forAll(faItems_, fieldI)
|
||||
{
|
||||
if (!faItems_[fieldI].active())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Field " << faItems_[fieldI].fieldName()
|
||||
<< " not found in database for averaging";
|
||||
}
|
||||
}
|
||||
|
||||
// ensure first averaging works unconditionally
|
||||
prevTimeIndex_ = -1;
|
||||
|
||||
@ -104,7 +96,7 @@ void Foam::fieldAverage::initialize()
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldAverage::restart()
|
||||
void Foam::functionObjects::fieldAverage::restart()
|
||||
{
|
||||
Info<< " Restarting averaging at time " << obr_.time().timeName()
|
||||
<< nl << endl;
|
||||
@ -119,7 +111,7 @@ void Foam::fieldAverage::restart()
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldAverage::calcAverages()
|
||||
void Foam::functionObjects::fieldAverage::calcAverages()
|
||||
{
|
||||
if (!initialised_)
|
||||
{
|
||||
@ -168,7 +160,7 @@ void Foam::fieldAverage::calcAverages()
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldAverage::writeAverages() const
|
||||
void Foam::functionObjects::fieldAverage::writeAverages() const
|
||||
{
|
||||
Info<< " Writing average fields" << endl;
|
||||
|
||||
@ -180,7 +172,7 @@ void Foam::fieldAverage::writeAverages() const
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldAverage::writeAveragingProperties() const
|
||||
void Foam::functionObjects::fieldAverage::writeAveragingProperties() const
|
||||
{
|
||||
IOdictionary propsDict
|
||||
(
|
||||
@ -208,7 +200,7 @@ void Foam::fieldAverage::writeAveragingProperties() const
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldAverage::readAveragingProperties()
|
||||
void Foam::functionObjects::fieldAverage::readAveragingProperties()
|
||||
{
|
||||
totalIter_.clear();
|
||||
totalIter_.setSize(faItems_.size(), 1);
|
||||
@ -264,7 +256,7 @@ void Foam::fieldAverage::readAveragingProperties()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldAverage::fieldAverage
|
||||
Foam::functionObjects::fieldAverage::fieldAverage
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -274,7 +266,6 @@ Foam::fieldAverage::fieldAverage
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
prevTimeIndex_(-1),
|
||||
restartOnRestart_(false),
|
||||
restartOnOutput_(false),
|
||||
@ -286,105 +277,91 @@ Foam::fieldAverage::fieldAverage
|
||||
totalTime_(),
|
||||
periodIndex_(1)
|
||||
{
|
||||
// Only active if a fvMesh is available
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_ << nl
|
||||
<< endl;
|
||||
}
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::fieldAverage::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldAverage::~fieldAverage()
|
||||
Foam::functionObjects::fieldAverage::~fieldAverage()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldAverage::read(const dictionary& dict)
|
||||
void Foam::functionObjects::fieldAverage::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
initialised_ = false;
|
||||
|
||||
Info<< type() << " " << name_ << ":" << nl;
|
||||
|
||||
dict.readIfPresent("restartOnRestart", restartOnRestart_);
|
||||
dict.readIfPresent("restartOnOutput", restartOnOutput_);
|
||||
dict.readIfPresent("periodicRestart", periodicRestart_);
|
||||
dict.lookup("fields") >> faItems_;
|
||||
|
||||
if (periodicRestart_)
|
||||
{
|
||||
initialised_ = false;
|
||||
|
||||
Info<< type() << " " << name_ << ":" << nl;
|
||||
|
||||
dict.readIfPresent("restartOnRestart", restartOnRestart_);
|
||||
dict.readIfPresent("restartOnOutput", restartOnOutput_);
|
||||
dict.readIfPresent("periodicRestart", periodicRestart_);
|
||||
dict.lookup("fields") >> faItems_;
|
||||
|
||||
if (periodicRestart_)
|
||||
{
|
||||
dict.lookup("restartPeriod") >> restartPeriod_;
|
||||
}
|
||||
|
||||
readAveragingProperties();
|
||||
|
||||
Info<< endl;
|
||||
dict.lookup("restartPeriod") >> restartPeriod_;
|
||||
}
|
||||
|
||||
readAveragingProperties();
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldAverage::execute()
|
||||
void Foam::functionObjects::fieldAverage::execute()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
calcAverages();
|
||||
Info<< endl;
|
||||
}
|
||||
calcAverages();
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldAverage::end()
|
||||
void Foam::functionObjects::fieldAverage::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
calcAverages();
|
||||
Info<< endl;
|
||||
}
|
||||
calcAverages();
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldAverage::timeSet()
|
||||
void Foam::functionObjects::fieldAverage::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fieldAverage::write()
|
||||
void Foam::functionObjects::fieldAverage::write()
|
||||
{
|
||||
if (active_)
|
||||
writeAverages();
|
||||
writeAveragingProperties();
|
||||
|
||||
if (restartOnOutput_)
|
||||
{
|
||||
writeAverages();
|
||||
writeAveragingProperties();
|
||||
|
||||
if (restartOnOutput_)
|
||||
{
|
||||
restart();
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
restart();
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldAverage::updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
void Foam::functionObjects::fieldAverage::updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fieldAverage::movePoints(const polyMesh&)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
void Foam::functionObjects::fieldAverage::movePoints(const polyMesh&)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::fieldAverage
|
||||
Foam::functionObjects::fieldAverage
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
@ -133,12 +133,17 @@ namespace Foam
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class fieldAverageItem;
|
||||
template<class Type>
|
||||
class List;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class fieldAverageItem;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fieldAverage Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -155,9 +160,6 @@ protected:
|
||||
//- Database this class is registered to
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- On/off switch
|
||||
bool active_;
|
||||
|
||||
//- Time at last call, prevents repeated averaging
|
||||
label prevTimeIndex_;
|
||||
|
||||
@ -299,6 +301,16 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~fieldAverage();
|
||||
@ -337,6 +349,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -31,10 +31,8 @@ License
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldAverage::addMeanFieldType(const label fieldI)
|
||||
void Foam::functionObjects::fieldAverage::addMeanFieldType(const label fieldI)
|
||||
{
|
||||
faItems_[fieldI].active() = true;
|
||||
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
const word& meanFieldName = faItems_[fieldI].meanFieldName();
|
||||
|
||||
@ -79,7 +77,7 @@ void Foam::fieldAverage::addMeanFieldType(const label fieldI)
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldAverage::addMeanField(const label fieldI)
|
||||
void Foam::functionObjects::fieldAverage::addMeanField(const label fieldI)
|
||||
{
|
||||
if (faItems_[fieldI].mean())
|
||||
{
|
||||
@ -101,7 +99,10 @@ void Foam::fieldAverage::addMeanField(const label fieldI)
|
||||
|
||||
|
||||
template<class Type1, class Type2>
|
||||
void Foam::fieldAverage::addPrime2MeanFieldType(const label fieldI)
|
||||
void Foam::functionObjects::fieldAverage::addPrime2MeanFieldType
|
||||
(
|
||||
const label fieldI
|
||||
)
|
||||
{
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
const word& meanFieldName = faItems_[fieldI].meanFieldName();
|
||||
@ -149,7 +150,7 @@ void Foam::fieldAverage::addPrime2MeanFieldType(const label fieldI)
|
||||
|
||||
|
||||
template<class Type1, class Type2>
|
||||
void Foam::fieldAverage::addPrime2MeanField(const label fieldI)
|
||||
void Foam::functionObjects::fieldAverage::addPrime2MeanField(const label fieldI)
|
||||
{
|
||||
typedef GeometricField<Type1, fvPatchField, volMesh> volFieldType1;
|
||||
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> surfFieldType1;
|
||||
@ -182,7 +183,10 @@ void Foam::fieldAverage::addPrime2MeanField(const label fieldI)
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldAverage::calculateMeanFieldType(const label fieldI) const
|
||||
void Foam::functionObjects::fieldAverage::calculateMeanFieldType
|
||||
(
|
||||
const label fieldI
|
||||
) const
|
||||
{
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
|
||||
@ -224,7 +228,7 @@ void Foam::fieldAverage::calculateMeanFieldType(const label fieldI) const
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldAverage::calculateMeanFields() const
|
||||
void Foam::functionObjects::fieldAverage::calculateMeanFields() const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> surfFieldType;
|
||||
@ -241,7 +245,10 @@ void Foam::fieldAverage::calculateMeanFields() const
|
||||
|
||||
|
||||
template<class Type1, class Type2>
|
||||
void Foam::fieldAverage::calculatePrime2MeanFieldType(const label fieldI) const
|
||||
void Foam::functionObjects::fieldAverage::calculatePrime2MeanFieldType
|
||||
(
|
||||
const label fieldI
|
||||
) const
|
||||
{
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
|
||||
@ -288,7 +295,7 @@ void Foam::fieldAverage::calculatePrime2MeanFieldType(const label fieldI) const
|
||||
|
||||
|
||||
template<class Type1, class Type2>
|
||||
void Foam::fieldAverage::calculatePrime2MeanFields() const
|
||||
void Foam::functionObjects::fieldAverage::calculatePrime2MeanFields() const
|
||||
{
|
||||
typedef GeometricField<Type1, fvPatchField, volMesh> volFieldType1;
|
||||
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> surfFieldType1;
|
||||
@ -308,7 +315,10 @@ void Foam::fieldAverage::calculatePrime2MeanFields() const
|
||||
|
||||
|
||||
template<class Type1, class Type2>
|
||||
void Foam::fieldAverage::addMeanSqrToPrime2MeanType(const label fieldI) const
|
||||
void Foam::functionObjects::fieldAverage::addMeanSqrToPrime2MeanType
|
||||
(
|
||||
const label fieldI
|
||||
) const
|
||||
{
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
|
||||
@ -328,7 +338,7 @@ void Foam::fieldAverage::addMeanSqrToPrime2MeanType(const label fieldI) const
|
||||
|
||||
|
||||
template<class Type1, class Type2>
|
||||
void Foam::fieldAverage::addMeanSqrToPrime2Mean() const
|
||||
void Foam::functionObjects::fieldAverage::addMeanSqrToPrime2Mean() const
|
||||
{
|
||||
typedef GeometricField<Type1, fvPatchField, volMesh> volFieldType1;
|
||||
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> surfFieldType1;
|
||||
@ -348,7 +358,10 @@ void Foam::fieldAverage::addMeanSqrToPrime2Mean() const
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldAverage::writeFieldType(const word& fieldName) const
|
||||
void Foam::functionObjects::fieldAverage::writeFieldType
|
||||
(
|
||||
const word& fieldName
|
||||
) const
|
||||
{
|
||||
if (obr_.foundObject<Type>(fieldName))
|
||||
{
|
||||
@ -359,7 +372,7 @@ void Foam::fieldAverage::writeFieldType(const word& fieldName) const
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldAverage::writeFields() const
|
||||
void Foam::functionObjects::fieldAverage::writeFields() const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> surfFieldType;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<fieldAverage>
|
||||
typedef OutputFilterFunctionObject<functionObjects::fieldAverage>
|
||||
fieldAverageFunctionObject;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,33 +27,34 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
const word fieldAverageItem::EXT_MEAN = "Mean";
|
||||
const word fieldAverageItem::EXT_PRIME2MEAN = "Prime2Mean";
|
||||
const Foam::word Foam::functionObjects::fieldAverageItem::EXT_MEAN
|
||||
(
|
||||
"Mean"
|
||||
);
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::fieldAverageItem::baseType,
|
||||
2
|
||||
>::names[] =
|
||||
{
|
||||
"iteration",
|
||||
"time"
|
||||
};
|
||||
}
|
||||
const Foam::word Foam::functionObjects::fieldAverageItem::EXT_PRIME2MEAN
|
||||
(
|
||||
"Prime2Mean"
|
||||
);
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldAverageItem::baseType,
|
||||
2
|
||||
>::names[] = { "iteration", "time"};
|
||||
|
||||
const Foam::NamedEnum<Foam::fieldAverageItem::baseType, 2>
|
||||
Foam::fieldAverageItem::baseTypeNames_;
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldAverageItem::baseType,
|
||||
2
|
||||
> Foam::functionObjects::fieldAverageItem::baseTypeNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldAverageItem::fieldAverageItem()
|
||||
Foam::functionObjects::fieldAverageItem::fieldAverageItem()
|
||||
:
|
||||
active_(false),
|
||||
fieldName_("unknown"),
|
||||
mean_(0),
|
||||
meanFieldName_("unknown"),
|
||||
@ -65,9 +66,11 @@ Foam::fieldAverageItem::fieldAverageItem()
|
||||
{}
|
||||
|
||||
|
||||
Foam::fieldAverageItem::fieldAverageItem(const fieldAverageItem& faItem)
|
||||
Foam::functionObjects::fieldAverageItem::fieldAverageItem
|
||||
(
|
||||
const fieldAverageItem& faItem
|
||||
)
|
||||
:
|
||||
active_(faItem.active_),
|
||||
fieldName_(faItem.fieldName_),
|
||||
mean_(faItem.mean_),
|
||||
meanFieldName_(faItem.meanFieldName_),
|
||||
@ -81,13 +84,16 @@ Foam::fieldAverageItem::fieldAverageItem(const fieldAverageItem& faItem)
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldAverageItem::~fieldAverageItem()
|
||||
Foam::functionObjects::fieldAverageItem::~fieldAverageItem()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldAverageItem::operator=(const fieldAverageItem& rhs)
|
||||
void Foam::functionObjects::fieldAverageItem::operator=
|
||||
(
|
||||
const fieldAverageItem& rhs
|
||||
)
|
||||
{
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
@ -98,7 +104,6 @@ void Foam::fieldAverageItem::operator=(const fieldAverageItem& rhs)
|
||||
}
|
||||
|
||||
// Set updated values
|
||||
active_ = rhs.active_;
|
||||
fieldName_ = rhs.fieldName_;
|
||||
mean_ = rhs.mean_;
|
||||
meanFieldName_ = rhs.meanFieldName_;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::fieldAverageItem
|
||||
Foam::functionObjects::fieldAverageItem
|
||||
|
||||
Description
|
||||
Helper class to describe what form of averaging to apply. A set will be
|
||||
@ -62,12 +62,14 @@ namespace Foam
|
||||
class Istream;
|
||||
class Ostream;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
class fieldAverageItem;
|
||||
Istream& operator>>(Istream&, fieldAverageItem&);
|
||||
Ostream& operator<<(Ostream&, const fieldAverageItem&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fieldAverageItem Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -98,9 +100,6 @@ private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Active flag
|
||||
Switch active_;
|
||||
|
||||
//- Field name
|
||||
word fieldName_;
|
||||
|
||||
@ -151,18 +150,6 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return const access to the active flag
|
||||
const Switch& active() const
|
||||
{
|
||||
return active_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the active flag
|
||||
Switch& active()
|
||||
{
|
||||
return active_;
|
||||
}
|
||||
|
||||
//- Return const access to the field name
|
||||
const word& fieldName() const
|
||||
{
|
||||
@ -277,6 +264,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,9 +29,8 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldAverageItem::fieldAverageItem(Istream& is)
|
||||
Foam::functionObjects::fieldAverageItem::fieldAverageItem(Istream& is)
|
||||
:
|
||||
active_(false),
|
||||
fieldName_("unknown"),
|
||||
mean_(0),
|
||||
meanFieldName_("unknown"),
|
||||
@ -40,7 +39,11 @@ Foam::fieldAverageItem::fieldAverageItem(Istream& is)
|
||||
base_(ITER),
|
||||
window_(-1.0)
|
||||
{
|
||||
is.check("Foam::fieldAverageItem::fieldAverageItem(Foam::Istream&)");
|
||||
is.check
|
||||
(
|
||||
"Foam::functionObjects::fieldAverageItem::fieldAverageItem"
|
||||
"(Foam::Istream&)"
|
||||
);
|
||||
|
||||
const dictionaryEntry entry(dictionary::null, is);
|
||||
|
||||
@ -63,17 +66,20 @@ Foam::fieldAverageItem::fieldAverageItem(Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, fieldAverageItem& faItem)
|
||||
Foam::Istream& Foam::functionObjects::operator>>
|
||||
(
|
||||
Istream& is,
|
||||
fieldAverageItem& faItem
|
||||
)
|
||||
{
|
||||
is.check
|
||||
(
|
||||
"Foam::Istream& Foam::operator>>"
|
||||
"(Foam::Istream&, Foam::fieldAverageItem&)"
|
||||
"(Foam::Istream&, Foam::functionObjects::fieldAverageItem&)"
|
||||
);
|
||||
|
||||
const dictionaryEntry entry(dictionary::null, is);
|
||||
|
||||
faItem.active_ = false;
|
||||
faItem.fieldName_ = entry.keyword();
|
||||
entry.lookup("mean") >> faItem.mean_;
|
||||
entry.lookup("prime2Mean") >> faItem.prime2Mean_;
|
||||
@ -97,12 +103,16 @@ Foam::Istream& Foam::operator>>(Istream& is, fieldAverageItem& faItem)
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const fieldAverageItem& faItem)
|
||||
Foam::Ostream& Foam::functionObjects::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const fieldAverageItem& faItem
|
||||
)
|
||||
{
|
||||
os.check
|
||||
(
|
||||
"Foam::Ostream& Foam::operator<<"
|
||||
"(Foam::Ostream&, const Foam::fieldAverageItem&)"
|
||||
"(Foam::Ostream&, const Foam::functionObjects::fieldAverageItem&)"
|
||||
);
|
||||
|
||||
os << faItem.fieldName_ << nl << token::BEGIN_BLOCK << nl;
|
||||
@ -129,7 +139,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const fieldAverageItem& faItem)
|
||||
os.check
|
||||
(
|
||||
"Foam::Ostream& Foam::operator<<"
|
||||
"(Foam::Ostream&, const Foam::fieldAverageItem&)"
|
||||
"(Foam::Ostream&, const Foam::functionObjects::fieldAverageItem&)"
|
||||
);
|
||||
|
||||
return os;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,13 +30,17 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(fieldCoordinateSystemTransform, 0);
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(fieldCoordinateSystemTransform, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldCoordinateSystemTransform::fieldCoordinateSystemTransform
|
||||
Foam::functionObjects::fieldCoordinateSystemTransform::
|
||||
fieldCoordinateSystemTransform
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -46,100 +50,91 @@ Foam::fieldCoordinateSystemTransform::fieldCoordinateSystemTransform
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldSet_(),
|
||||
coordSys_(obr, dict)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict);
|
||||
read(dict);
|
||||
|
||||
Info<< type() << " " << name_ << ":" << nl
|
||||
<< " Applying transformation from global Cartesian to local "
|
||||
<< coordSys_ << nl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_
|
||||
<< endl;
|
||||
}
|
||||
Info<< type() << " " << name_ << ":" << nl
|
||||
<< " Applying transformation from global Cartesian to local "
|
||||
<< coordSys_ << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::fieldCoordinateSystemTransform::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldCoordinateSystemTransform::~fieldCoordinateSystemTransform()
|
||||
Foam::functionObjects::fieldCoordinateSystemTransform::
|
||||
~fieldCoordinateSystemTransform()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldCoordinateSystemTransform::read(const dictionary& dict)
|
||||
void Foam::functionObjects::fieldCoordinateSystemTransform::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
if (active_)
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldCoordinateSystemTransform::execute()
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
// If necessary load field
|
||||
transform<scalar>(fieldSet_[fieldI]);
|
||||
transform<vector>(fieldSet_[fieldI]);
|
||||
transform<sphericalTensor>(fieldSet_[fieldI]);
|
||||
transform<symmTensor>(fieldSet_[fieldI]);
|
||||
transform<tensor>(fieldSet_[fieldI]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldCoordinateSystemTransform::execute()
|
||||
void Foam::functionObjects::fieldCoordinateSystemTransform::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
// If necessary load field
|
||||
transform<scalar>(fieldSet_[fieldI]);
|
||||
transform<vector>(fieldSet_[fieldI]);
|
||||
transform<sphericalTensor>(fieldSet_[fieldI]);
|
||||
transform<symmTensor>(fieldSet_[fieldI]);
|
||||
transform<tensor>(fieldSet_[fieldI]);
|
||||
}
|
||||
}
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldCoordinateSystemTransform::end()
|
||||
void Foam::functionObjects::fieldCoordinateSystemTransform::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldCoordinateSystemTransform::write()
|
||||
{
|
||||
if (active_)
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
execute();
|
||||
const word fieldName = fieldSet_[fieldI] + ":Transformed";
|
||||
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(fieldName);
|
||||
|
||||
Info<< " writing field " << field.name() << nl;
|
||||
|
||||
field.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldCoordinateSystemTransform::timeSet()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldCoordinateSystemTransform::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
const word fieldName = fieldSet_[fieldI] + ":Transformed";
|
||||
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(fieldName);
|
||||
|
||||
Info<< " writing field " << field.name() << nl;
|
||||
|
||||
field.write();
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::fieldCoordinateSystemTransform
|
||||
Foam::functionObjects::fieldCoordinateSystemTransform
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
@ -93,6 +93,9 @@ class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fieldCoordinateSystemTransform Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -108,9 +111,6 @@ protected:
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
//- Fields to transform
|
||||
wordList fieldSet_;
|
||||
|
||||
@ -156,6 +156,16 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~fieldCoordinateSystemTransform();
|
||||
@ -196,6 +206,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,8 +43,10 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<fieldCoordinateSystemTransform>
|
||||
fieldCoordinateSystemTransformFunctionObject;
|
||||
typedef OutputFilterFunctionObject
|
||||
<
|
||||
functionObjects::fieldCoordinateSystemTransform
|
||||
> fieldCoordinateSystemTransformFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,7 +32,7 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldCoordinateSystemTransform::transformField
|
||||
void Foam::functionObjects::fieldCoordinateSystemTransform::transformField
|
||||
(
|
||||
const Type& field
|
||||
) const
|
||||
@ -74,7 +74,7 @@ void Foam::fieldCoordinateSystemTransform::transformField
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldCoordinateSystemTransform::transform
|
||||
void Foam::functionObjects::fieldCoordinateSystemTransform::transform
|
||||
(
|
||||
const word& fieldName
|
||||
) const
|
||||
|
||||
@ -29,29 +29,30 @@ License
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(fieldMinMax, 0);
|
||||
|
||||
template<>
|
||||
const char* NamedEnum
|
||||
<
|
||||
fieldMinMax::modeType,
|
||||
2
|
||||
>::names[] =
|
||||
{
|
||||
"magnitude",
|
||||
"component"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldMinMax::modeType,
|
||||
2
|
||||
>::names[] = {"magnitude", "component"};
|
||||
|
||||
const Foam::NamedEnum<Foam::fieldMinMax::modeType, 2>
|
||||
Foam::fieldMinMax::modeTypeNames_;
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldMinMax::modeType,
|
||||
2
|
||||
> Foam::functionObjects::fieldMinMax::modeTypeNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldMinMax::fieldMinMax
|
||||
Foam::functionObjects::fieldMinMax::fieldMinMax
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -62,47 +63,47 @@ Foam::fieldMinMax::fieldMinMax
|
||||
functionObjectFiles(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
log_(true),
|
||||
location_(true),
|
||||
mode_(mdMag),
|
||||
fieldSet_()
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::fieldMinMax::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldMinMax::~fieldMinMax()
|
||||
Foam::functionObjects::fieldMinMax::~fieldMinMax()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldMinMax::read(const dictionary& dict)
|
||||
void Foam::functionObjects::fieldMinMax::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
log_ = dict.lookupOrDefault<Switch>("log", true);
|
||||
location_ = dict.lookupOrDefault<Switch>("location", true);
|
||||
log_ = dict.lookupOrDefault<Switch>("log", true);
|
||||
location_ = dict.lookupOrDefault<Switch>("location", true);
|
||||
|
||||
mode_ = modeTypeNames_[dict.lookupOrDefault<word>("mode", "magnitude")];
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
}
|
||||
mode_ = modeTypeNames_[dict.lookupOrDefault<word>("mode", "magnitude")];
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldMinMax::writeFileHeader(const label i)
|
||||
void Foam::functionObjects::fieldMinMax::writeFileHeader(const label i)
|
||||
{
|
||||
OFstream& file = this->file();
|
||||
|
||||
@ -142,45 +143,36 @@ void Foam::fieldMinMax::writeFileHeader(const label i)
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldMinMax::execute()
|
||||
void Foam::functionObjects::fieldMinMax::execute()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldMinMax::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldMinMax::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldMinMax::write()
|
||||
{
|
||||
// Do nothing - only valid on write
|
||||
}
|
||||
functionObjectFiles::write();
|
||||
|
||||
if (!location_) writeTime(file());
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
void Foam::fieldMinMax::end()
|
||||
{
|
||||
// Do nothing - only valid on write
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldMinMax::timeSet()
|
||||
{
|
||||
// Do nothing - only valid on write
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldMinMax::write()
|
||||
{
|
||||
if (active_)
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
functionObjectFiles::write();
|
||||
|
||||
if (!location_) writeTime(file());
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
calcMinMaxFields<scalar>(fieldSet_[fieldI], mdCmpt);
|
||||
calcMinMaxFields<vector>(fieldSet_[fieldI], mode_);
|
||||
calcMinMaxFields<sphericalTensor>(fieldSet_[fieldI], mode_);
|
||||
calcMinMaxFields<symmTensor>(fieldSet_[fieldI], mode_);
|
||||
calcMinMaxFields<tensor>(fieldSet_[fieldI], mode_);
|
||||
}
|
||||
|
||||
if (!location_) file()<< endl;
|
||||
if (log_) Info<< endl;
|
||||
calcMinMaxFields<scalar>(fieldSet_[fieldI], mdCmpt);
|
||||
calcMinMaxFields<vector>(fieldSet_[fieldI], mode_);
|
||||
calcMinMaxFields<sphericalTensor>(fieldSet_[fieldI], mode_);
|
||||
calcMinMaxFields<symmTensor>(fieldSet_[fieldI], mode_);
|
||||
calcMinMaxFields<tensor>(fieldSet_[fieldI], mode_);
|
||||
}
|
||||
|
||||
if (!location_) file()<< endl;
|
||||
if (log_) Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::fieldMinMax
|
||||
Foam::functionObjects::fieldMinMax
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
@ -93,6 +93,9 @@ class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fieldMinMax Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -122,9 +125,6 @@ protected:
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
//- Switch to send output to Info as well
|
||||
Switch log_;
|
||||
|
||||
@ -182,6 +182,16 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~fieldMinMax();
|
||||
@ -230,6 +240,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<fieldMinMax>
|
||||
typedef OutputFilterFunctionObject<functionObjects::fieldMinMax>
|
||||
fieldMinMaxFunctionObject;
|
||||
}
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldMinMax::output
|
||||
void Foam::functionObjects::fieldMinMax::output
|
||||
(
|
||||
const word& fieldName,
|
||||
const word& outputName,
|
||||
@ -99,7 +99,7 @@ void Foam::fieldMinMax::output
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldMinMax::calcMinMaxFields
|
||||
void Foam::functionObjects::fieldMinMax::calcMinMaxFields
|
||||
(
|
||||
const word& fieldName,
|
||||
const modeType& mode
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,48 +32,61 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<>
|
||||
const char* NamedEnum<fieldValues::cellSource::sourceType, 2>::names[] =
|
||||
{
|
||||
"cellZone",
|
||||
"all"
|
||||
};
|
||||
|
||||
|
||||
template<>
|
||||
const char* NamedEnum<fieldValues::cellSource::operationType, 11>::names[] =
|
||||
{
|
||||
"none",
|
||||
"sum",
|
||||
"sumMag",
|
||||
"average",
|
||||
"weightedAverage",
|
||||
"volAverage",
|
||||
"weightedVolAverage",
|
||||
"volIntegrate",
|
||||
"min",
|
||||
"max",
|
||||
"CoV"
|
||||
};
|
||||
|
||||
namespace fieldValues
|
||||
{
|
||||
defineTypeNameAndDebug(cellSource, 0);
|
||||
addToRunTimeSelectionTable(fieldValue, cellSource, dictionary);
|
||||
}
|
||||
namespace functionObjects
|
||||
{
|
||||
namespace fieldValues
|
||||
{
|
||||
defineTypeNameAndDebug(cellSource, 0);
|
||||
addToRunTimeSelectionTable(fieldValue, cellSource, dictionary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
const char*
|
||||
Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldValues::cellSource::sourceType,
|
||||
2
|
||||
>::names[] = {"cellZone", "all"};
|
||||
|
||||
const Foam::NamedEnum<Foam::fieldValues::cellSource::sourceType, 2>
|
||||
Foam::fieldValues::cellSource::sourceTypeNames_;
|
||||
template<>
|
||||
const char*
|
||||
Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldValues::cellSource::operationType,
|
||||
11
|
||||
>::names[] =
|
||||
{
|
||||
"none",
|
||||
"sum",
|
||||
"sumMag",
|
||||
"average",
|
||||
"weightedAverage",
|
||||
"volAverage",
|
||||
"weightedVolAverage",
|
||||
"volIntegrate",
|
||||
"min",
|
||||
"max",
|
||||
"CoV"
|
||||
};
|
||||
|
||||
const Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 11>
|
||||
Foam::fieldValues::cellSource::operationTypeNames_;
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldValues::cellSource::sourceType,
|
||||
2
|
||||
> Foam::functionObjects::fieldValues::cellSource::sourceTypeNames_;
|
||||
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldValues::cellSource::operationType,
|
||||
11
|
||||
> Foam::functionObjects::fieldValues::cellSource::operationTypeNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::cellSource::setCellZoneCells()
|
||||
void Foam::functionObjects::fieldValues::cellSource::setCellZoneCells()
|
||||
{
|
||||
switch (source_)
|
||||
{
|
||||
@ -118,7 +131,7 @@ void Foam::fieldValues::cellSource::setCellZoneCells()
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::fieldValues::cellSource::volume() const
|
||||
Foam::scalar Foam::functionObjects::fieldValues::cellSource::volume() const
|
||||
{
|
||||
return gSum(filterField(mesh().V()));
|
||||
}
|
||||
@ -126,19 +139,19 @@ Foam::scalar Foam::fieldValues::cellSource::volume() const
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::cellSource::initialise(const dictionary& dict)
|
||||
void Foam::functionObjects::fieldValues::cellSource::initialise
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
setCellZoneCells();
|
||||
|
||||
if (nCells_ == 0)
|
||||
{
|
||||
WarningInFunction
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||
<< " Source has no cells - deactivating" << endl;
|
||||
|
||||
active_ = false;
|
||||
return;
|
||||
<< " Source has no cells" << exit(FatalError);
|
||||
}
|
||||
|
||||
volume_ = volume();
|
||||
@ -158,7 +171,10 @@ void Foam::fieldValues::cellSource::initialise(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::cellSource::writeFileHeader(const label i)
|
||||
void Foam::functionObjects::fieldValues::cellSource::writeFileHeader
|
||||
(
|
||||
const label i
|
||||
)
|
||||
{
|
||||
writeCommented(file(), "Source : ");
|
||||
file() << sourceTypeNames_[source_] << " " << sourceName_ << endl;
|
||||
@ -186,7 +202,7 @@ void Foam::fieldValues::cellSource::writeFileHeader(const label i)
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValues::cellSource::cellSource
|
||||
Foam::functionObjects::fieldValues::cellSource::cellSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -206,74 +222,84 @@ Foam::fieldValues::cellSource::cellSource
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::fieldValues::cellSource::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValues::cellSource::~cellSource()
|
||||
Foam::functionObjects::fieldValues::cellSource::~cellSource()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::cellSource::read(const dictionary& dict)
|
||||
void Foam::functionObjects::fieldValues::cellSource::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
fieldValue::read(dict);
|
||||
|
||||
if (active_)
|
||||
{
|
||||
// no additional info to read
|
||||
initialise(dict);
|
||||
}
|
||||
// No additional info to read
|
||||
initialise(dict);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::cellSource::write()
|
||||
void Foam::functionObjects::fieldValues::cellSource::write()
|
||||
{
|
||||
fieldValue::write();
|
||||
|
||||
if (active_)
|
||||
if (Pstream::master())
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeTime(file());
|
||||
}
|
||||
|
||||
if (writeVolume_)
|
||||
{
|
||||
volume_ = volume();
|
||||
if (Pstream::master())
|
||||
{
|
||||
file() << tab << volume_;
|
||||
}
|
||||
if (log_) Info<< " total volume = " << volume_ << endl;
|
||||
}
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
const word& fieldName = fields_[i];
|
||||
bool processed = false;
|
||||
|
||||
processed = processed || writeValues<scalar>(fieldName);
|
||||
processed = processed || writeValues<vector>(fieldName);
|
||||
processed = processed || writeValues<sphericalTensor>(fieldName);
|
||||
processed = processed || writeValues<symmTensor>(fieldName);
|
||||
processed = processed || writeValues<tensor>(fieldName);
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Requested field " << fieldName
|
||||
<< " not found in database and not processed"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
file()<< endl;
|
||||
}
|
||||
|
||||
if (log_) Info<< endl;
|
||||
writeTime(file());
|
||||
}
|
||||
|
||||
if (writeVolume_)
|
||||
{
|
||||
volume_ = volume();
|
||||
if (Pstream::master())
|
||||
{
|
||||
file() << tab << volume_;
|
||||
}
|
||||
if (log_) Info<< " total volume = " << volume_ << endl;
|
||||
}
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
const word& fieldName = fields_[i];
|
||||
bool processed = false;
|
||||
|
||||
processed = processed || writeValues<scalar>(fieldName);
|
||||
processed = processed || writeValues<vector>(fieldName);
|
||||
processed = processed || writeValues<sphericalTensor>(fieldName);
|
||||
processed = processed || writeValues<symmTensor>(fieldName);
|
||||
processed = processed || writeValues<tensor>(fieldName);
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Requested field " << fieldName
|
||||
<< " not found in database and not processed"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
file()<< endl;
|
||||
}
|
||||
|
||||
if (log_) Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::fieldValues::cellSource
|
||||
Foam::functionObjects::fieldValues::cellSource
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
@ -114,6 +114,8 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
namespace fieldValues
|
||||
{
|
||||
|
||||
@ -237,14 +239,26 @@ public:
|
||||
TypeName("cellSource");
|
||||
|
||||
|
||||
//- Construct from components
|
||||
cellSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
cellSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -283,6 +297,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fieldValues
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,8 +43,10 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<fieldValues::cellSource>
|
||||
cellSourceFunctionObject;
|
||||
typedef OutputFilterFunctionObject
|
||||
<
|
||||
functionObjects::fieldValues::cellSource
|
||||
> cellSourceFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,19 +27,18 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::fieldValues::cellSource::sourceType&
|
||||
Foam::fieldValues::cellSource::source() const
|
||||
inline const Foam::functionObjects::fieldValues::cellSource::sourceType&
|
||||
Foam::functionObjects::fieldValues::cellSource::source() const
|
||||
{
|
||||
return source_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::fieldValues::cellSource::cellId() const
|
||||
Foam::functionObjects::fieldValues::cellSource::cellId() const
|
||||
{
|
||||
return cellId_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
|
||||
@ -29,7 +29,10 @@ License
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
bool Foam::fieldValues::cellSource::validField(const word& fieldName) const
|
||||
bool Foam::functionObjects::fieldValues::cellSource::validField
|
||||
(
|
||||
const word& fieldName
|
||||
) const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||
|
||||
@ -43,7 +46,8 @@ bool Foam::fieldValues::cellSource::validField(const word& fieldName) const
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::fieldValues::cellSource::setFieldValues
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::functionObjects::fieldValues::cellSource::setFieldValues
|
||||
(
|
||||
const word& fieldName,
|
||||
const bool mustGet
|
||||
@ -68,7 +72,7 @@ Foam::tmp<Foam::Field<Type>> Foam::fieldValues::cellSource::setFieldValues
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::fieldValues::cellSource::processValues
|
||||
Type Foam::functionObjects::fieldValues::cellSource::processValues
|
||||
(
|
||||
const Field<Type>& values,
|
||||
const scalarField& V,
|
||||
@ -140,10 +144,8 @@ Type Foam::fieldValues::cellSource::processValues
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
case opNone:
|
||||
{}
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -153,7 +155,10 @@ Type Foam::fieldValues::cellSource::processValues
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
bool Foam::fieldValues::cellSource::writeValues(const word& fieldName)
|
||||
bool Foam::functionObjects::fieldValues::cellSource::writeValues
|
||||
(
|
||||
const word& fieldName
|
||||
)
|
||||
{
|
||||
const bool ok = validField<Type>(fieldName);
|
||||
|
||||
@ -211,7 +216,8 @@ bool Foam::fieldValues::cellSource::writeValues(const word& fieldName)
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::fieldValues::cellSource::filterField
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::functionObjects::fieldValues::cellSource::filterField
|
||||
(
|
||||
const Field<Type>& field
|
||||
) const
|
||||
|
||||
@ -38,53 +38,68 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<>
|
||||
const char* NamedEnum<fieldValues::faceSource::sourceType, 3>::names[] =
|
||||
{
|
||||
"faceZone",
|
||||
"patch",
|
||||
"sampledSurface"
|
||||
};
|
||||
|
||||
|
||||
template<>
|
||||
const char* NamedEnum<fieldValues::faceSource::operationType, 15>::names[] =
|
||||
{
|
||||
"none",
|
||||
"sum",
|
||||
"sumMag",
|
||||
"sumDirection",
|
||||
"sumDirectionBalance",
|
||||
"average",
|
||||
"weightedAverage",
|
||||
"areaAverage",
|
||||
"weightedAreaAverage",
|
||||
"areaIntegrate",
|
||||
"min",
|
||||
"max",
|
||||
"CoV",
|
||||
"areaNormalAverage",
|
||||
"areaNormalIntegrate"
|
||||
};
|
||||
|
||||
namespace fieldValues
|
||||
{
|
||||
defineTypeNameAndDebug(faceSource, 0);
|
||||
addToRunTimeSelectionTable(fieldValue, faceSource, dictionary);
|
||||
}
|
||||
namespace functionObjects
|
||||
{
|
||||
namespace fieldValues
|
||||
{
|
||||
defineTypeNameAndDebug(faceSource, 0);
|
||||
addToRunTimeSelectionTable(fieldValue, faceSource, dictionary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldValues::faceSource::sourceType,
|
||||
3
|
||||
>::names[] =
|
||||
{
|
||||
"faceZone",
|
||||
"patch",
|
||||
"sampledSurface"
|
||||
};
|
||||
|
||||
const Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 3>
|
||||
Foam::fieldValues::faceSource::sourceTypeNames_;
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldValues::faceSource::operationType,
|
||||
15
|
||||
>::names[] =
|
||||
{
|
||||
"none",
|
||||
"sum",
|
||||
"sumMag",
|
||||
"sumDirection",
|
||||
"sumDirectionBalance",
|
||||
"average",
|
||||
"weightedAverage",
|
||||
"areaAverage",
|
||||
"weightedAreaAverage",
|
||||
"areaIntegrate",
|
||||
"min",
|
||||
"max",
|
||||
"CoV",
|
||||
"areaNormalAverage",
|
||||
"areaNormalIntegrate"
|
||||
};
|
||||
|
||||
const Foam::NamedEnum<Foam::fieldValues::faceSource::operationType, 15>
|
||||
Foam::fieldValues::faceSource::operationTypeNames_;
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldValues::faceSource::sourceType,
|
||||
3
|
||||
> Foam::functionObjects::fieldValues::faceSource::sourceTypeNames_;
|
||||
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldValues::faceSource::operationType,
|
||||
15
|
||||
> Foam::functionObjects::fieldValues::faceSource::operationTypeNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::faceSource::setFaceZoneFaces()
|
||||
void Foam::functionObjects::fieldValues::faceSource::setFaceZoneFaces()
|
||||
{
|
||||
label zoneId = mesh().faceZones().findZoneID(sourceName_);
|
||||
|
||||
@ -169,7 +184,7 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces()
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::faceSource::setPatchFaces()
|
||||
void Foam::functionObjects::fieldValues::faceSource::setPatchFaces()
|
||||
{
|
||||
const label patchid = mesh().boundaryMesh().findPatchID(sourceName_);
|
||||
|
||||
@ -206,7 +221,10 @@ void Foam::fieldValues::faceSource::setPatchFaces()
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::faceSource::sampledSurfaceFaces(const dictionary& dict)
|
||||
void Foam::functionObjects::fieldValues::faceSource::sampledSurfaceFaces
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
surfacePtr_ = sampledSurface::New
|
||||
(
|
||||
@ -219,7 +237,7 @@ void Foam::fieldValues::faceSource::sampledSurfaceFaces(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::faceSource::combineMeshGeometry
|
||||
void Foam::functionObjects::fieldValues::faceSource::combineMeshGeometry
|
||||
(
|
||||
faceList& faces,
|
||||
pointField& points
|
||||
@ -340,7 +358,7 @@ void Foam::fieldValues::faceSource::combineMeshGeometry
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::faceSource::combineSurfaceGeometry
|
||||
void Foam::functionObjects::fieldValues::faceSource::combineSurfaceGeometry
|
||||
(
|
||||
faceList& faces,
|
||||
pointField& points
|
||||
@ -379,7 +397,7 @@ void Foam::fieldValues::faceSource::combineSurfaceGeometry
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::fieldValues::faceSource::totalArea() const
|
||||
Foam::scalar Foam::functionObjects::fieldValues::faceSource::totalArea() const
|
||||
{
|
||||
scalar totalArea;
|
||||
|
||||
@ -398,7 +416,10 @@ Foam::scalar Foam::fieldValues::faceSource::totalArea() const
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
||||
void Foam::functionObjects::fieldValues::faceSource::initialise
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
dict.lookup("sourceName") >> sourceName_;
|
||||
|
||||
@ -431,13 +452,10 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
||||
|
||||
if (nFaces_ == 0)
|
||||
{
|
||||
WarningInFunction
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||
<< " Source has no faces - deactivating" << endl;
|
||||
|
||||
active_ = false;
|
||||
return;
|
||||
<< " Source has no faces" << exit(FatalError);
|
||||
}
|
||||
|
||||
if (surfacePtr_.valid())
|
||||
@ -513,7 +531,10 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::faceSource::writeFileHeader(const label i)
|
||||
void Foam::functionObjects::fieldValues::faceSource::writeFileHeader
|
||||
(
|
||||
const label i
|
||||
)
|
||||
{
|
||||
writeCommented(file(), "Source : ");
|
||||
file() << sourceTypeNames_[source_] << " " << sourceName_ << endl;
|
||||
@ -540,7 +561,7 @@ void Foam::fieldValues::faceSource::writeFileHeader(const label i)
|
||||
|
||||
|
||||
template<>
|
||||
Foam::scalar Foam::fieldValues::faceSource::processValues
|
||||
Foam::scalar Foam::functionObjects::fieldValues::faceSource::processValues
|
||||
(
|
||||
const Field<scalar>& values,
|
||||
const vectorField& Sf,
|
||||
@ -571,7 +592,7 @@ Foam::scalar Foam::fieldValues::faceSource::processValues
|
||||
|
||||
|
||||
template<>
|
||||
Foam::vector Foam::fieldValues::faceSource::processValues
|
||||
Foam::vector Foam::functionObjects::fieldValues::faceSource::processValues
|
||||
(
|
||||
const Field<vector>& values,
|
||||
const vectorField& Sf,
|
||||
@ -617,7 +638,7 @@ Foam::vector Foam::fieldValues::faceSource::processValues
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValues::faceSource::faceSource
|
||||
Foam::functionObjects::fieldValues::faceSource::faceSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -643,97 +664,106 @@ Foam::fieldValues::faceSource::faceSource
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::fieldValues::faceSource::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValues::faceSource::~faceSource()
|
||||
Foam::functionObjects::fieldValues::faceSource::~faceSource()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::faceSource::read(const dictionary& dict)
|
||||
void Foam::functionObjects::fieldValues::faceSource::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
fieldValue::read(dict);
|
||||
|
||||
if (active_)
|
||||
{
|
||||
initialise(dict);
|
||||
}
|
||||
initialise(dict);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::faceSource::write()
|
||||
void Foam::functionObjects::fieldValues::faceSource::write()
|
||||
{
|
||||
fieldValue::write();
|
||||
|
||||
if (active_)
|
||||
if (surfacePtr_.valid())
|
||||
{
|
||||
if (surfacePtr_.valid())
|
||||
{
|
||||
surfacePtr_().update();
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeTime(file());
|
||||
}
|
||||
|
||||
if (writeArea_)
|
||||
{
|
||||
totalArea_ = totalArea();
|
||||
if (Pstream::master())
|
||||
{
|
||||
file() << tab << totalArea_;
|
||||
}
|
||||
if (log_) Info<< " total area = " << totalArea_ << endl;
|
||||
}
|
||||
|
||||
// construct weight field. Note: zero size means weight = 1
|
||||
scalarField weightField;
|
||||
if (weightFieldName_ != "none")
|
||||
{
|
||||
weightField =
|
||||
getFieldValues<scalar>
|
||||
(
|
||||
weightFieldName_,
|
||||
true,
|
||||
orientWeightField_
|
||||
);
|
||||
}
|
||||
|
||||
// Combine onto master
|
||||
combineFields(weightField);
|
||||
|
||||
// process the fields
|
||||
forAll(fields_, i)
|
||||
{
|
||||
const word& fieldName = fields_[i];
|
||||
bool ok = false;
|
||||
|
||||
bool orient = i >= orientedFieldsStart_;
|
||||
ok = ok || writeValues<scalar>(fieldName, weightField, orient);
|
||||
ok = ok || writeValues<vector>(fieldName, weightField, orient);
|
||||
ok = ok
|
||||
|| writeValues<sphericalTensor>(fieldName, weightField, orient);
|
||||
ok = ok || writeValues<symmTensor>(fieldName, weightField, orient);
|
||||
ok = ok || writeValues<tensor>(fieldName, weightField, orient);
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Requested field " << fieldName
|
||||
<< " not found in database and not processed"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
file()<< endl;
|
||||
}
|
||||
|
||||
if (log_) Info<< endl;
|
||||
surfacePtr_().update();
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeTime(file());
|
||||
}
|
||||
|
||||
if (writeArea_)
|
||||
{
|
||||
totalArea_ = totalArea();
|
||||
if (Pstream::master())
|
||||
{
|
||||
file() << tab << totalArea_;
|
||||
}
|
||||
if (log_) Info<< " total area = " << totalArea_ << endl;
|
||||
}
|
||||
|
||||
// construct weight field. Note: zero size means weight = 1
|
||||
scalarField weightField;
|
||||
if (weightFieldName_ != "none")
|
||||
{
|
||||
weightField =
|
||||
getFieldValues<scalar>
|
||||
(
|
||||
weightFieldName_,
|
||||
true,
|
||||
orientWeightField_
|
||||
);
|
||||
}
|
||||
|
||||
// Combine onto master
|
||||
combineFields(weightField);
|
||||
|
||||
// process the fields
|
||||
forAll(fields_, i)
|
||||
{
|
||||
const word& fieldName = fields_[i];
|
||||
bool ok = false;
|
||||
|
||||
bool orient = i >= orientedFieldsStart_;
|
||||
ok = ok || writeValues<scalar>(fieldName, weightField, orient);
|
||||
ok = ok || writeValues<vector>(fieldName, weightField, orient);
|
||||
ok = ok
|
||||
|| writeValues<sphericalTensor>(fieldName, weightField, orient);
|
||||
ok = ok || writeValues<symmTensor>(fieldName, weightField, orient);
|
||||
ok = ok || writeValues<tensor>(fieldName, weightField, orient);
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Requested field " << fieldName
|
||||
<< " not found in database and not processed"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
file()<< endl;
|
||||
}
|
||||
|
||||
if (log_) Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::fieldValues::faceSource
|
||||
Foam::functionObjects::fieldValues::faceSource
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
@ -152,6 +152,8 @@ namespace Foam
|
||||
|
||||
class sampledSurface;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
namespace fieldValues
|
||||
{
|
||||
|
||||
@ -337,14 +339,26 @@ public:
|
||||
TypeName("faceSource");
|
||||
|
||||
|
||||
//- Construct from components
|
||||
faceSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
faceSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -426,6 +440,7 @@ vector faceSource::processValues
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fieldValues
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,8 +43,10 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<fieldValues::faceSource>
|
||||
faceSourceFunctionObject;
|
||||
typedef OutputFilterFunctionObject
|
||||
<
|
||||
functionObjects::fieldValues::faceSource
|
||||
> faceSourceFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,33 +27,32 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::fieldValues::faceSource::sourceType&
|
||||
Foam::fieldValues::faceSource::source() const
|
||||
inline const Foam::functionObjects::fieldValues::faceSource::sourceType&
|
||||
Foam::functionObjects::fieldValues::faceSource::source() const
|
||||
{
|
||||
return source_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::fieldValues::faceSource::faceId() const
|
||||
Foam::functionObjects::fieldValues::faceSource::faceId() const
|
||||
{
|
||||
return faceId_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::fieldValues::faceSource::facePatch() const
|
||||
Foam::functionObjects::fieldValues::faceSource::facePatch() const
|
||||
{
|
||||
return facePatchId_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::fieldValues::faceSource::faceSign() const
|
||||
Foam::functionObjects::fieldValues::faceSource::faceSign() const
|
||||
{
|
||||
return faceSign_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
|
||||
@ -32,7 +32,10 @@ License
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
bool Foam::fieldValues::faceSource::validField(const word& fieldName) const
|
||||
bool Foam::functionObjects::fieldValues::faceSource::validField
|
||||
(
|
||||
const word& fieldName
|
||||
) const
|
||||
{
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||
@ -51,7 +54,8 @@ bool Foam::fieldValues::faceSource::validField(const word& fieldName) const
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::fieldValues::faceSource::getFieldValues
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::functionObjects::fieldValues::faceSource::getFieldValues
|
||||
(
|
||||
const word& fieldName,
|
||||
const bool mustGet,
|
||||
@ -120,7 +124,7 @@ Foam::tmp<Foam::Field<Type>> Foam::fieldValues::faceSource::getFieldValues
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::fieldValues::faceSource::processSameTypeValues
|
||||
Type Foam::functionObjects::fieldValues::faceSource::processSameTypeValues
|
||||
(
|
||||
const Field<Type>& values,
|
||||
const vectorField& Sf,
|
||||
@ -236,10 +240,12 @@ Type Foam::fieldValues::faceSource::processSameTypeValues
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
case opAreaNormalAverage:
|
||||
{}
|
||||
case opAreaNormalIntegrate:
|
||||
{}
|
||||
case opNone:
|
||||
{}
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -247,7 +253,7 @@ Type Foam::fieldValues::faceSource::processSameTypeValues
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::fieldValues::faceSource::processValues
|
||||
Type Foam::functionObjects::fieldValues::faceSource::processValues
|
||||
(
|
||||
const Field<Type>& values,
|
||||
const vectorField& Sf,
|
||||
@ -262,7 +268,7 @@ Type Foam::fieldValues::faceSource::processValues
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
bool Foam::fieldValues::faceSource::writeValues
|
||||
bool Foam::functionObjects::fieldValues::faceSource::writeValues
|
||||
(
|
||||
const word& fieldName,
|
||||
const scalarField& weightField,
|
||||
@ -348,7 +354,8 @@ bool Foam::fieldValues::faceSource::writeValues
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::fieldValues::faceSource::filterField
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::functionObjects::fieldValues::faceSource::filterField
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& field,
|
||||
const bool applyOrientation
|
||||
@ -389,7 +396,8 @@ Foam::tmp<Foam::Field<Type>> Foam::fieldValues::faceSource::filterField
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::fieldValues::faceSource::filterField
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::functionObjects::fieldValues::faceSource::filterField
|
||||
(
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
|
||||
const bool applyOrientation
|
||||
|
||||
@ -41,25 +41,19 @@ namespace Foam
|
||||
|
||||
void Foam::fieldValue::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
dict_ = dict;
|
||||
dict_ = dict;
|
||||
|
||||
log_ = dict.lookupOrDefault<Switch>("log", true);
|
||||
dict.lookup("fields") >> fields_;
|
||||
dict.lookup("valueOutput") >> valueOutput_;
|
||||
}
|
||||
log_ = dict.lookupOrDefault<Switch>("log", true);
|
||||
dict.lookup("fields") >> fields_;
|
||||
dict.lookup("valueOutput") >> valueOutput_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValue::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
functionObjectFiles::write();
|
||||
functionObjectFiles::write();
|
||||
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||
}
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||
}
|
||||
|
||||
|
||||
@ -78,25 +72,13 @@ Foam::fieldValue::fieldValue
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
dict_(dict),
|
||||
active_(true),
|
||||
log_(true),
|
||||
sourceName_(word::null),
|
||||
fields_(dict.lookup("fields")),
|
||||
valueOutput_(dict.lookup("valueOutput")),
|
||||
resultDict_(fileName("name"), dictionary::null)
|
||||
{
|
||||
// Only active if obr is an fvMesh
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name << nl
|
||||
<< endl;
|
||||
active_ = false;
|
||||
}
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
@ -109,33 +91,23 @@ Foam::fieldValue::~fieldValue()
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValue::execute()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fieldValue::end()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fieldValue::timeSet()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fieldValue::updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fieldValue::movePoints(const polyMesh&)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -78,9 +78,6 @@ protected:
|
||||
//- Construction dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- Active flag
|
||||
bool active_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
@ -155,9 +152,6 @@ public:
|
||||
//- Return the reference to the construction dictionary
|
||||
inline const dictionary& dict() const;
|
||||
|
||||
//- Return the active flag
|
||||
inline bool active() const;
|
||||
|
||||
//- Return the switch to send output to Info as well as to file
|
||||
inline const Switch& log() const;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,12 +46,6 @@ inline const Foam::dictionary& Foam::fieldValue::dict() const
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::fieldValue::active() const
|
||||
{
|
||||
return active_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::Switch& Foam::fieldValue::log() const
|
||||
{
|
||||
return log_;
|
||||
|
||||
@ -33,51 +33,42 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fieldValues
|
||||
{
|
||||
defineTypeNameAndDebug(fieldValueDelta, 0);
|
||||
}
|
||||
|
||||
template<>
|
||||
const char*
|
||||
NamedEnum<fieldValues::fieldValueDelta::operationType, 5>::names[] =
|
||||
{
|
||||
"add",
|
||||
"subtract",
|
||||
"min",
|
||||
"max",
|
||||
"average"
|
||||
};
|
||||
|
||||
const NamedEnum<fieldValues::fieldValueDelta::operationType, 5>
|
||||
fieldValues::fieldValueDelta::operationTypeNames_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValues::fieldValueDelta::fieldValueDelta
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectFiles(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
loadFromFiles_(loadFromFiles),
|
||||
log_(true),
|
||||
operation_(opSubtract),
|
||||
source1Ptr_(NULL),
|
||||
source2Ptr_(NULL)
|
||||
namespace functionObjects
|
||||
{
|
||||
read(dict);
|
||||
namespace fieldValues
|
||||
{
|
||||
defineTypeNameAndDebug(fieldValueDelta, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldValues::fieldValueDelta::operationType,
|
||||
5
|
||||
>::names[] =
|
||||
{
|
||||
"add",
|
||||
"subtract",
|
||||
"min",
|
||||
"max",
|
||||
"average"
|
||||
};
|
||||
|
||||
void Foam::fieldValues::fieldValueDelta::writeFileHeader(const label i)
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::fieldValues::fieldValueDelta::operationType,
|
||||
5
|
||||
> Foam::functionObjects::fieldValues::fieldValueDelta::operationTypeNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::writeFileHeader
|
||||
(
|
||||
const label i
|
||||
)
|
||||
{
|
||||
const wordList& fields1 = source1Ptr_->fields();
|
||||
const wordList& fields2 = source2Ptr_->fields();
|
||||
@ -108,15 +99,54 @@ void Foam::fieldValues::fieldValueDelta::writeFileHeader(const label i)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::fieldValues::fieldValueDelta::fieldValueDelta
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectFiles(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
loadFromFiles_(loadFromFiles),
|
||||
log_(true),
|
||||
operation_(opSubtract),
|
||||
source1Ptr_(NULL),
|
||||
source2Ptr_(NULL)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::fieldValues::fieldValueDelta::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValues::fieldValueDelta::~fieldValueDelta()
|
||||
Foam::functionObjects::fieldValues::fieldValueDelta::~fieldValueDelta()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::fieldValueDelta::read(const dictionary& dict)
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
log_ = dict.lookupOrDefault<Switch>("log", true);
|
||||
source1Ptr_.reset
|
||||
@ -146,7 +176,7 @@ void Foam::fieldValues::fieldValueDelta::read(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::fieldValueDelta::write()
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::write()
|
||||
{
|
||||
functionObjectFiles::write();
|
||||
|
||||
@ -186,34 +216,30 @@ void Foam::fieldValues::fieldValueDelta::write()
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::fieldValueDelta::execute()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::execute()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fieldValues::fieldValueDelta::end()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fieldValues::fieldValueDelta::timeSet()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fieldValues::fieldValueDelta::updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::updateMesh
|
||||
(
|
||||
const mapPolyMesh&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fieldValues::fieldValueDelta::movePoints(const polyMesh&)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::movePoints
|
||||
(
|
||||
const polyMesh&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::fieldValues::fieldValueDelta
|
||||
Foam::functionObjects::fieldValues::fieldValueDelta
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
@ -84,7 +84,8 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
namespace fieldValues
|
||||
{
|
||||
|
||||
@ -162,14 +163,26 @@ public:
|
||||
TypeName("fieldValueDelta");
|
||||
|
||||
|
||||
//- Construct from components
|
||||
fieldValueDelta
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
fieldValueDelta
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -206,6 +219,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fieldValues
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,8 +43,10 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<fieldValues::fieldValueDelta>
|
||||
fieldValueDeltaFunctionObject;
|
||||
typedef OutputFilterFunctionObject
|
||||
<
|
||||
functionObjects::fieldValues::fieldValueDelta
|
||||
> fieldValueDeltaFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -30,7 +30,7 @@ License
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Type Foam::fieldValues::fieldValueDelta::applyOperation
|
||||
Type Foam::functionObjects::fieldValues::fieldValueDelta::applyOperation
|
||||
(
|
||||
const Type& value1,
|
||||
const Type& value2
|
||||
@ -79,7 +79,10 @@ Type Foam::fieldValues::fieldValueDelta::applyOperation
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldValues::fieldValueDelta::processFields(bool& found)
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::processFields
|
||||
(
|
||||
bool& found
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
||||
|
||||
@ -75,26 +75,13 @@ Foam::functionObjects::histogram::histogram
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, typeName),
|
||||
name_(name),
|
||||
active_(true)
|
||||
name_(name)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_ << nl
|
||||
<< endl;
|
||||
}
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::functionObjects::histogram>
|
||||
Foam::functionObjects::histogram::New
|
||||
bool Foam::functionObjects::histogram::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -102,17 +89,8 @@ Foam::functionObjects::histogram::New
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
if (isA<fvMesh>(obr))
|
||||
{
|
||||
return autoPtr<histogram>
|
||||
(
|
||||
new histogram(name, obr, dict, loadFromFiles)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return autoPtr<histogram>();
|
||||
}
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
@ -126,16 +104,13 @@ Foam::functionObjects::histogram::~histogram()
|
||||
|
||||
void Foam::functionObjects::histogram::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
dict.lookup("field") >> fieldName_;
|
||||
dict.lookup("max") >> max_;
|
||||
min_ = dict.lookupOrDefault<scalar>("min", 0);
|
||||
dict.lookup("nBins") >> nBins_;
|
||||
dict.lookup("field") >> fieldName_;
|
||||
dict.lookup("max") >> max_;
|
||||
min_ = dict.lookupOrDefault<scalar>("min", 0);
|
||||
dict.lookup("nBins") >> nBins_;
|
||||
|
||||
word format(dict.lookup("setFormat"));
|
||||
formatterPtr_ = writer<scalar>::New(format);
|
||||
}
|
||||
word format(dict.lookup("setFormat"));
|
||||
formatterPtr_ = writer<scalar>::New(format);
|
||||
}
|
||||
|
||||
|
||||
@ -153,87 +128,84 @@ void Foam::functionObjects::histogram::timeSet()
|
||||
|
||||
void Foam::functionObjects::histogram::write()
|
||||
{
|
||||
if (active_)
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
autoPtr<volScalarField> fieldPtr;
|
||||
if (obr_.foundObject<volScalarField>(fieldName_))
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
autoPtr<volScalarField> fieldPtr;
|
||||
if (obr_.foundObject<volScalarField>(fieldName_))
|
||||
{
|
||||
Info<< " Looking up field " << fieldName_ << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " Reading field " << fieldName_ << endl;
|
||||
fieldPtr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName_,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const volScalarField& field =
|
||||
Info<< " Looking up field " << fieldName_ << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " Reading field " << fieldName_ << endl;
|
||||
fieldPtr.reset
|
||||
(
|
||||
fieldPtr.valid()
|
||||
? fieldPtr()
|
||||
: obr_.lookupObject<volScalarField>(fieldName_)
|
||||
);
|
||||
|
||||
// Calculate the mid-points of bins for the graph axis
|
||||
pointField xBin(nBins_);
|
||||
const scalar delta = (max_- min_)/nBins_;
|
||||
|
||||
scalar x = min_ + 0.5*delta;
|
||||
forAll(xBin, i)
|
||||
{
|
||||
xBin[i] = point(x, 0, 0);
|
||||
x += delta;
|
||||
}
|
||||
|
||||
scalarField volFrac(nBins_, 0);
|
||||
const scalarField& V = mesh.V();
|
||||
|
||||
forAll(field, celli)
|
||||
{
|
||||
const label bini = (field[celli] - min_)/delta;
|
||||
if (bini >= 0 && bini < nBins_)
|
||||
{
|
||||
volFrac[bini] += V[celli];
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::listCombineGather(volFrac, plusEqOp<scalar>());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
const scalar sumVol = sum(volFrac);
|
||||
|
||||
if (sumVol > SMALL)
|
||||
{
|
||||
volFrac /= sumVol;
|
||||
|
||||
const coordSet coords
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Volume_Fraction",
|
||||
"x",
|
||||
xBin,
|
||||
mag(xBin)
|
||||
);
|
||||
fieldName_,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
writeGraph(coords, field.name(), volFrac);
|
||||
}
|
||||
const volScalarField& field =
|
||||
(
|
||||
fieldPtr.valid()
|
||||
? fieldPtr()
|
||||
: obr_.lookupObject<volScalarField>(fieldName_)
|
||||
);
|
||||
|
||||
// Calculate the mid-points of bins for the graph axis
|
||||
pointField xBin(nBins_);
|
||||
const scalar delta = (max_- min_)/nBins_;
|
||||
|
||||
scalar x = min_ + 0.5*delta;
|
||||
forAll(xBin, i)
|
||||
{
|
||||
xBin[i] = point(x, 0, 0);
|
||||
x += delta;
|
||||
}
|
||||
|
||||
scalarField volFrac(nBins_, 0);
|
||||
const scalarField& V = mesh.V();
|
||||
|
||||
forAll(field, celli)
|
||||
{
|
||||
const label bini = (field[celli] - min_)/delta;
|
||||
if (bini >= 0 && bini < nBins_)
|
||||
{
|
||||
volFrac[bini] += V[celli];
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::listCombineGather(volFrac, plusEqOp<scalar>());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
const scalar sumVol = sum(volFrac);
|
||||
|
||||
if (sumVol > SMALL)
|
||||
{
|
||||
volFrac /= sumVol;
|
||||
|
||||
const coordSet coords
|
||||
(
|
||||
"Volume_Fraction",
|
||||
"x",
|
||||
xBin,
|
||||
mag(xBin)
|
||||
);
|
||||
|
||||
writeGraph(coords, field.name(), volFrac);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,9 +99,6 @@ class histogram
|
||||
//- Name of this histogram
|
||||
word name_;
|
||||
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
//- Name of field
|
||||
word fieldName_;
|
||||
|
||||
@ -152,9 +149,9 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Construct on free-store and return pointer if successful
|
||||
// otherwise return a null-pointer
|
||||
static autoPtr<histogram> New
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
|
||||
@ -32,14 +32,17 @@ License
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(nearWallFields, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::nearWallFields::calcAddressing()
|
||||
void Foam::functionObjects::nearWallFields::calcAddressing()
|
||||
{
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
@ -218,7 +221,7 @@ void Foam::nearWallFields::calcAddressing()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::nearWallFields::nearWallFields
|
||||
Foam::functionObjects::nearWallFields::nearWallFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -228,28 +231,28 @@ Foam::nearWallFields::nearWallFields
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldSet_()
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_
|
||||
<< endl;
|
||||
}
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::nearWallFields::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::nearWallFields::~nearWallFields()
|
||||
Foam::functionObjects::nearWallFields::~nearWallFields()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -260,157 +263,142 @@ Foam::nearWallFields::~nearWallFields()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::nearWallFields::read(const dictionary& dict)
|
||||
void Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << endl;
|
||||
}
|
||||
|
||||
if (active_)
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
patchSet_ =
|
||||
mesh.boundaryMesh().patchSet(wordReList(dict.lookup("patches")));
|
||||
distance_ = readScalar(dict.lookup("distance"));
|
||||
|
||||
|
||||
// Clear out any previously loaded fields
|
||||
vsf_.clear();
|
||||
vvf_.clear();
|
||||
vSpheretf_.clear();
|
||||
vSymmtf_.clear();
|
||||
vtf_.clear();
|
||||
fieldMap_.clear();
|
||||
reverseFieldMap_.clear();
|
||||
|
||||
|
||||
// Generate fields with mappedField boundary condition
|
||||
|
||||
// Convert field to map
|
||||
fieldMap_.resize(2*fieldSet_.size());
|
||||
reverseFieldMap_.resize(2*fieldSet_.size());
|
||||
forAll(fieldSet_, setI)
|
||||
{
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
const word& fldName = fieldSet_[setI].first();
|
||||
const word& sampleFldName = fieldSet_[setI].second();
|
||||
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
patchSet_ =
|
||||
mesh.boundaryMesh().patchSet(wordReList(dict.lookup("patches")));
|
||||
distance_ = readScalar(dict.lookup("distance"));
|
||||
fieldMap_.insert(fldName, sampleFldName);
|
||||
reverseFieldMap_.insert(sampleFldName, fldName);
|
||||
}
|
||||
|
||||
Info<< type() << " " << name_ << ": Sampling " << fieldMap_.size()
|
||||
<< " fields" << endl;
|
||||
|
||||
// Do analysis
|
||||
calcAddressing();
|
||||
}
|
||||
|
||||
|
||||
// Clear out any previously loaded fields
|
||||
vsf_.clear();
|
||||
vvf_.clear();
|
||||
vSpheretf_.clear();
|
||||
vSymmtf_.clear();
|
||||
vtf_.clear();
|
||||
fieldMap_.clear();
|
||||
reverseFieldMap_.clear();
|
||||
void Foam::functionObjects::nearWallFields::execute()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << endl;
|
||||
}
|
||||
|
||||
|
||||
// Generate fields with mappedField boundary condition
|
||||
|
||||
// Convert field to map
|
||||
fieldMap_.resize(2*fieldSet_.size());
|
||||
reverseFieldMap_.resize(2*fieldSet_.size());
|
||||
forAll(fieldSet_, setI)
|
||||
{
|
||||
const word& fldName = fieldSet_[setI].first();
|
||||
const word& sampleFldName = fieldSet_[setI].second();
|
||||
|
||||
fieldMap_.insert(fldName, sampleFldName);
|
||||
reverseFieldMap_.insert(sampleFldName, fldName);
|
||||
}
|
||||
|
||||
Info<< type() << " " << name_ << ": Sampling " << fieldMap_.size()
|
||||
if
|
||||
(
|
||||
fieldMap_.size()
|
||||
&& vsf_.empty()
|
||||
&& vvf_.empty()
|
||||
&& vSpheretf_.empty()
|
||||
&& vSymmtf_.empty()
|
||||
&& vtf_.empty()
|
||||
)
|
||||
{
|
||||
Info<< type() << " " << name_ << ": Creating " << fieldMap_.size()
|
||||
<< " fields" << endl;
|
||||
|
||||
// Do analysis
|
||||
calcAddressing();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::nearWallFields::execute()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << endl;
|
||||
}
|
||||
|
||||
|
||||
if (active_)
|
||||
{
|
||||
if
|
||||
(
|
||||
fieldMap_.size()
|
||||
&& vsf_.empty()
|
||||
&& vvf_.empty()
|
||||
&& vSpheretf_.empty()
|
||||
&& vSymmtf_.empty()
|
||||
&& vtf_.empty()
|
||||
)
|
||||
{
|
||||
Info<< type() << " " << name_ << ": Creating " << fieldMap_.size()
|
||||
<< " fields" << endl;
|
||||
|
||||
createFields(vsf_);
|
||||
createFields(vvf_);
|
||||
createFields(vSpheretf_);
|
||||
createFields(vSymmtf_);
|
||||
createFields(vtf_);
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
Info<< " Sampling fields to " << obr_.time().timeName()
|
||||
<< endl;
|
||||
|
||||
sampleFields(vsf_);
|
||||
sampleFields(vvf_);
|
||||
sampleFields(vSpheretf_);
|
||||
sampleFields(vSymmtf_);
|
||||
sampleFields(vtf_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::nearWallFields::end()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << endl;
|
||||
}
|
||||
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::nearWallFields::timeSet()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::nearWallFields::write()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << endl;
|
||||
}
|
||||
|
||||
if (active_)
|
||||
{
|
||||
Info<< " Writing sampled fields to " << obr_.time().timeName()
|
||||
<< endl;
|
||||
|
||||
forAll(vsf_, i)
|
||||
{
|
||||
vsf_[i].write();
|
||||
}
|
||||
forAll(vvf_, i)
|
||||
{
|
||||
vvf_[i].write();
|
||||
}
|
||||
forAll(vSpheretf_, i)
|
||||
{
|
||||
vSpheretf_[i].write();
|
||||
}
|
||||
forAll(vSymmtf_, i)
|
||||
{
|
||||
vSymmtf_[i].write();
|
||||
}
|
||||
forAll(vtf_, i)
|
||||
{
|
||||
vtf_[i].write();
|
||||
}
|
||||
createFields(vsf_);
|
||||
createFields(vvf_);
|
||||
createFields(vSpheretf_);
|
||||
createFields(vSymmtf_);
|
||||
createFields(vtf_);
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
Info<< " Sampling fields to " << obr_.time().timeName()
|
||||
<< endl;
|
||||
|
||||
sampleFields(vsf_);
|
||||
sampleFields(vvf_);
|
||||
sampleFields(vSpheretf_);
|
||||
sampleFields(vSymmtf_);
|
||||
sampleFields(vtf_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::nearWallFields::end()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << endl;
|
||||
}
|
||||
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::nearWallFields::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::nearWallFields::write()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << endl;
|
||||
}
|
||||
|
||||
Info<< " Writing sampled fields to " << obr_.time().timeName()
|
||||
<< endl;
|
||||
|
||||
forAll(vsf_, i)
|
||||
{
|
||||
vsf_[i].write();
|
||||
}
|
||||
forAll(vvf_, i)
|
||||
{
|
||||
vvf_[i].write();
|
||||
}
|
||||
forAll(vSpheretf_, i)
|
||||
{
|
||||
vSpheretf_[i].write();
|
||||
}
|
||||
forAll(vSymmtf_, i)
|
||||
{
|
||||
vSymmtf_[i].write();
|
||||
}
|
||||
forAll(vtf_, i)
|
||||
{
|
||||
vtf_[i].write();
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::nearWallFields
|
||||
Foam::functionObjects::nearWallFields
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
@ -88,6 +88,9 @@ class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nearWallFields Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -103,9 +106,6 @@ protected:
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
// Read from dictionary
|
||||
|
||||
//- Fields to process
|
||||
@ -197,6 +197,16 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~nearWallFields();
|
||||
@ -237,6 +247,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<nearWallFields>
|
||||
typedef OutputFilterFunctionObject<functionObjects::nearWallFields>
|
||||
nearWallFieldsFunctionObject;
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::nearWallFields::createFields
|
||||
void Foam::functionObjects::nearWallFields::createFields
|
||||
(
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh>>& sflds
|
||||
) const
|
||||
@ -72,7 +72,7 @@ void Foam::nearWallFields::createFields
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::nearWallFields::sampleBoundaryField
|
||||
void Foam::functionObjects::nearWallFields::sampleBoundaryField
|
||||
(
|
||||
const interpolationCellPoint<Type>& interpolator,
|
||||
GeometricField<Type, fvPatchField, volMesh>& fld
|
||||
@ -122,7 +122,7 @@ void Foam::nearWallFields::sampleBoundaryField
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::nearWallFields::sampleFields
|
||||
void Foam::functionObjects::nearWallFields::sampleFields
|
||||
(
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh>>& sflds
|
||||
) const
|
||||
|
||||
@ -31,13 +31,16 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(processorField, 0);
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(processorField, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorField::processorField
|
||||
Foam::functionObjects::processorField::processorField
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -46,96 +49,85 @@ Foam::processorField::processorField
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true)
|
||||
obr_(obr)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict);
|
||||
read(dict);
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
volScalarField* procFieldPtr
|
||||
volScalarField* procFieldPtr
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
new volScalarField
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"processorID",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
"processorID",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimless, 0.0)
|
||||
)
|
||||
);
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimless, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
mesh.objectRegistry::store(procFieldPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_
|
||||
<< endl;
|
||||
}
|
||||
mesh.objectRegistry::store(procFieldPtr);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::processorField::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorField::~processorField()
|
||||
Foam::functionObjects::processorField::~processorField()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::processorField::read(const dictionary& dict)
|
||||
void Foam::functionObjects::processorField::read(const dictionary& dict)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::processorField::execute()
|
||||
{
|
||||
// do nothing
|
||||
const volScalarField& procField =
|
||||
obr_.lookupObject<volScalarField>("processorID");
|
||||
|
||||
const_cast<volScalarField&>(procField) ==
|
||||
dimensionedScalar("proci", dimless, Pstream::myProcNo());
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorField::execute()
|
||||
void Foam::functionObjects::processorField::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
const volScalarField& procField =
|
||||
obr_.lookupObject<volScalarField>("processorID");
|
||||
|
||||
const_cast<volScalarField&>(procField) ==
|
||||
dimensionedScalar("proci", dimless, Pstream::myProcNo());
|
||||
}
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorField::end()
|
||||
void Foam::functionObjects::processorField::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::processorField::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
}
|
||||
const volScalarField& procField =
|
||||
obr_.lookupObject<volScalarField>("processorID");
|
||||
|
||||
|
||||
void Foam::processorField::timeSet()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorField::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
const volScalarField& procField =
|
||||
obr_.lookupObject<volScalarField>("processorID");
|
||||
|
||||
procField.write();
|
||||
}
|
||||
procField.write();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::processorField
|
||||
Foam::functionObjects::processorField
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
@ -76,6 +76,9 @@ class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class processorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -92,9 +95,6 @@ protected:
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -125,6 +125,16 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~processorField();
|
||||
@ -165,6 +175,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<processorField>
|
||||
typedef OutputFilterFunctionObject<functionObjects::processorField>
|
||||
processorFieldFunctionObject;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,13 +30,16 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(readFields, 0);
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(readFields, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::readFields::readFields
|
||||
Foam::functionObjects::readFields::readFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -46,92 +49,80 @@ Foam::readFields::readFields
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldSet_()
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_
|
||||
<< endl;
|
||||
}
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::readFields::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::readFields::~readFields()
|
||||
Foam::functionObjects::readFields::~readFields()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::readFields::read(const dictionary& dict)
|
||||
void Foam::functionObjects::readFields::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::readFields::execute()
|
||||
{
|
||||
// Clear out any previously loaded fields
|
||||
vsf_.clear();
|
||||
vvf_.clear();
|
||||
vSpheretf_.clear();
|
||||
vSymmtf_.clear();
|
||||
vtf_.clear();
|
||||
|
||||
ssf_.clear();
|
||||
svf_.clear();
|
||||
sSpheretf_.clear();
|
||||
sSymmtf_.clear();
|
||||
stf_.clear();
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
const word& fieldName = fieldSet_[fieldI];
|
||||
|
||||
// If necessary load field
|
||||
loadField<scalar>(fieldName, vsf_, ssf_);
|
||||
loadField<vector>(fieldName, vvf_, svf_);
|
||||
loadField<sphericalTensor>(fieldName, vSpheretf_, sSpheretf_);
|
||||
loadField<symmTensor>(fieldName, vSymmtf_, sSymmtf_);
|
||||
loadField<tensor>(fieldName, vtf_, stf_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::readFields::execute()
|
||||
void Foam::functionObjects::readFields::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
// Clear out any previously loaded fields
|
||||
vsf_.clear();
|
||||
vvf_.clear();
|
||||
vSpheretf_.clear();
|
||||
vSymmtf_.clear();
|
||||
vtf_.clear();
|
||||
|
||||
ssf_.clear();
|
||||
svf_.clear();
|
||||
sSpheretf_.clear();
|
||||
sSymmtf_.clear();
|
||||
stf_.clear();
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
{
|
||||
const word& fieldName = fieldSet_[fieldI];
|
||||
|
||||
// If necessary load field
|
||||
loadField<scalar>(fieldName, vsf_, ssf_);
|
||||
loadField<vector>(fieldName, vvf_, svf_);
|
||||
loadField<sphericalTensor>(fieldName, vSpheretf_, sSpheretf_);
|
||||
loadField<symmTensor>(fieldName, vSymmtf_, sSymmtf_);
|
||||
loadField<tensor>(fieldName, vtf_, stf_);
|
||||
}
|
||||
}
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::readFields::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
}
|
||||
void Foam::functionObjects::readFields::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::readFields::timeSet()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::readFields::write()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
void Foam::functionObjects::readFields::write()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::readFields
|
||||
Foam::functionObjects::readFields
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
@ -81,6 +81,9 @@ class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class readFields Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -96,9 +99,6 @@ protected:
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
//- Fields to load
|
||||
wordList fieldSet_;
|
||||
|
||||
@ -156,6 +156,16 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~readFields();
|
||||
@ -196,6 +206,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<readFields>
|
||||
typedef OutputFilterFunctionObject<functionObjects::readFields>
|
||||
readFieldsFunctionObject;
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::readFields::loadField
|
||||
void Foam::functionObjects::readFields::loadField
|
||||
(
|
||||
const word& fieldName,
|
||||
PtrList<GeometricField<Type, fvPatchField, volMesh>>& vflds,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::regionSizeDistribution
|
||||
Foam::functionObjects::regionSizeDistribution
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
@ -126,6 +126,9 @@ class mapPolyMesh;
|
||||
class regionSplit;
|
||||
class polyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class regionSizeDistribution Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -141,9 +144,6 @@ class regionSizeDistribution
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
//- Name of field
|
||||
word alphaName_;
|
||||
|
||||
@ -255,6 +255,16 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
@ -296,6 +306,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<regionSizeDistribution>
|
||||
typedef OutputFilterFunctionObject<functionObjects::regionSizeDistribution>
|
||||
regionSizeDistributionFunctionObject;
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ License
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Map<Type> Foam::regionSizeDistribution::regionSum
|
||||
Foam::Map<Type> Foam::functionObjects::regionSizeDistribution::regionSum
|
||||
(
|
||||
const regionSplit& regions,
|
||||
const Field<Type>& fld
|
||||
@ -60,9 +60,8 @@ Foam::Map<Type> Foam::regionSizeDistribution::regionSum
|
||||
}
|
||||
|
||||
|
||||
// Get data in sortedToc order
|
||||
template<class Type>
|
||||
Foam::List<Type> Foam::regionSizeDistribution::extractData
|
||||
Foam::List<Type> Foam::functionObjects::regionSizeDistribution::extractData
|
||||
(
|
||||
const UList<label>& keys,
|
||||
const Map<Type>& regionData
|
||||
|
||||
@ -40,14 +40,17 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(streamLine, 0);
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(streamLine, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::indirectPrimitivePatch>
|
||||
Foam::streamLine::wallPatch() const
|
||||
Foam::functionObjects::streamLine::wallPatch() const
|
||||
{
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
@ -57,7 +60,6 @@ Foam::streamLine::wallPatch() const
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
//if (!polyPatch::constraintType(patches[patchi].type()))
|
||||
if (isA<wallPolyPatch>(patches[patchi]))
|
||||
{
|
||||
nFaces += patches[patchi].size();
|
||||
@ -70,7 +72,6 @@ Foam::streamLine::wallPatch() const
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
//if (!polyPatch::constraintType(patches[patchi].type()))
|
||||
if (isA<wallPolyPatch>(patches[patchi]))
|
||||
{
|
||||
const polyPatch& pp = patches[patchi];
|
||||
@ -97,7 +98,7 @@ Foam::streamLine::wallPatch() const
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::track()
|
||||
void Foam::functionObjects::streamLine::track()
|
||||
{
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
@ -121,7 +122,7 @@ void Foam::streamLine::track()
|
||||
mesh,
|
||||
seedPoints[i],
|
||||
seedPoints.cells()[i],
|
||||
lifeTime_ // lifetime
|
||||
lifeTime_
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -294,7 +295,7 @@ void Foam::streamLine::track()
|
||||
}
|
||||
|
||||
|
||||
// additional particle info
|
||||
// Additional particle info
|
||||
streamLineParticle::trackingData td
|
||||
(
|
||||
particles,
|
||||
@ -322,7 +323,7 @@ void Foam::streamLine::track()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::streamLine::streamLine
|
||||
Foam::functionObjects::streamLine::streamLine
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -334,244 +335,217 @@ Foam::streamLine::streamLine
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
loadFromFiles_(loadFromFiles),
|
||||
active_(true),
|
||||
nSubCycle_(0)
|
||||
{
|
||||
// Only active if a fvMesh is available
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict_);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating."
|
||||
<< nl << endl;
|
||||
}
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::streamLine::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::streamLine::~streamLine()
|
||||
Foam::functionObjects::streamLine::~streamLine()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::streamLine::read(const dictionary& dict)
|
||||
void Foam::functionObjects::streamLine::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
Info<< type() << " " << name_ << ":" << nl;
|
||||
|
||||
dict.lookup("fields") >> fields_;
|
||||
if (dict.found("UName"))
|
||||
{
|
||||
Info<< type() << " " << name_ << ":" << nl;
|
||||
|
||||
//dict_ = dict;
|
||||
dict.lookup("fields") >> fields_;
|
||||
if (dict.found("UName"))
|
||||
{
|
||||
dict.lookup("UName") >> UName_;
|
||||
}
|
||||
else
|
||||
{
|
||||
UName_ = "U";
|
||||
if (dict.found("U"))
|
||||
{
|
||||
IOWarningInFunction(dict)
|
||||
<< "Using deprecated entry \"U\"."
|
||||
<< " Please use \"UName\" instead."
|
||||
<< endl;
|
||||
dict.lookup("U") >> UName_;
|
||||
}
|
||||
}
|
||||
|
||||
if (findIndex(fields_, UName_) == -1)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Velocity field for tracking " << UName_
|
||||
<< " should be present in the list of fields " << fields_
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
dict.lookup("trackForward") >> trackForward_;
|
||||
dict.lookup("lifeTime") >> lifeTime_;
|
||||
if (lifeTime_ < 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal value " << lifeTime_ << " for lifeTime"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
bool subCycling = dict.found("nSubCycle");
|
||||
bool fixedLength = dict.found("trackLength");
|
||||
|
||||
if (subCycling && fixedLength)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Cannot both specify automatic time stepping (through '"
|
||||
<< "nSubCycle' specification) and fixed track length (through '"
|
||||
<< "trackLength')"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
nSubCycle_ = 1;
|
||||
if (dict.readIfPresent("nSubCycle", nSubCycle_))
|
||||
{
|
||||
trackLength_ = VGREAT;
|
||||
if (nSubCycle_ < 1)
|
||||
{
|
||||
nSubCycle_ = 1;
|
||||
}
|
||||
Info<< " automatic track length specified through"
|
||||
<< " number of sub cycles : " << nSubCycle_ << nl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
dict.lookup("trackLength") >> trackLength_;
|
||||
|
||||
Info<< " fixed track length specified : "
|
||||
<< trackLength_ << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
interpolationScheme_ = dict.lookupOrDefault
|
||||
(
|
||||
"interpolationScheme",
|
||||
interpolationCellPoint<scalar>::typeName
|
||||
);
|
||||
|
||||
//Info<< " using interpolation " << interpolationScheme_
|
||||
// << endl;
|
||||
|
||||
cloudName_ = dict.lookupOrDefault<word>("cloudName", "streamLine");
|
||||
dict.lookup("seedSampleSet") >> seedSet_;
|
||||
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
meshSearchPtr_.reset(new meshSearch(mesh));
|
||||
|
||||
const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs");
|
||||
sampledSetPtr_ = sampledSet::New
|
||||
(
|
||||
seedSet_,
|
||||
mesh,
|
||||
meshSearchPtr_(),
|
||||
coeffsDict
|
||||
);
|
||||
coeffsDict.lookup("axis") >> sampledSetAxis_;
|
||||
|
||||
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
|
||||
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
|
||||
dict.lookup("UName") >> UName_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::execute()
|
||||
{
|
||||
// const Time& runTime = obr_.time();
|
||||
// Pout<< "**streamLine::execute : time:" << runTime.timeName() << endl;
|
||||
//
|
||||
// bool isOutputTime = false;
|
||||
//
|
||||
// const functionObjectList& fobs = runTime.functionObjects();
|
||||
//
|
||||
// forAll(fobs, i)
|
||||
// {
|
||||
// if (isA<streamLineFunctionObject>(fobs[i]))
|
||||
// {
|
||||
// const streamLineFunctionObject& fo =
|
||||
// dynamic_cast<const streamLineFunctionObject&>(fobs[i]);
|
||||
//
|
||||
// if (fo.name() == name_)
|
||||
// {
|
||||
// Pout<< "found me:" << i << endl;
|
||||
// if (fo.outputControl().output())
|
||||
// {
|
||||
// isOutputTime = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (active_ && isOutputTime)
|
||||
// {
|
||||
// track();
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::streamLine::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::streamLine::write()
|
||||
{
|
||||
if (active_)
|
||||
else
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
|
||||
// Do all injection and tracking
|
||||
track();
|
||||
|
||||
|
||||
if (Pstream::parRun())
|
||||
UName_ = "U";
|
||||
if (dict.found("U"))
|
||||
{
|
||||
// Append slave tracks to master ones
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
IOWarningInFunction(dict)
|
||||
<< "Using deprecated entry \"U\"."
|
||||
<< " Please use \"UName\" instead."
|
||||
<< endl;
|
||||
dict.lookup("U") >> UName_;
|
||||
}
|
||||
}
|
||||
|
||||
globalIndex globalTrackIDs(allTracks_.size());
|
||||
if (findIndex(fields_, UName_) == -1)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Velocity field for tracking " << UName_
|
||||
<< " should be present in the list of fields " << fields_
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
// Construct a distribution map to pull all to the master.
|
||||
labelListList sendMap(Pstream::nProcs());
|
||||
labelListList recvMap(Pstream::nProcs());
|
||||
|
||||
if (Pstream::master())
|
||||
dict.lookup("trackForward") >> trackForward_;
|
||||
dict.lookup("lifeTime") >> lifeTime_;
|
||||
if (lifeTime_ < 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal value " << lifeTime_ << " for lifeTime"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
bool subCycling = dict.found("nSubCycle");
|
||||
bool fixedLength = dict.found("trackLength");
|
||||
|
||||
if (subCycling && fixedLength)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Cannot both specify automatic time stepping (through '"
|
||||
<< "nSubCycle' specification) and fixed track length (through '"
|
||||
<< "trackLength')"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
nSubCycle_ = 1;
|
||||
if (dict.readIfPresent("nSubCycle", nSubCycle_))
|
||||
{
|
||||
trackLength_ = VGREAT;
|
||||
if (nSubCycle_ < 1)
|
||||
{
|
||||
nSubCycle_ = 1;
|
||||
}
|
||||
Info<< " automatic track length specified through"
|
||||
<< " number of sub cycles : " << nSubCycle_ << nl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
dict.lookup("trackLength") >> trackLength_;
|
||||
|
||||
Info<< " fixed track length specified : "
|
||||
<< trackLength_ << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
interpolationScheme_ = dict.lookupOrDefault
|
||||
(
|
||||
"interpolationScheme",
|
||||
interpolationCellPoint<scalar>::typeName
|
||||
);
|
||||
|
||||
cloudName_ = dict.lookupOrDefault<word>("cloudName", "streamLine");
|
||||
dict.lookup("seedSampleSet") >> seedSet_;
|
||||
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
meshSearchPtr_.reset(new meshSearch(mesh));
|
||||
|
||||
const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs");
|
||||
sampledSetPtr_ = sampledSet::New
|
||||
(
|
||||
seedSet_,
|
||||
mesh,
|
||||
meshSearchPtr_(),
|
||||
coeffsDict
|
||||
);
|
||||
coeffsDict.lookup("axis") >> sampledSetAxis_;
|
||||
|
||||
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
|
||||
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::streamLine::execute()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::streamLine::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::streamLine::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::streamLine::write()
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
|
||||
// Do all injection and tracking
|
||||
track();
|
||||
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Append slave tracks to master ones
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
globalIndex globalTrackIDs(allTracks_.size());
|
||||
|
||||
// Construct a distribution map to pull all to the master.
|
||||
labelListList sendMap(Pstream::nProcs());
|
||||
labelListList recvMap(Pstream::nProcs());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master: receive all. My own first, then consecutive
|
||||
// processors.
|
||||
label trackI = 0;
|
||||
|
||||
forAll(recvMap, proci)
|
||||
{
|
||||
// Master: receive all. My own first, then consecutive
|
||||
// processors.
|
||||
label trackI = 0;
|
||||
|
||||
forAll(recvMap, proci)
|
||||
labelList& fromProc = recvMap[proci];
|
||||
fromProc.setSize(globalTrackIDs.localSize(proci));
|
||||
forAll(fromProc, i)
|
||||
{
|
||||
labelList& fromProc = recvMap[proci];
|
||||
fromProc.setSize(globalTrackIDs.localSize(proci));
|
||||
forAll(fromProc, i)
|
||||
{
|
||||
fromProc[i] = trackI++;
|
||||
}
|
||||
fromProc[i] = trackI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
labelList& toMaster = sendMap[0];
|
||||
toMaster.setSize(globalTrackIDs.localSize());
|
||||
forAll(toMaster, i)
|
||||
{
|
||||
toMaster[i] = i;
|
||||
}
|
||||
labelList& toMaster = sendMap[0];
|
||||
toMaster.setSize(globalTrackIDs.localSize());
|
||||
forAll(toMaster, i)
|
||||
{
|
||||
toMaster[i] = i;
|
||||
}
|
||||
|
||||
const mapDistribute distMap
|
||||
(
|
||||
globalTrackIDs.size(),
|
||||
sendMap.xfer(),
|
||||
recvMap.xfer()
|
||||
);
|
||||
const mapDistribute distMap
|
||||
(
|
||||
globalTrackIDs.size(),
|
||||
sendMap.xfer(),
|
||||
recvMap.xfer()
|
||||
);
|
||||
|
||||
|
||||
// Distribute the track positions. Note: use scheduled comms
|
||||
// to prevent buffering.
|
||||
// Distribute the track positions. Note: use scheduled comms
|
||||
// to prevent buffering.
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allTracks_
|
||||
);
|
||||
|
||||
// Distribute the scalars
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
@ -579,193 +553,168 @@ void Foam::streamLine::write()
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allTracks_
|
||||
allScalars_[scalarI]
|
||||
);
|
||||
|
||||
// Distribute the scalars
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allScalars_[scalarI]
|
||||
);
|
||||
}
|
||||
// Distribute the vectors
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allVectors_[vectorI]
|
||||
);
|
||||
}
|
||||
}
|
||||
// Distribute the vectors
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allVectors_[vectorI]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
label n = 0;
|
||||
label n = 0;
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
n += allTracks_[trackI].size();
|
||||
}
|
||||
|
||||
Info<< " Tracks:" << allTracks_.size() << nl
|
||||
<< " Total samples:" << n
|
||||
<< endl;
|
||||
|
||||
|
||||
// Massage into form suitable for writers
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (Pstream::master() && allTracks_.size())
|
||||
{
|
||||
// Make output directory
|
||||
|
||||
fileName vtkPath
|
||||
(
|
||||
Pstream::parRun()
|
||||
? runTime.path()/".."/"postProcessing"/"sets"/name()
|
||||
: runTime.path()/"postProcessing"/"sets"/name()
|
||||
);
|
||||
if (mesh.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
vtkPath = vtkPath/mesh.name();
|
||||
}
|
||||
vtkPath = vtkPath/mesh.time().timeName();
|
||||
|
||||
mkDir(vtkPath);
|
||||
|
||||
// Convert track positions
|
||||
|
||||
PtrList<coordSet> tracks(allTracks_.size());
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
n += allTracks_[trackI].size();
|
||||
tracks.set
|
||||
(
|
||||
trackI,
|
||||
new coordSet
|
||||
(
|
||||
"track" + Foam::name(trackI),
|
||||
sampledSetAxis_ //"xyz"
|
||||
)
|
||||
);
|
||||
tracks[trackI].transfer(allTracks_[trackI]);
|
||||
}
|
||||
|
||||
Info<< " Tracks:" << allTracks_.size() << nl
|
||||
<< " Total samples:" << n
|
||||
<< endl;
|
||||
// Convert scalar values
|
||||
|
||||
|
||||
// Massage into form suitable for writers
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (Pstream::master() && allTracks_.size())
|
||||
if (allScalars_.size() > 0)
|
||||
{
|
||||
// Make output directory
|
||||
List<List<scalarField>> scalarValues(allScalars_.size());
|
||||
|
||||
fileName vtkPath
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
DynamicList<scalarList>& allTrackVals =
|
||||
allScalars_[scalarI];
|
||||
scalarValues[scalarI].setSize(allTrackVals.size());
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
scalarList& trackVals = allTrackVals[trackI];
|
||||
scalarValues[scalarI][trackI].transfer(trackVals);
|
||||
}
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
(
|
||||
Pstream::parRun()
|
||||
? runTime.path()/".."/"postProcessing"/"sets"/name()
|
||||
: runTime.path()/"postProcessing"/"sets"/name()
|
||||
vtkPath
|
||||
/ scalarFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
scalarNames_
|
||||
)
|
||||
);
|
||||
if (mesh.name() != fvMesh::defaultRegion)
|
||||
|
||||
Info<< " Writing data to " << vtkFile.path() << endl;
|
||||
|
||||
scalarFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
scalarNames_,
|
||||
scalarValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
|
||||
// Convert vector values
|
||||
|
||||
if (allVectors_.size() > 0)
|
||||
{
|
||||
List<List<vectorField>> vectorValues(allVectors_.size());
|
||||
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
vtkPath = vtkPath/mesh.name();
|
||||
}
|
||||
vtkPath = vtkPath/mesh.time().timeName();
|
||||
DynamicList<vectorList>& allTrackVals =
|
||||
allVectors_[vectorI];
|
||||
vectorValues[vectorI].setSize(allTrackVals.size());
|
||||
|
||||
mkDir(vtkPath);
|
||||
|
||||
// Convert track positions
|
||||
|
||||
PtrList<coordSet> tracks(allTracks_.size());
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
tracks.set
|
||||
(
|
||||
trackI,
|
||||
new coordSet
|
||||
(
|
||||
"track" + Foam::name(trackI),
|
||||
sampledSetAxis_ //"xyz"
|
||||
)
|
||||
);
|
||||
tracks[trackI].transfer(allTracks_[trackI]);
|
||||
}
|
||||
|
||||
// Convert scalar values
|
||||
|
||||
if (allScalars_.size() > 0)
|
||||
{
|
||||
List<List<scalarField>> scalarValues(allScalars_.size());
|
||||
|
||||
forAll(allScalars_, scalarI)
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
DynamicList<scalarList>& allTrackVals =
|
||||
allScalars_[scalarI];
|
||||
scalarValues[scalarI].setSize(allTrackVals.size());
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
scalarList& trackVals = allTrackVals[trackI];
|
||||
scalarValues[scalarI][trackI].transfer(trackVals);
|
||||
}
|
||||
vectorList& trackVals = allTrackVals[trackI];
|
||||
vectorValues[vectorI][trackI].transfer(trackVals);
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
(
|
||||
vtkPath
|
||||
/ scalarFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
scalarNames_
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Writing data to " << vtkFile.path() << endl;
|
||||
|
||||
scalarFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
scalarNames_,
|
||||
scalarValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
|
||||
// Convert vector values
|
||||
|
||||
if (allVectors_.size() > 0)
|
||||
{
|
||||
List<List<vectorField>> vectorValues(allVectors_.size());
|
||||
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
DynamicList<vectorList>& allTrackVals =
|
||||
allVectors_[vectorI];
|
||||
vectorValues[vectorI].setSize(allTrackVals.size());
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
vectorList& trackVals = allTrackVals[trackI];
|
||||
vectorValues[vectorI][trackI].transfer(trackVals);
|
||||
}
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
fileName vtkFile
|
||||
(
|
||||
vtkPath
|
||||
/ vectorFormatterPtr_().getFileName
|
||||
(
|
||||
vtkPath
|
||||
/ vectorFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
vectorNames_
|
||||
)
|
||||
);
|
||||
tracks[0],
|
||||
vectorNames_
|
||||
)
|
||||
);
|
||||
|
||||
//Info<< " Writing vector data to " << vtkFile << endl;
|
||||
|
||||
vectorFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
vectorNames_,
|
||||
vectorValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
vectorFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
vectorNames_,
|
||||
vectorValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::updateMesh(const mapPolyMesh&)
|
||||
void Foam::functionObjects::streamLine::updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::movePoints(const polyMesh&)
|
||||
void Foam::functionObjects::streamLine::movePoints(const polyMesh&)
|
||||
{
|
||||
// Moving mesh affects the search tree
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
//void Foam::streamLine::readUpdate(const polyMesh::readUpdateState state)
|
||||
//{
|
||||
// if (state != UNCHANGED)
|
||||
// {
|
||||
// read(dict_);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::streamLine
|
||||
Foam::functionObjects::streamLine
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
@ -125,6 +125,9 @@ class mapPolyMesh;
|
||||
class meshSearch;
|
||||
class sampledSet;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class streamLine Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -145,9 +148,6 @@ class streamLine
|
||||
//- Load fields from files (not from objectRegistry)
|
||||
bool loadFromFiles_;
|
||||
|
||||
//- On/off switch
|
||||
bool active_;
|
||||
|
||||
//- List of fields to sample
|
||||
wordList fields_;
|
||||
|
||||
@ -182,7 +182,6 @@ class streamLine
|
||||
wordList vectorNames_;
|
||||
|
||||
|
||||
|
||||
// Demand driven
|
||||
|
||||
//- Mesh searching enigne
|
||||
@ -244,6 +243,16 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~streamLine();
|
||||
@ -277,14 +286,12 @@ public:
|
||||
|
||||
//- Update for mesh point-motion
|
||||
virtual void movePoints(const polyMesh&);
|
||||
|
||||
////- Update for changes of mesh due to readUpdate
|
||||
//virtual void readUpdate(const polyMesh::readUpdateState state);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<streamLine>
|
||||
typedef OutputFilterFunctionObject<functionObjects::streamLine>
|
||||
streamLineFunctionObject;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,14 +28,17 @@ License
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(surfaceInterpolateFields, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfaceInterpolateFields::surfaceInterpolateFields
|
||||
Foam::functionObjects::surfaceInterpolateFields::surfaceInterpolateFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -45,109 +48,99 @@ Foam::surfaceInterpolateFields::surfaceInterpolateFields
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldSet_()
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_
|
||||
<< endl;
|
||||
}
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::surfaceInterpolateFields::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfaceInterpolateFields::~surfaceInterpolateFields()
|
||||
Foam::functionObjects::surfaceInterpolateFields::~surfaceInterpolateFields()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::surfaceInterpolateFields::read(const dictionary& dict)
|
||||
void Foam::functionObjects::surfaceInterpolateFields::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
if (active_)
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::surfaceInterpolateFields::execute()
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
// Clear out any previously loaded fields
|
||||
ssf_.clear();
|
||||
svf_.clear();
|
||||
sSpheretf_.clear();
|
||||
sSymmtf_.clear();
|
||||
stf_.clear();
|
||||
|
||||
interpolateFields<scalar>(ssf_);
|
||||
interpolateFields<vector>(svf_);
|
||||
interpolateFields<sphericalTensor>(sSpheretf_);
|
||||
interpolateFields<symmTensor>(sSymmtf_);
|
||||
interpolateFields<tensor>(stf_);
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::surfaceInterpolateFields::end()
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::surfaceInterpolateFields::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::surfaceInterpolateFields::write()
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
Info<< " Writing interpolated surface fields to "
|
||||
<< obr_.time().timeName() << endl;
|
||||
|
||||
forAll(ssf_, i)
|
||||
{
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
ssf_[i].write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::surfaceInterpolateFields::execute()
|
||||
{
|
||||
if (active_)
|
||||
forAll(svf_, i)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
// Clear out any previously loaded fields
|
||||
ssf_.clear();
|
||||
svf_.clear();
|
||||
sSpheretf_.clear();
|
||||
sSymmtf_.clear();
|
||||
stf_.clear();
|
||||
|
||||
interpolateFields<scalar>(ssf_);
|
||||
interpolateFields<vector>(svf_);
|
||||
interpolateFields<sphericalTensor>(sSpheretf_);
|
||||
interpolateFields<symmTensor>(sSymmtf_);
|
||||
interpolateFields<tensor>(stf_);
|
||||
|
||||
Info<< endl;
|
||||
svf_[i].write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::surfaceInterpolateFields::end()
|
||||
{
|
||||
if (active_)
|
||||
forAll(sSpheretf_, i)
|
||||
{
|
||||
execute();
|
||||
sSpheretf_[i].write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::surfaceInterpolateFields::timeSet()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::surfaceInterpolateFields::write()
|
||||
{
|
||||
if (active_)
|
||||
forAll(sSymmtf_, i)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
|
||||
Info<< " Writing interpolated surface fields to "
|
||||
<< obr_.time().timeName() << endl;
|
||||
|
||||
forAll(ssf_, i)
|
||||
{
|
||||
ssf_[i].write();
|
||||
}
|
||||
forAll(svf_, i)
|
||||
{
|
||||
svf_[i].write();
|
||||
}
|
||||
forAll(sSpheretf_, i)
|
||||
{
|
||||
sSpheretf_[i].write();
|
||||
}
|
||||
forAll(sSymmtf_, i)
|
||||
{
|
||||
sSymmtf_[i].write();
|
||||
}
|
||||
forAll(stf_, i)
|
||||
{
|
||||
stf_[i].write();
|
||||
}
|
||||
sSymmtf_[i].write();
|
||||
}
|
||||
forAll(stf_, i)
|
||||
{
|
||||
stf_[i].write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -84,6 +84,9 @@ class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class surfaceInterpolateFields Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -99,9 +102,6 @@ protected:
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
//- Fields to process
|
||||
//wordList fieldSet_;
|
||||
List<Tuple2<word, word>> fieldSet_;
|
||||
@ -152,6 +152,16 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~surfaceInterpolateFields();
|
||||
@ -192,6 +202,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,8 +43,10 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<surfaceInterpolateFields>
|
||||
surfaceInterpolateFieldsFunctionObject;
|
||||
typedef OutputFilterFunctionObject
|
||||
<
|
||||
functionObjects::surfaceInterpolateFields
|
||||
> surfaceInterpolateFieldsFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -30,7 +30,7 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::surfaceInterpolateFields::interpolateFields
|
||||
void Foam::functionObjects::surfaceInterpolateFields::interpolateFields
|
||||
(
|
||||
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& sflds
|
||||
) const
|
||||
|
||||
@ -42,14 +42,17 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(wallBoundedStreamLine, 0);
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(wallBoundedStreamLine, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::indirectPrimitivePatch>
|
||||
Foam::wallBoundedStreamLine::wallPatch() const
|
||||
Foam::functionObjects::wallBoundedStreamLine::wallPatch() const
|
||||
{
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
@ -99,7 +102,7 @@ Foam::wallBoundedStreamLine::wallPatch() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tetIndices Foam::wallBoundedStreamLine::findNearestTet
|
||||
Foam::tetIndices Foam::functionObjects::wallBoundedStreamLine::findNearestTet
|
||||
(
|
||||
const PackedBoolList& isWallPatch,
|
||||
const point& seedPt,
|
||||
@ -156,7 +159,7 @@ Foam::tetIndices Foam::wallBoundedStreamLine::findNearestTet
|
||||
}
|
||||
|
||||
|
||||
void Foam::wallBoundedStreamLine::track()
|
||||
void Foam::functionObjects::wallBoundedStreamLine::track()
|
||||
{
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
@ -432,7 +435,7 @@ void Foam::wallBoundedStreamLine::track()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::wallBoundedStreamLine::wallBoundedStreamLine
|
||||
Foam::functionObjects::wallBoundedStreamLine::wallBoundedStreamLine
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -443,180 +446,175 @@ Foam::wallBoundedStreamLine::wallBoundedStreamLine
|
||||
dict_(dict),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
loadFromFiles_(loadFromFiles),
|
||||
active_(true)
|
||||
loadFromFiles_(loadFromFiles)
|
||||
{
|
||||
// Only active if a fvMesh is available
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict_);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_
|
||||
<< nl << endl;
|
||||
}
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::wallBoundedStreamLine::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::wallBoundedStreamLine::~wallBoundedStreamLine()
|
||||
Foam::functionObjects::wallBoundedStreamLine::~wallBoundedStreamLine()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::wallBoundedStreamLine::read(const dictionary& dict)
|
||||
void Foam::functionObjects::wallBoundedStreamLine::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
//dict_ = dict;
|
||||
dict.lookup("fields") >> fields_;
|
||||
if (dict.found("UName"))
|
||||
{
|
||||
//dict_ = dict;
|
||||
dict.lookup("fields") >> fields_;
|
||||
if (dict.found("UName"))
|
||||
dict.lookup("UName") >> UName_;
|
||||
}
|
||||
else
|
||||
{
|
||||
UName_ = "U";
|
||||
if (dict.found("U"))
|
||||
{
|
||||
dict.lookup("UName") >> UName_;
|
||||
}
|
||||
else
|
||||
{
|
||||
UName_ = "U";
|
||||
if (dict.found("U"))
|
||||
{
|
||||
IOWarningInFunction
|
||||
(
|
||||
dict
|
||||
) << "Using deprecated entry \"U\"."
|
||||
<< " Please use \"UName\" instead."
|
||||
<< endl;
|
||||
dict.lookup("U") >> UName_;
|
||||
}
|
||||
}
|
||||
|
||||
if (findIndex(fields_, UName_) == -1)
|
||||
{
|
||||
FatalIOErrorInFunction
|
||||
IOWarningInFunction
|
||||
(
|
||||
dict
|
||||
) << "Velocity field for tracking " << UName_
|
||||
<< " should be present in the list of fields " << fields_
|
||||
<< exit(FatalIOError);
|
||||
) << "Using deprecated entry \"U\"."
|
||||
<< " Please use \"UName\" instead."
|
||||
<< endl;
|
||||
dict.lookup("U") >> UName_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dict.lookup("trackForward") >> trackForward_;
|
||||
dict.lookup("lifeTime") >> lifeTime_;
|
||||
if (lifeTime_ < 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal value " << lifeTime_ << " for lifeTime"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
trackLength_ = VGREAT;
|
||||
if (dict.found("trackLength"))
|
||||
{
|
||||
dict.lookup("trackLength") >> trackLength_;
|
||||
|
||||
Info<< type() << " : fixed track length specified : "
|
||||
<< trackLength_ << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
interpolationScheme_ = dict.lookupOrDefault
|
||||
if (findIndex(fields_, UName_) == -1)
|
||||
{
|
||||
FatalIOErrorInFunction
|
||||
(
|
||||
"interpolationScheme",
|
||||
interpolationCellPoint<scalar>::typeName
|
||||
);
|
||||
dict
|
||||
) << "Velocity field for tracking " << UName_
|
||||
<< " should be present in the list of fields " << fields_
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
//Info<< typeName << " using interpolation " << interpolationScheme_
|
||||
// << endl;
|
||||
|
||||
cloudName_ = dict.lookupOrDefault<word>
|
||||
dict.lookup("trackForward") >> trackForward_;
|
||||
dict.lookup("lifeTime") >> lifeTime_;
|
||||
if (lifeTime_ < 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal value " << lifeTime_ << " for lifeTime"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
trackLength_ = VGREAT;
|
||||
if (dict.found("trackLength"))
|
||||
{
|
||||
dict.lookup("trackLength") >> trackLength_;
|
||||
|
||||
Info<< type() << " : fixed track length specified : "
|
||||
<< trackLength_ << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
interpolationScheme_ = dict.lookupOrDefault
|
||||
(
|
||||
"interpolationScheme",
|
||||
interpolationCellPoint<scalar>::typeName
|
||||
);
|
||||
|
||||
cloudName_ = dict.lookupOrDefault<word>
|
||||
(
|
||||
"cloudName",
|
||||
"wallBoundedStreamLine"
|
||||
);
|
||||
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),
|
||||
coeffsDict
|
||||
);
|
||||
coeffsDict.lookup("axis") >> sampledSetAxis_;
|
||||
|
||||
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
|
||||
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
|
||||
|
||||
|
||||
// Make sure that the mesh is trackable
|
||||
if (debug)
|
||||
{
|
||||
// 1. positive volume decomposition tets
|
||||
faceSet faces(mesh, "lowQualityTetFaces", mesh.nFaces()/100+1);
|
||||
if
|
||||
(
|
||||
"cloudName",
|
||||
"wallBoundedStreamLine"
|
||||
);
|
||||
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),
|
||||
coeffsDict
|
||||
);
|
||||
coeffsDict.lookup("axis") >> sampledSetAxis_;
|
||||
|
||||
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
|
||||
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
|
||||
|
||||
|
||||
// Make sure that the mesh is trackable
|
||||
if (debug)
|
||||
{
|
||||
// 1. positive volume decomposition tets
|
||||
faceSet faces(mesh, "lowQualityTetFaces", mesh.nFaces()/100+1);
|
||||
if
|
||||
polyMeshTetDecomposition::checkFaceTets
|
||||
(
|
||||
polyMeshTetDecomposition::checkFaceTets
|
||||
(
|
||||
mesh,
|
||||
polyMeshTetDecomposition::minTetQuality,
|
||||
true,
|
||||
&faces
|
||||
)
|
||||
mesh,
|
||||
polyMeshTetDecomposition::minTetQuality,
|
||||
true,
|
||||
&faces
|
||||
)
|
||||
)
|
||||
{
|
||||
label nFaces = returnReduce(faces.size(), sumOp<label>());
|
||||
|
||||
WarningInFunction
|
||||
<< "Found " << nFaces
|
||||
<<" faces with low quality or negative volume "
|
||||
<< "decomposition tets. Writing to faceSet " << faces.name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// 2. all edges on a cell having two faces
|
||||
EdgeMap<label> numFacesPerEdge;
|
||||
forAll(mesh.cells(), celli)
|
||||
{
|
||||
const cell& cFaces = mesh.cells()[celli];
|
||||
|
||||
numFacesPerEdge.clear();
|
||||
|
||||
forAll(cFaces, cFacei)
|
||||
{
|
||||
label nFaces = returnReduce(faces.size(), sumOp<label>());
|
||||
|
||||
WarningInFunction
|
||||
<< "Found " << nFaces
|
||||
<<" faces with low quality or negative volume "
|
||||
<< "decomposition tets. Writing to faceSet " << faces.name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// 2. all edges on a cell having two faces
|
||||
EdgeMap<label> numFacesPerEdge;
|
||||
forAll(mesh.cells(), celli)
|
||||
{
|
||||
const cell& cFaces = mesh.cells()[celli];
|
||||
|
||||
numFacesPerEdge.clear();
|
||||
|
||||
forAll(cFaces, cFacei)
|
||||
label facei = cFaces[cFacei];
|
||||
const face& f = mesh.faces()[facei];
|
||||
forAll(f, fp)
|
||||
{
|
||||
label facei = cFaces[cFacei];
|
||||
const face& f = mesh.faces()[facei];
|
||||
forAll(f, fp)
|
||||
const edge e(f[fp], f.nextLabel(fp));
|
||||
EdgeMap<label>::iterator eFnd =
|
||||
numFacesPerEdge.find(e);
|
||||
if (eFnd != numFacesPerEdge.end())
|
||||
{
|
||||
const edge e(f[fp], f.nextLabel(fp));
|
||||
EdgeMap<label>::iterator eFnd =
|
||||
numFacesPerEdge.find(e);
|
||||
if (eFnd != numFacesPerEdge.end())
|
||||
{
|
||||
eFnd()++;
|
||||
}
|
||||
else
|
||||
{
|
||||
numFacesPerEdge.insert(e, 1);
|
||||
}
|
||||
eFnd()++;
|
||||
}
|
||||
else
|
||||
{
|
||||
numFacesPerEdge.insert(e, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
forAllConstIter(EdgeMap<label>, numFacesPerEdge, iter)
|
||||
forAllConstIter(EdgeMap<label>, numFacesPerEdge, iter)
|
||||
{
|
||||
if (iter() != 2)
|
||||
{
|
||||
if (iter() != 2)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "problem cell:" << celli
|
||||
<< abort(FatalError);
|
||||
}
|
||||
FatalErrorInFunction
|
||||
<< "problem cell:" << celli
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -624,75 +622,86 @@ void Foam::wallBoundedStreamLine::read(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::wallBoundedStreamLine::execute()
|
||||
void Foam::functionObjects::wallBoundedStreamLine::execute()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::wallBoundedStreamLine::end()
|
||||
void Foam::functionObjects::wallBoundedStreamLine::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::wallBoundedStreamLine::timeSet()
|
||||
void Foam::functionObjects::wallBoundedStreamLine::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::wallBoundedStreamLine::write()
|
||||
void Foam::functionObjects::wallBoundedStreamLine::write()
|
||||
{
|
||||
if (active_)
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
|
||||
// Do all injection and tracking
|
||||
track();
|
||||
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
// Append slave tracks to master ones
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
globalIndex globalTrackIDs(allTracks_.size());
|
||||
|
||||
// Do all injection and tracking
|
||||
track();
|
||||
// Construct a distribution map to pull all to the master.
|
||||
labelListList sendMap(Pstream::nProcs());
|
||||
labelListList recvMap(Pstream::nProcs());
|
||||
|
||||
|
||||
if (Pstream::parRun())
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Append slave tracks to master ones
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Master: receive all. My own first, then consecutive
|
||||
// processors.
|
||||
label trackI = 0;
|
||||
|
||||
globalIndex globalTrackIDs(allTracks_.size());
|
||||
|
||||
// Construct a distribution map to pull all to the master.
|
||||
labelListList sendMap(Pstream::nProcs());
|
||||
labelListList recvMap(Pstream::nProcs());
|
||||
|
||||
if (Pstream::master())
|
||||
forAll(recvMap, proci)
|
||||
{
|
||||
// Master: receive all. My own first, then consecutive
|
||||
// processors.
|
||||
label trackI = 0;
|
||||
|
||||
forAll(recvMap, proci)
|
||||
labelList& fromProc = recvMap[proci];
|
||||
fromProc.setSize(globalTrackIDs.localSize(proci));
|
||||
forAll(fromProc, i)
|
||||
{
|
||||
labelList& fromProc = recvMap[proci];
|
||||
fromProc.setSize(globalTrackIDs.localSize(proci));
|
||||
forAll(fromProc, i)
|
||||
{
|
||||
fromProc[i] = trackI++;
|
||||
}
|
||||
fromProc[i] = trackI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
labelList& toMaster = sendMap[0];
|
||||
toMaster.setSize(globalTrackIDs.localSize());
|
||||
forAll(toMaster, i)
|
||||
{
|
||||
toMaster[i] = i;
|
||||
}
|
||||
labelList& toMaster = sendMap[0];
|
||||
toMaster.setSize(globalTrackIDs.localSize());
|
||||
forAll(toMaster, i)
|
||||
{
|
||||
toMaster[i] = i;
|
||||
}
|
||||
|
||||
const mapDistribute distMap
|
||||
(
|
||||
globalTrackIDs.size(),
|
||||
sendMap.xfer(),
|
||||
recvMap.xfer()
|
||||
);
|
||||
const mapDistribute distMap
|
||||
(
|
||||
globalTrackIDs.size(),
|
||||
sendMap.xfer(),
|
||||
recvMap.xfer()
|
||||
);
|
||||
|
||||
|
||||
// Distribute the track positions. Note: use scheduled comms
|
||||
// to prevent buffering.
|
||||
// Distribute the track positions. Note: use scheduled comms
|
||||
// to prevent buffering.
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allTracks_
|
||||
);
|
||||
|
||||
// Distribute the scalars
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
@ -700,193 +709,170 @@ void Foam::wallBoundedStreamLine::write()
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allTracks_
|
||||
allScalars_[scalarI]
|
||||
);
|
||||
|
||||
// Distribute the scalars
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allScalars_[scalarI]
|
||||
);
|
||||
}
|
||||
// Distribute the vectors
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allVectors_[vectorI]
|
||||
);
|
||||
}
|
||||
}
|
||||
// Distribute the vectors
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allVectors_[vectorI]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
label n = 0;
|
||||
label n = 0;
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
n += allTracks_[trackI].size();
|
||||
}
|
||||
|
||||
Info<< " Tracks:" << allTracks_.size() << nl
|
||||
<< " Total samples:" << n << endl;
|
||||
|
||||
|
||||
// Massage into form suitable for writers
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (Pstream::master() && allTracks_.size())
|
||||
{
|
||||
// Make output directory
|
||||
|
||||
fileName vtkPath
|
||||
(
|
||||
Pstream::parRun()
|
||||
? runTime.path()/".."/"postProcessing"/"sets"/name()
|
||||
: runTime.path()/"postProcessing"/"sets"/name()
|
||||
);
|
||||
if (mesh.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
vtkPath = vtkPath/mesh.name();
|
||||
}
|
||||
vtkPath = vtkPath/mesh.time().timeName();
|
||||
|
||||
mkDir(vtkPath);
|
||||
|
||||
// Convert track positions
|
||||
|
||||
PtrList<coordSet> tracks(allTracks_.size());
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
n += allTracks_[trackI].size();
|
||||
tracks.set
|
||||
(
|
||||
trackI,
|
||||
new coordSet
|
||||
(
|
||||
"track" + Foam::name(trackI),
|
||||
sampledSetAxis_ //"xyz"
|
||||
)
|
||||
);
|
||||
tracks[trackI].transfer(allTracks_[trackI]);
|
||||
}
|
||||
|
||||
Info<< " Tracks:" << allTracks_.size() << nl
|
||||
<< " Total samples:" << n << endl;
|
||||
// Convert scalar values
|
||||
|
||||
|
||||
// Massage into form suitable for writers
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (Pstream::master() && allTracks_.size())
|
||||
if (allScalars_.size() > 0)
|
||||
{
|
||||
// Make output directory
|
||||
List<List<scalarField>> scalarValues(allScalars_.size());
|
||||
|
||||
fileName vtkPath
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
DynamicList<scalarList>& allTrackVals =
|
||||
allScalars_[scalarI];
|
||||
scalarValues[scalarI].setSize(allTrackVals.size());
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
scalarList& trackVals = allTrackVals[trackI];
|
||||
scalarValues[scalarI][trackI].transfer(trackVals);
|
||||
}
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
(
|
||||
Pstream::parRun()
|
||||
? runTime.path()/".."/"postProcessing"/"sets"/name()
|
||||
: runTime.path()/"postProcessing"/"sets"/name()
|
||||
vtkPath
|
||||
/ scalarFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
scalarNames_
|
||||
)
|
||||
);
|
||||
if (mesh.name() != fvMesh::defaultRegion)
|
||||
|
||||
Info<< "Writing data to " << vtkFile.path() << endl;
|
||||
|
||||
scalarFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
scalarNames_,
|
||||
scalarValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
|
||||
// Convert vector values
|
||||
|
||||
if (allVectors_.size() > 0)
|
||||
{
|
||||
List<List<vectorField>> vectorValues(allVectors_.size());
|
||||
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
vtkPath = vtkPath/mesh.name();
|
||||
}
|
||||
vtkPath = vtkPath/mesh.time().timeName();
|
||||
DynamicList<vectorList>& allTrackVals =
|
||||
allVectors_[vectorI];
|
||||
vectorValues[vectorI].setSize(allTrackVals.size());
|
||||
|
||||
mkDir(vtkPath);
|
||||
|
||||
// Convert track positions
|
||||
|
||||
PtrList<coordSet> tracks(allTracks_.size());
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
tracks.set
|
||||
(
|
||||
trackI,
|
||||
new coordSet
|
||||
(
|
||||
"track" + Foam::name(trackI),
|
||||
sampledSetAxis_ //"xyz"
|
||||
)
|
||||
);
|
||||
tracks[trackI].transfer(allTracks_[trackI]);
|
||||
}
|
||||
|
||||
// Convert scalar values
|
||||
|
||||
if (allScalars_.size() > 0)
|
||||
{
|
||||
List<List<scalarField>> scalarValues(allScalars_.size());
|
||||
|
||||
forAll(allScalars_, scalarI)
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
DynamicList<scalarList>& allTrackVals =
|
||||
allScalars_[scalarI];
|
||||
scalarValues[scalarI].setSize(allTrackVals.size());
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
scalarList& trackVals = allTrackVals[trackI];
|
||||
scalarValues[scalarI][trackI].transfer(trackVals);
|
||||
}
|
||||
vectorList& trackVals = allTrackVals[trackI];
|
||||
vectorValues[vectorI][trackI].transfer(trackVals);
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
(
|
||||
vtkPath
|
||||
/ scalarFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
scalarNames_
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Writing data to " << vtkFile.path() << endl;
|
||||
|
||||
scalarFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
scalarNames_,
|
||||
scalarValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
|
||||
// Convert vector values
|
||||
|
||||
if (allVectors_.size() > 0)
|
||||
{
|
||||
List<List<vectorField>> vectorValues(allVectors_.size());
|
||||
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
DynamicList<vectorList>& allTrackVals =
|
||||
allVectors_[vectorI];
|
||||
vectorValues[vectorI].setSize(allTrackVals.size());
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
vectorList& trackVals = allTrackVals[trackI];
|
||||
vectorValues[vectorI][trackI].transfer(trackVals);
|
||||
}
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
fileName vtkFile
|
||||
(
|
||||
vtkPath
|
||||
/ vectorFormatterPtr_().getFileName
|
||||
(
|
||||
vtkPath
|
||||
/ vectorFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
vectorNames_
|
||||
)
|
||||
);
|
||||
tracks[0],
|
||||
vectorNames_
|
||||
)
|
||||
);
|
||||
|
||||
//Info<< "Writing vector data to " << vtkFile << endl;
|
||||
|
||||
vectorFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
vectorNames_,
|
||||
vectorValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
vectorFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
vectorNames_,
|
||||
vectorValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::wallBoundedStreamLine::updateMesh(const mapPolyMesh&)
|
||||
void Foam::functionObjects::wallBoundedStreamLine::updateMesh
|
||||
(
|
||||
const mapPolyMesh&
|
||||
)
|
||||
{
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::wallBoundedStreamLine::movePoints(const polyMesh&)
|
||||
void Foam::functionObjects::wallBoundedStreamLine::movePoints(const polyMesh&)
|
||||
{
|
||||
// Moving mesh affects the search tree
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
//void Foam::wallBoundedStreamLine::readUpdate
|
||||
//(const polyMesh::readUpdateState state)
|
||||
//{
|
||||
// if (state != UNCHANGED)
|
||||
// {
|
||||
// read(dict_);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::wallBoundedStreamLine
|
||||
Foam::functionObjects::wallBoundedStreamLine
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
@ -127,6 +127,9 @@ class mapPolyMesh;
|
||||
class meshSearch;
|
||||
class sampledSet;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class wallBoundedStreamLine Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -147,10 +150,6 @@ class wallBoundedStreamLine
|
||||
//- Load fields from files (not from objectRegistry)
|
||||
bool loadFromFiles_;
|
||||
|
||||
//- On/off switch
|
||||
bool active_;
|
||||
|
||||
|
||||
//- List of fields to sample
|
||||
wordList fields_;
|
||||
|
||||
@ -250,6 +249,16 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~wallBoundedStreamLine();
|
||||
@ -283,14 +292,12 @@ public:
|
||||
|
||||
//- Update for mesh point-motion
|
||||
virtual void movePoints(const polyMesh&);
|
||||
|
||||
////- Update for changes of mesh due to readUpdate
|
||||
//virtual void readUpdate(const polyMesh::readUpdateState state);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,7 +44,7 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<wallBoundedStreamLine>
|
||||
typedef OutputFilterFunctionObject<functionObjects::wallBoundedStreamLine>
|
||||
wallBoundedStreamLineFunctionObject;
|
||||
}
|
||||
|
||||
|
||||
@ -140,13 +140,11 @@ Foam::functionObjects::forceCoeffs::forceCoeffs
|
||||
Aref_(0.0)
|
||||
{
|
||||
read(dict);
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::functionObjects::forceCoeffs>
|
||||
Foam::functionObjects::forceCoeffs::New
|
||||
bool Foam::functionObjects::forceCoeffs::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -154,17 +152,8 @@ Foam::functionObjects::forceCoeffs::New
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
if (isA<fvMesh>(obr))
|
||||
{
|
||||
return autoPtr<forceCoeffs>
|
||||
(
|
||||
new forceCoeffs(name, obr, dict, loadFromFiles)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return autoPtr<forceCoeffs>();
|
||||
}
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
@ -178,22 +167,19 @@ Foam::functionObjects::forceCoeffs::~forceCoeffs()
|
||||
|
||||
void Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
forces::read(dict);
|
||||
forces::read(dict);
|
||||
|
||||
// Directions for lift and drag forces, and pitch moment
|
||||
dict.lookup("liftDir") >> liftDir_;
|
||||
dict.lookup("dragDir") >> dragDir_;
|
||||
dict.lookup("pitchAxis") >> pitchAxis_;
|
||||
// Directions for lift and drag forces, and pitch moment
|
||||
dict.lookup("liftDir") >> liftDir_;
|
||||
dict.lookup("dragDir") >> dragDir_;
|
||||
dict.lookup("pitchAxis") >> pitchAxis_;
|
||||
|
||||
// Free stream velocity magnitude
|
||||
dict.lookup("magUInf") >> magUInf_;
|
||||
// Free stream velocity magnitude
|
||||
dict.lookup("magUInf") >> magUInf_;
|
||||
|
||||
// Reference length and area scales
|
||||
dict.lookup("lRef") >> lRef_;
|
||||
dict.lookup("Aref") >> Aref_;
|
||||
}
|
||||
// Reference length and area scales
|
||||
dict.lookup("lRef") >> lRef_;
|
||||
dict.lookup("Aref") >> Aref_;
|
||||
}
|
||||
|
||||
|
||||
@ -213,11 +199,6 @@ void Foam::functionObjects::forceCoeffs::write()
|
||||
{
|
||||
forces::calcForcesMoment();
|
||||
|
||||
if (!active_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
functionObjectFiles::write();
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::forceCoeffs
|
||||
Foam::functionObjects::forceCoeffs
|
||||
|
||||
Group
|
||||
grpForcesFunctionObjects
|
||||
@ -172,9 +172,9 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Construct on free-store and return pointer if successful
|
||||
// otherwise return a null-pointer
|
||||
static autoPtr<forceCoeffs> New
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
|
||||
@ -161,7 +161,7 @@ void Foam::functionObjects::forces::writeFileHeader(const label i)
|
||||
|
||||
void Foam::functionObjects::forces::initialise()
|
||||
{
|
||||
if (initialised_ || !active_)
|
||||
if (initialised_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -170,11 +170,9 @@ void Foam::functionObjects::forces::initialise()
|
||||
{
|
||||
if (!obr_.foundObject<volVectorField>(fDName_))
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "Could not find " << fDName_ << " in database." << nl
|
||||
<< " De-activating forces."
|
||||
<< endl;
|
||||
FatalErrorInFunction
|
||||
<< "Could not find " << fDName_ << " in database."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -189,10 +187,9 @@ void Foam::functionObjects::forces::initialise()
|
||||
)
|
||||
)
|
||||
{
|
||||
active_ = false;
|
||||
|
||||
WarningInFunction
|
||||
<< "Could not find " << UName_ << ", " << pName_;
|
||||
FatalErrorInFunction
|
||||
<< "Could not find " << UName_ << ", " << pName_
|
||||
<< exit(FatalError);
|
||||
|
||||
if (rhoName_ != "rhoInf")
|
||||
{
|
||||
@ -534,7 +531,6 @@ Foam::functionObjects::forces::forces
|
||||
functionObjectFiles(obr, name, createFileNames(dict)),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
log_(true),
|
||||
force_(3),
|
||||
moment_(3),
|
||||
@ -557,28 +553,15 @@ Foam::functionObjects::forces::forces
|
||||
binCumulative_(true),
|
||||
initialised_(false)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (isA<fvMesh>(obr_))
|
||||
if (readFields)
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
read(dict);
|
||||
Info<< endl;
|
||||
}
|
||||
read(dict);
|
||||
Info<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating " << name_
|
||||
<< endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::functionObjects::forces>
|
||||
Foam::functionObjects::forces::New
|
||||
bool Foam::functionObjects::forces::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -586,17 +569,8 @@ Foam::functionObjects::forces::New
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
if (isA<fvMesh>(obr))
|
||||
{
|
||||
return autoPtr<forces>
|
||||
(
|
||||
new forces(name, obr, dict, loadFromFiles)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return autoPtr<forces>();
|
||||
}
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
@ -616,7 +590,6 @@ Foam::functionObjects::forces::forces
|
||||
functionObjectFiles(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
log_(true),
|
||||
force_(3),
|
||||
moment_(3),
|
||||
@ -657,134 +630,131 @@ Foam::functionObjects::forces::~forces()
|
||||
|
||||
void Foam::functionObjects::forces::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
initialised_ = false;
|
||||
|
||||
log_ = dict.lookupOrDefault<Switch>("log", false);
|
||||
|
||||
if (log_) Info<< type() << " " << name_ << ":" << nl;
|
||||
|
||||
directForceDensity_ = dict.lookupOrDefault("directForceDensity", false);
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
|
||||
patchSet_ = pbm.patchSet(wordReList(dict.lookup("patches")));
|
||||
|
||||
if (directForceDensity_)
|
||||
{
|
||||
initialised_ = false;
|
||||
// Optional entry for fDName
|
||||
fDName_ = dict.lookupOrDefault<word>("fDName", "fD");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Optional entries U and p
|
||||
pName_ = dict.lookupOrDefault<word>("pName", "p");
|
||||
UName_ = dict.lookupOrDefault<word>("UName", "U");
|
||||
rhoName_ = dict.lookupOrDefault<word>("rhoName", "rho");
|
||||
|
||||
log_ = dict.lookupOrDefault<Switch>("log", false);
|
||||
// Reference density needed for incompressible calculations
|
||||
rhoRef_ = readScalar(dict.lookup("rhoInf"));
|
||||
|
||||
if (log_) Info<< type() << " " << name_ << ":" << nl;
|
||||
// Reference pressure, 0 by default
|
||||
pRef_ = dict.lookupOrDefault<scalar>("pRef", 0.0);
|
||||
}
|
||||
|
||||
directForceDensity_ = dict.lookupOrDefault("directForceDensity", false);
|
||||
coordSys_.clear();
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
// Centre of rotation for moment calculations
|
||||
// specified directly, from coordinate system, or implicitly (0 0 0)
|
||||
if (!dict.readIfPresent<point>("CofR", coordSys_.origin()))
|
||||
{
|
||||
coordSys_ = coordinateSystem(obr_, dict);
|
||||
localSystem_ = true;
|
||||
}
|
||||
|
||||
patchSet_ = pbm.patchSet(wordReList(dict.lookup("patches")));
|
||||
dict.readIfPresent("porosity", porosity_);
|
||||
if (porosity_)
|
||||
{
|
||||
if (log_) Info<< " Including porosity effects" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (log_) Info<< " Not including porosity effects" << endl;
|
||||
}
|
||||
|
||||
if (directForceDensity_)
|
||||
if (dict.found("binData"))
|
||||
{
|
||||
const dictionary& binDict(dict.subDict("binData"));
|
||||
binDict.lookup("nBin") >> nBin_;
|
||||
|
||||
if (nBin_ < 0)
|
||||
{
|
||||
// Optional entry for fDName
|
||||
fDName_ = dict.lookupOrDefault<word>("fDName", "fD");
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Number of bins (nBin) must be zero or greater"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else
|
||||
else if ((nBin_ == 0) || (nBin_ == 1))
|
||||
{
|
||||
// Optional entries U and p
|
||||
pName_ = dict.lookupOrDefault<word>("pName", "p");
|
||||
UName_ = dict.lookupOrDefault<word>("UName", "U");
|
||||
rhoName_ = dict.lookupOrDefault<word>("rhoName", "rho");
|
||||
|
||||
// Reference density needed for incompressible calculations
|
||||
rhoRef_ = readScalar(dict.lookup("rhoInf"));
|
||||
|
||||
// Reference pressure, 0 by default
|
||||
pRef_ = dict.lookupOrDefault<scalar>("pRef", 0.0);
|
||||
}
|
||||
|
||||
coordSys_.clear();
|
||||
|
||||
// Centre of rotation for moment calculations
|
||||
// specified directly, from coordinate system, or implicitly (0 0 0)
|
||||
if (!dict.readIfPresent<point>("CofR", coordSys_.origin()))
|
||||
{
|
||||
coordSys_ = coordinateSystem(obr_, dict);
|
||||
localSystem_ = true;
|
||||
}
|
||||
|
||||
dict.readIfPresent("porosity", porosity_);
|
||||
if (porosity_)
|
||||
{
|
||||
if (log_) Info<< " Including porosity effects" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (log_) Info<< " Not including porosity effects" << endl;
|
||||
}
|
||||
|
||||
if (dict.found("binData"))
|
||||
{
|
||||
const dictionary& binDict(dict.subDict("binData"));
|
||||
binDict.lookup("nBin") >> nBin_;
|
||||
|
||||
if (nBin_ < 0)
|
||||
nBin_ = 1;
|
||||
forAll(force_, i)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Number of bins (nBin) must be zero or greater"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else if ((nBin_ == 0) || (nBin_ == 1))
|
||||
{
|
||||
nBin_ = 1;
|
||||
forAll(force_, i)
|
||||
{
|
||||
force_[i].setSize(1);
|
||||
moment_[i].setSize(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (nBin_ > 1)
|
||||
{
|
||||
binDict.lookup("direction") >> binDir_;
|
||||
binDir_ /= mag(binDir_);
|
||||
|
||||
binMin_ = GREAT;
|
||||
scalar binMax = -GREAT;
|
||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||
{
|
||||
label patchi = iter.key();
|
||||
const polyPatch& pp = pbm[patchi];
|
||||
scalarField d(pp.faceCentres() & binDir_);
|
||||
binMin_ = min(min(d), binMin_);
|
||||
binMax = max(max(d), binMax);
|
||||
}
|
||||
reduce(binMin_, minOp<scalar>());
|
||||
reduce(binMax, maxOp<scalar>());
|
||||
|
||||
// slightly boost binMax so that region of interest is fully
|
||||
// within bounds
|
||||
binMax = 1.0001*(binMax - binMin_) + binMin_;
|
||||
|
||||
binDx_ = (binMax - binMin_)/scalar(nBin_);
|
||||
|
||||
// create the bin points used for writing
|
||||
binPoints_.setSize(nBin_);
|
||||
forAll(binPoints_, i)
|
||||
{
|
||||
binPoints_[i] = (i + 0.5)*binDir_*binDx_;
|
||||
}
|
||||
|
||||
binDict.lookup("cumulative") >> binCumulative_;
|
||||
|
||||
// allocate storage for forces and moments
|
||||
forAll(force_, i)
|
||||
{
|
||||
force_[i].setSize(nBin_);
|
||||
moment_[i].setSize(nBin_);
|
||||
}
|
||||
force_[i].setSize(1);
|
||||
moment_[i].setSize(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (nBin_ == 1)
|
||||
if (nBin_ > 1)
|
||||
{
|
||||
binDict.lookup("direction") >> binDir_;
|
||||
binDir_ /= mag(binDir_);
|
||||
|
||||
binMin_ = GREAT;
|
||||
scalar binMax = -GREAT;
|
||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||
{
|
||||
label patchi = iter.key();
|
||||
const polyPatch& pp = pbm[patchi];
|
||||
scalarField d(pp.faceCentres() & binDir_);
|
||||
binMin_ = min(min(d), binMin_);
|
||||
binMax = max(max(d), binMax);
|
||||
}
|
||||
reduce(binMin_, minOp<scalar>());
|
||||
reduce(binMax, maxOp<scalar>());
|
||||
|
||||
// slightly boost binMax so that region of interest is fully
|
||||
// within bounds
|
||||
binMax = 1.0001*(binMax - binMin_) + binMin_;
|
||||
|
||||
binDx_ = (binMax - binMin_)/scalar(nBin_);
|
||||
|
||||
// create the bin points used for writing
|
||||
binPoints_.setSize(nBin_);
|
||||
forAll(binPoints_, i)
|
||||
{
|
||||
binPoints_[i] = (i + 0.5)*binDir_*binDx_;
|
||||
}
|
||||
|
||||
binDict.lookup("cumulative") >> binCumulative_;
|
||||
|
||||
// allocate storage for forces and moments
|
||||
force_[0].setSize(1);
|
||||
force_[1].setSize(1);
|
||||
force_[2].setSize(1);
|
||||
moment_[0].setSize(1);
|
||||
moment_[1].setSize(1);
|
||||
moment_[2].setSize(1);
|
||||
forAll(force_, i)
|
||||
{
|
||||
force_[i].setSize(nBin_);
|
||||
moment_[i].setSize(nBin_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nBin_ == 1)
|
||||
{
|
||||
// allocate storage for forces and moments
|
||||
force_[0].setSize(1);
|
||||
force_[1].setSize(1);
|
||||
force_[2].setSize(1);
|
||||
moment_[0].setSize(1);
|
||||
moment_[1].setSize(1);
|
||||
moment_[2].setSize(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -804,11 +774,6 @@ void Foam::functionObjects::forces::write()
|
||||
{
|
||||
calcForcesMoment();
|
||||
|
||||
if (!active_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
functionObjectFiles::write();
|
||||
@ -826,11 +791,6 @@ void Foam::functionObjects::forces::calcForcesMoment()
|
||||
{
|
||||
initialise();
|
||||
|
||||
if (!active_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
force_[0] = Zero;
|
||||
force_[1] = Zero;
|
||||
force_[2] = Zero;
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::forces
|
||||
Foam::functionObjects::forces
|
||||
|
||||
Group
|
||||
grpForcesFunctionObjects
|
||||
@ -156,9 +156,6 @@ protected:
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- On/off switch
|
||||
bool active_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
@ -296,9 +293,9 @@ public:
|
||||
const bool readFields = true
|
||||
);
|
||||
|
||||
//- Construct on free-store and return pointer if successful
|
||||
// otherwise return a null-pointer
|
||||
static autoPtr<forces> New
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,13 +32,16 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(calcFvcDiv, 0);
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(calcFvcDiv, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::volScalarField& Foam::calcFvcDiv::divField
|
||||
Foam::volScalarField& Foam::functionObjects::calcFvcDiv::divField
|
||||
(
|
||||
const word& divName,
|
||||
const dimensionSet& dims
|
||||
@ -76,7 +79,7 @@ Foam::volScalarField& Foam::calcFvcDiv::divField
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::calcFvcDiv::calcFvcDiv
|
||||
Foam::functionObjects::calcFvcDiv::calcFvcDiv
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -86,93 +89,82 @@ Foam::calcFvcDiv::calcFvcDiv
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldName_("undefined-fieldName"),
|
||||
resultName_("undefined-resultName")
|
||||
{
|
||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating." << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::calcFvcDiv::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::calcFvcDiv::~calcFvcDiv()
|
||||
Foam::functionObjects::calcFvcDiv::~calcFvcDiv()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::calcFvcDiv::read(const dictionary& dict)
|
||||
void Foam::functionObjects::calcFvcDiv::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.lookup("resultName") >> resultName_;
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.lookup("resultName") >> resultName_;
|
||||
|
||||
if (resultName_ == "none")
|
||||
{
|
||||
resultName_ = "fvc::div(" + fieldName_ + ")";
|
||||
}
|
||||
if (resultName_ == "none")
|
||||
{
|
||||
resultName_ = "fvc::div(" + fieldName_ + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::calcFvcDiv::execute()
|
||||
void Foam::functionObjects::calcFvcDiv::execute()
|
||||
{
|
||||
if (active_)
|
||||
bool processed = false;
|
||||
|
||||
calcDiv<surfaceScalarField>(fieldName_, resultName_, processed);
|
||||
calcDiv<volVectorField>(fieldName_, resultName_, processed);
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
bool processed = false;
|
||||
|
||||
calcDiv<surfaceScalarField>(fieldName_, resultName_, processed);
|
||||
calcDiv<volVectorField>(fieldName_, resultName_, processed);
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Unprocessed field " << fieldName_ << endl;
|
||||
}
|
||||
WarningInFunction
|
||||
<< "Unprocessed field " << fieldName_ << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::calcFvcDiv::end()
|
||||
void Foam::functionObjects::calcFvcDiv::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::calcFvcDiv::timeSet()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
void Foam::functionObjects::calcFvcDiv::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::calcFvcDiv::write()
|
||||
void Foam::functionObjects::calcFvcDiv::write()
|
||||
{
|
||||
if (active_)
|
||||
if (obr_.foundObject<regIOobject>(resultName_))
|
||||
{
|
||||
if (obr_.foundObject<regIOobject>(resultName_))
|
||||
{
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(resultName_);
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(resultName_);
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
<< " writing field " << field.name() << nl << endl;
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
<< " writing field " << field.name() << nl << endl;
|
||||
|
||||
field.write();
|
||||
}
|
||||
field.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::calcFvcDiv
|
||||
Foam::functionObjects::calcFvcDiv
|
||||
|
||||
Group
|
||||
grpFVFunctionObjects
|
||||
@ -59,6 +59,9 @@ class polyMesh;
|
||||
class mapPolyMesh;
|
||||
class dimensionSet;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class calcFvcDiv Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -73,9 +76,6 @@ class calcFvcDiv
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- On/off switch
|
||||
bool active_;
|
||||
|
||||
//- Name of field to process
|
||||
word fieldName_;
|
||||
|
||||
@ -126,6 +126,16 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~calcFvcDiv();
|
||||
@ -166,6 +176,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,8 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<calcFvcDiv> calcFvcDivFunctionObject;
|
||||
typedef OutputFilterFunctionObject<functionObjects::calcFvcDiv>
|
||||
calcFvcDivFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,7 +29,7 @@ License
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class FieldType>
|
||||
void Foam::calcFvcDiv::calcDiv
|
||||
void Foam::functionObjects::calcFvcDiv::calcDiv
|
||||
(
|
||||
const word& fieldName,
|
||||
const word& resultName,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,13 +32,16 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(calcFvcGrad, 0);
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(calcFvcGrad, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::calcFvcGrad::calcFvcGrad
|
||||
Foam::functionObjects::calcFvcGrad::calcFvcGrad
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -48,93 +51,82 @@ Foam::calcFvcGrad::calcFvcGrad
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldName_("undefined-fieldName"),
|
||||
resultName_("undefined-resultName")
|
||||
{
|
||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating." << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::calcFvcGrad::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::calcFvcGrad::~calcFvcGrad()
|
||||
Foam::functionObjects::calcFvcGrad::~calcFvcGrad()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::calcFvcGrad::read(const dictionary& dict)
|
||||
void Foam::functionObjects::calcFvcGrad::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.lookup("resultName") >> resultName_;
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.lookup("resultName") >> resultName_;
|
||||
|
||||
if (resultName_ == "none")
|
||||
{
|
||||
resultName_ = "fvc::grad(" + fieldName_ + ")";
|
||||
}
|
||||
if (resultName_ == "none")
|
||||
{
|
||||
resultName_ = "fvc::grad(" + fieldName_ + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::calcFvcGrad::execute()
|
||||
void Foam::functionObjects::calcFvcGrad::execute()
|
||||
{
|
||||
if (active_)
|
||||
bool processed = false;
|
||||
|
||||
calcGrad<scalar>(fieldName_, resultName_, processed);
|
||||
calcGrad<vector>(fieldName_, resultName_, processed);
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
bool processed = false;
|
||||
|
||||
calcGrad<scalar>(fieldName_, resultName_, processed);
|
||||
calcGrad<vector>(fieldName_, resultName_, processed);
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Unprocessed field " << fieldName_ << endl;
|
||||
}
|
||||
WarningInFunction
|
||||
<< "Unprocessed field " << fieldName_ << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::calcFvcGrad::end()
|
||||
void Foam::functionObjects::calcFvcGrad::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::calcFvcGrad::timeSet()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
void Foam::functionObjects::calcFvcGrad::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::calcFvcGrad::write()
|
||||
void Foam::functionObjects::calcFvcGrad::write()
|
||||
{
|
||||
if (active_)
|
||||
if (obr_.foundObject<regIOobject>(resultName_))
|
||||
{
|
||||
if (obr_.foundObject<regIOobject>(resultName_))
|
||||
{
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(resultName_);
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(resultName_);
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
<< " writing field " << field.name() << nl << endl;
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
<< " writing field " << field.name() << nl << endl;
|
||||
|
||||
field.write();
|
||||
}
|
||||
field.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::calcFvcGrad
|
||||
Foam::functionObjects::calcFvcGrad
|
||||
|
||||
Group
|
||||
grpFVFunctionObjects
|
||||
@ -59,6 +59,9 @@ class polyMesh;
|
||||
class mapPolyMesh;
|
||||
class dimensionSet;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class calcFvcGrad Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -73,9 +76,6 @@ class calcFvcGrad
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- On/off switch
|
||||
bool active_;
|
||||
|
||||
//- Name of field to process
|
||||
word fieldName_;
|
||||
|
||||
@ -129,6 +129,16 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~calcFvcGrad();
|
||||
@ -169,6 +179,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,8 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<calcFvcGrad> calcFvcGradFunctionObject;
|
||||
typedef OutputFilterFunctionObject<functionObjects::calcFvcGrad>
|
||||
calcFvcGradFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,7 +35,11 @@ Foam::GeometricField
|
||||
Foam::fvPatchField,
|
||||
Foam::volMesh
|
||||
>&
|
||||
Foam::calcFvcGrad::gradField(const word& gradName, const dimensionSet& dims)
|
||||
Foam::functionObjects::calcFvcGrad::gradField
|
||||
(
|
||||
const word& gradName,
|
||||
const dimensionSet& dims
|
||||
)
|
||||
{
|
||||
Info<< "gradField" << endl;
|
||||
|
||||
@ -78,7 +82,7 @@ Foam::calcFvcGrad::gradField(const word& gradName, const dimensionSet& dims)
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::calcFvcGrad::calcGrad
|
||||
void Foam::functionObjects::calcFvcGrad::calcGrad
|
||||
(
|
||||
const word& fieldName,
|
||||
const word& resultName,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,13 +32,16 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(calcMag, 0);
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(calcMag, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::calcMag::calcMag
|
||||
Foam::functionObjects::calcMag::calcMag
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -48,96 +51,85 @@ Foam::calcMag::calcMag
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldName_("undefined-fieldName"),
|
||||
resultName_("undefined-resultName")
|
||||
{
|
||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
active_ = false;
|
||||
WarningInFunction
|
||||
<< "No fvMesh available, deactivating." << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::calcMag::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
// Construction is viable if the available mesh is an fvMesh
|
||||
return isA<fvMesh>(obr);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::calcMag::~calcMag()
|
||||
Foam::functionObjects::calcMag::~calcMag()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::calcMag::read(const dictionary& dict)
|
||||
void Foam::functionObjects::calcMag::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.lookup("resultName") >> resultName_;
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.lookup("resultName") >> resultName_;
|
||||
|
||||
if (resultName_ == "none")
|
||||
{
|
||||
resultName_ = "mag(" + fieldName_ + ")";
|
||||
}
|
||||
if (resultName_ == "none")
|
||||
{
|
||||
resultName_ = "mag(" + fieldName_ + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::calcMag::execute()
|
||||
void Foam::functionObjects::calcMag::execute()
|
||||
{
|
||||
if (active_)
|
||||
bool processed = false;
|
||||
|
||||
calc<scalar>(fieldName_, resultName_, processed);
|
||||
calc<vector>(fieldName_, resultName_, processed);
|
||||
calc<sphericalTensor>(fieldName_, resultName_, processed);
|
||||
calc<symmTensor>(fieldName_, resultName_, processed);
|
||||
calc<tensor>(fieldName_, resultName_, processed);
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
bool processed = false;
|
||||
|
||||
calc<scalar>(fieldName_, resultName_, processed);
|
||||
calc<vector>(fieldName_, resultName_, processed);
|
||||
calc<sphericalTensor>(fieldName_, resultName_, processed);
|
||||
calc<symmTensor>(fieldName_, resultName_, processed);
|
||||
calc<tensor>(fieldName_, resultName_, processed);
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Unprocessed field " << fieldName_ << endl;
|
||||
}
|
||||
WarningInFunction
|
||||
<< "Unprocessed field " << fieldName_ << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::calcMag::end()
|
||||
void Foam::functionObjects::calcMag::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::calcMag::timeSet()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
void Foam::functionObjects::calcMag::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::calcMag::write()
|
||||
void Foam::functionObjects::calcMag::write()
|
||||
{
|
||||
if (active_)
|
||||
if (obr_.foundObject<regIOobject>(resultName_))
|
||||
{
|
||||
if (obr_.foundObject<regIOobject>(resultName_))
|
||||
{
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(resultName_);
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(resultName_);
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
<< " writing field " << field.name() << nl << endl;
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
<< " writing field " << field.name() << nl << endl;
|
||||
|
||||
field.write();
|
||||
}
|
||||
field.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::calcMag
|
||||
Foam::functionObjects::calcMag
|
||||
|
||||
Group
|
||||
grpFVFunctionObjects
|
||||
@ -59,6 +59,9 @@ class polyMesh;
|
||||
class mapPolyMesh;
|
||||
class dimensionSet;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class calcMag Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -73,9 +76,6 @@ class calcMag
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- On/off switch
|
||||
bool active_;
|
||||
|
||||
//- Name of field to process
|
||||
word fieldName_;
|
||||
|
||||
@ -123,6 +123,16 @@ public:
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~calcMag();
|
||||
@ -163,6 +173,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,8 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<calcMag> calcMagFunctionObject;
|
||||
typedef OutputFilterFunctionObject<functionObjects::calcMag>
|
||||
calcMagFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,7 +29,7 @@ License
|
||||
#include "surfaceFields.H"
|
||||
|
||||
template<class FieldType>
|
||||
FieldType& Foam::calcMag::magField
|
||||
FieldType& Foam::functionObjects::calcMag::magField
|
||||
(
|
||||
const word& magName,
|
||||
const dimensionSet& dims
|
||||
@ -68,7 +68,7 @@ FieldType& Foam::calcMag::magField
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::calcMag::calc
|
||||
void Foam::functionObjects::calcMag::calc
|
||||
(
|
||||
const word& fieldName,
|
||||
const word& resultName,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,35 +34,34 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(abortCalculation, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::abortCalculation::actionType,
|
||||
3
|
||||
>::names[] =
|
||||
{
|
||||
"noWriteNow",
|
||||
"writeNow",
|
||||
"nextWrite"
|
||||
};
|
||||
defineTypeNameAndDebug(abortCalculation, 0);
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::abortCalculation::actionType,
|
||||
3
|
||||
>::names[] =
|
||||
{
|
||||
"noWriteNow",
|
||||
"writeNow",
|
||||
"nextWrite"
|
||||
};
|
||||
|
||||
const Foam::NamedEnum<Foam::abortCalculation::actionType, 3>
|
||||
Foam::abortCalculation::actionTypeNames_;
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::functionObjects::abortCalculation::actionType,
|
||||
3
|
||||
> Foam::functionObjects::abortCalculation::actionTypeNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::abortCalculation::removeFile() const
|
||||
void Foam::functionObjects::abortCalculation::removeFile() const
|
||||
{
|
||||
bool hasAbort = isFile(abortFile_);
|
||||
reduce(hasAbort, orOp<bool>());
|
||||
@ -77,7 +76,7 @@ void Foam::abortCalculation::removeFile() const
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::abortCalculation::abortCalculation
|
||||
Foam::functionObjects::abortCalculation::abortCalculation
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
@ -98,15 +97,28 @@ Foam::abortCalculation::abortCalculation
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::abortCalculation::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::abortCalculation::~abortCalculation()
|
||||
Foam::functionObjects::abortCalculation::~abortCalculation()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::abortCalculation::read(const dictionary& dict)
|
||||
void Foam::functionObjects::abortCalculation::read(const dictionary& dict)
|
||||
{
|
||||
if (dict.found("action"))
|
||||
{
|
||||
@ -124,7 +136,7 @@ void Foam::abortCalculation::read(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::abortCalculation::execute()
|
||||
void Foam::functionObjects::abortCalculation::execute()
|
||||
{
|
||||
bool hasAbort = isFile(abortFile_);
|
||||
reduce(hasAbort, orOp<bool>());
|
||||
@ -173,22 +185,18 @@ void Foam::abortCalculation::execute()
|
||||
}
|
||||
|
||||
|
||||
void Foam::abortCalculation::end()
|
||||
void Foam::functionObjects::abortCalculation::end()
|
||||
{
|
||||
removeFile();
|
||||
}
|
||||
|
||||
|
||||
void Foam::abortCalculation::timeSet()
|
||||
{
|
||||
// Do nothing - only valid on execute
|
||||
}
|
||||
void Foam::functionObjects::abortCalculation::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::abortCalculation::write()
|
||||
{
|
||||
// Do nothing - only valid on execute
|
||||
}
|
||||
void Foam::functionObjects::abortCalculation::write()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::abortCalculation
|
||||
Foam::functionObjects::abortCalculation
|
||||
|
||||
Group
|
||||
grpJobControlFunctionObjects
|
||||
@ -58,6 +58,9 @@ class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class abortCalculation Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -124,6 +127,16 @@ public:
|
||||
const bool loadFromFilesUnused = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~abortCalculation();
|
||||
@ -164,6 +177,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<abortCalculation>
|
||||
typedef OutputFilterFunctionObject<functionObjects::abortCalculation>
|
||||
abortCalculationFunctionObject;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,13 +31,16 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(systemCall, 0);
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(systemCall, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::systemCall::systemCall
|
||||
Foam::functionObjects::systemCall::systemCall
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
@ -54,15 +57,27 @@ Foam::systemCall::systemCall
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::systemCall::viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::systemCall::~systemCall()
|
||||
Foam::functionObjects::systemCall::~systemCall()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::systemCall::read(const dictionary& dict)
|
||||
void Foam::functionObjects::systemCall::read(const dictionary& dict)
|
||||
{
|
||||
dict.readIfPresent("executeCalls", executeCalls_);
|
||||
dict.readIfPresent("endCalls", endCalls_);
|
||||
@ -93,7 +108,7 @@ void Foam::systemCall::read(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::systemCall::execute()
|
||||
void Foam::functionObjects::systemCall::execute()
|
||||
{
|
||||
forAll(executeCalls_, callI)
|
||||
{
|
||||
@ -102,7 +117,7 @@ void Foam::systemCall::execute()
|
||||
}
|
||||
|
||||
|
||||
void Foam::systemCall::end()
|
||||
void Foam::functionObjects::systemCall::end()
|
||||
{
|
||||
forAll(endCalls_, callI)
|
||||
{
|
||||
@ -111,13 +126,11 @@ void Foam::systemCall::end()
|
||||
}
|
||||
|
||||
|
||||
void Foam::systemCall::timeSet()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
void Foam::functionObjects::systemCall::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::systemCall::write()
|
||||
void Foam::functionObjects::systemCall::write()
|
||||
{
|
||||
forAll(writeCalls_, callI)
|
||||
{
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::systemCall
|
||||
Foam::functionObjects::systemCall
|
||||
|
||||
Group
|
||||
grpFunctionObjects
|
||||
@ -100,6 +100,9 @@ class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class systemCall Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -152,6 +155,16 @@ public:
|
||||
const bool loadFromFilesUnused = false
|
||||
);
|
||||
|
||||
//- Return true if the construction of this functionObject is viable
|
||||
// i.e. the prerequisites for construction are available
|
||||
static bool viable
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~systemCall();
|
||||
@ -192,6 +205,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user