1. 26 Jun, 2019 1 commit
  2. 01 May, 2019 1 commit
    • Mark Olesen's avatar
      ENH: ensure that content changes in coded objects are noticed (#1293) · a85c55bb
      Mark Olesen authored
      - for codedFunctionObject and CodedSource the main code snippets
        were not included in the SHA1 calculation, which meant that many
        changes would not be noticed and no new library would be compiled.
      
        As a workaround, a dummy 'code' entry could be used solely for the
        purposes of generating a SHA1, but this is easily forgotten.
      
        We now allow tracking of the dynamicCodeContext for the coded
        objects and append to the SHA1 hasher with specific entries.
        This should solve the previous misbehaviour.
      
        We additionally add information about the ordering of the code
        sections. Suppose we have a coded function object (all code
        segments are optional) with the following:
      
            codeExecute "";
            codeWrite   #{ Info<< "Called\n"; #};
      
        which we subsequently change to this:
      
            codeExecute #{ Info<< "Called\n"; #};
            codeWrite   "";
      
        If the code strings are simply concatenated together, the SHA1 hashes
        will be identical. We thus 'salt' with their semantic locations,
        choosing tags that are unlikely to occur within the code strings
        themselves.
      
      - simplify the coded templates with constexpr for the SHA1sum
        information.
      
      - Correct the CodedSource to use 'codeConstrain' instead of
        'codeSetValue' for consistency with the underlying functions.
      a85c55bb
  3. 25 Mar, 2019 1 commit
  4. 19 Mar, 2019 1 commit
  5. 14 Mar, 2019 1 commit
  6. 26 Mar, 2019 2 commits
  7. 18 Feb, 2019 1 commit
    • Kutalmis Bercin's avatar
      ENH: Digital-Filter Based Synthetic Turbulence Generation Method for LES/DES Inflows · 33ef139a
      Kutalmis Bercin authored
          Velocity boundary condition generating synthetic turbulence-alike
          time-series for LES and DES turbulent flow computations.
      
          To this end, two synthetic turbulence generators can be chosen:
          - Digital-filter method-based generator (DFM)
      
          \verbatim
          Klein, M., Sadiki, A., and Janicka, J.
              A digital filter based generation of inflow data for spatially
              developing direct numerical or large eddy simulations,
              Journal of Computational Physics (2003) 186(2):652-665.
              doi:10.1016/S0021-9991(03)00090-1
          \endverbatim
      
          - Forward-stepwise method-based generator (FSM)
      
          \verbatim
          Xie, Z.-T., and Castro, I.
              Efficient generation of inflow conditions for large eddy simulation of
              street-scale flows, Flow, Turbulence and Combustion (2008) 81(3):449-470
              doi:10.1007/s10494-008-9151-5
          \endverbatim
      
          In DFM or FSM, a random number set (mostly white noise), and a group
          of target statistics (mostly mean flow, Reynolds stress tensor profiles and
          length-scale sets) are fused into a new number set (stochastic time-series,
          yet consisting of the statistics) by a chain of mathematical operations
          whose characteristics are designated by the target statistics, so that the
          realised statistics of the new sets could match the target.
      
          Random number sets ---->-|
                                   |
                               DFM or FSM ---> New stochastic time-series consisting
                                   |           turbulence statistics
          Turbulence statistics ->-|
      
          The main difference between DFM and FSM is that the latter replaces the
          streamwise convolution summation in DFM by a simpler and a quantitatively
          justified equivalent procedure in order to reduce computational costs.
          Accordingly, the latter potentially brings resource advantages for
          computations involving relatively large length-scale sets and small
          time-steps.
      33ef139a
  8. 11 Feb, 2019 1 commit
  9. 08 Feb, 2019 1 commit
  10. 06 Feb, 2019 1 commit
  11. 05 Feb, 2019 1 commit
  12. 25 Jan, 2019 1 commit
  13. 11 Jan, 2019 2 commits
  14. 20 Dec, 2018 1 commit
  15. 17 Dec, 2018 1 commit
  16. 11 Dec, 2018 1 commit
    • Mark Olesen's avatar
      ENH: use Zero when zero-initializing types · 1d85fecf
      Mark Olesen authored
      - makes the intent clearer and avoids the need for additional
        constructor casting. Eg,
      
            labelList(10, Zero)    vs.  labelList(10, 0)
            scalarField(10, Zero)  vs.  scalarField(10, scalar(0))
            vectorField(10, Zero)  vs.  vectorField(10, vector::zero)
      1d85fecf
  17. 03 Dec, 2018 1 commit
    • Andrew Heather's avatar
      ENH: freestream BC: allow inlet value to be specified by another patch · 31a439dc
      Andrew Heather authored
      The freestreamFvPatchField previously employed a fixed value when supplying
      the inlet values.  This commit extends the BC so that users can use another
      patch to supply the values via the new freestreamBC entry, e.g. to set the
      velocity to an atmospheric boundary layer profile:
      
          inlet
          {
              type            freestream;
              freestreamBC
              {
                  type            atmBoundaryLayerInletVelocity;
                  flowDir         (1 0 0);
                  zDir            (0 0 1);
                  Uref            20;
                  Zref            20;
                  z0              uniform 0.1;
                  zGround         uniform 935;
              }
          }
      
      The earlier specification is also maintained for backwards compatibility, e.g.
      
          inlet
          {
              type            freestream;
              freestreamValue uniform (300 0 0);
          }
      31a439dc
  18. 14 Nov, 2018 1 commit
  19. 20 Nov, 2018 2 commits
    • Mark Olesen's avatar
      ENH: add read guard for dimensionedType constructors (#762) · dd87c983
      Mark Olesen authored
      - deprecate dimensionedType constructors using an Istream in favour of
        versions accepting a keyword and a dictionary.
      
        Dictionary entries are almost the exclusive means of read
        constructing a dimensionedType. By construct from the dictionary
        entry instead of doing a lookup() first, we can detect possible
        input errors such as too many tokens as a result of a input syntax
        error.
      
        Constructing a dimensionedType from a dictionary entry now has
        two forms.
      
        1.  dimensionedType(key, dims, dict);
      
            This is the constructor that will normally be used.
      
            It accepts entries with optional leading names and/or
            dimensions. If the entry contains dimensions, they are
            verified against the expected dimensions and an IOError is
            raised if they do not correspond. On conclusion, checks the
            token stream for any trailing rubbish.
      
        2.  dimensionedType(key, dict);
      
            This constructor is used less frequently.
      
            ...
      dd87c983
    • Mark Olesen's avatar
      ENH: use dictionary::get<> instead of pTraits (#762) · efdbeae2
      Mark Olesen authored
      - check Istream in readBool in operator>> variant (#1033)
      efdbeae2
  20. 12 Nov, 2018 1 commit
  21. 06 Nov, 2018 1 commit
  22. 05 Nov, 2018 1 commit
  23. 31 Oct, 2018 1 commit
  24. 29 Oct, 2018 2 commits
  25. 18 Oct, 2018 1 commit
    • Mark Olesen's avatar
      ENH: cleanup of Enum class · 3b745122
      Mark Olesen authored
      - more dictionary-like methods, enforce keyType::LITERAL for all
        lookups to avoid any spurious keyword matching.
      
      - new readEntry, readIfPresent methods
      
      - The get() method replaces the now deprecate lookup() method.
      
      - Deprecate lookupOrFailsafe()
        Failsafe behaviour is now an optional parameter for lookupOrDefault,
        which makes it easier to tailor behaviour at runtime.
      
      - output of the names is now always flatted without line-breaks.
        Thus,
      
           os << flatOutput(someEnumNames.names()) << nl;
           os << someEnumNames << nl;
      
        both generate the same output.
      
      - Constructor now uses C-string (const char*) directly instead of
        Foam::word in its initializer_list.
      
      - Remove special enum + initializer_list constructor form since
        it can create unbounded lookup indices.
      
      - Removd old hasEnum, hasName forms that were provided during initial
        transition from NamedEnum.
      
      - Added static_assert on Enum contents to restrict to enum or
        integral values.  Should not likely be using this class to enumerate
        other things since it internally uses an 'int' for its values.
      
        Changed volumeType accordingly to enumerate on its type (enum),
        not the class itself.
      3b745122
  26. 17 Oct, 2018 1 commit
    • Mark Olesen's avatar
      ENH: simplify objectRegistry access names (issue #322) · 8fabc325
      Mark Olesen authored
        New name:  findObject(), cfindObject()
        Old name:  lookupObjectPtr()
      
            Return a const pointer or nullptr on failure.
      
        New name:  findObject()
        Old name:  --
      
            Return a non-const pointer or nullptr on failure.
      
        New name:  getObjectPtr()
        Old name:  lookupObjectRefPtr()
      
            Return a non-const pointer or nullptr on failure.
            Can be called on a const object and it will perform a
            const_cast.
      
      - use these updated names and functionality in more places
      
      NB: The older methods names are deprecated, but continue to be defined.
      8fabc325
  27. 12 Oct, 2018 1 commit
    • Mark Olesen's avatar
      ENH: avoid readScalar, readLabel etc from dictionary (#762, #1033) · 8eddcc07
      Mark Olesen authored
      - use the dictionary 'get' methods instead of readScalar for
        additional checking
      
           Unchecked:  readScalar(dict.lookup("key"));
           Checked:    dict.get<scalar>("key");
      
      - In templated classes that also inherit from a dictionary, an additional
        'template' keyword will be required. Eg,
      
           this->coeffsDict().template get<scalar>("key");
      
        For this common use case, the predefined getXXX shortcuts may be
        useful. Eg,
      
           this->coeffsDict().getScalar("key");
      8eddcc07
  28. 01 Oct, 2018 1 commit
    • Mark Olesen's avatar
      ENH: improve, simplify, rationalize coordinate system handling (issue #863) · 6697bb47
      Mark Olesen authored
      Previously the coordinate system functionality was split between
      coordinateSystem and coordinateRotation. The coordinateRotation stored
      the rotation tensor and handled all tensor transformations.
      
      The functionality has now been revised and consolidated into the
      coordinateSystem classes. The sole purpose of coordinateRotation
      is now just to provide a selectable mechanism of how to define the
      rotation tensor (eg, axis-angle, euler angles, local axes) for user
      input, but after providing the appropriate rotation tensor it has
      no further influence on the transformations.
      
      --
      
      The coordinateSystem class now contains an origin and a base rotation
      tensor directly and various transformation methods.
      
        - The origin represents the "shift" for a local coordinate system.
      
        - The base rotation tensor represents the "tilt" or orientation
          of the local coordinate system in general (eg, for mapping
          positions), but may require position-dependent tensors when
          transforming vectors and tensors.
      
      For some coordinate systems (currently the cylindrical coordinate system),
      the rotation tensor required for rotating a vector or tensor is
      position-dependent.
      
      The new coordinateSystem and its derivates (cartesian, cylindrical,
      indirect) now provide a uniform() method to define if the rotation
      tensor is position dependent/independent.
      
      The coordinateSystem transform and invTransform methods are now
      available in two-parameter forms for obtaining position-dependent
      rotation tensors. Eg,
      
            ... = cs.transform(globalPt, someVector);
      
      In some cases it can be useful to use query uniform() to avoid
      storage of redundant values.
      
            if (cs.uniform())
            {
                vector xx = cs.transform(someVector);
            }
            else
            {
                List<vector> xx = cs.transform(manyPoints, someVector);
            }
      
      Support transform/invTransform for common data types:
         (scalar, vector, sphericalTensor, symmTensor, tensor).
      
      ====================
        Breaking Changes
      ====================
      
      - These changes to coordinate systems and rotations may represent
        a breaking change for existing user coding.
      
      - Relocating the rotation tensor into coordinateSystem itself means
        that the coordinate system 'R()' method now returns the rotation
        directly instead of the coordinateRotation. The method name 'R()'
        was chosen for consistency with other low-level entities (eg,
        quaternion).
      
        The following changes will be needed in coding:
      
            Old:  tensor rot = cs.R().R();
            New:  tensor rot = cs.R();
      
            Old:  cs.R().transform(...);
            New:  cs.transform(...);
      
        Accessing the runTime selectable coordinateRotation
        has moved to the rotation() method:
      
            Old:  Info<< "Rotation input: " << cs.R() << nl;
            New:  Info<< "Rotation input: " << cs.rotation() << nl;
      
      - Naming consistency changes may also cause code to break.
      
            Old:  transformVector()
            New:  transformPrincipal()
      
        The old method name transformTensor() now simply becomes transform().
      
      ====================
        New methods
      ====================
      
      For operations requiring caching of the coordinate rotations, the
      'R()' method can be used with multiple input points:
      
             tensorField rots(cs.R(somePoints));
      
         and later
      
             Foam::transformList(rots, someVectors);
      
      The rotation() method can also be used to change the rotation tensor
      via a new coordinateRotation definition (issue #879).
      
      The new methods transformPoint/invTransformPoint provide
      transformations with an origin offset using Cartesian for both local
      and global points. These can be used to determine the local position
      based on the origin/rotation without interpreting it as a r-theta-z
      value, for example.
      
      ================
        Input format
      ================
      
      - Streamline dictionary input requirements
      
        * The default type is cartesian.
        * The default rotation type is the commonly used axes rotation
          specification (with e1/e2/3), which is assumed if the 'rotation'
          sub-dictionary does not exist.
      
          Example,
      
          Compact specification:
      
              coordinateSystem
              {
                  origin  (0 0 0);
                  e2      (0 1 0);
                  e3      (0.5 0 0.866025);
              }
      
          Full specification (also accepts the longer 'coordinateRotation'
          sub-dictionary name):
      
              coordinateSystem
              {
                  type    cartesian;
                  origin  (0 0 0);
      
                  rotation
                  {
                      type    axes;
                      e2      (0 1 0);
                      e3      (0.5 0 0.866025);
                  }
              }
      
         This simplifies the input for many cases.
      
      - Additional rotation specification 'none' (an identity rotation):
      
            coordinateSystem
            {
                origin  (0 0 0);
                rotation { type none; }
            }
      
      - Additional rotation specification 'axisAngle', which is similar
        to the -rotate-angle option for transforming points (issue #660).
        For some cases this can be more intuitive.
      
        For example,
      
            rotation
            {
                type    axisAngle;
                axis    (0 1 0);
                angle   30;
            }
        vs.
            rotation
            {
                type    axes;
                e2      (0 1 0);
                e3      (0.5 0 0.866025);
            }
      
      - shorter names (or older longer names) for the coordinate rotation
        specification.
      
           euler         EulerRotation
           starcd        STARCDRotation
           axes          axesRotation
      
      ================
        Coding Style
      ================
      - use Foam::coordSystem namespace for categories of coordinate systems
        (cartesian, cylindrical, indirect). This reduces potential name
        clashes and makes a clearer declaration. Eg,
      
            coordSystem::cartesian csys_;
      
        The older names (eg, cartesianCS, etc) remain available via typedefs.
      
      - added coordinateRotations namespace for better organization and
        reduce potential name clashes.
      6697bb47
  29. 11 Sep, 2018 1 commit
  30. 30 Jul, 2018 1 commit
  31. 26 Jul, 2018 1 commit
  32. 05 Oct, 2018 1 commit
    • Mark Olesen's avatar
      ENH: use dictionary::readEntry for detection of input errors (#762, #1033) · 13778f76
      Mark Olesen authored
      - instead of   dict.lookup(name) >> val;
        can use      dict.readEntry(name, val);
      
        for checking of input token sizes.
        This helps catch certain types of input errors:
      
        {
      
            key1 ;                // <- Missing value
            key2 1234             // <- Missing ';' terminator
            key3 val;
        }
      
      STYLE: readIfPresent() instead of 'if found ...' in a few more places.
      13778f76
  33. 23 Jul, 2018 1 commit
  34. 20 Jul, 2018 1 commit
  35. 26 Jun, 2018 1 commit
  36. 19 Jun, 2018 1 commit