Commit Graph

23498 Commits

Author SHA1 Message Date
Mark Olesen
5f93f20652 ENH: add stringOps::inplaceRemoveSpace()
Style changes:
  - use std algorithm for some stringOps internals
  - pass SubStrings iterators by const reference

ENH: special nullptr handling for ISstream getLine
  - pass through to istream::ignore to support read and discard
2020-02-19 23:36:46 +01:00
Mark Olesen
6b3b6bb99f ENH: add stream format options for surface writers (#1595)
- additional boundaryData options (header, binary, compression)

- remove vtkSurfaceWriter "writePrecision" keyword (1806 compatibilty)
  and use "precision" in format option sub-dictionary.
2020-02-19 21:30:55 +01:00
sergio
514751dcf7 STY: General clean up 2020-02-19 10:40:56 -08:00
Mattijs Janssens
83c06f1ace Merge branch 'feature.interPCFoam' into 'develop'
Feature.interPCFoam

See merge request Development/openfoam!338
2020-02-19 15:33:39 +00:00
mattijs
1319144a72 STYLE: stefanProblem: cleanup. 2020-02-19 14:18:25 +00:00
mattijs
31eb7c61b5 ENH: interfaceHeight: avoid tracking to corner point 2020-02-19 14:18:25 +00:00
sergio
4abb2153a1 STY: Updating headers for tutorial 2020-02-19 14:18:25 +00:00
sergio
499933dbab ENH: Adding features for phase change solvers
1) Adding interfaceHeight FO
2) Adding interfaceHeatResistance mass transfer model to
   interCondensatingEvaporatingFoam with spread source approach
3) Reworking framework for icoReactingMultiphaseInterFoam
2020-02-19 14:18:25 +00:00
Mattijs Janssens
2ee9315532 Merge branch 'feature-writeObject' into 'develop'
Feature write object

