Commit Graph

25381 Commits

Author SHA1 Message Date
Mark Olesen
9a5125111e ENH: add coded Function1 (#2282)
- update coded templates with qualified names

GIT: add in missing PatchFunction1 constant() method

- was missed in a previous commit
2021-12-03 20:56:10 +01:00
Mark Olesen
8624d65c5a ENH: support alternative build-root location (#2286)
- specify any of these

    ./Allwmake -build-root=...
    wmake -build-root=...
    FOAM_BUILDROOT=... wmake

  these specify an alternative root where build artifacts are to land.
  Currently only used as an alternative for the 'build/' hierarchy
  since the 'platforms/' target normally includes inputs as well.

  Possible use:
  ```
  (
      export WM_MPLIB="%{foam_mplib}"
      export FOAM_MPI="%{foam_mpi}"
      export MPI_ARCH_PATH="%{mpi_prefix}"

      export FOAM_BUILDROOT=/tmp/mpibuild
      export FOAM_MPI_LIBBIN="$FOAM_BUILDROOT/platforms/$WM_OPTIONS/lib/$FOAM_MPI"

      src/Pstream/Allwmake-mpi
   )
   ```
2021-12-03 17:10:22 +01:00
Mark Olesen
27e57c29f7 BUG: dangling dictionary reference for expression BCs
- exposed by the new embedded function handling.

  Requires local copies of dictionary content instead
  (similar to coded BCs handling)

BUG: incorrect formatting for expression function output

ENH: simpler copyDict version taking wordList instead of wordRes

- corresponds to the most common use case at the moment

ENH: expression string writeEntry method

- write as verbatim for better readability
2021-12-03 17:10:22 +01:00
Mark Olesen
e09298092d ENH: support negated regular expressions (#2283)
- extendes the prefix syntax to handle '!' values.

  For example,  "(?!).*processor.*" or "(?!i)inlet.*"
2021-12-03 17:10:22 +01:00
Mark Olesen
49e26dd7d2 ENH: consistent specification of fan conditions (fixes #2279) 2021-12-03 17:10:22 +01:00
Mark Olesen
31a7c2a9cd ENH: initial use of ReactionTable to wrap information 2021-12-03 17:10:22 +01:00
Mark Olesen
c7f30a0989 STYLE: use Hash<word> instead of string::hasher for runTimeSelectionTables 2021-12-03 15:55:19 +01:00
Mark Olesen
bdf77bbdd1 ENH: simplify hashing overloads of string-types
- 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`
2021-12-03 15:55:19 +01:00
Daniel Jasiński
939c335504 INT: liquidProperties: support for user defined liquid properties (#2141)
- 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
2021-12-03 15:54:48 +01:00
Mark Olesen
e9054ec636 COMP: consistent FatalError/FatalIOError exit types
STYLE: hostName() is short name, don't need parameter
2021-12-03 15:32:37 +01:00
Mark Olesen
ed5dee71a4 BUG: ccm region merge fails (fixes #2048)
- 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
2021-12-03 15:32:37 +01:00
Mark Olesen
e6f4ae927a LINT: script not marked as bash-specific
CONFIG: cleanup additional build-related env variables
2021-12-03 15:32:37 +01:00
Mark Olesen
8ed6a61106 CONFIG: set API level to 2109
- Function1, sampledSets, expressions, runTime selection tables
2021-12-03 15:32:37 +01:00
Mark Olesen
78cc5f8676 SUBMODULE: entries marked as removable, compilation fixes 2021-12-03 15:32:37 +01:00
Mark Olesen
f7c7fa94a3 ENH: add Function1 constant() member
- 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
2021-12-03 15:32:37 +01:00
Andrew Heather
b96cef1339 ENH: [sampled]DistanceSurface - added construct from searchableSurface 2021-12-03 13:48:34 +00:00
Andrew Heather
9cf26ac7c5 BUG: InjectionModel::findCellAtPosition - celli can be zero 2021-12-03 13:48:34 +00:00
Andrew Heather
9833e614da BUG: surfaceAlignedSBRStressFvMotionSolver - corrected units (see #2265)
Note - this resolves the reported dimensions error, but it is not clear
if this code (has ever?) run or if this change is appropriate...
2021-12-03 13:48:34 +00:00
Andrew Heather
6aa608cf33 ENH: MRF - exposed origin and axis; added lookup from name 2021-12-03 13:48:33 +00:00
Andrew Heather
53e9c8eb5a ENH: forces|Coeffs FO - updated coordinate system 2021-12-03 13:48:33 +00:00
Sergio Ferraris
8fc4501c46 Merge branch 'feature-turbulentTemperature_Function1' into 'develop'
ENH: coupling BC: allow Function1. Fixes #2277.

See merge request Development/openfoam!507
2021-12-02 18:03:17 +00:00
Mattijs Janssens
29c70e9bbb ENH: coupling BC: allow Function1. Fixes #2277. 2021-12-02 18:03:16 +00:00
mattijs
6abbcb3eac BUG: GAMG: processorAgglomerator crashes. Fixes #2281.
Problem was extending the storage, copying the
original contents.
2021-11-29 14:44:24 +00:00
Andrew Heather
2880a54373 Merge branch 'feature-expr-improvements' into 'develop'
Updates for expressions to improve robustness and support functions, external context etc.

See merge request Development/openfoam!501
2021-11-26 12:16:45 +00:00
Mark Olesen
c0adccf826 ENH: generalize volField lookups to include 'context' objects
- 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.
2021-11-26 12:24:35 +01:00
Mark Olesen
643763d258 ENH: add cell/face set/zone support for patch expressions
- 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
2021-11-26 12:24:35 +01:00
Mark Olesen
fc6239d96e ENH: add expression support for scalar/vector expression lookups
- 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)
2021-11-26 12:24:35 +01:00
Mark Olesen
e6697edb52 ENH: robuster lemon parsing
- 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).
2021-11-26 12:24:35 +01:00
Mark Olesen
adbcd3a19f Merge branch 'feature-functionObject-Function1' into 'develop'
Function1 objectRegistry access

See merge request Development/openfoam!499
2021-11-26 11:24:13 +00:00
Mark Olesen
adcf41bd13 ENH: add Function1 wrapping for functionObject trigger
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
2021-11-26 11:22:36 +00:00
Mark Olesen
30a2fa4b27 BUG: dsmcFields fails with scoped field names 2021-11-26 11:22:36 +00:00
Andrew Heather
89ddc271c7 ENH: LimitRange Function1 - extended and renamed
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)
2021-11-26 11:22:36 +00:00
Andrew Heather
ba45fb2cba ENH: Function1 - updated time-based Function1 usage 2021-11-26 11:22:36 +00:00
Andrew Heather
f6ee1811e7 STYLE: renamed convertTimeBase to more descriptive userTimeToTime 2021-11-26 11:22:36 +00:00
Andrew Heather
098aec4962 ENH: Function1's - added objectRegistry access 2021-11-26 11:22:36 +00:00
Andrew Heather
889bc171d9 TUT: Added example showing use of functionObject result lookup from a Function1 2021-11-26 11:22:36 +00:00
Andrew Heather
c233961d45 ENH: function objects - apply scoped name when registering objects 2021-11-26 11:22:36 +00:00
Andrew Heather
9194cd5203 ENH: Deprecated TimeFunction1 usage in favour of Function1 2021-11-26 11:22:36 +00:00
Mark Olesen
925a2e724b ENH: add caching selector to PatchFunction1
- extend handling of uniform PatchFunction1 to include new Function1
  types and pass through the objectRegistry information
2021-11-26 11:22:36 +00:00
Andrew Heather
f29eb55cee ENH: Refactored TimeFunction1 - now possible using Function1 directly 2021-11-26 11:22:36 +00:00
Andrew Heather
b9b011f5ea ENH: Added new sample Function1 2021-11-26 11:22:36 +00:00
Andrew Heather
bc2b469f9d ENH: Added new Function1: FunctionObjectValue
Returns a value retrieved from a function object result.

Usage:
    <entryName> functionObjectValue;
    <entryName>Coeffs
    {
        functionObject          <name>;
        functionObjectResult    <function object result field name>
    }
2021-11-26 11:22:36 +00:00
Andrew Heather
2c2310dc17 ENH: reference function object - retrieve reference using Function1
Note: previous behaviour to set the reference to a cell value can be recovered
by using the new 'sample' Function1
2021-11-26 11:22:36 +00:00
Andrew Heather
70b55be684 COMP: Function1 - propagated API change resulting from new objectRegistry access 2021-11-26 11:22:36 +00:00
Andrew Heather
c1a04abd96 ENH: Function1 - added optional objectRegistry reference
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
2021-11-26 11:22:36 +00:00
Andrew Heather
aeef96251f ENH: Refactored stateFunctionObject
- 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
2021-11-26 11:22:36 +00:00
Andrew Heather
b19e767b8f ENH: sampledSets - added min,max,average values to the results dict 2021-11-26 11:22:36 +00:00
Mark Olesen
f078643f8c ENH: add blockFaces.vtp output for blockMesh -write-vtk 2021-11-25 20:02:09 +01:00
Mark Olesen
f459b11e24 STYLE: direct iteration over dictionary entries 2021-11-25 20:02:08 +01:00
Mark Olesen
bcf8a48c68 CONFIG: add build information into shell session
- 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
2021-11-25 17:36:37 +01:00