Commit Graph

130 Commits

Author SHA1 Message Date
2caad45a9b functionObjects/setTimeStep: Compatibility with 'adjustableRunTime'
setTimeStep is now compatible with a 'writeControl adjustableRunTime;'
setting in the systemControlDict. If 'adjustableRunTime' is selected
then the time-step values set by this function object will not be
exactly as specified, but write intervals will be matched exactly.

All function object time adjustment is now done during the execute
methods, so the specific setTimeStep hooks have been removed.
2021-01-26 08:12:21 +00:00
3ca14ebe58 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).
2021-01-26 08:12:21 +00:00
1adc1806df functionObjects::logFiles: Removed the writing of additional '_0' or '_<time>' files on restart
Given that logFiles now writes the log files into postProcessing/<func
name>/<time> it is no longer useful to add '_<time>' to the log file name in the
case that the file already exists without this extension.
2021-01-21 12:06:46 +00:00
0b21dbf1ec functionObject: Updated documentation
Resolves report https://bugs.openfoam.org/view.php?id=3609
2021-01-08 13:18:02 +00:00
f5b0a27241 includeFunc: Added 'funcName' option to set the name of the functionObject entry in the functions list
This is used to set the directory name for the results of the functionObject, if
not specified a unique name is generated automatically from the function type
and argument list, e.g.

    #includeFunc patchAverage(name=inlet, fields=(p U))

writes surfaceFieldValue.dat in postProcessing/patchAverage(name=inlet,fields=(pU))/0 and

    #includeFunc patchAverage(funcName=inlet, name=inlet, fields=(p U))

writes surfaceFieldValue.dat in postProcessing/inlet/0.
2020-12-11 17:10:46 +00:00
f7848e62a1 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
2020-10-27 20:03:19 +00:00
b7b000be3b functionObjects::writeObjects: Changed the default executeAtStart to 'no'
This avoids attempting to write temporary fields before they have been created.
The executeAtStart can be set to 'yes' in the writeObjects dictionary or the

functions
{
    #includeFunc writeObjects(executeAtStart = yes, <field1>, <field2>...)
}
2020-10-22 12:36:47 +01:00
081f2d5726 writeObjectsBase: Append explicit names (regExp = false) directly to the list 2020-09-27 20:13:56 +01:00
560db98b34 dictionary: Standardised and centralised the argument list parser
to simplify maintenance
2020-09-19 15:52:09 +01:00
ad33cc2cc8 functionObject: Added support for scoped keyword lookup in the argument list
functions
{
    #includeFunc        singleGraph(setConfig/axis = y)
    .
    .
    .
}
2020-09-18 21:39:40 +01:00
def4772281 Documentation: Centred the Class Declaration comment
Patch contributed by Institute of Fluid Dynamics,
Helmholtz-Zentrum Dresden - Rossendorf (HZDR)
2020-08-28 13:28:58 +01:00
d82d47c74b regIOobject.H: Rationalised includes 2020-08-21 08:40:47 +01:00
a4fb8c6460 functionObject.H: Corrected documentation of the end() member function
Resolves bug-report https://bugs.openfoam.org/view.php?id=3487
2020-04-22 10:10:18 +01:00
b9c7428619 functionObjectList::wordAndDictionary: Added null constructor for pre-7 gcc versions
Resolves bug-report https://bugs.openfoam.org/view.php?id=3479
2020-04-10 16:08:04 +01:00
3a83ac7b85 functionObjectList: Removed unused sub-class 2020-04-08 11:04:26 +01:00
81188fefaa functionObjectList: Improved flexibility of field argument parsing
Additional flexibility for handling of field arguments has been extended
to dictionary lists of field settings, as well as word lists of field
names. This means that the following syntax is now supported:

    postProcess -func "fieldAverage(p, U { prime2Mean on; }, T)"

    postProcess -func "fieldAverage(fields=(p U { prime2Mean on; } T))"
2020-04-08 09:03:23 +01:00
ad12d3a8c1 functionObjectList: Improved flexibility of field argument parsing
Function object argument parsing now takes all "field", "fields" and
"objects" arguments and combines them into a single list of
fields/objects that the function should operate on. This means that the
following postProcess executions are now all equivalent and function as
expected:

    postProcess -func "
        flowRatePatch
        (
            name=outlet,
            phi,
            alphaRhoPhi.air,
            alphaRhoPhi.particles
        )"

    postProcess -func "
        flowRatePatch
        (
            name=outlet,
            fields=(phi alphaRhoPhi.air alphaRhoPhi.particles)
        )"

    postProcess -func "
        flowRatePatch
        (
            name=outlet,
            objects=(phi),
            alphaRhoPhi.air,
            field=alphaRhoPhi.particles
        )"

As are the following:

    postProcess -func "mag(U.air)"

    postProcess -func "mag(field=U.air)"
2020-04-07 17:02:27 +01:00
b78df458e3 functionObjectList: Add support for additional field attributes in the fields argument to #includeFunc
e.g.

    #includeFunc fieldAverage(fields = (U.air {prime2Mean yes;} U.water {prime2Mean yes;}))
