Commit Graph

230 Commits

Author SHA1 Message Date
68e4678221 reactingTwoPhaseEulerFoam: Replaced by multiphaseEulerFoam
The reactingtTwoPhaseEulerFoam solver has been replaced by the more general
multiphaseEulerFoam solver which supports two-phase and multiphase systems
containing fluid and stationary phases, compressible or incompressible, with
heat and mass transfer, reactions, size distribution and all the usual phase
interaction and transfer models.

All reactingtTwoPhaseEulerFoam tutorials have been ported to multiphaseEulerFoam
to demonstrate two-phase capability with a wide range of phase and
phase-interaction models.

When running with two-phases the optional referencePhase entry in
phaseProperties can be used to specify which phase fraction should not be
solved, providing compatibility with reactingtTwoPhaseEulerFoam, see

tutorials/multiphase/multiphaseEulerFoam/RAS/fluidisedBed
tutorials/multiphase/multiphaseEulerFoam/laminar/bubbleColumn

for examples.
2020-07-17 20:18:15 +01:00
5bfd3b2488 functionObjects::stopAtClockTime: New functionObject to stop the run when the specified clock time is exceeded
Description
    Stops the run when the specified clock time in second has been reached
    and optionally write results before stopping.

    The following actions are supported:
    - noWriteNow
    - writeNow
    - nextWrite (default)

    Examples of function object specification:
    \verbatim
    stop
    {
        type        stopAtClockTime;
        libs        ("libutilityFunctionObjects.so");
        stopTime    10;
        action      writeNow;
    }
    \endverbatim
    will stop the run at the next write after the file "stop" is created in the
    case directory.

Usage
    \table
        Property | Description              | Required | Default value
        type     | type name: stopAtClockTime | yes    |
        stopTime | Maximum elapsed time [s] | yes      |
        action   | Action executed          | no       | nextWrite
    \endtable
2020-07-17 11:13:46 +01:00
7379f4525f functionObjects::stopAt: New abstract base class for run stop conditions
By default the case stops following the next write but stopping immediately with
or without writing are also options.

The stopAtFile functionObject derived from stopAt stops the run when a file
predefined file is created in the case directory:

Description
    Stops the run when the specified file is created in the case directory.

    The default name of the trigger file is \c $FOAM_CASE/<name> where \c
    <name> is the name of the functionObject entry and the default action is \c
    nextWrite.

    Currently the following action types are supported:
    - noWriteNow
    - writeNow
    - nextWrite

    Examples of function object specification:
    \verbatim
    stop
    {
        type stopAtFile;
        libs ("libutilityFunctionObjects.so");
    }
    \endverbatim
    will stop the run at the next write after the file "stop" is created in the
    case directory.

    \verbatim
    stop
    {
        type stopAtFile;
        libs ("libutilityFunctionObjects.so");
        file "$FOAM_CASE/stop";
        action writeNow;
    }
    \endverbatim
    will write the fields and stop the run when the file "stop" is created in
    the case directory.

Usage
    \table
        Property | Description            | Required | Default value
        type     | type name: stopAtFile  | yes      |
        file     | Trigger file path name | no       | $FOAM_CASE/<name>
        action   | Action executed        | no       | nextWrite
    \endtable
2020-07-16 17:44:51 +01:00
9fd9172913 Rationalised the named of uncoupled particle tracing solvers and functionObject
Solvers
    icoUncoupledKinematicParcelFoam -> particleFoam
    uncoupledKinematicParcelFoam -> rhoParticleFoam

functionObjects
    icoUncoupledKinematicCloud -> particles
2020-07-16 13:06:08 +01:00
98d4937ee3 functionObjects::abort: Added documentation 2020-07-14 12:12:24 +01:00
44cf9977c3 Use the new primitive mesh magFaceAreas where appropriate 2020-06-03 17:11:56 +01:00
73503b1a38 functionObjects::age: Added fvOption support 2020-05-18 15:09:57 +01:00
d3fed1155a wallHeatFlux: Output values only on the patches specified
Resolves bug report https://bugs.openfoam.org/view.php?id=3481
2020-04-15 15:06:29 +01:00
de66b1be68 MomentumTransportModels: Update of the TurbulenceModels library for all flow types
providing the shear-stress term in the momentum equation for incompressible and
compressible Newtonian, non-Newtonian and visco-elastic laminar flow as well as
Reynolds averaged and large-eddy simulation of turbulent flow.