See merge request Development/openfoam!341
2020-02-19 09:26:35 +00:00
Mark Olesen
8498e3f516 ENH: reduce some overhead in fileOperations
- more consistent handling of file format (#1587)
2020-02-19 09:25:33 +00:00
Mark Olesen
42299dca22 ENH: use IOstreamOption for writeObject() calls.
- reduces the number of parameters that are being passed around
  and allows future additions into the IOstreamOption with mininal
  effort.
2020-02-19 09:25:33 +00:00
Kutalmis Bercin
9be1772e0c BUG: surfaceInertia analytic eigendecomposition (fixes #1599)
- was missing cast to symmTensor
2020-02-19 10:14:57 +01:00
Mark Olesen
e3f681fa59 ENH: support use of IOstreamOption for IFstream/OFstream
- can be convenient to bundle IO options as a single parameter
2020-02-18 21:51:36 +01:00
Mark Olesen
f3106ec146 STYLE: use unique_ptr for Fstream resource management
STYLE: change return type of NewOFstream from Ostream to OSstream
2020-02-18 21:51:35 +01:00
Mark Olesen
3135dcf2a9 ENH: support IOstreamOption in abstract stream types
- expose the write IOstreamOption in Time
2020-02-18 21:51:35 +01:00
Mark Olesen
33f9ae5080 ENH: improvements to IOstreamOption
* Support default values for format/compress enum lookups.

  - Avoids situations where the preferred default format is not ASCII.
    For example, with dictionary input:

        format binar;

    The typing mistake would previously have caused formatEnum to
    default to ASCII. We can now properly control its behaviour.

        IOstream::formatEnum
        (
            dict.get<word>("format"), IOstream::BINARY
        );

    Allowing us to switch ascii/binary, using BINARY by default even in
    the case of spelling mistakes. The mistakes are flagged, but the
    return value can be non-ASCII.

* The format/compression lookup behave as pass-through if the lookup
  string is empty.

  - Allows the following to work without complaint

      IOstream::formatEnum
      (
          dict.getOrDefault("format", word::null), IOstream::BINARY
      );

  - Or use constructor-like failsafe method

      IOstream::formatEnum("format", dict, IOstream::BINARY);

  - Apply the same behaviour with setting stream format/compression
    from a word.

       is.format("binar");

    will emit a warning, but leave the stream format UNCHANGED

* Rationalize versionNumber construction

  - constexpr constructors where possible.
    Default construct is the "currentVersion"

  - Construct from token to shift the burden to versionNumber.
    Support token as argument to version().

    Now:

        is.version(headerDict.get<token>("version"));

    or failsafe constructor method

        is.version
        (
            IOstreamOption::versionNumber("version", headerDict)
        );

    Before (controlled input):

        is.version
        (
            IOstreamOption::versionNumber
            (
                headerDict.get<float>("version")
            )
        );

    Old, uncontrolled input - has been removed:

        is.version(headerDict.lookup("version"));

* improve consistency, default behaviour for IOstreamOption construct

  - constexpr constructors where possible

  - add copy construct with change of format.

  - construct IOstreamOption from streamFormat is now non-explicit.
    This is a commonly expected result with no ill-effects
2020-02-18 21:51:35 +01:00
Mark Olesen
bb53e8adb3 ENH: adjustments to Switch
- align Switch more with Enum.
  Now have find(), found() static methods.
  Constructors with failsafe option.

  The find() method makes for clearer coding:

  OLD

     Switch sw(some_string, true); // NB: true = allowBad

     if (sw.valid()) ...

  NOW

     Switch sw = Switch::find(some_string);

     if (sw.good()) ...

  or

     if (Switch::found(some_string)) ...

- improve construct from dictionary to handle all valid token types.
  Previously just read in a word.

- Remove asText() method - replaced by c_str() and str() several
  versions ago.
2020-02-18 21:51:35 +01:00
Mark Olesen
ed4bd54846 STYLE: provide return value for IOstream::fatalCheck()
- allows reuse as base implementation for IOstream::check()
2020-02-18 17:02:45 +01:00
Mark Olesen
ac709da3ac STYLE: FatalError instead of warning for handling deprecated field format
- The warning in Field.C has been emitted since 2005.
- The warning in mappedPatchBase.C has been emitted since 2012.
2020-02-18 17:02:45 +01:00
Mark Olesen
2834193c27 STYLE: remove "originalVersion" face handling
- an old pre-OpenFOAM transitional feature (prior to 2004)
  for named faces.
2020-02-18 17:02:44 +01:00
Mark Olesen
9ee870e09c ENH: impose type-narrowing for Ensight output 2020-02-18 17:02:44 +01:00
Mark Olesen
fedcbff6f4 ENH: provide narrowFloat, narrowInt32 definitions
- underflow/overflow handling for type narrowing.
  Eg, double -> float, int64 -> int32
2020-02-18 17:02:44 +01:00
Mark Olesen
4e1bc2d2f1 COMP: incorrect placement of compiler attributes 2020-02-18 13:51:20 +01:00
Mark Olesen
d7969b1ba4 ENH: preserve tokenized directive and variable types 2020-02-18 13:51:20 +01:00
Mark Olesen
4307e1719f STYLE: adjust names, locations for fileFormats
- renamed 'core/' -> 'base/' to avoid gitignore masking when re-adding
  files

- rename 'nas/' to 'nastran/' for more clarity

- relocated OBJstream from surfMesh to fileFormats

STYLE: remove unused parseNASCoord. Was deprecated 2017-09
2020-02-18 13:51:20 +01:00
Mark Olesen
fbb371dda4 STYLE: avoid extraneous c_str() for OFstream construct 2020-02-18 13:51:20 +01:00
Andrew Heather
0e1c9b0af7 Merge branch 'feature-analytic-eigen' into 'develop'
ENH: Improve polynomial equations and analytical eigendecompositions

See merge request Development/openfoam!340
2020-02-18 12:23:46 +00:00
Kutalmis Bercin
55e7da670c ENH: improve analytical eigendecompositions
- `tensor` and `tensor2D` returns complex eigenvalues/vectors
  - `symmTensor` and `symmTensor2D` returns real eigenvalues/vectors
  - adds new test routines for eigendecompositions
  - improves numerical stability by:
    - using new robust algorithms,
    - reordering the conditional branches in root-type selection
2020-02-18 12:21:01 +00:00
Kutalmis Bercin
6a53794e0a STYLE: reorder global funcs and opers in Tensor types
- In the course of time, global funcs/opers of Tensor types expanded
    leaving funcs/opers unordered.

  - Therefore, by following the order designated in Matrix class, the order
    of global funcs and global opers are reordered:
    - oper+ oper- oper* oper/ inner-product double-inner-product outer-product
2020-02-18 12:21:01 +00:00
Kutalmis Bercin
66b02ca5ca ENH: improve funcs and opers in Tensor types
- ensures each Tensor-container operates for the following base types:
    - floatScalar
    - doubleScalar
    - complex

  - adds/improves test applications for each container and base type:
    - constructors
    - member functions
    - global functions
    - global operators

  - misc:
    - silently removes `invariantIII()` for `tensor2D` and `symmTensor2D`
      since the 3rd invariant does not exist for 2x2 matrices
    - fixes `invariantII()` algorithm for `tensor2D` and `symmTensor2D`
    - adds `Cmpt` multiplication to `Vector2D` and `Vector`
    - adds missing access funcs for symmetric containers
    - improves func/header documentations
2020-02-18 12:21:01 +00:00
Kutalmis Bercin
8ca724fffa ENH: improve stability in polynomialEqns
- replaces floating-point equal comparisons in
    `linearEqn`, `quadraticEqn`, and `cubicEqn`,
  - ensures `quadraticEqn` and `cubicEqn` can return `complex` roots,
  - reorders if-branches in `quadraticEqn` and `cubicEqn` to avoid
    zero-equal comparison,
  - adds Kahan's cancellation-avoiding algorithm into `quadraticEqn` and
    `cubicEqn` for the numerically-sensitive discriminant computation,

  - adds/improves `polynomialEqns` tests:
    * adds Test-linearEqn.C
    * adds Test-quadraticEqn.C
    * improves Test-cubicEqn.C
2020-02-18 12:21:01 +00:00
Andrew Heather
97bdd5bc04 Merge branch 'feature-ensight-parts' into 'develop'
Feature ensight parts

See merge request Development/openfoam!339
2020-02-18 11:10:42 +00:00
Mark Olesen
a97628121c ENH: overhaul ensight handling (#1579)
- includes restructuring and simplification of low-level ensight part
  handling and refactor of backends to improve code reuse.

foamToEnsight
-------------

  * new cellZone support.
    This was previously only possible via a separate foamToEnsightParts
    utility that was not parallelized.

  * support for point fields.

  * `-nearCellValue` option (as per foamToVTK)

  * data indexing now uses values from the time index.
    This is consistent with the ensightWrite function object and
    can help with restarts.

  * existing ensight directories are removed, unless the -no-overwrite
    option is supplied

foamToEnsightParts
------------------
  * now redundant and removed.

ensightOutputSurface (new class)
--------------------------------
  * a lightweight wrapper for point/face references that is tailored
    for the ensightSurfaceWriter. It uses compact face/point information
    and is serial only, since this is the format requirements from the
    surfaceWriter class.

ensightMesh (revised class)
---------------------------
  * now only holds a polyMesh reference, which removes its dependency
    on finiteVolume and allows it to be relocated under fileFormats
    instead of conversion.

Removed classes: ensightParts, ensighPartFaces, ensightPartCells

- these were used by foamToEnsightParts, but not needed anymore.
2020-02-18 11:09:43 +00:00
Mark Olesen
c7e8f22baf ENH: improve ensightFile output support (#1579)
- indirect lists, lists of labels
- writeString() methods to avoid any ambiguities

- support handling of mixed element/node data in ensightCase
2020-02-18 11:09:43 +00:00
mattijs
4fea7b3bb4 BUG: SPDP: PrecisionAdaptor copies input list. Fixes #1590. 2020-02-12 17:27:41 +00:00
mattijs
09db19c3f0 Merge remote-tracking branch 'origin/master' into develop 2020-02-12 17:13:34 +00:00
mattijs
80b5d3a1a0 ENH: blockMesh: protect face projection from misses. Fixes #1591. 2020-02-12 17:13:11 +00:00
Mark Olesen
ec3de7128c STYLE: adjust logic names for point-values in foamToVTK 2020-02-12 18:03:50 +01:00
mattijs
ff19bedbc3 BUG: SPDP mode: guaranteeing initial value. Fixes #1590.
In differing precisions the PrecisionAdaptor will copy
the input array element by element and this can trigger
NaN detection.
2020-02-12 16:54:05 +00:00
Mark Olesen
f90de02159 ENH: openfoam shell session - improved and relocated
- '-c' option (as per shell), '-Dkey[=value]' option to provide
  preferences via the command-line. For example,

      etc/openfoam -DWM_COMPILER=Clang -int64  ./Allwmake -j -s -l

  These can also be combined with other options. Eg,

      etc/openfoam -DWM_COMPILER=Clang \
          -c 'wmake -show-path-cxx -show-cxxflags'

- relocated from bin/tools/ => etc/ for easier access

- bin/tools/openfoam.in : for autoconfig-style installation

- Auto-detect if the shell script was executed with openfoam and
  interpret accordingly.

  Simple example,

      --------------
      #!/usr/bin/openfoam
      cd "${0%/*}" || exit   # Run -*-sh-*- from this dir

      blockMesh
      simpleFoam
      --------------

   Note it is NOT currently possible to provide any other parameters
   this way. Eg,

      `#!/usr/bin/openfoam -sp` (NOT)

   This will either fail to run, or result in infinite recursion.
2020-02-12 17:48:09 +01:00
Mark Olesen
d483123cef STYLE: limit foamEtcFile -show-api to querying the META-INFO/api-info
- simplifies code, covers most cases.
  Can use wmake -show-api or wmakeBuildInfo to query the make rules.

STYLE: Allwmake script adjustments

- use bin/foamEtcFile instead of relying on PATH.
  The make environment may not have the OpenFOAM bin/ in it.

- simpler shell syntax
2020-02-12 17:48:09 +01:00
mattijs
8ab37e13e2 ENH: foamFormatConvert: leave boundary intact. Fixes #1358. 2020-02-12 15:04:05 +00:00
Mark Olesen
8e63f084b1 ENH: improve type consistency for HashTable iterators (#1563) 2020-02-11 11:00:30 +01:00
Mark Olesen
beebe4e214 STYLE: fix shell syntax 2020-02-10 17:02:30 +01:00
Andrew Heather
49e63378f8 TUT: corrected link to online case. Fixes #1584 2020-02-10 11:44:20 +00:00
Mark Olesen
531f6d9ea2 TUT: add inner-region cellZone to simpleFoam/motorBike
- useful for post-processing and data conversion tests
2020-02-07 17:00:20 +01:00
Mark Olesen
553c01d52e CONFIG: bin/tools/query-versions
- Query the etc/config.sh values for ThirdParty software.
  Usable without an active OpenFOAM environment.
2020-02-07 17:11:49 +01:00
Mark Olesen
739bc3c4af COMP: add -pthread compile/link dependency for std::thread (#614) 2020-02-07 11:06:06 +01:00
mattijs
9da83a3e4f ENH: snappyHexMesh: allow cellZone erosion in parallel. See #1528.
Issues:
- neighbouring processors use different ray since always from
owner cc to nbr cc
- growing cellZones did not correctly unmark intersections
- stand-alone baffles now always removed (if inside 'grow' region,
i.e. within 1 cell of cellZone)
2020-02-06 12:40:34 +00:00
mattijs
01c14532bd ENH: checkMesh: write cellZone, faceZone info. See #1543. 2020-02-06 12:36:26 +00:00