2020-03-12 14:02:19 +00:00
d728b23427 codedFunctionObject: Updated and simplified using the new CodedBase 2020-02-03 21:44:44 +00:00
aff00a2e7e dlLibraryTable: Simplified and rationalised the handling of dynamic library loading
Rather than being tied to the Time class the dlLibraryTable libs is now a global
variable in the Foam namespace which is accessable by any class needing to load
dynamic libraries, in particular argList, Time and codeStream.
2020-01-31 08:18:10 +00:00
bae37a52a6 functionObjects::writeObjects: Added option to disable regular expressions
When selecting fields with complex automatically generated names it is
cumbersome to escape all the regular expression meta characters and more
convenient to specify the name as a literal string, the new regExp option
provides the ability to switch the regular expression support and defaults to
true for backward compatibility.

For example to cache and write out an intermediate temporary field generated by
the kOmegaSST model:

cacheTemporaryObjects
(
    "((interpolate(((1|((1|(1|A(U)))-H(1)))-(1|A(U))))*snGrad(p))*magSf)"
);

functions
{
    #includeFunc writeObjects(regExp=off, "((interpolate(((1|((1|(1|A(U)))-H(1)))-(1|A(U))))*snGrad(p))*magSf)")
}

The regExp option can also be specified in a writeObjects dict as

    regExp  off;

Additionally regular expression support has been added to the includeFunc
argument parsing.
2019-12-25 11:04:31 +00:00
2ef9267323 functionObjectList: Set parent dictionary for temporary function dictionary
so that it inherits the IO properties of the top dictionary.

Resolves bug-report https://bugs.openfoam.org/view.php?id=3414
2019-12-19 16:47:23 +00:00
435b894d2c functionObjectList: Search for functions in multi-region cases in a more logical order
When operating on multi-region cases, function files are now searched
for in the following order:

 - First the $FOAM_CASE/system/<region> directory is searched

 - Second the $FOAM_CASE/system directory is searched

 - Finally a search is done through the preconfigured functions in
   $WM_PROJECT_DIR/etc

Previously, in a multi-region case, preconfigured objects were
considered before those in the case's (non-region) system directory.
This was considered counter-intuitive. Functions residing in the system
directory should always take precedence, whether they are in the region
subdirectory or not.
2019-12-04 11:43:37 +00:00
7d229e7026 functionObject: Log by default to stdout when in postProcess mode, not otherwise
This change formalises the usage of the "log" keyword in function
objects. By default, logging to stdout is activated when running
"postProcess" or "<solver> -postProcess", and deactivated when a
function is being executed as part of a run.

This behaviour can now be overridden in the function object dictionary
when operating in either mode.
2019-11-27 16:27:27 +00:00
5eaf74c3a4 dictionary scalar lookup: simplified syntax using the type templated lookup function
Replaced
    readScalar(dict.lookup("name"))
with
    dict.lookup<scalar>("name")
2019-11-27 14:56:32 +00:00
5f0e76fcf9 functionObjectList: Prevent execution during construction
As of 2ebed5ec, functonObjectList::start contains run commands that
trigger if some function objects are executable at time-zero. A call to
this method in functionObjectList::New has been removed (and replaced
with functonObjectList::read) as it was causing postProcess and <solver>
-postProcess to execute twice; once on construction, and once at the
selected initial time.

This change also fixes lookup errors generated by postProcess which
occured because fields (specified with -field or -fields arguments) are
not read and registered prior to function object construction.

Usage of functonObjectList::start within Time::run has not been altered.
2019-11-15 16:07:35 +00:00
e62ded842f functionObjects::age: Added caching of the age field
to allow post-processing, e.g. sampling, cutting planes, averaging etc.
2019-10-10 16:16:24 +01:00
2ebed5ec71 functionObject: Added executeAtStart
By default most functionObjects now execute and write at the start-time except
those that perform averaging (fieldAverage, dsmcFields) which cannot be executed
until the end of the first time-step.  There is also a new optional
functionObject dictionary entry "executeAtStart" which defaults to true but can
be set false if the execution and results of the functionObject are not required
or appropriate at the start-time.

A result of this change is that time logs of forces, sampling etc. now include a
values for time 0.
2019-09-30 11:03:20 +01:00
dbe9fb3b76 functionObjectList: Removed warning for optional entries
Simplified the residuals functionObject call in the tutorials
2019-09-01 21:16:37 +01:00
6e9801e7e8 functionObjectList: Added support for arguments to added to the object list
If the functionObject requires an object list rather than a field list the
non-named arguments are now inserted into the object list, for example

functions
{
    #includeFunc writeObjects(kEpsilon:G)
}

which is equivalent to

functions
{
    #includeFunc writeObjects(objects = (kEpsilon:G))
}
2019-09-01 15:30:09 +01:00
da52b23f41 functionEntry: Simplified the primitiveEntry created when functions are disabled 2019-08-20 23:36:49 +01:00
2469e5576f functionObjectList: Expanded documentation of the readFunctionObject function 2019-08-11 00:51:41 +01:00
81f9320119 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.
2019-08-10 19:16:25 +01:00
61f9131389 functionObject: Improved handling of #includeFunc arguments
adding support for argument substitution into sub-dictionaries for
e.g. pressureDifferencePatch, white space before, in and after the argument list
and continuation lines, for example:

