functionObjects: Added fields() function to provide list of required fields to postProcess

With this change each functionObject provides the list of fields required so
that the postProcess utility can pre-load them before executing the list of
functionObjects.  This provides a more convenient interface than using the
-field or -fields command-line options to postProcess which are now redundant.
This commit is contained in:
Henry Weller
2021-10-21 09:23:34 +01:00
parent 777e5aeece
commit c01118589f
110 changed files with 809 additions and 746 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2018-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -134,6 +134,12 @@ public:
//- Read the input data
virtual bool read(const dictionary& dict);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate the force fields
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -109,6 +109,12 @@ public:
// Member Functions
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate the force fields
virtual bool execute();

View File

@ -232,6 +232,12 @@ public:
//- Read the sizeDistribution data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Execute, currently does nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -74,6 +74,12 @@ bool Foam::functionObjects::writeVTK::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::writeVTK::fields() const
{
return objectNames_;
}
bool Foam::functionObjects::writeVTK::execute()
{
return true;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -64,7 +64,6 @@ SourceFiles
#define functionObjects_writeVTK_H
#include "fvMeshFunctionObject.H"
#include "wordReList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -84,7 +83,7 @@ class writeVTK
// Private Data
//- Names of objects
wordReList objectNames_;
wordList objectNames_;
// Private Member Functions
@ -122,6 +121,9 @@ public:
//- Read the writeVTK data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Execute, currently does nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,22 +33,11 @@ template<class GeoField>
Foam::UPtrList<const GeoField>
Foam::functionObjects::writeVTK::lookupFields() const
{
DynamicList<word> allNames(obr_.toc().size());
UPtrList<const GeoField> fields(objectNames_.size());
forAll(objectNames_, i)
{
wordList names(obr_.names<GeoField>(objectNames_[i]));
if (names.size())
{
allNames.append(names);
}
}
UPtrList<const GeoField> fields(allNames.size());
forAll(allNames, i)
{
const GeoField& field = obr_.lookupObject<GeoField>(allNames[i]);
const GeoField& field = obr_.lookupObject<GeoField>(objectNames_[i]);
Info<< " Writing " << GeoField::typeName
<< " field " << field.name() << endl;
fields.set(i, &field);

View File

@ -44,21 +44,21 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define ReadFields(GeoFieldType) \
readFields<GeoFieldType>(mesh, objects, selectedFields, storedObjects);
readFields<GeoFieldType>(mesh, objects, requiredFields, storedObjects);
#define ReadPointFields(GeoFieldType) \
readFields<GeoFieldType>(pMesh, objects, selectedFields, storedObjects);
readFields<GeoFieldType>(pMesh, objects, requiredFields, storedObjects);
#define ReadUniformFields(FieldType) \
readUniformFields<FieldType> \
(constantObjects, selectedFields, storedObjects);
(constantObjects, requiredFields, storedObjects);
void executeFunctionObjects
(
const argList& args,
const Time& runTime,
fvMesh& mesh,
const HashSet<word>& selectedFields,
const HashSet<word>& requiredFields0,
functionObjectList& functions,
bool lastTime
)
@ -72,6 +72,12 @@ void executeFunctionObjects
// Read objects in time directory
IOobjectList objects(mesh, runTime.timeName());
HashSet<word> requiredFields(requiredFields0);
forAll(functions, i)
{
requiredFields.insert(functions[i].fields());
}
// Read volFields
ReadFields(volScalarField);
ReadFields(volVectorField);
@ -151,14 +157,14 @@ int main(int argc, char *argv[])
#include "createNamedMesh.H"
// Initialise the set of selected fields from the command-line options
HashSet<word> selectedFields;
HashSet<word> requiredFields;
if (args.optionFound("fields"))
{
args.optionLookup("fields")() >> selectedFields;
args.optionLookup("fields")() >> requiredFields;
}
if (args.optionFound("field"))
{
selectedFields.insert(args.optionLookup("field")());
requiredFields.insert(args.optionLookup("field")());
}
// Externally stored dictionary for functionObjectList
@ -172,8 +178,7 @@ int main(int argc, char *argv[])
(
args,
runTime,
functionsControlDict,
selectedFields
functionsControlDict
)
);
@ -190,8 +195,7 @@ int main(int argc, char *argv[])
(
args,
runTime,
functionsControlDict,
selectedFields
functionsControlDict
);
}
@ -204,7 +208,7 @@ int main(int argc, char *argv[])
args,
runTime,
mesh,
selectedFields,
requiredFields,
functionsPtr(),
timei == timeDirs.size()-1
);

View File

