functionObjects: Fixes to restart and run-time modification behaviour

All function objects now re-read as a result of run-time modifications
to the system/controlDict.

Function objects that write log files (via the logFiles class) will now
generate a new postProcessing/<funcName>/<time> directory as a result of
either restart or run-time modification. Log files will therefore never
be overwritten by restart or run-time modification, except for when a
case is restarted at the same time as a previous execution (e.g.,
repeated runs at the start time).
This commit is contained in:
Will Bainbridge
2021-01-22 10:34:37 +00:00
parent 4e301e9227
commit 3ca14ebe58
24 changed files with 99 additions and 100 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) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -110,7 +110,6 @@ Foam::functionObjects::fieldMinMax::fieldMinMax
fieldSet_()
{
read(dict);
resetName(typeName);
}
@ -131,6 +130,8 @@ bool Foam::functionObjects::fieldMinMax::read(const dictionary& dict)
mode_ = modeTypeNames_[dict.lookupOrDefault<word>("mode", "magnitude")];
dict.lookup("fields") >> fieldSet_;
resetName(typeName);
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
@ -52,11 +52,11 @@ Foam::functionObjects::fieldValue::fieldValue
fvMeshFunctionObject(name, runTime, dict),
logFiles(obr_, name),
dict_(dict),
valueType_(valueType),
regionName_(word::null),
resultDict_(fileName("name"), dictionary::null)
{
read(dict);
resetName(valueType);
}
@ -71,11 +71,11 @@ Foam::functionObjects::fieldValue::fieldValue
fvMeshFunctionObject(name, obr, dict),
logFiles(obr_, name),
dict_(dict),
valueType_(valueType),
regionName_(word::null),
resultDict_(fileName("name"), dictionary::null)
{
read(dict);
resetName(valueType);
}
@ -99,6 +99,8 @@ bool Foam::functionObjects::fieldValue::read(const dictionary& dict)
dict.lookup("fields") >> fields_;
dict.lookup("writeFields") >> writeFields_;
resetName(valueType_);
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-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -73,6 +73,9 @@ protected:
//- Construction dictionary
dictionary dict_;
//- The name of the type of value (volFieldValue, or surfaceFieldValue)
const word valueType_;
//- Name of region (patch, zone, etc.)
word regionName_;

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
@ -113,7 +113,6 @@ Foam::functionObjects::fieldValues::fieldValueDelta::fieldValueDelta
region2Ptr_(nullptr)
{
read(dict);
resetName(typeName);
}
@ -155,6 +154,8 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::read
operation_ = operationTypeNames_.read(dict.lookup("operation"));
resetName(typeName);
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-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -224,7 +224,6 @@ Foam::functionObjects::interfaceHeight::interfaceHeight
interpolationScheme_("cellPoint")
{
read(dict);
resetNames({"height", "position"});
}
@ -238,11 +237,15 @@ Foam::functionObjects::interfaceHeight::~interfaceHeight()
bool Foam::functionObjects::interfaceHeight::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
dict.readIfPresent("alpha", alphaName_);
dict.readIfPresent("liquid", liquid_);
dict.lookup("locations") >> locations_;
dict.readIfPresent("interpolationScheme", interpolationScheme_);
resetNames({"height", "position"});
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) 2018-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2018-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -72,8 +72,6 @@ Foam::functionObjects::turbulenceIntensity::turbulenceIntensity
writeLocalObjects(obr_, log)
{
read(dict);
resetName(typeName);
resetLocalObjectName("I");
}
@ -90,6 +88,9 @@ bool Foam::functionObjects::turbulenceIntensity::read(const dictionary& dict)
fvMeshFunctionObject::read(dict);
writeLocalObjects::read(dict);
resetName(typeName);
resetLocalObjectName("I");
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
@ -120,8 +120,6 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
patchSet_()
{
read(dict);
resetName(typeName);
resetLocalObjectName(typeName);
}
@ -185,6 +183,9 @@ bool Foam::functionObjects::wallHeatFlux::read(const dictionary& dict)
patchSet_ = filteredPatchSet;
}
resetName(typeName);
resetLocalObjectName(typeName);
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) 2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -76,15 +76,13 @@ Foam::functionObjects::wallHeatTransferCoeff::wallHeatTransferCoeff
fvMeshFunctionObject(name, runTime, dict),
logFiles(obr_, name),
writeLocalObjects(obr_, log),
coeffModel_(wallHeatTransferCoeffModel::New(dict.name(), mesh_, dict)),
rho_("rho", dimDensity, Zero),
Cp_("Cp", dimArea/sqr(dimTime)/dimTemperature, Zero),
runTime_(runTime),
patchSet_()
{
coeffModel_ = wallHeatTransferCoeffModel::New(dict.name(), mesh_, dict);
read(dict);
resetName(typeName);
resetLocalObjectName(typeName);
}
@ -162,6 +160,9 @@ bool Foam::functionObjects::wallHeatTransferCoeff::read(const dictionary& dict)
coeffModel_->read(dict);
resetName(typeName);
resetLocalObjectName(typeName);
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) 2013-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -105,8 +105,6 @@ Foam::functionObjects::wallShearStress::wallShearStress
patchSet_()
{
read(dict);
resetName(typeName);
resetLocalObjectName(typeName);
}
@ -170,6 +168,9 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
patchSet_ = filteredPatchSet;
}
resetName(typeName);
resetLocalObjectName(typeName);
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) 2013-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -138,8 +138,6 @@ Foam::functionObjects::yPlus::yPlus
phaseName_(dict.lookupOrDefault<word>("phase", word::null))
{
read(dict);
resetName(IOobject::groupName(typeName, phaseName_));
resetLocalObjectName(IOobject::groupName(typeName, phaseName_));
}
@ -156,6 +154,9 @@ bool Foam::functionObjects::yPlus::read(const dictionary& dict)
fvMeshFunctionObject::read(dict);
writeLocalObjects::read(dict);
resetName(IOobject::groupName(typeName, phaseName_));
resetLocalObjectName(IOobject::groupName(typeName, phaseName_));
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-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -559,7 +559,6 @@ Foam::functionObjects::forces::forces
initialised_(false)
{
read(dict);
resetNames(createFileNames(dict));
}
@ -594,7 +593,6 @@ Foam::functionObjects::forces::forces
initialised_(false)
{
read(dict);
resetNames(createFileNames(dict));
}
@ -739,6 +737,8 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
moment_[2].setSize(1);
}
resetNames(createFileNames(dict));
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) 2012-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -87,8 +87,6 @@ bool Foam::functionObjects::cloudInfo::read(const dictionary& dict)
{
regionFunctionObject::read(dict);
logFiles::resetNames(dict.lookup("clouds"));
Info<< type() << " " << name() << ": ";
if (names().size())
{
@ -104,6 +102,8 @@ bool Foam::functionObjects::cloudInfo::read(const dictionary& dict)
Info<< "no clouds to be processed" << nl << endl;
}
resetNames(dict.lookup("clouds"));
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) 2015-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -58,7 +58,6 @@ Foam::functionObjects::residuals::residuals
fieldSet_()
{
read(dict);
resetName(typeName);
}
@ -76,6 +75,8 @@ bool Foam::functionObjects::residuals::read(const dictionary& dict)
dict.lookup("fields") >> fieldSet_;
resetName(typeName);
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) 2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2018-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -61,8 +61,6 @@ Foam::functionObjects::time::time
clockTime0_(time_.elapsedClockTime())
{
read(dict);
resetName(typeName);
write();
}
@ -80,6 +78,8 @@ bool Foam::functionObjects::time::read(const dictionary& dict)
dict.readIfPresent("perTimeStep", perTimeStep_);
resetName(typeName);
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) 2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -58,7 +58,6 @@ Foam::functionObjects::timeStep::timeStep
logFiles(obr_, name)
{
read(dict);
resetName(typeName);
}
@ -74,6 +73,8 @@ bool Foam::functionObjects::timeStep::read(const dictionary& dict)
{
functionObject::read(dict);
resetName(typeName);
return true;
}