Commit Graph

82 Commits

Author SHA1 Message Date
fa766e8f3d fvPatchFields: Reordered constructor definitions to match declarations 2021-06-16 12:10:39 +01:00
44bb20af03 dynamicCode::basicChemistryModelTemplate.C: Corrected cpp test for TDAC 2021-06-01 10:47:31 +01:00
4064161331 dynamicLibrary::compileTemplate: Standardised naming convention for the dynamic compilation template files
which now all have Template.H or Template.C appended to differentiate them from
standard OpenFOAM library files.
2021-05-20 10:52:57 +01:00
178828a921 codedBase: Merged with CodedBase to simplify and rationalise the implementation 2021-05-19 17:59:52 +01:00
eeb9b35a72 codedFvModelTemplate: Fixed syntax error 2021-05-04 17:06:42 +01:00
07d583e989 StandardChemistryModel: Renamed as standardChemistryModel for consistency with the run-time selection name "standard"
which simplifies dynamic compilation of chemistry and error messages.
2021-04-28 17:47:08 +01:00
80139f6116 compileTemplate: Improved the handling of backward-compatibility renaming of classes 2021-04-28 11:29:35 +01:00
78ef8e1eb0 etc/codeTemplates/dynamicCode: Added basicChemistryModel dynamic compilation support
for chemFoam, fireFoam, buoyantReactingFoam, reactingFoam, chtMultiRegionFoam,
buoyantReactingParticleFoam, reactingParticleFoam, simpleReactingParticleFoam

If the combination of chemistry model and solver selected in chemistryProperties
is not already compiled and present in the standard libraries for the selected
thermophysical properties the chemistry package will be constructed and compiled
automatically using the standard dynamicCode system provided in OpenFOAM.

The chemistry package is constructed automatically from the
etc/codeTemplates/dynamicCode/basicChemistryModel.* files, if these files do not
exist the standard chemistry lookup error message is generated as before.

As with all other dynamicCode options in OpenFOAM (codeStream,
codedFunctionObject etc.) dynamic compilation of the chemistry package is only
enabled if allowSystemOperations is set true.
2021-04-20 16:37:12 +01:00
f60252ff7b etc/codeTemplates/dynamicCode: Added rhoThermo and rhoReactionThermo dynamic compilation support
for multiphaseEulerFoam, compressibleInterFoam and compressibleMultiphaseInterFoam
2021-04-16 20:18:11 +01:00
29bbbd6984 etc/codeTemplates/dynamicCode: Added fluidReactionThermo dynamic compilation support
for chemFoam, fireFoam, buoyantReactingFoam, reactingFoam, chtMultiRegionFoam,
buoyantReactingParticleFoam, reactingParticleFoam, simpleReactingParticleFoam

If the combination of property models selected in thermophysicalProperties is
not already compiled and present in the standard libraries the thermophysical
property package will be constructed and compiled automatically using the
standard dynamicCode system provided in OpenFOAM.

The thermophysical property package is constructed automatically from the
etc/codeTemplates/dynamicCode files for the corresponding base thermo type,
fluidThermo, fluidReactionThermo etc. If the corresponding codeTemplates files
do not exist the standard thermo lookup error message is generated as before.

As with all other dynamicCode options in OpenFOAM (codeStream,
codedFunctionObject etc.) dynamic compilation of the thermophysical property
package is only enabled if allowSystemOperations is set true.
2021-04-16 18:42:38 +01:00
d4d269e93e etc/codeTemplates/dynamicCode/psiuReactionThermo: Pruned selection tables for compressibility based EoSs 2021-04-16 15:39:45 +01:00
ae0e8e0751 etc/codeTemplates/dynamicCode: Added psiuReactionThermo dynamic compilation support
for XiFoam and PDRFoam
2021-04-16 12:24:00 +01:00
ad0082a7eb etc/codeTemplates/dynamicCode: Added psiThermo dynamic compilation support
for rhoCentralFoam
2021-04-15 19:17:36 +01:00
04cab84af6 basicThermo: Added support for dynamic compilation of thermophysical property packages
If the combination of property models selected in thermophysicalProperties is
not already compiled and present in the standard libraries the thermophysical
property package will be constructed and compiled automatically using the
standard dynamicCode system provided in OpenFOAM.

The thermophysical property package is constructed automatically from the
etc/codeTemplates/dynamicCode files for the corresponding base thermo
type (e.g. fluidThermo), currently these are provided only for fluidThermo but
the others will be added shortly.  If the corresponding codeTemplates files do
not exist the standard thermo lookup error message is generated as before.