The general deviatoric shear-stress term provided by the MomentumTransportModels
library is named divDevTau for compressible flow and divDevSigma (sigma =
tau/rho) for incompressible flow, the spherical part of the shear-stress is
assumed to be either included in the pressure or handled separately.  The
corresponding stress function sigma is also provided which in the case of
Reynolds stress closure returns the effective Reynolds stress (including the
laminar contribution) or for other Reynolds averaged or large-eddy turbulence
closures returns the modelled Reynolds stress or sub-grid stress respectively.
For visco-elastic flow the sigma function returns the effective total stress
including the visco-elastic and Newtonian contributions.

For thermal flow the heat-flux generated by thermal diffusion is now handled by
the separate ThermophysicalTransportModels library allowing independent run-time
selection of the heat-flux model.

During the development of the MomentumTransportModels library significant effort
has been put into rationalising the components and supporting libraries,
removing redundant code, updating names to provide a more logical, consistent
and extensible interface and aid further development and maintenance.  All
solvers and tutorials have been updated correspondingly and backward
compatibility of the input dictionaries provided.

Henry G. Weller
CFD Direct Ltd.
2020-04-14 20:44:22 +01:00
08e686eb18 TurbulenceModels: Refactored to transfer all heat and specie transport to the new ThermophysicalTransportModels library
This provides an extensible and run-time selectable framework to support complex
energy and specie transport models, in particular multi-component diffusion.
Currently only the Fourier for laminar and eddyDiffusivity for RAS and LES
turbulent flows are provided but the interface is general and the set of models
will be expanded in the near future.
2020-04-12 10:35:52 +01:00
7f5144312e Renamed turbulenceProperties -> momentumTransport
Following the generalisation of the TurbulenceModels library to support
non-Newtonian laminar flow including visco-elasticity and extensible to other
form of non-Newtonian behaviour the name TurbulenceModels is misleading and does
not properly represent how general the OpenFOAM solvers now are.  The
TurbulenceModels now provides an interface to momentum transport modelling in
general and the plan is to rename it MomentumTransportModels and in preparation
for this the turbulenceProperties dictionary has been renamed momentumTransport
to properly reflect its new more general purpose.

The old turbulenceProperties name is supported for backward-compatibility.
2020-04-10 17:17:37 +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
0177c7dd59 functionObjects::fieldAverage: Simplified the controls
Rather than specifying the controls per field it is simpler to use a single set
of controls for all the fields in the list and use separate instances of the
fieldAverage functionObject for different control sets:

    Example of function object specification setting all the optional parameters:
    fieldAverage1
    {
        type                fieldAverage;
        libs                ("libfieldFunctionObjects.so");

        writeControl        writeTime;

        restartOnRestart    false;
        restartOnOutput     false;
        periodicRestart     false;
        restartPeriod       0.002;

        base                time;
        window              10.0;
        windowName          w1;

        mean                yes;
        prime2Mean          yes;

        fields              (U p);
    }

This allows for a simple specification with the optional prime2Mean entry using

    #includeFunc fieldAverage(U, p, prime2Mean = yes)

or if the prime2Mean is not needed just

    #includeFunc fieldAverage(U, p)
2020-03-17 20:15:17 +00:00
46c790dd09 functionObjects::fieldAverage: Simplified the interface by the introduction of defaults
The mean, prime2Mean and base now have default values:

    {
        mean            on;   // (default = on)
        prime2Mean      on;   // (default = off)
        base            time; // time or iteration (default = time)
        window          200;  // optional averaging window
        windowName      w1;   // optional window name (default = "")
    }

so for the majority of cases for which these defaults are appropriate the
fieldAverage functionObject can now be specified in the functions entry in
controlDict thus:

functions
{
    fieldAverage1
    {
        #includeEtc "caseDicts/postProcessing/fields/fieldAverage.cfg"

        fields
        (
            U.air
            U.water
            alpha.air
            p
        );
    }
}

also utilising the new fieldAverage.cfg file.

For cases in which these defaults are not appropriate, e.g. the prime2Mean is
also required the optional entries can be specified within sub-dictionaries for
each field, e.g.

    fieldAverage1
    {
        #includeEtc "caseDicts/postProcessing/fields/fieldAverage.cfg"

        fields
        (
            U
            {
                prime2Mean  yes;
            }

            p
            {
                prime2Mean  yes;
            }
        );
    }
2020-03-06 15:51:49 +00:00
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