From f7848e62a1722fb8a99ee67ba2fa8d229d50d8cd Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Tue, 27 Oct 2020 20:03:19 +0000 Subject: [PATCH] functionObjects: Emit warning messages only for field names which do not exist for any type Resolves bug-report https://bugs.openfoam.org/view.php?id=3583 --- .../regionFunctionObject.C | 13 ++++- .../regionFunctionObject.H | 7 +++ .../regionFunctionObjectTemplates.C | 15 +++++- .../field/CourantNo/CourantNo.C | 4 +- src/functionObjects/field/Lambda2/Lambda2.C | 4 +- src/functionObjects/field/PecletNo/PecletNo.C | 2 + src/functionObjects/field/Q/Q.C | 4 +- .../field/blendingFactor/blendingFactor.C | 7 ++- .../field/components/components.C | 7 ++- src/functionObjects/field/ddt/ddt.C | 15 +++--- src/functionObjects/field/div/div.C | 7 ++- .../field/enstrophy/enstrophy.C | 4 +- .../field/fieldExpression/fieldExpression.H | 10 ---- .../fieldExpressionTemplates.C | 52 ------------------- .../fieldValues/volFieldValue/volFieldValue.C | 13 ++--- .../fieldsExpressionTemplates.C | 10 ++-- src/functionObjects/field/flowType/flowType.C | 4 +- src/functionObjects/field/grad/grad.C | 7 ++- src/functionObjects/field/log/log.C | 4 +- src/functionObjects/field/mag/mag.C | 15 +++--- src/functionObjects/field/magSqr/magSqr.C | 15 +++--- src/functionObjects/field/pressure/pressure.C | 4 +- .../field/randomise/randomise.C | 13 +++-- src/functionObjects/field/scale/scale.C | 15 +++--- .../field/streamFunction/streamFunction.C | 4 +- .../field/vorticity/vorticity.C | 4 +- .../biconic25-55Run35/system/controlDict | 4 +- 27 files changed, 140 insertions(+), 123 deletions(-) delete mode 100644 src/functionObjects/field/fieldExpression/fieldExpressionTemplates.C diff --git a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C index beca50ade0..b62fe38bdb 100644 --- a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,6 +40,17 @@ namespace functionObjects // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // +void Foam::functionObjects::regionFunctionObject::cannotFindObject +( + const word& fieldName +) +{ + Warning + << " functionObjects::" << type() << " " << name() + << " cannot find required object " << fieldName << endl; +} + + bool Foam::functionObjects::regionFunctionObject::writeObject ( const word& fieldName diff --git a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H index 827bc6860a..c2139a06cb 100644 --- a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H @@ -78,6 +78,13 @@ protected: template bool foundObject(const word& fieldName) const; + //- Prints a warning message that fieldName cannot be found + template + void cannotFindObject(const word& fieldName); + + //- Prints a warning message that fieldName cannot be found + void cannotFindObject(const word& fieldName); + //- Lookup object from the objectRegistry template const ObjectType& lookupObject(const word& fieldName) const; diff --git a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C index cbb89d8ec1..d03bea8300 100644 --- a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C +++ b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,6 +38,19 @@ bool Foam::functionObjects::regionFunctionObject::foundObject } +template +void Foam::functionObjects::regionFunctionObject::cannotFindObject +( + const word& fieldName +) +{ + Warning + << " functionObjects::" << type() << " " << name() + << " cannot find required object " << fieldName << " of type " + << Type::typeName << endl; +} + + template const ObjectType& Foam::functionObjects::regionFunctionObject::lookupObject ( diff --git a/src/functionObjects/field/CourantNo/CourantNo.C b/src/functionObjects/field/CourantNo/CourantNo.C index 6ec91d1a28..465c4c350a 100644 --- a/src/functionObjects/field/CourantNo/CourantNo.C +++ b/src/functionObjects/field/CourantNo/CourantNo.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -98,6 +98,8 @@ bool Foam::functionObjects::CourantNo::calc() } else { + cannotFindObject(fieldName_); + return false; } } diff --git a/src/functionObjects/field/Lambda2/Lambda2.C b/src/functionObjects/field/Lambda2/Lambda2.C index eab2077b9c..182ef2c537 100644 --- a/src/functionObjects/field/Lambda2/Lambda2.C +++ b/src/functionObjects/field/Lambda2/Lambda2.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,6 +69,8 @@ bool Foam::functionObjects::Lambda2::calc() } else { + cannotFindObject(fieldName_); + return false; } } diff --git a/src/functionObjects/field/PecletNo/PecletNo.C b/src/functionObjects/field/PecletNo/PecletNo.C index 6e561e16e2..46a9c2b94b 100644 --- a/src/functionObjects/field/PecletNo/PecletNo.C +++ b/src/functionObjects/field/PecletNo/PecletNo.C @@ -76,6 +76,8 @@ bool Foam::functionObjects::PecletNo::calc() } else { + cannotFindObject(fieldName_); + return false; } } diff --git a/src/functionObjects/field/Q/Q.C b/src/functionObjects/field/Q/Q.C index 6d79b04c82..3457925e57 100644 --- a/src/functionObjects/field/Q/Q.C +++ b/src/functionObjects/field/Q/Q.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,6 +63,8 @@ bool Foam::functionObjects::Q::calc() } else { + cannotFindObject(fieldName_); + return false; } } diff --git a/src/functionObjects/field/blendingFactor/blendingFactor.C b/src/functionObjects/field/blendingFactor/blendingFactor.C index 83b3cff5ac..5328b3a1ef 100644 --- a/src/functionObjects/field/blendingFactor/blendingFactor.C +++ b/src/functionObjects/field/blendingFactor/blendingFactor.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,6 +47,11 @@ bool Foam::functionObjects::blendingFactor::calc() processed = processed || calcBF(); processed = processed || calcBF(); + if (!processed) + { + cannotFindObject(fieldName_); + } + return processed; } diff --git a/src/functionObjects/field/components/components.C b/src/functionObjects/field/components/components.C index c9a351bbcc..90c686c076 100644 --- a/src/functionObjects/field/components/components.C +++ b/src/functionObjects/field/components/components.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,6 +49,11 @@ bool Foam::functionObjects::components::calc() processed = processed || calcComponents(); processed = processed || calcComponents(); + if (!processed) + { + cannotFindObject(fieldName_); + } + return processed; } diff --git a/src/functionObjects/field/ddt/ddt.C b/src/functionObjects/field/ddt/ddt.C index 138f0153c2..567090bc3c 100644 --- a/src/functionObjects/field/ddt/ddt.C +++ b/src/functionObjects/field/ddt/ddt.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,11 +53,14 @@ bool Foam::functionObjects::ddt::calc() bool processed = false; - processed = processed || calcDdt(); - processed = processed || calcDdt(); - processed = processed || calcDdt(); - processed = processed || calcDdt(); - processed = processed || calcDdt(); + #define processType(fieldType, none) \ + processed = processed || calcDdt(); + FOR_ALL_FIELD_TYPES(processType) + + if (!processed) + { + cannotFindObject(fieldName_); + } return processed; } diff --git a/src/functionObjects/field/div/div.C b/src/functionObjects/field/div/div.C index 93adf716f3..f9a97f65a2 100644 --- a/src/functionObjects/field/div/div.C +++ b/src/functionObjects/field/div/div.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,6 +49,11 @@ bool Foam::functionObjects::div::calc() processed = processed || calcDiv(); processed = processed || calcDiv(); + if (!processed) + { + cannotFindObject(fieldName_); + } + return processed; } diff --git a/src/functionObjects/field/enstrophy/enstrophy.C b/src/functionObjects/field/enstrophy/enstrophy.C index e7332d4d66..23653f4de0 100644 --- a/src/functionObjects/field/enstrophy/enstrophy.C +++ b/src/functionObjects/field/enstrophy/enstrophy.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -59,6 +59,8 @@ bool Foam::functionObjects::enstrophy::calc() } else { + cannotFindObject(fieldName_); + return false; } diff --git a/src/functionObjects/field/fieldExpression/fieldExpression.H b/src/functionObjects/field/fieldExpression/fieldExpression.H index ea31f72b28..ce03514ce7 100644 --- a/src/functionObjects/field/fieldExpression/fieldExpression.H +++ b/src/functionObjects/field/fieldExpression/fieldExpression.H @@ -38,7 +38,6 @@ SourceFiles #define functionObjects_fieldExpression_H #include "fvMeshFunctionObject.H" -#include "volFieldsFwd.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -70,9 +69,6 @@ protected: virtual bool calc() = 0; - template - bool foundObject(const word& name); - public: @@ -129,12 +125,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository - #include "fieldExpressionTemplates.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/functionObjects/field/fieldExpression/fieldExpressionTemplates.C b/src/functionObjects/field/fieldExpression/fieldExpressionTemplates.C deleted file mode 100644 index e5c034e28f..0000000000 --- a/src/functionObjects/field/fieldExpression/fieldExpressionTemplates.C +++ /dev/null @@ -1,52 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "fieldExpression.H" - -// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // - -template -bool Foam::functionObjects::fieldExpression::foundObject -( - const word& name -) -{ - if (fvMeshFunctionObject::foundObject(name)) - { - return true; - } - else - { - Warning - << " functionObjects::" << type() << " " << this->name() - << " cannot find required object " << name << " of type " - << Type::typeName << endl; - - return false; - } -} - - -// ************************************************************************* // diff --git a/src/functionObjects/field/fieldValues/volFieldValue/volFieldValue.C b/src/functionObjects/field/fieldValues/volFieldValue/volFieldValue.C index 5694c82b27..c1b7cfac3f 100644 --- a/src/functionObjects/field/fieldValues/volFieldValue/volFieldValue.C +++ b/src/functionObjects/field/fieldValues/volFieldValue/volFieldValue.C @@ -191,18 +191,13 @@ bool Foam::functionObjects::fieldValues::volFieldValue::write() const word& fieldName = fields_[i]; bool processed = false; - processed = processed || writeValues(fieldName); - processed = processed || writeValues(fieldName); - processed = processed || writeValues(fieldName); - processed = processed || writeValues(fieldName); - processed = processed || writeValues(fieldName); + #define processType(fieldType, none) \ + processed = processed || writeValues(fieldName); + FOR_ALL_FIELD_TYPES(processType) if (!processed) { - WarningInFunction - << "Requested field " << fieldName - << " not found in database and not processed" - << endl; + cannotFindObject(fieldName); } } diff --git a/src/functionObjects/field/fieldsExpression/fieldsExpressionTemplates.C b/src/functionObjects/field/fieldsExpression/fieldsExpressionTemplates.C index 5cb5b6ac78..2eb0b182e6 100644 --- a/src/functionObjects/field/fieldsExpression/fieldsExpressionTemplates.C +++ b/src/functionObjects/field/fieldsExpression/fieldsExpressionTemplates.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,11 +69,9 @@ bool Foam::functionObjects::fieldsExpression::calcAllTypes(FOType& fo) { bool processed = false; - processed = processed || fo.template calcType(fo); - processed = processed || fo.template calcType(fo); - processed = processed || fo.template calcType(fo); - processed = processed || fo.template calcType(fo); - processed = processed || fo.template calcType(fo); + #define processType(fieldType, none) \ + processed = processed || fo.template calcType(fo); + FOR_ALL_FIELD_TYPES(processType) return processed; } diff --git a/src/functionObjects/field/flowType/flowType.C b/src/functionObjects/field/flowType/flowType.C index a5e346bb96..08740c5c3a 100644 --- a/src/functionObjects/field/flowType/flowType.C +++ b/src/functionObjects/field/flowType/flowType.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,6 +73,8 @@ bool Foam::functionObjects::flowType::calc() } else { + cannotFindObject(fieldName_); + return false; } } diff --git a/src/functionObjects/field/grad/grad.C b/src/functionObjects/field/grad/grad.C index de21feb075..90a806a49e 100644 --- a/src/functionObjects/field/grad/grad.C +++ b/src/functionObjects/field/grad/grad.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,6 +47,11 @@ bool Foam::functionObjects::grad::calc() processed = processed || calcGrad(); processed = processed || calcGrad(); + if (!processed) + { + cannotFindObject(fieldName_); + } + return processed; } diff --git a/src/functionObjects/field/log/log.C b/src/functionObjects/field/log/log.C index e2452084f3..1aac1afb38 100644 --- a/src/functionObjects/field/log/log.C +++ b/src/functionObjects/field/log/log.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -78,6 +78,8 @@ bool Foam::functionObjects::log::calc() } else { + cannotFindObject(fieldName_); + return false; } diff --git a/src/functionObjects/field/mag/mag.C b/src/functionObjects/field/mag/mag.C index 6f512192ef..e4b40d4473 100644 --- a/src/functionObjects/field/mag/mag.C +++ b/src/functionObjects/field/mag/mag.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,11 +44,14 @@ bool Foam::functionObjects::mag::calc() { bool processed = false; - processed = processed || calcMag(); - processed = processed || calcMag(); - processed = processed || calcMag(); - processed = processed || calcMag(); - processed = processed || calcMag(); + #define processType(fieldType, none) \ + processed = processed || calcMag(); + FOR_ALL_FIELD_TYPES(processType) + + if (!processed) + { + cannotFindObject(fieldName_); + } return processed; } diff --git a/src/functionObjects/field/magSqr/magSqr.C b/src/functionObjects/field/magSqr/magSqr.C index ce4de177cc..0e2fdd9655 100644 --- a/src/functionObjects/field/magSqr/magSqr.C +++ b/src/functionObjects/field/magSqr/magSqr.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,11 +44,14 @@ bool Foam::functionObjects::magSqr::calc() { bool processed = false; - processed = processed || calcMagSqr(); - processed = processed || calcMagSqr(); - processed = processed || calcMagSqr(); - processed = processed || calcMagSqr(); - processed = processed || calcMagSqr(); + #define processType(fieldType, none) \ + processed = processed || calcMagSqr(); + FOR_ALL_FIELD_TYPES(processType) + + if (!processed) + { + cannotFindObject(fieldName_); + } return processed; } diff --git a/src/functionObjects/field/pressure/pressure.C b/src/functionObjects/field/pressure/pressure.C index bbecabc87a..c1952f8a1a 100644 --- a/src/functionObjects/field/pressure/pressure.C +++ b/src/functionObjects/field/pressure/pressure.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -175,6 +175,8 @@ bool Foam::functionObjects::pressure::calc() } else { + cannotFindObject(fieldName_); + return false; } } diff --git a/src/functionObjects/field/randomise/randomise.C b/src/functionObjects/field/randomise/randomise.C index af1cc58bb7..54c8db6b26 100644 --- a/src/functionObjects/field/randomise/randomise.C +++ b/src/functionObjects/field/randomise/randomise.C @@ -44,11 +44,14 @@ bool Foam::functionObjects::randomise::calc() { bool processed = false; - processed = processed || calcRandomised(); - processed = processed || calcRandomised(); - processed = processed || calcRandomised(); - processed = processed || calcRandomised(); - processed = processed || calcRandomised(); + #define processType(fieldType, none) \ + processed = processed || calcRandomised(); + FOR_ALL_FIELD_TYPES(processType) + + if (!processed) + { + cannotFindObject(fieldName_); + } return processed; } diff --git a/src/functionObjects/field/scale/scale.C b/src/functionObjects/field/scale/scale.C index 32401147d5..62bf365f5b 100644 --- a/src/functionObjects/field/scale/scale.C +++ b/src/functionObjects/field/scale/scale.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,11 +44,14 @@ bool Foam::functionObjects::scale::calc() { bool processed = false; - processed = processed || calcScale(); - processed = processed || calcScale(); - processed = processed || calcScale(); - processed = processed || calcScale(); - processed = processed || calcScale(); + #define processType(fieldType, none) \ + processed = processed || calcScale(); + FOR_ALL_FIELD_TYPES(processType) + + if (!processed) + { + cannotFindObject(fieldName_); + } return processed; } diff --git a/src/functionObjects/field/streamFunction/streamFunction.C b/src/functionObjects/field/streamFunction/streamFunction.C index 09d2b1dd87..a29506ddc5 100644 --- a/src/functionObjects/field/streamFunction/streamFunction.C +++ b/src/functionObjects/field/streamFunction/streamFunction.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -420,6 +420,8 @@ bool Foam::functionObjects::streamFunction::calc() } else { + cannotFindObject(fieldName_); + return false; } } diff --git a/src/functionObjects/field/vorticity/vorticity.C b/src/functionObjects/field/vorticity/vorticity.C index bfcb790604..faadda4aaa 100644 --- a/src/functionObjects/field/vorticity/vorticity.C +++ b/src/functionObjects/field/vorticity/vorticity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -59,6 +59,8 @@ bool Foam::functionObjects::vorticity::calc() } else { + cannotFindObject(fieldName_); + return false; } diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/controlDict b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/controlDict index ba1f0a6b5f..581ae581f0 100644 --- a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/controlDict +++ b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/controlDict @@ -17,7 +17,7 @@ FoamFile application rhoCentralFoam; -startFrom latestTime; +startFrom startTime; startTime 0; @@ -53,7 +53,7 @@ maxDeltaT 2e-8; functions { - #includeFunc wallHeatFlux + #includeFunc wallHeatFlux(log = true) #includeFunc sample }