Commit Graph

23 Commits

Author SHA1 Message Date
Andrew Heather
dffb5774d5 ENH: Added new foamReport functionObject
Replaces user-supplied keywords by run-time computed values in a text file.

Usage
    Example using system/controlDict.functions:

    foamReport1
    {
        // Mandatory entries (unmodifiable)
        type            foamReport;
        libs            (foamUtilityFunctionObjects);

        template        "<system>/myTemplate.md";

        substitutions
        {
            divSchemes1
            {
                type        dictionaryValue;
                object      fvSchemes;

                entries
                {
                    divSchemes      "divSchemes";
                }
            }
            fvSolution1
            {
                type        dictionaryValue;
                path        "<system>/fvSolution";

                entries
                {
                    solver_p        "solvers/p/solver";
                    solver_p_tol    "solvers/p/tolerance";
                    solver_p_reltol "solvers/p/relTol";
                    solver_U        "solvers/U/solver";
                    solver_U_tol    "solvers/U/tolerance";
                    solver_U_reltol "solvers/U/relTol";
                }
            }
            controlDict1
            {
                type        dictionaryValue;
                path        "<system>/controlDict";

                entries
                {
                    initial_deltaT       "deltaT";
                }
            }
            continuityErrors
            {
                type        functionObjectValue;
                functionObject continuityError1;

                entries
                {
                    cont_error_local    local;
                    cont_error_global   global;
                    cont_error_cumulative cumulative;
                }
            }
        }
2024-12-20 09:51:42 +00:00
Andrew Heather
82e471e045 ENH: Added new graphFunctionObject function object
Accumulates function object result values and renders into a graph in SVG format

Minimal example by using system/controlDict.functions to plot the residuals from
the solverInfo function Object:

    residualGraph
    {
        type            graphFunctionObject;
        libs            (utilityFunctionObjects);
        writeControl    writeTime;

        logScaleX       no;
        logScaleY       yes;

        xlabel          "Iteration";
        ylabel          "log10(Initial residual)";

        functions
        {
            line1
            {
                object      solverInfo1;
                entry       Ux_initial;
            }
            line2
            {
                object      solverInfo1;
                entry       Uy_initial;
            }
            line3
            {
                object      solverInfo1;
                entry       Uz_initial;
            }
            line4
            {
                object      solverInfo1;
                entry       p_initial;
            }
        }
    }
2024-12-20 09:51:42 +00:00
Andrew Heather
64c15e179a ENH: New viewFactorHeatFlux function object
Determines radiation heat flux between patches when using the viewFactor
radiation model.

Example usage

    viewFactorHeatFlux1
    {
        // Mandatory entries (unmodifiable)
        type        viewFactorHeatFlux;
        libs        (utilityFunctionObjects);

        // Optional entries (runtime modifiable)
        qr          qr;
    }
2024-06-04 16:39:56 +00:00
Andrew Heather
6242e70d09 ENH: Added new caseInfo function object
Collects and writes case information to file in OpenFOAM dictionary or JSON
format.  Data includes:

- meta: case name, path, regions, parallel etc.
- dictionaries: entries retrieved from dictionaries - registered or from file
- per region: mesh metrics, boundary and boundary field types
- function object results

Example of function object specification:

    caseInfo
    {
        type            caseInfo;
        libs            (utilityFunctionObjects);

        // Warn when entries are not found
        lookupMode  warn; // none | warn | error;

        // Write format
        writeFormat json; //  dictionary | json;

        dictionaries
        {
            USolver // User-specified names
            {
                // Look up using registered name
                name        "fvSolution";

                // Optionally limit to specific entries
                include
                (
                    "solvers/U/solver"
                );
            }
            fvSchemes
            {
                name        "fvSchemes";

                // include all entries by default
            }
            timeScheme
            {
                name        "fvSchemes";

                include
                (
                    "/ddtSchemes/default"
                );
            }

            turbulence
            {
                name        "turbulenceProperties";

                // include all entries by default
            }
            controlDict
            {
                // Look up using file path
                path        "<case>/system/controlDict";

                include
                (
                    "application"
                    "deltaT"
                    "startTime"
                    "endTime"
                );
            }
        }

        functionObjects (minMax1);
    }
2023-12-01 14:00:52 +00:00
Mattijs Janssens
b0b3ec0d8e ENH: parProfiling: profile linear solver only 2023-05-03 19:04:10 +00:00
Andrew Heather
bb04f5759d ENH: runTimeControl - enable resetting the trigger to an earlier instant
The runTimeControl function object can activate further function objects using
triggers. Previously the trigger index could only advance; this change set
allows users to set smaller values to enable function object recycling, e.g.

Repeat for N cycles:
1. average the pressure at a point in space
2. when the average stabilises, run for a further 100 iterations
3. set a new patch inlet velocity
  - back to (1)

- Removes old default behaviour that only permitted an increase in the
  trigger level. This type of 'ratcheting' mechanism (if required) is
  now the responsibility of the derived function object.
2022-02-25 15:39:26 +01:00
Andrew Heather
53c2eae543 ENH: runTimeControl - added 'none' condition as a no-op 2022-02-25 15:39:22 +01:00
Andrew Heather
af86d19ea5 ENH: Added new multiRegion function object
Wrapper that clones the supplied object for each region.

Simplifies the setup of identical post-processing requirements for
multi-region cases.
Applies the supplied function to all regions by default.

Example of function object specification:

    multiRegion
    {
        type    multiRegion;
        libs    (utilityFunctionObjects);
        ...

        function
        {
            // Actual object specification
            type    fieldMinMax;
            libs    (fieldFunctionObjects);
            fields  (<field1> .. <fieldN>);
        }

        // Optional entries
        regions     (region1 region2);
    }

    Where the entries comprise:
        Property   | Description                    | Reqd | Default
        type       | Type name: multiRegion         | yes |
        function   | Function object sub-dictionary | yes |
        regions    | List of region names           | no  | all
2021-06-16 13:44:50 +02:00
mattijs
89f2cda3ab ENH: mpi: use per-application communicator. 2020-12-09 15:17:44 +00:00
Mark Olesen
0adcd1ec47 ENH: timeInfo function object (#1320)
- records execution and wallclock times to postProcessing/
  which can be more convenient than parsing a log file.
2019-05-15 09:21:45 +01:00
Mark Olesen
828f8e8504 ENH: add simple profiling of MPI communications 2019-04-25 15:33:51 +02:00
Mark Olesen
8bd6568d05 ENH: added areaWrite function object (#1237)
- write finiteArea meshes and fields to standard surface output
  formats (Ensight, VTK, etc).
2019-03-13 19:44:51 +01:00
Andrew Heather
94070f5ee7 STYLE: Renamed residuals FO -> solverInfo to reflect capabilities 2019-01-29 13:52:37 +00:00
Andrew Heather
bd79f1d5ab ENH: runTimeControl FO - added new maxDuration condition 2018-08-20 14:04:27 +01:00
Mark Olesen
8cff734abc ENH: improvements for ensightWrite function object (issue #926)
- align input parameters and some of the behaviour with vtkWrite

  The output is now postProcessing/<name> for similar reasoning as
  mentioned in #866 - better alignment with other function objects, no
  data collision with foamToEnsight output.

- separate controls for internal and boundary meshes

- can restrict conversion based on zone names, enclosing volumes,
  bounding box.
2018-10-09 18:22:40 +02:00
Mark Olesen
42bb497084 ENH: improvements for vtkWrite function object (issue #926)
- parallel output.

  The output is now postProcessing/<name> for similar reasoning as
  mentioned in #866 - better alignment with other function objects, no
  collision with foamToVTK output.

- align the input parameters with those of vtkCloud so that we can
  specify the ASCII precision and the padding width for the output
  file names as well.

- emit TimeValue field, support file series generation

- support internal or boundary meshes, combining the result into a vtm
  file.

- can restrict conversion based on zone names, enclosing volumes,
  bounding box
2018-10-09 15:52:52 +02:00
Mark Olesen
98cc0fc004 ENH: upgrade writeVTK function object -> vtkWrite function object
- user-selectable format (vtk or vtu, ascii or binary)
- dictionary syntax closer to ensightWrite
- tutorial example in windAroundBuildings
2017-06-14 01:48:32 +02:00
Mark Olesen
2495fcb42e ENH: replace foamToVTK routines with library-level equivalents 2017-05-22 16:13:53 +02:00
Mark Olesen
54da8848ba ENH: add in ensightWrite function object (issue # 241)
- Currently no writing of clouds.
  Managing restarts needs more thought.
2016-10-05 13:13:23 +02:00
sergio
b9b2ac694a ENH: Adding eddyDissipationDiffusionModel, thermocouple probe and thermocoupleTestCase 2016-10-07 10:17:43 -07:00
Andrew Heather
b9940cbbb1 COMP: Multiple changes - first clean build after latest merge - UNTESTED 2016-09-23 15:36:53 +01:00
Henry Weller
4b5905e535 functionObjects::writeRegisteredObject -> functionObjects::writeObjects
Added configuration file etc/caseDicts/postProcessing/fields/writeObjects
2016-06-10 08:28:13 +01:00
Henry Weller
e4dc50dcb0 postProcessing: Replaced 'foamCalc' and the 'postCalc' utilities
with the more general and flexible 'postProcess' utility and '-postProcess' solver option

Rationale
---------

Both the 'postProcess' utility and '-postProcess' solver option use the
same extensive set of functionObjects available for data-processing
during the run avoiding the substantial code duplication necessary for
the 'foamCalc' and 'postCalc' utilities and simplifying maintenance.
Additionally consistency is guaranteed between solver data processing
and post-processing.

The functionObjects have been substantially re-written and generalized
to simplify development and encourage contribution.

Configuration
-------------

An extensive set of simple functionObject configuration files are
provided in

OpenFOAM-dev/etc/caseDicts/postProcessing

and more will be added in the future.  These can either be copied into
'<case>/system' directory and included into the 'controlDict.functions'
sub-dictionary or included directly from 'etc/caseDicts/postProcessing'
using the '#includeEtc' directive or the new and more convenient
'#includeFunc' directive which searches the
'<etc>/caseDicts/postProcessing' directories for the selected
functionObject, e.g.

functions
{
    #includeFunc Q
    #includeFunc Lambda2
}

'#includeFunc' first searches the '<case>/system' directory in case
there is a local configuration.

Description of #includeFunc
---------------------------

    Specify a functionObject dictionary file to include, expects the
    functionObject name to follow (without quotes).

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

    An example of the \c \#includeFunc directive:
    \verbatim
        #includeFunc <funcName>
    \endverbatim

postProcess
-----------

The 'postProcess' utility and '-postProcess' solver option provide the
same set of controls to execute functionObjects after the run either by
reading a specified set of fields to process in the case of
'postProcess' or by reading all fields and models required to start the
run in the case of '-postProcess' for each selected time:

postProcess -help

Usage: postProcess [OPTIONS]
options:
  -case <dir>       specify alternate case directory, default is the cwd
  -constant         include the 'constant/' dir in the times list
  -dict <file>      read control dictionary from specified location
  -field <name>     specify the name of the field to be processed, e.g. U
  -fields <list>    specify a list of fields to be processed, e.g. '(U T p)' -
                    regular expressions not currently supported
  -func <name>      specify the name of the functionObject to execute, e.g. Q
  -funcs <list>     specify the names of the functionObjects to execute, e.g.
                    '(Q div(U))'
  -latestTime       select the latest time
  -newTimes         select the new times
  -noFunctionObjects
                    do not execute functionObjects
  -noZero           exclude the '0/' dir from the times list, has precedence
                    over the -withZero option
  -parallel         run in parallel
  -region <name>    specify alternative mesh region
  -roots <(dir1 .. dirN)>
                    slave root directories for distributed running
  -time <ranges>    comma-separated time ranges - eg, ':10,20,40:70,1000:'
  -srcDoc           display source code in browser
  -doc              display application documentation in browser
  -help             print the usage

 pimpleFoam -postProcess -help

Usage: pimpleFoam [OPTIONS]
options:
  -case <dir>       specify alternate case directory, default is the cwd
  -constant         include the 'constant/' dir in the times list
  -dict <file>      read control dictionary from specified location
  -field <name>     specify the name of the field to be processed, e.g. U
  -fields <list>    specify a list of fields to be processed, e.g. '(U T p)' -
                    regular expressions not currently supported
  -func <name>      specify the name of the functionObject to execute, e.g. Q
  -funcs <list>     specify the names of the functionObjects to execute, e.g.
                    '(Q div(U))'
  -latestTime       select the latest time
  -newTimes         select the new times
  -noFunctionObjects
                    do not execute functionObjects
  -noZero           exclude the '0/' dir from the times list, has precedence
                    over the -withZero option
  -parallel         run in parallel
  -postProcess      Execute functionObjects only
  -region <name>    specify alternative mesh region
  -roots <(dir1 .. dirN)>
                    slave root directories for distributed running
  -time <ranges>    comma-separated time ranges - eg, ':10,20,40:70,1000:'
  -srcDoc           display source code in browser
  -doc              display application documentation in browser
  -help             print the usage

The functionObjects to execute may be specified on the command-line
using the '-func' option for a single functionObject or '-funcs' for a
list, e.g.

postProcess -func Q
postProcess -funcs '(div(U) div(phi))'

In the case of 'Q' the default field to process is 'U' which is
specified in and read from the configuration file but this may be
overridden thus:

postProcess -func 'Q(Ua)'

as is done in the example above to calculate the two forms of the divergence of
the velocity field.  Additional fields which the functionObjects may depend on
can be specified using the '-field' or '-fields' options.

The 'postProcess' utility can only be used to execute functionObjects which
process fields present in the time directories.  However, functionObjects which
depend on fields obtained from models, e.g. properties derived from turbulence
models can be executed using the '-postProcess' of the appropriate solver, e.g.

pisoFoam -postProcess -func PecletNo

or

sonicFoam -postProcess -func MachNo

In this case all required fields will have already been read so the '-field' or
'-fields' options are not be needed.

Henry G. Weller
CFD Direct Ltd.
2016-05-28 18:58:48 +01:00