functionObject: Improved incorrect and incomplete argument error messages

Both the functionObject call context (the command line for postProcess, and the
controlDict path for run-time post-precessing) and the configuration file
context where the arguments are substituted are now printed in the error
message, e.g.

    postProcess -func 'patchAverage(name=inlet, ields=(p U))'

generates the message

--> FOAM FATAL IO ERROR:
Essential value for keyword 'fields' not set in function entry
    patchAverage(name=inlet, ields=(p U))
    in command line postProcess -func patchAverage(name=inlet, ields=(p U))
    Placeholder value is <field_names>

file: /home/dm2/henry/OpenFOAM/OpenFOAM-dev/etc/caseDicts/postProcessing/surfaceFieldValue/patchAverage from line 13 to line 17.

and with the following in controlDict

functions
{
    #includeFunc patchAverage(name=inlet, ields=(p U))
}

generates the message

--> FOAM FATAL IO ERROR:
Essential value for keyword 'fields' not set in function entry
     patchAverage(name=inlet, ields=(p U))
    in file /home/dm2/henry/OpenFOAM/OpenFOAM-dev/tutorials/incompressible/pimpleFoam/RAS/pitzDaily/system/controlDict at line 55
    Placeholder value is <field_names>

file: /home/dm2/henry/OpenFOAM/OpenFOAM-dev/etc/caseDicts/postProcessing/surfaceFieldValue/patchAverage from line 13 to line 17.
This commit is contained in:
Henry Weller
2019-08-10 19:16:25 +01:00
parent 808e827d20
commit 81f9320119
16 changed files with 132 additions and 39 deletions

View File

@ -95,6 +95,14 @@ class functionObjectList
// configuration files, add to the given map and recurse
static void listDir(const fileName& dir, HashSet<word>& foMap);
static void checkUnsetEntries
(
const string& funcNameArgs,
const dictionary& funcArgsDict,
const dictionary& funcDict,
const string& context
);
public:
@ -247,6 +255,7 @@ public:
(
const string& funcNameArgs0,
dictionary& functionsDict,
const string& context,
HashSet<word>& requiredFields,
const word& region = word::null
);