As with all other dynamicCode options in OpenFOAM (codeStream,
codedFunctionObject etc.) dynamic compilation of the thermophysical property
package is only enabled if allowSystemOperations is set true.
2021-04-15 16:32:50 +01:00
252b71f3c6 fvModels: Simplified structure using fvCellSet member data
which will allow for a run-time selectable and hence extensible fvCellSet in the
future.
2021-03-09 15:17:32 +00:00
6e172a708d fvModels: codedSource -> codedFvModel 2021-03-08 14:53:22 +00:00
da3f4cc92e fvModels, fvConstraints: Rational separation of fvOptions between physical modelling and numerical constraints
The new fvModels is a general interface to optional physical models in the
finite volume framework, providing sources to the governing conservation
equations, thus ensuring consistency and conservation.  This structure is used
not only for simple sources and forces but also provides a general run-time
selection interface for more complex models such as radiation and film, in the
future this will be extended to Lagrangian, reaction, combustion etc.  For such
complex models the 'correct()' function is provided to update the state of these
models at the beginning of the PIMPLE loop.

fvModels are specified in the optional constant/fvModels dictionary and
backward-compatibility with fvOption is provided by reading the
constant/fvOptions or system/fvOptions dictionary if present.

The new fvConstraints is a general interface to optional numerical constraints
applied to the matrices of the governing equations after construction and/or to
the resulting field after solution.  This system allows arbitrary changes to
either the matrix or solution to ensure numerical or other constraints and hence
violates consistency with the governing equations and conservation but it often
useful to ensure numerical stability, particularly during the initial start-up
period of a run.  Complex manipulations can be achieved with fvConstraints, for
example 'meanVelocityForce' used to maintain a specified mean velocity in a
cyclic channel by manipulating the momentum matrix and the velocity solution.

fvConstraints are specified in the optional system/fvConstraints dictionary and
backward-compatibility with fvOption is provided by reading the
constant/fvOptions or system/fvOptions dictionary if present.

The separation of fvOptions into fvModels and fvConstraints provides a rational
and consistent separation between physical and numerical models which is easier
to understand and reason about, avoids the confusing issue of location of the
controlling dictionary file, improves maintainability and easier to extend to
handle current and future requirements for optional complex physical models and
numerical constraints.
2021-03-07 22:45:01 +00:00
07f5080f2e fvOptions: Remove type restrictions and rewrite of field-name handling
A number of fvOptions that apply to a user-derined field can now
automatically work what primitive type they apply to. These options can
apply to any field type, and in some cases even multiple fields of
differing type. Example usage of the options to which this change
applies are shown below:

    codedSource1
    {
        type            codedSource;
        name            codedSource1;

        field           h;

        ...
    }

    fixedValueConstraint1
    {
        type            fixedValueConstraint;

        fieldValues
        {
            R           (1 0 0 1 0 1);
            epsilon     150;
        }

        ...
    }

    phaseLimitStabilization11
    {
        type            phaseLimitStabilization;

        field           sigma.liquid;

        ...
    }