functions
{
    #includeFunc flowRatePatch(name=inlet)
    #includeFunc flowRatePatch ( name = outlet )

    #includeFunc pressureDifferencePatch \
    (                   \
        patch1 = inlet, \
        patch2 = outlet \
    )

    #includeFunc yPlus
    #includeFunc  residuals
}
2019-08-09 12:40:00 +01:00
213319ae30 Standardised the class declaration section comments to correspond to the foamNewSource template 2019-06-19 15:01:35 +01:00
8e9f692aa4 Standardised the class declaration section comments to correspond to the foamNewSource template 2019-06-13 21:26:33 +01:00
fc4d7b92c3 Corrected documentation comment for disabled copy constructors 2019-05-29 15:58:42 +01:00
f7ea836c65 src/OpenFOAM: Moved the deleted bitwise copy and assignment declarations into public section of the class 2019-05-29 15:48:49 +01:00
9140984cf4 Added "= delete" to disabled bitwise copy constructors and assignment operators
Currently these deleted function declarations are still in the private section
of the class declarations but will be moved by hand to the public section over
time as this is too complex to automate reliably.
2019-05-28 15:26:45 +01:00
30bea84fac C++11 conformance and consistency: Added "move" constructors and assignment operators to OpenFOAM containers
Replaced all uses of complex Xfer class with C++11 "move" constructors and
assignment operators.  Removed the now redundant Xfer class.

This substantial changes improves consistency between OpenFOAM and the C++11 STL
containers and algorithms, reduces memory allocation and copy overhead when
returning containers from functions and simplifies maintenance of the core
libraries significantly.
2019-05-25 17:40:39 +01:00
af45bd636d regIOobject: changed the "valid" argument name to "read" for read function and "write" for write functions
This clarifies the purpose which is to indicate that the object should be read
or written on this particular processor rather than it is or is not valid.
2019-04-27 10:46:57 +01:00
19c3584d4b functionObject::timeControl: Rationalised naming timeStart -> startTime, timeEnd -> endTime
Support for timeStart and timeEnd is maintained for backward-compatibility but
these names are deprecated.
2019-01-18 13:41:08 +00:00
bcbfe542cf Rationalised WM_PROJECT_SITE and WM_PROJECT_INST_DIR in foamEtcFile and etcFiles
for consistency with WM_PROJECT.  Now "etc" files are assumed to be in etc
sub-directories of WM_PROJECT_SITE and WM_PROJECT_INST_DIR allowing other files
to be stored in those directories.  The search order is now:

Search for files from user/group/shipped directories.
The search scheme allows for version-specific and
version-independent files using the following hierarchy:
- \b user settings:
  - ~/.OpenFOAM/\<VERSION\>/
  - ~/.OpenFOAM/
- \b group (site) settings (when $WM_PROJECT_SITE is set):
  - $WM_PROJECT_SITE/\<VERSION\>/etc/
  - $WM_PROJECT_SITE/etc/
- \b group (site) settings (when $WM_PROJECT_SITE is not set):
  - $WM_PROJECT_INST_DIR/site/\<VERSION\>/etc/
  - $WM_PROJECT_INST_DIR/site/etc/
- \b other (shipped) settings:
  - $WM_PROJECT_DIR/etc/

\return The list of full paths of all the matching files or
an empty list if the name cannot be found.
Optionally abort if the file cannot be found.
Optionally stop search after the first file has been found.

This change was proposed and agreed by the sponsors of the OpenFOAM project on
the OpenFOAM Hub, see https://openfoam.org/maintenance/
2018-11-28 22:00:34 +00:00
fb173af944 postProcess: Updated to allow functionObjects to access fields on construction 2018-09-28 10:29:22 +01:00
8ed92de98c src/OpenFOAM: Rationalised use of enumerations by using the C++11 scoped form
for

    db/functionObjects/timeControl/timeControl.H: timeControls
    primitives/bools/Switch/Switch.H: class switchType
    primitives/strings/fileName/fileName.H: fileType
    primitives/strings/wordRe/wordRe.H: compOption
2018-08-25 07:26:51 +01:00
bf54ab67e1 Updated OpenFOAM Foundation web-link in headers 2018-07-06 21:42:54 +01:00
42dde9014c postProcess.H: clear the object owned by the mesh objectRegistry
at the end of each time processed to ensure all fields are updated for each
time.

Resolves bug-report https://bugs.openfoam.org/view.php?id=2997
2018-06-27 22:21:02 +01:00
135e6eb8b9 sampleSet: Improve error message for renamed sets 2018-06-21 08:42:16 +01:00
f29114bfb6 Removed incomplete, inconsistent, confusing and un-maintained header clutter 2018-06-20 15:55:18 +01:00
89f1053f82 Code style: Fixed formatting of banners 2018-06-19 12:01:50 +01:00