Commit Graph

416 Commits

Author SHA1 Message Date
b49b1a2c37 functionObjects::totalEnthalpy: New functionObject to calculate, cache and write the total enthalpy
The total enthalpy is calculated as

    Ha = ha + K

where

    ha is absolute enthalpy
    K is the kinetic energy: 1/2*magSqr(U)

The total enthalpy or a particular phase can be calculated by specifying the
optional "phase" name, e.g.

    #includeFunc totalEnthalpy(phase = liquid)
2020-02-27 16:12:00 +00:00
670b158f17 functionObjects::shearStress: Updated phase support 2020-02-27 16:10:50 +00:00
e01de98df0 functionObjects::volFieldValue: Added support for a list of weighting fields
This is particularly useful for multiphase simulations for which integrating the
density weighted phase properties also requires the phase fraction to be
including in the weighting.

A single weight field can be specified as before:

    weightField rho;

or a list specified by:

    weightFields (alpha.water rho.water);
2020-02-24 15:28:36 +00:00
c57ffd2d07 functionObjects: Added shearStress
This function will output the volumetric shear stress as a symmetric
tensor field
2020-02-19 17:06:28 +00:00
fe13ba9fac functionObjects::forces: Corrected coordinate system example in header
Resolves bug-report https://bugs.openfoam.org/view.php?id=3455
2020-02-17 09:53:31 +00:00
d8cf7788eb CodedBase: Changed construction of static words to avoid construction order problems with Clang 2020-02-07 22:09:09 +00:00
a728a69c59 codedMixedFvPatchField, codedFixedValuePointPatchField: Updated and simplified using the new CodedBase class
reducing code duplication and maintenance overhead.
2020-02-07 00:05:27 +00:00
4cbb849eda codedFixedValueFvPatchField: Updated and simplified using the new CodedBase class
reducing code duplication and maintenance overhead.
2020-02-06 16:04:21 +00:00
d728b23427 codedFunctionObject: Updated and simplified using the new CodedBase 2020-02-03 21:44:44 +00:00
0dd2e97bd8 CodedFunction1: New Function1 which uses codeStream to dynamically compile the value function code
For example in the new tutorial case:
tutorials/incompressible/pimpleFoam/laminar/pitzDailyPulse
a cosine bell velocity pulse is specified at the inlet by directly defining the
code for it:

    inlet
    {
        type            uniformFixedValue;
        uniformValue    coded;

        name            pulse;

        codeInclude
        #{
            #include "mathematicalConstants.H"
        #};

        code
        #{
            return vector
            (
                0.5*(1 - cos(constant::mathematical::twoPi*min(x/0.3, 1))),
                0,
                0
            );
        #};
    }

which is then compiled automatically and linked into the running pimpleFoam
dynamically and executed to set the inlet velocity.
2020-01-31 23:39:59 +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
6dc3b30017 functionObjects::randomise: Resolved problem with construction order 2020-01-29 19:22:39 +00:00
b55bc28698 sampledSurface::writers: Added writeFormat option to select ascii or binary
e.g. in tutorials/incompressible/pisoFoam/LES/motorBike/motorBike/system/cuttingPlane

    surfaceFormat   vtk;
    writeFormat     binary;
    fields          (p U);

selects writing the VTK surface files in binary format which significantly
speeds-up reading of the files in paraview.

Currently binary writing is supported in VTK and EnSight formats.
2020-01-29 14:59:31 +00:00
3631f13a98 sampledSurface/writers: Removed unnecessary "verbose" argument 2020-01-28 22:46:00 +00:00
f4e47fccbc Corrected typos in comments
Patch contributed by Timo Niemi, VTT.
Resolves patch request https://bugs.openfoam.org/view.php?id=3437
2020-01-26 13:40:14 +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
d32e012238 functionObjects::surfaceInterpolate: Corrected documentation
Resolves bug-report https://bugs.openfoam.org/view.php?id=3407
2019-12-05 22:39:52 +00:00
da50aba2c4 functionObjects::fieldExpression: fieldName is now const as it cannot be changed after construction 2019-11-29 16:54:54 +00:00
8a6800abfe functionObjects::fieldExpression: Rationalised setting the field and result names 2019-11-29 11:22:01 +00:00
ffb65bcee5 functionObject::fieldExpression: Corrected construction of the result field name 2019-11-28 19:03:05 +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
d987648ef4 dictionary label lookup: simplified syntax using the type templated lookup function
Replaced
    readLabel(dict.lookup("name"))