Previously to apply to a given type, these options had to be selected
with the name of the type prepended to the option name (e.g., "type
symmTensorPhaseLimitStabilization;") and those that operated on multiple
fields were restricted to those fields being of the same type.

A number of other options have had improvements made to their handling
of user specification of fields. Where possible, the option will now
attempt to work out what field the option applies to automatically. The
following options, therefore, no longer require "field" or "fields"
entries:

    actuationDiskSource
    buoyancyEnergy
    buoyancyForce
    meanVelocityForce
    rotorDiskSource
    volumeFractionSource
    constantHeatTransfer
    function2HeatTransfer
    variableHeatTransfer

Non-standard field names can be overridden in the same way as in
boundary conditions; e.g., the velocity name can be overridden with a "U
<UName>;" entry if it does not have the default name, "U". The name of
the energy field is now always determined from the thermodynamics
model and should always be correct. Some options that can be applied to
an individual phase also support a "phase <phaseName>;" entry;

fvOptions field-name handling has been rewritten to increase its
flexibility and to improve warning messages. The flexibility now allows
for options that apply to all fields, or all fields of a given phase,
rather than being limited to a specific list of field names. Messages
warning about options that have not been applied now always print just
once per time-step.
2021-02-09 16:53:26 +00:00
c7591fa357 codeTemplates/BC: Updated constructor documentation 2020-12-09 12:37:54 +00:00
b448d4cc73 codeTemplates/BC: Updated constructors to disallow copy without setting internal field reference 2020-12-09 11:41:13 +00:00
a806e1bc6b thermophysicalFunction: Initial work to convert into Function1 and Function2 2020-12-03 19:22:50 +00:00
57b1655934 Function1: Renamed integrate -> integral for consistency with value
The integral function returns the integral as the value function returns the
value.
2020-12-02 16:15:55 +00:00
21bb6c549d Function1, Function2: Rationalising, simplifying and standardising writing 2020-11-28 19:50:39 +00:00
2cd197a536 Function2: New run-time selectable function of two variables
with many options provided from simple constant values to complex functions,
interpolated tabulated data etc. etc.
2020-11-12 18:07:42 +00:00
7380da599c etc/codeTemplates: Corrected #ifndef/#define 2020-11-10 15:51:44 +00:00
7e3f4976a8 PatchFields: Removed simple copy constructors and clone functions
These do not necessarily set the internal field reference correctly and it is
safer that the correct internal field is provided as an argument.
2020-10-03 22:16:10 +01:00
9f9ef9a2c0 fvOptions/.../codedSource: Updated for compressible and phase sources
There are now three possible code entries for the scalarCodedSource,
vectorCodedSource, etc..., fvOptions. These are `codeAddSup` for basic
sources, `codeAddRhoSup` for compressible sources, and
`codeAddAlphaRhoSup` for phase (compressible) sources.

Previously `codeAddSup` was used for both basic and compressible
sources, and phase sources were not implemented. This meant that whilst
a compressible source could be created, it could not make use of the
`rho` argument or the basic source function would fail to compile.
2020-09-03 11:13:42 +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
ff20398245 fvOptions: Changed the source, constraint and correct functions to const
Most fvOptions change the state of the fields and equations they are applied to
but do not change internal state so it makes more sense that the interface is
const, consistent with MeshObjects.  For the few fvOptions which do maintain a
changing state the member data is now mutable.
2020-08-04 15:40:40 +01: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
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
f9d3630cdc codeTemplates: Updated boundary condition template for changes to field mapping 2019-08-01 15:44:39 +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
5203a84a0f PatchFields: Improved documentation of the autoMap and rmap functions 2019-05-03 21:53:13 +01:00
d41166187a writeEntry: Rationalised for consistency, ease of use and maintainability
The writeEntry form is now defined and used consistently throughout OpenFOAM
making it easier to use and extend, particularly to support binary IO of complex
dictionary entries.
2019-03-14 20:54:10 +00:00
700f11fa11 dynamicCode: Put code entries on a list
The dynamic code functionality has been generalised so that the names of
the code entries in the specifying dictionary can be set by the caller.
This means that functions which utilise dynamic code but use different
entry names (e.g., codedFunctionObject uses codeExecute, codeEnd,
etc..., instead of code) now function correctly. The differently named
entries now form part of the library hash, and re-building triggers
appropriately as they are modified.
2019-02-01 09:17:26 +00:00
15b1d6e7ec codeTemplates/BC: Updated to use the new primitive writeEntry 2019-01-29 13:57:48 +00:00
70021b1268 fvPatchField: Corrected propagation of patchType
The construction of some patch fields has been corrected so that the
patchType setting always propagates on mapping, IO, clone, etc...
Dictionary and mapping-based patch field constructors now call the
corresponding constructor from the base class, regardless of whether
dictionary settings or mapping are actually needed.

A "mappingRequired" flag has been added to some of the base constructors
in order to prevent unecessary mapping of field data and retain the
previous level of optimisation.

Resolves bug report https://bugs.openfoam.org/view.php?id=3144
2019-01-04 10:01:17 +00:00
bf54ab67e1 Updated OpenFOAM Foundation web-link in headers 2018-07-06 21:42:54 +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
87e32ab499 Code style: Updated line comments to start with a space
//This is a comment   ->   // This is a comment
2018-05-01 11:57:50 +01:00
7bdbab7f4e Rationalize the "pos" function
"pos" now returns 1 if the argument is greater than 0, otherwise it returns 0.
This is consistent with the common mathematical definition of the "pos" function:

https://en.wikipedia.org/wiki/Sign_(mathematics)

However the previous implementation in which 1 was also returned for a 0
argument is useful in many situations so the "pos0" has been added which returns
1 if the argument is greater or equal to 0.  Additionally the "neg0" has been
added which returns 1 if if the argument is less than or equal to 0.
2017-06-22 14:32:18 +01:00
0d1c622906 codedFvOptionTemplate: updated 'setValue' to 'constrain'
Resolves bug-report https://bugs.openfoam.org/view.php?id=2579
2017-06-13 16:52:16 +01:00
e2ccbbbbe5 codeTemplates: The copyright year is now set automatically 2017-04-18 11:01:41 +01:00
52323f8dd1 codedFvOption: Added cellSet support
Patch provided by Mattijs Janssens
Resolves bug-report http://bugs.openfoam.org/view.php?id=2240
2016-09-09 12:29:06 +01:00