@ -121,6 +121,22 @@ bool ${typeName}FunctionObject::read(const dictionary& dict)
}
Foam::wordList ${typeName}FunctionObject::fields() const
{
if (${verbose:-false})
{
Info<<"fields ${typeName} sha1: ${SHA1sum}\n";
}
wordList fields;
//{{{ begin code
${codeFields}
//}}} end code
return fields;
}
bool ${typeName}FunctionObject::execute()
{
if (${verbose:-false})

View File

@ -96,6 +96,9 @@ public:
//- Read the system calls
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Execute the "executeCalls" at each time-step
virtual bool execute();

View File

@ -77,6 +77,12 @@ bool Foam::functionObjects::FUNCTIONOBJECT::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::FUNCTIONOBJECT::fields() const
{
return wordList::null();
}
bool Foam::functionObjects::FUNCTIONOBJECT::execute()
{
return true;

View File

@ -118,6 +118,9 @@ public:
//- Read the FUNCTIONOBJECT data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Execute, currently does nothing
virtual bool execute();

View File

@ -58,14 +58,11 @@ bool Foam::functionEntries::includeFuncEntry::execute
// Read line containing the function name and the optional arguments
const string fNameArgs(readFuncNameArgs(is));
HashSet<word> selectedFields;
return functionObjectList::readFunctionObject
(
fNameArgs,
parentDict,
{"file", is.name() + " at line " + Foam::name(is.lineNumber())},
selectedFields
{"file", is.name() + " at line " + Foam::name(is.lineNumber())}
);
}

View File

@ -214,6 +214,9 @@ public:
//- Read and set the functionObject if its data have changed
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const = 0;
//- Return true if the functionObject should be executed at the start
virtual bool executeAtStart() const;

View File

@ -236,7 +236,6 @@ bool Foam::functionObjectList::readFunctionObject
const string& funcArgs,
dictionary& functionsDict,
const Pair<string>& contextTypeAndValue,
HashSet<word>& requiredFields,
const word& region
)
{
@ -434,37 +433,6 @@ bool Foam::functionObjectList::readFunctionObject
);
}
// Lookup the field, fields and objects entries from the now expanded
// funcDict and insert into the requiredFields
dictionary& expandedFuncDict = funcArgsDict.subDict(funcName);
if (functionObject::debug)
{
InfoInFunction
<< nl << incrIndent << indent
<< funcArgs << expandedFuncDict
<< decrIndent << endl;
}
if (expandedFuncDict.found("field"))
{
requiredFields.insert(word(expandedFuncDict.lookup("field")));
}
if (expandedFuncDict.found("fields"))
{
List<wordAndDictionary> fields(expandedFuncDict.lookup("fields"));
forAll(fields, i)
{
requiredFields.insert(fields[i].first());
}
}
if (expandedFuncDict.found("objects"))
{
List<wordAndDictionary> objects(expandedFuncDict.lookup("objects"));
forAll(objects, i)
{
requiredFields.insert(objects[i].first());
}
}
// Merge this functionObject dictionary into functionsDict
functionsDict.merge(funcArgsDict);
functionsDict.subDict(funcName).name() = funcDict.name();
@ -512,8 +480,7 @@ Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
(
const argList& args,
const Time& runTime,
dictionary& controlDict,
HashSet<word>& requiredFields
dictionary& controlDict
)
{
autoPtr<functionObjectList> functionsPtr;
@ -563,7 +530,6 @@ Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
args["func"],
functionsDict,
{"command", args.commandLine()},
requiredFields,
region
);
}
@ -579,7 +545,6 @@ Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
funcs[i],
functionsDict,
{"command", args.commandLine()},
requiredFields,
region
);
}

View File

@ -149,8 +149,7 @@ public:
(
const argList& args,
const Time& runTime,
dictionary& controlDict,
HashSet<word>& requiredFields
dictionary& controlDict
);
@ -223,8 +222,6 @@ public:
// parsing the optional arguments included in the string 'funcArgs',
// inserting 'field' or 'fields' entries as required and merging the
// resulting functionObject dictionary into 'functionsDict'.
// Any fields required to execute the functionObject are added to
// 'requiredFields'
//
// Parses the optional functionObject arguments:
// 'Q(U)' -> funcName = Q; args = (U)
@ -243,7 +240,6 @@ public:
const string& funcArgs,
dictionary& functionsDict,
const Pair<string>& contextTypeAndValue,
HashSet<word>& requiredFields,
const word& region = word::null
);

View File

@ -116,8 +116,6 @@ if (argList::postProcess(argc, argv))
// if not constructed from runTime
dictionary functionsControlDict("controlDict");
HashSet<word> selectedFields;
// Construct functionObjectList
autoPtr<functionObjectList> functionsPtr
(
@ -125,8 +123,7 @@ if (argList::postProcess(argc, argv))
(
args,
runTime,
functionsControlDict,
selectedFields
functionsControlDict
)
);

View File

