- this revises the changes made in 95cd8ee75c to replace the
SFINAE-type of handling of string hashes with direct definitions.
This places a bit more burden on the developer if creating hashable
classes derived from std::string or variants of Foam::string, but
improves reliability when linking.
STYLE: drop template key defaulting from HashSet
- this was never used and `HashSet<>` is much less transparent
than writing `HashSet<word>` or `wordHashSet`
- Generic thermophysical properties class for a liquid in which the
functions and coefficients for each property are run-time selected.
Code adapted from openfoam.org
- had lookups into the merge-point map instead of
determining/remapping the duplicate points directly.
The result was a jumble of face/point addressing.
STYLE: additional debug/verbosity comment for mergePoints
- marks if the value is considered to be independent of 'x'.
Propagate into PatchFunction1 instead ad hoc checks there.
- adjust method name in PatchFunction1 to 'whichDb()' to reflect
final changes in Function1 method names.
ENH: add a Function1 'none' placeholder function
- This is principally useful for interfaces that expect a Function1
but where it is not necessarily used by a particular submodel.
TUT: update Function1 creation to use objectRegistry
- allows an additional HashTable of pointers to reference external
content which not otherwise directly available via an
objectRegistry.
This could typically be used to provide a function-local "rho"
to the expression evaluation.
- for cell quantities, these evaluate on the faceCells associated with
that patch to produce a field of true/false values
- for face quantities, these simply correspond to the mesh faces
associated with that patch to produce a field of true/false values
- similar idea to swak timelines/lookuptables but combined together
and based on Function1 for more flexibility.
Specified as 'functions<scalar>' or 'functions<vector>'.
For example,
functions<scalar>
{
intakeType table ((0 0) (10 1.2));
p_inlet
{
type sine;
frequency 3000;
scale 50;
level 101325;
}
}
These can be referenced in the expressions as a nullary function or a
unary function.
Within the parser, the names are prefixed with "fn:" (function).
It is thus possible to define "fn:sin()" that is different than
the builtin "sin()" function.
* A nullary call uses time value
- Eg, fn:p_inlet()
* A unary call acts as a remapper function.
- Eg, fn:intakeType(6.25)
- previously simply reused the scan token, which works fine for
non-nested tokenizations but becomes too fragile with nesting.
Now changed to use tagged unions that can be copied about
and still retain some rudimentary knowledge of their types,
which can be manually triggered with a destroy() call.
- provide an 'identifier' non-terminal as an additional catch
to avoid potential leakage on parsing failure.
- adjust lemon rules and infrastructure:
- use %token to predefine standard tokens.
Will reduce some noise on the generated headers by retaining the
order on the initial token names.
- Define BIT_NOT, internal token rename NOT -> LNOT
- handle non-terminal vector values.
Support vector::x, vector::y and vector::z constants
- permit fieldExpr access to time().
Probably not usable or useful for an '#eval' expression,
but useful for a Function1.
- provisioning for hooks into function calls. Establishes token
names for next commit(s).
Returns a 0/1 value corresponding to function object trigger levels.
Usage:
\verbatim
<entryName> functionObjectTrigger;
<entryName>Coeffs
{
triggers (1 3 5);
defaultValue false; // Default when no triggers activated
}
\endverbatim
ENH: add reset() method for Constant Function1
ENH: allow forced change of trigger index
- the triggers are normally increase only,
but can now override this optionally
Description
Function1 wrapper that maps the input value prior to it being used by
another Function1.
Example usage for limiting a polynomial:
\verbatim
<entryName>
{
type inputValueMapper;
mode minMax;
min 0.4;
max 1.4;
value polynomial
(
(5 1)
(-2 2)
(-2 3)
(1 4)
);
}
\endverbatim
Here the return value will be:
- poly(0.4) for x <= 0.4;
- poly(1.4) for x >= 1.4; and
- poly(x) for 0.4 < x < 1.4.
Example usage for supplying a patch mass flux for a table lookup:
\verbatim
<entryName>
{
type inputValueMapper;
mode function;
function
{
type functionObjectValue;
functionObject surfaceFieldValue1;
functionObjectResult sum(outlet,phi);
}
value
{
type table;
file "<system>/fanCurve.txt";
}
}
\endverbatim
Where:
\table
Property | Description | Required
mode | Mapping mode (see below) | yes
function | Mapping Function1 | no*
min | Minimum input value | no*
max | Maximum input value | no*
value | Function of type Function1<Type> | yes
\endtable
Mapping modes include
- none : the input value is simply passed to the 'value' Function1
- function : the input value is passed through the 'function' Function1
before being passed to the 'value' Function1
- minMax : limits the input value to 'min' and 'max' values before being
passed to the 'value' Function1
Note
Replaces the LimitRange Function1 (v2106 and earlier)
Returns a value retrieved from a function object result.
Usage:
<entryName> functionObjectValue;
<entryName>Coeffs
{
functionObject <name>;
functionObjectResult <function object result field name>
}
Function1 can now be created with an object registry, e.g. time or mesh
database. This enables access to other stored objects, e.g. fields,
dictionaries etc. making Function1 much more flexible.
Note: will allow TimeFunction1 to be deprecated
- created new functionObjects::properties class derived from IOdictionary
- replaces raw state IOdictionary owned by functionObjectList
- state dictionary access/manipulators moved from stateFunctionObject
- stateFunctionObject now acts as a light wrapper around
functionObjecties::properties
- updated dependent code
- more closely reflect what the binaries report
- report the installation path
- change PS1 case/separator to roughly correspond to package names
STYLE: adjust README to mention upcoming v2112
- use `#word` to concatenate, expand content with the resulting string
being treated as a word token. Can be used in dictionary or
primitive context.
In dictionary context, it fills the gap for constructing dictionary
names on-the-fly. For example,
```
#word "some_prefix_solverInfo_${application}"
{
type solverInfo;
libs (utilityFunctionObjects);
...
}
```
The '#word' directive will automatically squeeze out non-word
characters. In the block content form, it will also strip out
comments. This means that this type of content should also work:
```
#word {
some_prefix_solverInfo
/* Appended with application name (if defined) */
${application:+_} // Use '_' separator
${application} // The application
}
{
type solverInfo;
libs (utilityFunctionObjects);
...
}
```
This is admittedly quite ugly, but illustrates its capabilities.
- use `#message` to report expanded string content to stderr.
For example,
```
T
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-10;
relTol 0;
#message "using solver: $solver"
}
```
Only reports on the master node.