with
    dict.lookup<label>("name)
2019-11-27 11:38:59 +00:00
93047de818 functionObject::surfaceFieldValue: Removed temporary diagnostics statement 2019-11-11 13:19:02 +00:00
a5c33c5e18 functionObject::surfaceFieldValue: Added support for weighting with negative fields
For example this allows the an inlet flux to be used to create a weighted
average.

Resolves bug-report https://bugs.openfoam.org/view.php?id=3384
2019-11-11 12:20:35 +00:00
7ab73932cf Function1: Generalisation and removal of unused code
Function1 has been generalised in order to provide functionality
previously provided by some near-duplicate pieces of code.

The interpolationTable and tableReader classes have been removed and
their usage cases replaced by Function1. The interfaces to Function1,
Table and TableFile has been improved for the purpose of using it
internally; i.e., without user input.

Some boundary conditions, fvOptions and function objects which
previously used interpolationTable or other low-level interpolation
classes directly have been changed to use Function1 instead. These
changes may not be backwards compatible. See header documentation for
details.

In addition, the timeVaryingUniformFixedValue boundary condition has
been removed as its functionality is duplicated entirely by
uniformFixedValuePointPatchField.
2019-10-23 13:13:53 +01:00
280c055ef6 functionObjects::comfort: New functionObject to calculate fields relating to thermal comfort
Description
    Calculates the thermal comfort quantities predicted mean vote (PMV) and
    predicted percentage of dissatisfaction (PPD) based on DIN ISO EN 7730:2005.

Usage
    \table
        Property      | Description                  | Required  | Default value
        clothing      | The insulation value of the cloth | no   | 0
        metabolicRate | The metabolic rate      | no        | 0.8
        extWork       | The external work        | no        | 0
        Trad          | Radiation temperature | no | -1
        relHumidity   | Relative humidity of the air | no | 50
        pSat          | Saturation pressure of water | no | -1
        tolerance     | Residual control for the cloth temperature | no | 1e-5
        maxClothIter  | Maximum number of iterations | no       | 0
        meanVelocity  | Use a constant mean velocity in the whole domain | no |\
        false
    \endtable

    \table
        Predicted Mean Vote (PMV)   | evaluation
        + 3                         | hot
        + 2                         | warm
        + 1                         | slightly warm
        + 0                         | neutral
        - 1                         | slightly cool
        - 2                         | cool
        - 3                         | cold
    \endtable

    \verbatim
    comfortAnalysis
    {
        type            comfort;
        libs            ("libfieldFunctionObjects.so");

        executeControl  writeTime;
        writeControl    writeTime;
    }
    \endverbatim

The new tutorial case heatTransfer/buoyantSimpleFoam/comfortHotRoom is provided
to demonstrate the calculation of PMV and PPD using the comfort functionObject.

This work is based on code and case contributed by Tobias Holzmann.
2019-10-19 23:08:34 +01:00
81fca4c43a Corrected typos in comments
found using cspell.

Patch contributed by Timo Niemi, VTT.
2019-10-18 11:46:20 +01:00
2b0c5028a4 Corrected typos in comments and in name of solidEquilibriumEnergySource fvOption
Patch contributed by Timo Niemi, VTT.
Resolves bug report https://bugs.openfoam.org/view.php?id=3369
2019-10-14 09:21:43 +01:00
8ea55e8f06 functionObjects/.../*FieldValue: Protect against division by zero
Patch contributed by Timo Niemi, VTT.
Resolves bug report https://bugs.openfoam.org/view.php?id=3370
2019-10-14 09:21:27 +01: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
a2a74cbb79 functionObjects::age: add optinoal diffusion term and convergence control
to enable the calculation of the residence time for a fluid; mainly used in HVAC
analysis. E.g. residence time of air inside a ventilated room, see the new
tutorial roomResidenceTime.

Contributed by Tobias Holzmann
2019-10-08 16:14:38 +01:00
1bbac95448 objectRegistry: Improvements to caching of temporary objects
Cached temporary objects are now registered from the moment of
construction. This means it is possible to use them before they go out
of scope. Non-cached temporaries are not registered, as before.

The check for the existence of requested cached objects is now done
after function object evaluation. This means that caching can be done on
fields generated by the function objects themselves without generating
warning messages.

The above, however, means that if an object isn't successfully cached
and it's lookup in a function fails, then the warning will not be
generated before the lookup raises an error. This could make diagnosing
the reason for such a failure more difficult. To remedy this the content
of the warning (i.e., the list of objects that are available for
caching) has been added to the lookup error message if the looked up
name is on the caching list. The same level of logged information is
therefore retained in the event of caching and lookup failures.
2019-09-30 16:32:39 +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
6f1c3362a6 cloudInfo: Corrected libcloudFunctionObjects -> liblagrangianFunctionObjects
Resolves bug-report https://bugs.openfoam.org/view.php?id=3356
2019-09-27 11:40:09 +01:00
4feee735a3 functionObjects::log: Added optional switch to disable dimension checking:
Description
    Calculates the natural logarithm of the specified scalar field.

    Performs \f$ln(max(x, a))\f$ where \f$x\f$ is the field and \f$a\f$ an
    optional clip to handle 0 or negative \f$x\f$.  Dimension checking can
    optionally be suspended for this operation if \f$x\f$ is dimensioned.

    Example of function object specification:
    \verbatim
    log1
    {
        type            log;
        libs            ("libfieldFunctionObjects.so");
        field           p;
        clip            1e-3;
        checkDimensions no;
    }
    \endverbatim

    or using \c postProcess
    \verbatim
    postProcess -func 'log(p, clip=1e-3, checkDimensions=no)'
    \endverbatim

Usage
    \table
        Property        | Description               | Required | Default value
        type            | Type name: log            | yes      |
        clip            | Clip value                | no       |
        checkDimensions | Dimension checking switch | no       |
    \endtable
2019-09-24 11:37:38 +01:00
f2fe387423 turbulenceFieldsTemplates: omega not registered on construction 2019-09-08 16:36:12 +01:00
02dcff00af functionObjects: yPlus: Added support for phases
The yPlus function object can now take a "phase" keyword which defines
the name of the phase for which to write yPlus. For example, to write
yPlus for a phase named "liquid", the following entry can be used:

    yPlus1
    {
        type        yPlus;
        libs        ("libfieldFunctionObjects.so");
        phase       liquid;
    }

Note that this will only be necessary in Euler-Euler type simulations
where the phases have separate turbulence models. For VoF, the phase
name will not be required.

Patch contributed by Juho Peltola, VTT.
2019-08-29 12:19:56 +01:00
ba5cdbeb61 functionObject::fieldAverage: Corrected the name of mean and variance of phase fields
Now rather than the average of "U.air" being named "U.airMean" it is correctly
named for the air phase "UMean.air".
2019-07-30 12:22:10 +01:00
9bcbaea4a3 functionObjects::scalarTransport/phaseScalarTransport: Use int for the corrector loop
rather than label.
2019-07-15 22:29:10 +01:00
3431c1d21e Updated unit expressions in documentation to new standardised form 2019-07-08 16:05:33 +01:00
5c188ddce7 Completed standardisation of the class declaration section comments to correspond to the foamNewSource template 2019-06-21 22:45:47 +01:00
96b69f6f88 Standardised and rationalised the way in which units are written in function documentation 2019-06-20 10:54:14 +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
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
3ecef91e72 Standardised copy constructor documentation comment 2019-05-27 22:34:32 +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
2f3d47ad7e Residuals: New MeshObject class to store solver performance residuals
This is more efficient and modular than the previous approach of storing the
residuals in the mesh data dictionary.
2019-04-04 19:08:08 +01:00
4519f47ab8 phasesScalarTransport: Corrected compressible fvOptions usage 2019-03-15 08:49:39 +00:00