@ -95,6 +95,12 @@ Foam::functionObjects::timeControl::timeControl
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::wordList Foam::functionObjects::timeControl::fields() const
{
return foPtr_->fields();
}
bool Foam::functionObjects::timeControl::executeAtStart() const
{
return foPtr_->executeAtStart();

View File

@ -136,6 +136,9 @@ public:
// Function object control
//- Return the list of fields required
virtual wordList fields() const;
//- Return true if the functionObject should be executed
// at the start
virtual bool executeAtStart() const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -71,6 +71,7 @@ public:
// Access
inline label size() const;
inline bool empty() const;
//- Return underlying list of wordRe
@ -83,7 +84,6 @@ public:
// Smart match as regular expression or as a string.
// Optionally specify a literal match only.
inline bool match(const string&, bool literalMatch=false) const;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2019-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -89,6 +89,12 @@ public:
//- Read the data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate the Qdot field
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -63,6 +63,12 @@ Foam::functionObjects::XiReactionRate::~XiReactionRate()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::wordList Foam::functionObjects::XiReactionRate::fields() const
{
return wordList{"b", "Su", "Xi"};
}
bool Foam::functionObjects::XiReactionRate::execute()
{
return true;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -98,6 +98,9 @@ public:
// Member Functions
//- Return the list of fields required
virtual wordList fields() const;
//- Do nothing
virtual bool execute();

View File

@ -124,6 +124,12 @@ bool Foam::functionObjects::age::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::age::fields() const
{
return wordList{phiName_, rhoName_};
}
bool Foam::functionObjects::age::execute()
{
tmp<volScalarField> tage

View File

@ -145,6 +145,9 @@ public:
//- Read the data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Execute
virtual bool execute();

View File

@ -298,6 +298,12 @@ bool Foam::functionObjects::comfort::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::comfort::fields() const
{
return wordList{"U", "T"};
}
bool Foam::functionObjects::comfort::execute()
{
const dimensionedScalar Trad(this->Trad());

View File

@ -191,6 +191,9 @@ public:
//- Read the data needed for the comfort calculation
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Calculate the predicted mean vote (PMV)
// and predicted percentage dissatisfaction (PPD) fields
virtual bool execute();

View File

@ -367,6 +367,19 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::fieldAverage::fields() const
{
wordList fields(faItems_.size());
forAll(faItems_, fieldi)
{
fields[fieldi] = faItems_[fieldi].fieldName();
}
return fields;
}
bool Foam::functionObjects::fieldAverage::execute()
{
calcAverages();

View File

@ -339,6 +339,9 @@ public:
//- Read the field average data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Do not average at the start of the run
virtual bool executeAtStart() const
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -55,7 +55,7 @@ fieldCoordinateSystemTransform
)
:
fvMeshFunctionObject(name, runTime, dict),
fieldSet_(),
fields_(),
coordSys_(coordinateSystem::New(mesh_, dict.subDict("coordinateSystem"))())
{
read(dict);
@ -92,21 +92,28 @@ bool Foam::functionObjects::fieldCoordinateSystemTransform::read
{
fvMeshFunctionObject::read(dict);
dict.lookup("fields") >> fieldSet_;
dict.lookup("fields") >> fields_;
return true;
}
Foam::wordList
Foam::functionObjects::fieldCoordinateSystemTransform::fields() const
{
return fields_;
}
bool Foam::functionObjects::fieldCoordinateSystemTransform::execute()
{
forAll(fieldSet_, fieldi)
forAll(fields_, fieldi)
{
transform<scalar>(fieldSet_[fieldi]);
transform<vector>(fieldSet_[fieldi]);
transform<sphericalTensor>(fieldSet_[fieldi]);
transform<symmTensor>(fieldSet_[fieldi]);
transform<tensor>(fieldSet_[fieldi]);
transform<scalar>(fields_[fieldi]);
transform<vector>(fields_[fieldi]);
transform<sphericalTensor>(fields_[fieldi]);
transform<symmTensor>(fields_[fieldi]);
transform<tensor>(fields_[fieldi]);
}
return true;
@ -115,9 +122,9 @@ bool Foam::functionObjects::fieldCoordinateSystemTransform::execute()
bool Foam::functionObjects::fieldCoordinateSystemTransform::write()
{
forAll(fieldSet_, fieldi)
forAll(fields_, fieldi)
{
writeObject(transformFieldName(fieldSet_[fieldi]));
writeObject(transformFieldName(fields_[fieldi]));
}
return true;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -100,7 +100,7 @@ protected:
// Protected data
//- Fields to transform
wordList fieldSet_;
wordList fields_;
//- Co-ordinate system to transform to
coordinateSystem coordSys_;
@ -146,6 +146,9 @@ public:
//- Read the input data
virtual bool read(const dictionary&);
//- Return the field required
virtual wordList fields() const;
//- Calculate the transformed fields
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -75,6 +75,12 @@ bool Foam::functionObjects::fieldExpression::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::fieldExpression::fields() const
{
return wordList(fieldName_);
}
bool Foam::functionObjects::fieldExpression::execute()
{
if (!calc())

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -101,6 +101,9 @@ public:
//- Read the fieldExpression data
virtual bool read(const dictionary&);
//- Return the field required
virtual wordList fields() const;
//- Calculate the result field
virtual bool execute();

View File

@ -163,8 +163,8 @@ public:
//- Return the region name
inline const word& regionName() const;
//- Return the list of field names
inline const wordList& fields() const;
//- Return the list of fields required
inline virtual wordList fields() const;
//- Return the output field values flag
inline const Switch& writeFields() const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ inline const Foam::word& Foam::functionObjects::fieldValue::regionName() const
}
inline const Foam::wordList& Foam::functionObjects::fieldValue::fields() const
inline Foam::wordList Foam::functionObjects::fieldValue::fields() const
{
return fields_;
}

View File

@ -68,8 +68,8 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::writeFileHeader
const label i
)
{
const wordList& fields1 = region1Ptr_->fields();
const wordList& fields2 = region2Ptr_->fields();
const wordList fields1 = region1Ptr_->fields();
const wordList fields2 = region2Ptr_->fields();
DynamicList<word> commonFields(fields1.size());
forAll(fields1, fieldi)
@ -160,6 +160,13 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::read
}
Foam::wordList
Foam::functionObjects::fieldValues::fieldValueDelta::fields() const
{
return region1Ptr_->fields();
}
bool Foam::functionObjects::fieldValues::fieldValueDelta::write()
{
logFiles::write();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -172,6 +172,9 @@ public:
//- Read from dictionary
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Do nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -87,7 +87,7 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::processFields
typedef GeometricField<Type, fvPatchField, volMesh> vf;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
const wordList& fields1 = region1Ptr_->fields();
const wordList fields1 = region1Ptr_->fields();
const dictionary& results1 = region1Ptr_->resultDict();
const dictionary& results2 = region2Ptr_->resultDict();

View File

@ -123,6 +123,12 @@ bool Foam::functionObjects::fieldsExpression::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::fieldsExpression::fields() const
{
return fieldNames_;
}
bool Foam::functionObjects::fieldsExpression::execute()
{
if (!calc())

View File

@ -170,6 +170,9 @@ public:
//- Read the fieldsExpression data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Calculate the result fields
virtual bool execute();

View File

@ -104,6 +104,12 @@ bool Foam::functionObjects::histogram::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::histogram::fields() const
{
return wordList(fieldName_);
}
bool Foam::functionObjects::histogram::execute()
{
return true;

View File

@ -145,6 +145,9 @@ public:
//- Read the histogram data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Execute, currently does nothing
virtual bool execute();

View File

@ -250,6 +250,12 @@ bool Foam::functionObjects::interfaceHeight::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::interfaceHeight::fields() const
{
return wordList(alphaName_);
}
bool Foam::functionObjects::interfaceHeight::execute()
{
return true;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -152,6 +152,9 @@ public:
//- Read
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Execute
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -234,10 +234,10 @@ bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
// Convert field to map
fieldMap_.resize(2*fieldSet_.size());
reverseFieldMap_.resize(2*fieldSet_.size());
forAll(fieldSet_, setI)
forAll(fieldSet_, seti)
{
const word& fldName = fieldSet_[setI].first();
const word& sampleFldName = fieldSet_[setI].second();
const word& fldName = fieldSet_[seti].first();
const word& sampleFldName = fieldSet_[seti].second();
fieldMap_.insert(fldName, sampleFldName);
reverseFieldMap_.insert(sampleFldName, fldName);
@ -253,6 +253,19 @@ bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::nearWallFields::fields() const
{
wordList fields(fieldSet_.size());
forAll(fieldSet_, fieldi)
{
fields[fieldi] = fieldSet_[fieldi].first();
}
return fields;
}
bool Foam::functionObjects::nearWallFields::execute()
{
DebugInFunction << endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -195,6 +195,9 @@ public:
//- Read the controls
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Calculate the near-wall fields
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -101,6 +101,12 @@ public:
//- Read the input data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate the processorID field
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -50,7 +50,7 @@ Foam::functionObjects::readFields::readFields
)
:
fvMeshFunctionObject(name, runTime, dict),
fieldSet_()
fields_()
{
read(dict);
}
@ -68,12 +68,18 @@ bool Foam::functionObjects::readFields::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
dict.lookup("fields") >> fieldSet_;
dict.lookup("fields") >> fields_;
return true;
}
Foam::wordList Foam::functionObjects::readFields::fields() const
{
return fields_;
}
bool Foam::functionObjects::readFields::execute()
{
// Clear out any previously loaded fields
@ -89,9 +95,9 @@ bool Foam::functionObjects::readFields::execute()
sSymmtf_.clear();
stf_.clear();
forAll(fieldSet_, fieldi)
forAll(fields_, fieldi)
{
const word& fieldName = fieldSet_[fieldi];
const word& fieldName = fields_[fieldi];
// If necessary load field
loadField<scalar>(fieldName, vsf_, ssf_);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,7 +85,7 @@ protected:
// Protected data
//- Fields to load
wordList fieldSet_;
wordList fields_;
//- Loaded fields
PtrList<volScalarField> vsf_;
@ -142,6 +142,9 @@ public:
//- Read the set of fields from dictionary
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Read the fields
virtual bool execute();

View File

@ -331,7 +331,7 @@ Foam::functionObjects::regionSizeDistribution::regionSizeDistribution
:
fvMeshFunctionObject(name, runTime, dict),
file_(obr_, name),
alphaName_(dict.lookup("field")),
alphaName_(dict.lookup("alpha")),
patchNames_(dict.lookup("patches"))
{
read(dict);
@ -372,6 +372,14 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::regionSizeDistribution::fields() const
{
wordList fields(fields_);
fields.append(alphaName_);
return fields;
}
bool Foam::functionObjects::regionSizeDistribution::execute()
{
return true;
@ -745,22 +753,19 @@ bool Foam::functionObjects::regionSizeDistribution::write()
// Collect some more field
{
wordList scalarNames(obr_.names(volScalarField::typeName));
labelList selected = findStrings(fields_, scalarNames);
forAll(selected, i)
forAll(fields_, i)
{
const word& fldName = scalarNames[selected[i]];
Info<< " Scalar field " << fldName << endl;
if (obr_.foundObject<volScalarField>(fields_[i]))
{
Info<< " Scalar field " << fields_[i] << endl;
const scalarField& fld = obr_.lookupObject
<
volScalarField
>(fldName).primitiveField();
const scalarField& fld =
obr_.lookupObject<volScalarField>(fields_[i])
.primitiveField();
writeGraphs
(
fldName, // name of field
fields_[i], // name of field
alphaVol*fld, // per cell field data
regions, // per cell the region(=droplet)
@ -773,23 +778,21 @@ bool Foam::functionObjects::regionSizeDistribution::write()
);
}
}
}
{
wordList vectorNames(obr_.names(volVectorField::typeName));
labelList selected = findStrings(fields_, vectorNames);
forAll(selected, i)
forAll(fields_, i)
{
const word& fldName = vectorNames[selected[i]];
Info<< " Vector field " << fldName << endl;
if (obr_.foundObject<volScalarField>(fields_[i]))
{
Info<< " Vector field " << fields_[i] << endl;
vectorField fld = obr_.lookupObject
<
volVectorField
>(fldName).primitiveField();
vectorField fld =
obr_.lookupObject<volVectorField>(fields_[i])
.primitiveField();
if (coordSysPtr_.valid())
{
Info<< "Transforming vector field " << fldName
Info<< "Transforming vector field " << fields_[i]
<< " with coordinate system "
<< coordSysPtr_().name()
<< endl;
@ -804,7 +807,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
{
writeGraphs
(
fldName + vector::componentNames[cmp],
fields_[i] + vector::componentNames[cmp],
alphaVol*fld.component(cmp),// per cell field data
regions, // per cell the region(=droplet)
@ -820,7 +823,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
// Magnitude
writeGraphs
(
fldName + "mag", // name of field
fields_[i] + "mag", // name of field
alphaVol*mag(fld), // per cell field data
regions, // per cell the region(=droplet)
@ -834,6 +837,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
}
}
}
}
return true;
}

View File

@ -58,7 +58,7 @@ Description
type regionSizeDistribution;
libs ("libfieldFunctionObjects.so");
...
field alpha;
alpha alpha;
patches (inlet);
threshold 0.4;
fields (p U);
@ -80,7 +80,7 @@ Usage
\table
Property | Description | Required | Default value
type | type name: regionSizeDistribution |yes|
field | phase field to interrogate | yes |
alpha | phase field to interrogate | yes |
patches | patches from which the liquid core is identified | yes|
threshold | phase fraction applied to delimit regions | yes |
fields | fields to sample | yes |
@ -154,7 +154,7 @@ class regionSizeDistribution
label nBins_;
//- Names of fields to sample on regions
wordReList fields_;
wordList fields_;
//- Output formatter to write
autoPtr<setWriter<scalar>> formatterPtr_;
@ -253,6 +253,9 @@ public:
//- Read the regionSizeDistribution data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Do nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -91,6 +91,12 @@ public:
//- Read the data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate the shearStress field
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -429,6 +429,15 @@ bool Foam::functionObjects::streamlines::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::streamlines::fields() const
{
wordList allFields(fields_);
allFields.append(UName_);
return allFields;
}
bool Foam::functionObjects::streamlines::execute()
{
return true;

View File

@ -261,6 +261,9 @@ public:
//- Read the field average data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Do nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -91,6 +91,12 @@ public:
//- Read the data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate the totalEnthalpy field
virtual bool execute();

View File

@ -195,6 +195,12 @@ public:
//- Read the controls
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate turbulence fields
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2018-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -138,6 +138,12 @@ public:
//- Read the turbulenceIntensity data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate the turbulenceIntensity field
virtual bool execute();

View File

@ -100,6 +100,12 @@ public:
//- Read the uniform data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate the field
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -141,6 +141,12 @@ public:
//- Read the wallHeatFlux data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate the wall heat-flux
virtual bool execute();

View File

@ -187,6 +187,12 @@ public:
//- Read the wallHeatTransferCoeffs data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate the wall heat transfer coefficient
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -152,6 +152,12 @@ public:
//- Read the wallShearStress data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate the wall shear-stress
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -98,6 +98,12 @@ public:
// Member Functions
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Do nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -97,6 +97,12 @@ public:
// Member Functions
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Do nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -141,6 +141,12 @@ public:
//- Read the yPlus data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate the yPlus field
virtual bool execute();

View File

@ -311,6 +311,12 @@ public:
//- Read the forces data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Calculate the forces and moments
virtual void calcForcesMoment();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -125,6 +125,12 @@ public:
//- Read the controls
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Execute, currently does nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -79,6 +79,21 @@ bool Foam::functionObjects::dsmcFields::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::dsmcFields::fields() const
{
return wordList
{
"rhoNMean",
"rhoMMean",
"momentumMean",
"linearKEMean",
"internalEMean",
"iDofMean",
"fDMean"
};
}
bool Foam::functionObjects::dsmcFields::execute()
{
return true;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -89,6 +89,9 @@ public:
//- Read the dsmcFields data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Do not evaluate the state at the start of the run
virtual bool executeAtStart() const
{

View File

@ -147,6 +147,12 @@ public:
//- Read the controls
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Track the cloud
virtual bool execute();

View File

@ -364,6 +364,12 @@ bool Foam::functionObjects::phaseScalarTransport::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::phaseScalarTransport::fields() const
{
return wordList{alphaName_, alphaPhiName_, phiName_, pName_};
}
bool Foam::functionObjects::phaseScalarTransport::execute()
{
Info<< type() << ": Executing" << endl;

View File

@ -215,6 +215,9 @@ public:
//- Read the settings from the given dictionary
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Solve for the evolution of the field
virtual bool execute();

View File

@ -155,6 +155,12 @@ bool Foam::functionObjects::scalarTransport::read(const dictionary& dict)
}
Foam::wordList Foam::functionObjects::scalarTransport::fields() const
{
return wordList{phiName_};
}
bool Foam::functionObjects::scalarTransport::execute()
{
Info<< type() << " write:" << endl;

View File

@ -137,6 +137,9 @@ public:
//- Read the scalarTransport data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Calculate the scalarTransport
virtual bool execute();

View File

@ -59,6 +59,7 @@ Foam::wordList Foam::codedFunctionObject::codeKeys() const
"codeExecute",
"codeInclude",
"codeRead",
"codeFields",
"codeWrite",
"localCode"
};
@ -152,6 +153,13 @@ Foam::functionObject& Foam::codedFunctionObject::redirectFunctionObject() const
}
Foam::wordList Foam::codedFunctionObject::fields() const
{
updateLibrary();
return redirectFunctionObject().fields();
}
bool Foam::codedFunctionObject::execute()
{
updateLibrary();

View File

@ -35,6 +35,7 @@ Description
codeData | c++; local member data (null constructed);
localCode | c++; local static functions;
codeRead | c++; upon functionObject::read();
codeFields | c++; upon functionObject::fields();
codeExecute | c++; upon functionObject::execute();
codeWrite | c++; upon functionObject::write()
codeEnd | c++; upon functionObject::end();
@ -137,6 +138,9 @@ public:
// Member Functions
//- Return the list of fields required
virtual wordList fields() const;
//- Called at each ++ or += of the time-loop.
// postProcess overrides the usual executeControl behaviour and
// forces execution (used in post-processing mode)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -116,6 +116,12 @@ public:
//- Read the removeRegisteredObject data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Remove the registered objects
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -130,6 +130,12 @@ public:
//- Read the controls
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Execute, currently does nothing
virtual bool execute();

View File

@ -102,6 +102,12 @@ public:
//- Read and reset the timeStep Function1
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Reset the timeStep from the Function1 of time
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -115,6 +115,12 @@ public:
//- Read and reset the writeInterval Function1
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Reset the writeInterval from the Function1 of time
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -121,6 +121,12 @@ public:
//- Read the dictionary settings
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Execute, check existence of stopAt file and take action
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -144,6 +144,12 @@ public:
//- Read the system calls
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Execute the "executeCalls" at each time-step
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2018-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -124,6 +124,12 @@ public:
//- Read the controls
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Execute, currently does nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -131,6 +131,12 @@ public:
//- Read the timeActivatedFileUpdate data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Execute file updates
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -109,6 +109,12 @@ public:
//- Read the controls
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Execute, currently does nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -110,6 +110,12 @@ public:
//- Read the writeDictionary data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Execute, currently does nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -160,6 +160,12 @@ public:
//- Read the writeObjects data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Do nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2019-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -123,6 +123,12 @@ public:
//- Read the rigidBodyState data
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const
{
return wordList::null();
}
//- Execute, currently does nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -207,27 +207,6 @@ Foam::patchProbes::patchProbes
}
Foam::patchProbes::patchProbes
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
probes(name, obr, dict)
{
// When constructing probes above it will have called the
// probes::findElements (since the virtual mechanism not yet operating).
// Not easy to workaround (apart from feeding through flag into constructor)
// so clear out any cells found for now.
elementList_.clear();
faceList_.clear();
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::patchProbes::~patchProbes()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -129,16 +129,6 @@ public:
const dictionary& dict
);
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
patchProbes
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Disallow default bitwise copy construction
patchProbes(const patchProbes&) = delete;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -89,27 +89,6 @@ void Foam::patchProbes::sampleAndWrite
)
{
forAll(fields, fieldi)
{
if (loadFromFiles_)
{
sampleAndWrite
(
GeometricField<Type, fvPatchField, volMesh>
(
IOobject
(
fields[fieldi],
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
),
mesh_
)
);
}
else
{
objectRegistry::const_iterator iter = mesh_.find(fields[fieldi]);
@ -131,7 +110,6 @@ void Foam::patchProbes::sampleAndWrite
}
}
}
}
template<class Type>
@ -141,27 +119,6 @@ void Foam::patchProbes::sampleAndWriteSurfaceFields
)
{
forAll(fields, fieldi)
{
if (loadFromFiles_)
{
sampleAndWrite
(
GeometricField<Type, fvsPatchField, surfaceMesh>
(
IOobject
(
fields[fieldi],
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
),
mesh_
)
);
}
else
{
objectRegistry::const_iterator iter = mesh_.find(fields[fieldi]);
@ -183,7 +140,6 @@ void Foam::patchProbes::sampleAndWriteSurfaceFields
}
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -279,28 +279,7 @@ Foam::probes::probes
)
)
),
loadFromFiles_(false),
fieldSelection_(),
fixedLocations_(true),
interpolationScheme_("cell")
{
read(dict);
}
Foam::probes::probes
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
functionObject(name),
pointField(0),
mesh_(refCast<const fvMesh>(obr)),
loadFromFiles_(loadFromFiles),
fieldSelection_(),
fields_(),
fixedLocations_(true),
interpolationScheme_("cell")
{
@ -319,7 +298,7 @@ Foam::probes::~probes()
bool Foam::probes::read(const dictionary& dict)
{
dict.lookup("probeLocations") >> *this;
dict.lookup("fields") >> fieldSelection_;
dict.lookup("fields") >> fields_;
dict.readIfPresent("fixedLocations", fixedLocations_);
if (dict.readIfPresent("interpolationScheme", interpolationScheme_))
@ -342,6 +321,12 @@ bool Foam::probes::read(const dictionary& dict)
}
Foam::wordList Foam::probes::fields() const
{
return fields_;
}
bool Foam::probes::execute()
{
return true;

View File

@ -45,7 +45,6 @@ SourceFiles
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "surfaceMesh.H"
#include "wordReList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -92,14 +91,11 @@ protected:
//- Const reference to fvMesh
const fvMesh& mesh_;
//- Load fields from files (not from objectRegistry)
bool loadFromFiles_;
// Read from dictonary
//- Names of fields to probe
wordReList fieldSelection_;
wordList fields_;
//- Fixed locations, default = yes
// Note: set to false for moving mesh calculations where locations
@ -198,16 +194,6 @@ public:
const dictionary& dict
);
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
probes
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles = false
);
//- Disallow default bitwise copy construction
probes(const probes&) = delete;
@ -218,11 +204,8 @@ public:
// Member Functions
//- Return names of fields to probe
virtual const wordReList& fieldNames() const
{
return fieldSelection_;
}
//- Return the list of fields required
virtual wordList fields() const;
//- Return locations to probe
virtual const pointField& probeLocations() const

View File

@ -113,35 +113,13 @@ Foam::label Foam::probes::classifyFields()
label nFields = 0;
clearFieldGroups();
if (loadFromFiles_ || postProcess)
// Check currently available fields
forAll(fields_, fieldi)
{
// check files for a particular time
IOobjectList objects(mesh_, mesh_.time().timeName());
wordList allFields = objects.sortedNames();
const word& fieldName = fields_[fieldi];
labelList indices = findStrings(fieldSelection_, allFields);
forAll(indices, fieldi)
if (mesh_.objectRegistry::found(fieldName))
{
const word& fieldName = allFields[indices[fieldi]];
nFields += appendFieldGroup
(
fieldName,
objects.find(fieldName)()->headerClassName()
);
}
}
else
{
// check currently available fields
wordList allFields = mesh_.sortedNames();
labelList indices = findStrings(fieldSelection_, allFields);
forAll(indices, fieldi)
{
const word& fieldName = allFields[indices[fieldi]];
nFields += appendFieldGroup
(
fieldName,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -119,27 +119,6 @@ template<class Type>
void Foam::probes::sampleAndWrite(const fieldGroup<Type>& fields)
{
forAll(fields, fieldi)
{
if (loadFromFiles_)
{
sampleAndWrite
(
GeometricField<Type, fvPatchField, volMesh>
(
IOobject
(
fields[fieldi],
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
),
mesh_
)
);
}
else
{
objectRegistry::const_iterator iter = mesh_.find(fields[fieldi]);
@ -161,34 +140,12 @@ void Foam::probes::sampleAndWrite(const fieldGroup<Type>& fields)
}
}
}
}
template<class Type>
void Foam::probes::sampleAndWriteSurfaceFields(const fieldGroup<Type>& fields)
{
forAll(fields, fieldi)
{
if (loadFromFiles_)
{
sampleAndWrite
(
GeometricField<Type, fvsPatchField, surfaceMesh>
(
IOobject
(
fields[fieldi],
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
),
mesh_
)
);
}
else
{
objectRegistry::const_iterator iter = mesh_.find(fields[fieldi]);
@ -210,7 +167,7 @@ void Foam::probes::sampleAndWriteSurfaceFields(const fieldGroup<Type>& fields)
}
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -158,36 +158,6 @@ Foam::sampledSets::sampledSets
)
)
),
loadFromFiles_(false),
outputPath_(fileName::null),
searchEngine_(mesh_),
interpolationScheme_(word::null),
writeFormat_(word::null)
{
outputPath_ =
mesh_.time().globalPath()/functionObjects::writeFile::outputPrefix/name;
if (mesh_.name() != fvMesh::defaultRegion)
{
outputPath_ = outputPath_/mesh_.name();
}
read(dict);
}
Foam::sampledSets::sampledSets
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
functionObject(name),
PtrList<sampledSet>(),
mesh_(refCast<const fvMesh>(obr)),
loadFromFiles_(loadFromFiles),
outputPath_(fileName::null),
searchEngine_(mesh_),
interpolationScheme_(word::null),
@ -219,6 +189,12 @@ void Foam::sampledSets::verbose(const bool verbosity)
}
Foam::wordList Foam::sampledSets::fields() const
{
return fields_;
}
bool Foam::sampledSets::execute()
{
return true;
@ -277,7 +253,7 @@ bool Foam::sampledSets::read(const dictionary& dict)
bool setsFound = dict_.found("sets");
if (setsFound)
{
dict_.lookup("fields") >> fieldSelection_;
dict_.lookup("fields") >> fields_;
clearFieldGroups();
dict.lookup("interpolationScheme") >> interpolationScheme_;
@ -304,7 +280,7 @@ bool Foam::sampledSets::read(const dictionary& dict)
if (Pstream::master() && debug)
{
Pout<< "sample fields:" << fieldSelection_ << nl
Pout<< "sample fields:" << fields_ << nl
<< "sample sets:" << nl << "(" << nl;
forAll(*this, setI)

View File

@ -176,7 +176,7 @@ class sampledSets
// Read from dictonary
//- Names of fields to sample
wordReList fieldSelection_;
wordList fields_;
//- Interpolation scheme to use
word interpolationScheme_;
@ -259,16 +259,6 @@ public:
const dictionary& dict
);
//- Construct for given objectRegistry and dictionary
// allow the possibility to load fields from files
sampledSets
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Disallow default bitwise copy construction
sampledSets(const sampledSets&) = delete;
@ -285,6 +275,9 @@ public:
//- Read the sampledSets
virtual bool read(const dictionary&);
//- Return the list of fields required
virtual wordList fields() const;
//- Execute, currently does nothing
virtual bool execute();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -81,66 +81,24 @@ Foam::label Foam::sampledSets::classifyFields()
label nFields = 0;
clearFieldGroups();
if (loadFromFiles_)
{
// Check files for a particular time
IOobjectList objects(mesh_, mesh_.time().timeName());
wordList allFields = objects.sortedNames();
forAll(fieldSelection_, i)
{
labelList indices = findStrings(fieldSelection_[i], allFields);
if (indices.size())
{
forAll(indices, fieldi)
{
const word& fieldName = allFields[indices[fieldi]];
nFields += appendFieldGroup
(
fieldName,
objects.find(fieldName)()->headerClassName()
);
}
}
else
{
WarningInFunction
<< "Cannot find field file matching "
<< fieldSelection_[i] << endl;
}
}
}
else
{
// Check currently available fields
wordList allFields = mesh_.sortedNames();
labelList indices = findStrings(fieldSelection_, allFields);
forAll(fieldSelection_, i)
forAll(fields_, fieldi)
{
labelList indices = findStrings(fieldSelection_[i], allFields);
const word& fieldName = fields_[fieldi];
if (indices.size())
if (mesh_.objectRegistry::found(fieldName))
{
forAll(indices, fieldi)
{
const word& fieldName = allFields[indices[fieldi]];
nFields += appendFieldGroup
(
fieldName,
mesh_.find(fieldName)()->type()
);
}
}
else
{
WarningInFunction
<< "Cannot find registered field matching "
<< fieldSelection_[i] << endl;
}
<< fieldName << endl;
}
}

View File

@ -243,46 +243,6 @@ void Foam::sampledSets::sampleAndWrite
<< fields[fieldi] << endl;
}
if (loadFromFiles_)
{
GeometricField<Type, fvPatchField, volMesh> vf
(
IOobject
(
fields[fieldi],
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
),
mesh_
);
if (interpolate)
{
sampledFields.set
(
fieldi,
new volFieldSampler<Type>
(
interpolationScheme_,
vf,
*this
)
);
}
else
{
sampledFields.set
(
fieldi,
new volFieldSampler<Type>(vf, *this)
);
}
}
else
{
if (interpolate)
{
sampledFields.set
@ -313,7 +273,6 @@ void Foam::sampledSets::sampleAndWrite
);
}
}
}
// Combine sampled fields from processors.
// Note: only master results are valid

View File

@ -268,6 +268,12 @@ Foam::sampledSurfaces::isoSurface::~isoSurface()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::wordList Foam::sampledSurfaces::isoSurface::fields() const
{
return wordList(isoField_);
}
bool Foam::sampledSurfaces::isoSurface::needsUpdate() const
{
const fvMesh& fvm = static_cast<const fvMesh&>(mesh());

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -142,6 +142,9 @@ public:
// Member Functions
//- Return the list of fields required
virtual wordList fields() const;
//- Does the surface need an update?
virtual bool needsUpdate() const;

Some files were not shown because too many files have changed in this diff Show More