controlDict: the optional graphFormat entry is now used as the default for all setFormat entries

Foam::graph superseded by the more general Foam::setWriter reducing code
maintenance overhead, simplifying usage and further development.
This commit is contained in:
Henry Weller
2023-06-12 17:14:37 +01:00
parent 1e9e0c141b
commit 618d9d33b2
72 changed files with 372 additions and 2034 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) 2013-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -87,7 +87,7 @@ bool Foam::functionObjects::CourantNo::calc()
tCo->ref() =
byRho
(
(0.5*mesh_.time().deltaT())
(0.5*time_.deltaT())
*fvc::surfaceSum(mag(phi))()()
/mesh_.V()
);

View File

@ -139,7 +139,7 @@ bool Foam::functionObjects::age::execute()
IOobject
(
typeName,
mesh_.time().name(),
time_.name(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_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) 2019-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2019-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -321,7 +321,7 @@ bool Foam::functionObjects::comfort::execute()
IOobject
(
"hc",
mesh_.time().name(),
time_.name(),
mesh_
),
mesh_,
@ -441,7 +441,7 @@ bool Foam::functionObjects::comfort::execute()
IOobject
(
"TI",
mesh_.time().name(),
time_.name(),
mesh_
),
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-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -86,7 +86,7 @@ void Foam::functionObjects::fieldAverage::initialise()
void Foam::functionObjects::fieldAverage::restart()
{
Log << " Restarting averaging at time " << obr_.time().name() << nl;
Log << " Restarting averaging at time " << time_.name() << nl;
// Clear the times
totalIter_ = 0;
@ -124,8 +124,8 @@ void Foam::functionObjects::fieldAverage::calcAverages()
{
Log << type() << " " << name() << ":" << nl;
const label currentTimeIndex = obr_.time().timeIndex();
const scalar currentTime = obr_.time().value();
const label currentTimeIndex = time_.timeIndex();
const scalar currentTime = time_.value();
if (prevTimeIndex_ == currentTimeIndex)
{
@ -148,7 +148,7 @@ void Foam::functionObjects::fieldAverage::calcAverages()
forAll(faItems_, fieldi)
{
totalIter_[fieldi]++;
totalTime_[fieldi] += obr_.time().deltaTValue();
totalTime_[fieldi] += time_.deltaTValue();
}
Log << " Calculating averages" << nl;
@ -185,7 +185,7 @@ void Foam::functionObjects::fieldAverage::writeAverages() const
IOobject
(
name() + "Properties",
obr_.time().name(),
time_.name(),
"uniform",
obr_,
IOobject::NO_READ,
@ -250,7 +250,7 @@ void Foam::functionObjects::fieldAverage::read
typeIOobject<timeIOdictionary> propsDictHeader
(
name() + "Properties",
obr_.time().name(),
time_.name(),
"uniform",
obr_,
IOobject::MUST_READ_IF_MODIFIED,

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-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,7 +38,7 @@ void Foam::functionObjects::fieldAverage::readMeanFieldType(const label fieldi)
IOobject meanFieldIo
(
meanFieldName,
obr_.time().name(),
time_.name(),
obr_,
IOobject::MUST_READ,
IOobject::NO_WRITE
@ -114,7 +114,7 @@ void Foam::functionObjects::fieldAverage::initialiseMeanFieldType
IOobject
(
meanFieldName,
obr_.time().name(),
time_.name(),
obr_
),
1*baseField
@ -161,7 +161,7 @@ void Foam::functionObjects::fieldAverage::readPrime2MeanFieldType
IOobject prime2MeanFieldIo
(
prime2MeanFieldName,
obr_.time().name(),
time_.name(),
obr_,
IOobject::MUST_READ,
IOobject::NO_WRITE
@ -253,7 +253,7 @@ void Foam::functionObjects::fieldAverage::initialisePrime2MeanFieldType
IOobject
(
prime2MeanFieldName,
obr_.time().name(),
time_.name(),
obr_
),
sqr(baseField) - sqr(meanField)
@ -313,7 +313,7 @@ void Foam::functionObjects::fieldAverage::calculateMeanFieldType
Type& meanField =
obr_.lookupObjectRef<Type>(faItems_[fieldi].meanFieldName());
scalar dt = obr_.time().deltaTValue();
scalar dt = time_.deltaTValue();
scalar Dt = totalTime_[fieldi];
if (iterBase())
@ -379,7 +379,7 @@ void Foam::functionObjects::fieldAverage::calculatePrime2MeanFieldType
Type2& prime2MeanField =
obr_.lookupObjectRef<Type2>(faItems_[fieldi].prime2MeanFieldName());
scalar dt = obr_.time().deltaTValue();
scalar dt = time_.deltaTValue();
scalar Dt = totalTime_[fieldi];
if (iterBase())

View File

@ -67,7 +67,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::faceSign() const
inline Foam::fileName
Foam::functionObjects::fieldValues::surfaceFieldValue::outputDir() const
{
return baseFileDir()/name()/"surface"/obr_.time().name();
return baseFileDir()/name()/"surface"/time_.name();
}

View File

@ -264,7 +264,7 @@ bool Foam::functionObjects::fieldValues::volFieldValue::writeValues
(
fieldName + '_' + selectionTypeNames[selectionType()]
+ '-' + cellSetName(),
obr_.time().name(),
time_.name(),
obr_,
IOobject::NO_READ,
IOobject::NO_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) 2016-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -71,7 +71,11 @@ bool Foam::functionObjects::histogram::read(const dictionary& dict)
min_ = dict.lookupOrDefault<scalar>("min", 0);
dict.lookup("nBins") >> nBins_;
formatterPtr_ = setWriter::New(dict.lookup("setFormat"), dict);
formatterPtr_ = setWriter::New
(
dict.lookupOrDefault("setFormat", time_.graphFormat()),
dict
);
return true;
}
@ -108,7 +112,7 @@ bool Foam::functionObjects::histogram::write()
IOobject
(
fieldName_,
mesh_.time().name(),
time_.name(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE

View File

@ -245,7 +245,11 @@ bool Foam::functionObjects::layerAverage::read(const dictionary& dict)
fields_ = dict.lookup<wordList>("fields");
formatter_ = setWriter::New(dict.lookup("setFormat"), dict);
formatter_ = setWriter::New
(
dict.lookupOrDefault("setFormat", time_.graphFormat()),
dict
);
calcLayers();
@ -316,11 +320,11 @@ bool Foam::functionObjects::layerAverage::write()
{
// Make output directory
const fileName outputPath =
mesh_.time().globalPath()
time_.globalPath()
/writeFile::outputPrefix
/(mesh_.name() != polyMesh::defaultRegion ? mesh_.name() : word())
/name()
/mesh_.time().name();
/time_.name();
mkDir(outputPath);
scalarField layerDistance(layerCentre_.size(), 0);

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-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -102,8 +102,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
// Dump particles
OBJstream str
(
mesh_.time().path()
/"wantedTracks_" + mesh_.time().name() + ".obj"
time_.path()
/"wantedTracks_" + time_.name() + ".obj"
);
InfoInFunction << "Dumping tracks to " << str.name() << endl;
@ -161,8 +161,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
{
OBJstream str
(
mesh_.time().path()
/"obtainedTracks_" + mesh_.time().name() + ".obj"
time_.path()
/"obtainedTracks_" + time_.name() + ".obj"
);
InfoInFunction << "Dumping obtained to " << str.name() << endl;

View File

@ -607,11 +607,11 @@ void Foam::functionObjects::patchCutLayerAverage::initialise()
Foam::fileName Foam::functionObjects::patchCutLayerAverage::outputPath() const
{
return
mesh_.time().globalPath()
time_.globalPath()
/writeFile::outputPrefix
/(mesh_.name() != polyMesh::defaultRegion ? mesh_.name() : word())
/name()
/mesh_.time().name();
/time_.name();
}
@ -658,7 +658,11 @@ bool Foam::functionObjects::patchCutLayerAverage::read(const dictionary& dict)
)
];
formatter_ = setWriter::New(dict.lookup("setFormat"), dict);
formatter_ = setWriter::New
(
dict.lookupOrDefault("setFormat", time_.graphFormat()),
dict
);
nOptimiseIter_ = dict.lookupOrDefault("nOptimiseIter", 2);

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-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -55,7 +55,7 @@ void Foam::functionObjects::readFields::loadField
IOobject fieldHeader
(
fieldName,
mesh_.time().name(),
time_.name(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE

View File

@ -89,7 +89,7 @@ void Foam::functionObjects::regionSizeDistribution::writeAlphaFields
IOobject
(
alphaName_ + "_liquidCore",
obr_.time().name(),
time_.name(),
obr_,
IOobject::NO_READ
),
@ -102,7 +102,7 @@ void Foam::functionObjects::regionSizeDistribution::writeAlphaFields
IOobject
(
alphaName_ + "_background",
obr_.time().name(),
time_.name(),
obr_,
IOobject::NO_READ
),
@ -371,7 +371,11 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
dict.lookup("nBins") >> nBins_;
dict.lookup("fields") >> fields_;
formatterPtr_ = setWriter::New(dict.lookup("setFormat"), dict);
formatterPtr_ = setWriter::New
(
dict.lookupOrDefault("setFormat", time_.graphFormat()),
dict
);
return true;
}
@ -410,7 +414,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
IOobject
(
alphaName_,
mesh_.time().name(),
time_.name(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE
@ -505,7 +509,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
IOobject
(
"region",
mesh_.time().name(),
time_.name(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE

View File

@ -181,7 +181,11 @@ bool Foam::functionObjects::streamlines::read(const dictionary& dict)
dict.subDict("seedSampleSet")
);
formatterPtr_ = setWriter::New(dict.lookup("setFormat"), dict);
formatterPtr_ = setWriter::New
(
dict.lookupOrDefault("setFormat", time_.graphFormat()),
dict
);
return true;
}
@ -534,11 +538,11 @@ bool Foam::functionObjects::streamlines::write()
{
// Make output directory
const fileName outputPath =
mesh_.time().globalPath()
time_.globalPath()
/writeFile::outputPrefix
/(mesh_.name() != polyMesh::defaultRegion ? mesh_.name() : word())
/name()
/mesh_.time().name();
/time_.name();
mkDir(outputPath);
// Pass data to the formatter to 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-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -59,7 +59,7 @@ void Foam::functionObjects::turbulenceFields::processField
IOobject
(
scopedName,
obr_.time().name(),
time_.name(),
obr_,
IOobject::READ_IF_PRESENT,
IOobject::NO_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) 2016-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -261,7 +261,7 @@ bool Foam::functionObjects::wallHeatFlux::write()
if (Pstream::master())
{
file()
<< mesh_.time().userTimeValue()
<< time_.userTimeValue()
<< tab << pp.name()
<< tab << minqp
<< tab << maxqp

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-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -221,7 +221,7 @@ bool Foam::functionObjects::wallHeatTransferCoeff::write()
if (Pstream::master())
{
file()
<< mesh_.time().userTimeValue()
<< time_.userTimeValue()
<< tab << pp.name()
<< tab << minHtcp
<< tab << maxHtcp

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-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -243,7 +243,7 @@ bool Foam::functionObjects::wallShearStress::write()
if (Pstream::master())
{
file() << mesh_.time().userTimeValue()
file() << time_.userTimeValue()
<< tab << pp.name()
<< tab << minSsp
<< tab << maxSsp