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:
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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())
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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_;
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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())
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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_);
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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,92 +753,88 @@ 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
|
||||
alphaVol*fld, // per cell field data
|
||||
writeGraphs
|
||||
(
|
||||
fields_[i], // name of field
|
||||
alphaVol*fld, // per cell field data
|
||||
|
||||
regions, // per cell the region(=droplet)
|
||||
sortedRegions, // valid regions in sorted order
|
||||
1.0/sortedVols, // per region normalisation
|
||||
regions, // per cell the region(=droplet)
|
||||
sortedRegions, // valid regions in sorted order
|
||||
1.0/sortedVols, // per region normalisation
|
||||
|
||||
indices, // index of bin for each region
|
||||
binCount, // per bin number of regions
|
||||
coords // graph data for bins
|
||||
);
|
||||
indices, // index of bin for each region
|
||||
binCount, // per bin number of regions
|
||||
coords // graph data for bins
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
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;
|
||||
|
||||
vectorField fld = obr_.lookupObject
|
||||
<
|
||||
volVectorField
|
||||
>(fldName).primitiveField();
|
||||
|
||||
if (coordSysPtr_.valid())
|
||||
if (obr_.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
Info<< "Transforming vector field " << fldName
|
||||
<< " with coordinate system "
|
||||
<< coordSysPtr_().name()
|
||||
<< endl;
|
||||
Info<< " Vector field " << fields_[i] << endl;
|
||||
|
||||
fld = coordSysPtr_().localVector(fld);
|
||||
}
|
||||
vectorField fld =
|
||||
obr_.lookupObject<volVectorField>(fields_[i])
|
||||
.primitiveField();
|
||||
|
||||
if (coordSysPtr_.valid())
|
||||
{
|
||||
Info<< "Transforming vector field " << fields_[i]
|
||||
<< " with coordinate system "
|
||||
<< coordSysPtr_().name()
|
||||
<< endl;
|
||||
|
||||
fld = coordSysPtr_().localVector(fld);
|
||||
}
|
||||
|
||||
|
||||
// Components
|
||||
// Components
|
||||
|
||||
for (direction cmp = 0; cmp < vector::nComponents; cmp++)
|
||||
{
|
||||
for (direction cmp = 0; cmp < vector::nComponents; cmp++)
|
||||
{
|
||||
writeGraphs
|
||||
(
|
||||
fields_[i] + vector::componentNames[cmp],
|
||||
alphaVol*fld.component(cmp),// per cell field data
|
||||
|
||||
regions, // per cell the region(=droplet)
|
||||
sortedRegions, // valid regions in sorted order
|
||||
1.0/sortedVols, // per region normalisation
|
||||
|
||||
indices, // index of bin for each region
|
||||
binCount, // per bin number of regions
|
||||
coords // graph data for bins
|
||||
);
|
||||
}
|
||||
|
||||
// Magnitude
|
||||
writeGraphs
|
||||
(
|
||||
fldName + vector::componentNames[cmp],
|
||||
alphaVol*fld.component(cmp),// per cell field data
|
||||
fields_[i] + "mag", // name of field
|
||||
alphaVol*mag(fld), // per cell field data
|
||||
|
||||
regions, // per cell the region(=droplet)
|
||||
sortedRegions, // valid regions in sorted order
|
||||
1.0/sortedVols, // per region normalisation
|
||||
regions, // per cell the region(=droplet)
|
||||
sortedRegions, // valid regions in sorted order
|
||||
1.0/sortedVols, // per region normalisation
|
||||
|
||||
indices, // index of bin for each region
|
||||
binCount, // per bin number of regions
|
||||
coords // graph data for bins
|
||||
indices, // index of bin for each region
|
||||
binCount, // per bin number of regions
|
||||
coords // graph data for bins
|
||||
);
|
||||
}
|
||||
|
||||
// Magnitude
|
||||
writeGraphs
|
||||
(
|
||||
fldName + "mag", // name of field
|
||||
alphaVol*mag(fld), // per cell field data
|
||||
|
||||
regions, // per cell the region(=droplet)
|
||||
sortedRegions, // valid regions in sorted order
|
||||
1.0/sortedVols, // per region normalisation
|
||||
|
||||
indices, // index of bin for each region
|
||||
binCount, // per bin number of regions
|
||||
coords // graph data for bins
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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
|
||||
@ -61,7 +61,7 @@ class streamFunction
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
tmp<pointScalarField> calc(const surfaceScalarField& phi) const;
|
||||
tmp<pointScalarField> calc(const surfaceScalarField& phi) const;
|
||||
|
||||
//- Calculate the stream-function and return true if successful
|
||||
virtual bool calc();
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user