Commit Graph

7416 Commits

Author SHA1 Message Date
mattijs
fa7f0e1b67 ENH: pureZoneMixture: different mixture properties according to cellZone 2022-12-14 15:07:00 +00:00
Andrew Heather
48973bad83 ENH: chtMultiRegionFoam - add frozenFlow option
Also for 'chtMultiRegionSimpleFoam' and 'chtMultiRegionTwoPhaseEulerFoam'.
2022-12-14 10:54:40 +00:00
Kutalmis Bercin
a0f1e98d24 ENH: finiteArea: improve robustness in code sections vulnerable to math errors
It has been observed that the finite-area framework is prone to numerical
issues when zero-valued edge lenghts, edge/face normals and face areas exist.

To improve exception handling at identified code sections to gracefully
overcome math errors, the problematic entities are lower-bounded by SMALL.
2022-12-14 10:18:23 +00:00
Mark Olesen
ed5690ffbc STYLE: volSurfaceMapping is const 2022-12-13 11:18:16 +01:00
Mark Olesen
4b94ac97c2 ENH: dimensioned/dimensionedSet handle optional read as per dictionary 2022-12-13 10:09:46 +01:00
Mark Olesen
b69db76b67 ENH: bundle together freed/outstanding MPI request handling
- improve communicator wrapping
- avoid indexing errors when using partial subranks
- UPstream::is_subrank (for testing partial subranks)
2022-12-09 10:59:32 +01:00
Mark Olesen
3151dacccc ENH: include <algorithm> in stdFoam.H
- was already included in many places (via UList.C templates), but now
  formalise by placing in stdFoam.H
2022-12-01 15:52:48 +00:00
Mark Olesen
8ae2e5a969 ENH: fail-safe access of ITstream tokens as front(), back()
- more standard naming than peekFront() etc
2022-12-01 14:51:19 +00:00
Mark Olesen
8d4e32da22 COMP: fixup test applications 2022-12-01 14:51:19 +00:00
Mark Olesen
ffeef76d8f ENH: cleaner separation of global and local world naming
- UPstream::globalComm constant always refers to MPI_COMM_WORLD but
  UPstream::worldComm could be MPI_COMM_WORLD (single world)
  or a dedicated local communicator (for multi-world).

- provide a Pstream wrapped version of MPI_COMM_SELF,
  references as UPstream::selfComm

- UPstream::isUserComm(label)
  test for additional user-defined communicators
2022-12-01 12:18:38 +00:00
mattijs
69be54107d ENH: IOobject headerClassName now initialised to empty value
- was previously populated with "IOobject" (the typeName) but then
  cannot easily detect if the object was actually read.
  Also clear the headerClassName on a failed read

BUG: parallel inconsistency in regIOobject::readHeaderOk

- headerOk() checked with master, but possible parallel operations
  within it
2022-11-25 12:48:45 +01:00
mattijs
adf95d483c BUG: redistributePar: softlink uniform. Fixes #163 2022-11-24 14:58:07 +00:00
Kutalmis Bercin
8c02820db6 COMP: EigenMatrix: remove unused iter variable 2022-11-24 13:47:08 +00:00
Mark Olesen
cb4e026aed ENH: add support for additional filter/mapping (#2609)
- comprises a few different elements:

FilterField (currently packaged in PatchFunction1Types namespace)
~~~~~~~~~~~

  The FilterField helper class provides a multi-sweep median filter
  for a Field of data associated with a geometric point cloud.

  The points can be freestanding or the faceCentres (or points)
  of a meshedSurface, for example.

  Using an initial specified search radius, the nearest point
  neighbours are gathered and addressing/weights are built for them.
  This currently uses an area-weighted, linear RBF interpolator
  with provision for quadratic RBF interpolator etc.

  After the weights and addressing are established,
  the evaluate() method can be called to apply a median filter
  to data fields, with a specified number of sweeps.

boundaryDataSurfaceReader
~~~~~~~~~~~~~~~~~~~~~~~~~

- a surfaceReader (similar to ensightSurfaceReader) when a general
  point data reader is needed.

MappedFile
~~~~~~~~~~
- has been extended to support alternative surface reading formats.
  This allows, for example, sampled ensight data to be reused for
  mapping.  Cavaet: multi-patch entries may still needs some work.

- additional multi-sweep median filtering of the input data.
  This can be used to remove higher spatial frequencies when
  sampling onto a coarse mesh.

smoothSurfaceData
~~~~~~~~~~~~~~~~~
- standalone application for testing of filter radii/sweeps
2022-11-24 13:30:16 +01:00
Mark Olesen
98598ba0bb ENH: use simpler constructor forms for treeData types 2022-11-24 12:21:01 +00:00
Mark Olesen
fc0b980333 BUG: avoid infinite recursion in AABBTree (fixes #2616)
- since bounding boxes overlap, need to verify the splitting actually
  did something. Problem only really evident with higher tree depths.
2022-11-24 12:21:01 +00:00
Mark Olesen
38b663b6a8 ENH: add boundBox/triangle intersection test to boundBox
- replaces edge by edge tests with separating axis tests
2022-11-24 12:21:01 +00:00
Mark Olesen
ac4f580d09 ENH: cleanup treeData items (#2609)
Changes / Improvements

- more consistent subsetting, interface

  * Extend the use of subset and non-subset collections with uniform
    internal getters to ensure that the subset/non-subset versions
    are robustly handled.

  * operator[](label) and objectIndex(label) for standardized access
    to the underlying item, or the original index, regardless of
    subsetting or not.

  * centres() and centre(label) for representative point cloud
    information.

  * nDim() returns the object dimensionality (0: point, 1: line, etc)
    these can be used to determine how 'fat' each shape may be
    and whether bounds(labelList) may contribute any useful information.

  * bounds(labelList) to return the full bound box required for
    specific items. Eg, the overall bounds for various 3D cells.

- easier construction of non-caching versions. The bounding boxes are
  rarely cached, so simpler constructors without the caching bool
  are provided.

- expose findNearest (bound sphere) method to allow general use
  since this does not actually need a tree.

- static helpers

  The boxes() static methods can be used by callers that need to build
  their own treeBoundBoxList of common shapes (edge, face, cell)
  that are also available as treeData types.

  The bounds() static methods can be used by callers to determine the
  overall bound-box size prior to constructing an indexedOctree
  without writing ad hoc code inplace.

  Not implemented for treeDataPrimitivePatch since similiar
  functionality is available directly from the PrimitivePatch::box()
  method with less typing.

========
BREAKING: cellLabels(), faceLabels(), edgeLabel() access methods

- it was always unsafe to use the treeData xxxLabels() methods without
  subsetting elements. However, since the various classes
  (treeDataCell, treeDataEdge, etc) automatically provided
  an identity lookup, this problem was not apparent.

  Use objectIndex(label) to safely de-reference to the original index
  and operator[](index) to de-reference to the original object.
2022-11-24 12:21:01 +00:00
Mark Olesen
b129446221 ENH: simplify sub-octant bound-box search
- basic support for splitting into two at a given position and face to keep
2022-11-24 12:21:01 +00:00
Mark Olesen
e5006a62d7 ENH: use simpler boundBox handling
- use default initialize boundBox instead of invertedBox
- reset() instead of assigning from invertedBox
- extend (three parameter version) and grow method
- inflate(Random) instead of extend + re-assigning
2022-11-24 12:21:01 +00:00
Mark Olesen
1339c3357b ENH: general boundBox/treeBoundBox improvements
- null() static method
  * as const reference to the invertedBox with the appropriate casting.

- boundBox inflate(random)
  * refactored from treeBoundBox::extend, but allows in-place modification

- boundBox::hexFaces() instead of boundBox::faces
  * rarely used, but avoids confusion with treeBoundBox::faces
    and reuses hexCell face definitions without code duplication

- boundBox::hexCorners() for corner points corresponding to a hexCell.
  Can also be accessed from a treeBoundBox without ambiguity with
  points(), which could be hex corners (boundBox) or octant corners
  (treeBoundBox)

- boundBox::add with pairs of points
  * convenient (for example) when adding edges or a 'box' that has
    been extracted from a primitive mesh shape.

- declare boundBox nPoints(), nFaces(), nEdges() as per hexCell

ENH: return invertedBox instead of FatalError for empty trees

- similar to #2612

ENH: cellShape(HEX, ...) + boundBox hexCorners for block meshes

STYLE: cellModel::ref(...) instead of de-reference cellModel::ptr(...)
2022-11-24 12:21:01 +00:00
Mark Olesen
0ba458fdbc ENH: add primitiveMesh cellBb()
- the boundBox for a given cell, using the cheapest calculation:

  - cellPoints if already available, since this will involve the
    fewest number of min/max comparisions.

  - otherwise walk the cell faces: via the cell box() method
    to avoid creating demand-driven cellPoints etc.
2022-11-24 12:21:01 +00:00
Mark Olesen
27c2cdc040 ENH: vector mag(), magSqr() methods - complementary to dist(), distSqr()
ENH: use direct access to pointHit as point(), use dist(), distSqr()

- if the pointHit has already been checked for hit(), can/should
  simply use point() noexcept access subsequently to avoid redundant
  checks. Using vector distSqr() methods provides a minor optimization
  (no itermediate temporary), but can also make for clearer code.

ENH: copy construct pointIndexHit with different index

- symmetric with constructing from a pointHit with an index

STYLE: prefer pointHit point() instead of rawPoint()
2022-11-24 12:21:01 +00:00
Mark Olesen
e4139898d2 ENH: face::connected() method
- return true if two faces share a common vertex.

  Same idea as the existing edge::connected() method
  (previously spelled 'connects()')
2022-11-24 12:21:01 +00:00
Mark Olesen
d3e285b48b ENH: add FixedList templated get<unsigned>() methods
- provides fast compile-time indexing for FixedList
  (invalid indices trigger a compiler error).

  This enables noexcept access, which can propagate into various
  other uses (eg, triFace, triPoints, ...)

ENH: add triangle edge vectors
2022-11-24 12:21:01 +00:00
Mark Olesen
c7e6ae30bf ENH: add front(), back() methods to List containers
- traditionally used first(), last() methods,
  but front(), back() are well-known from std::vector etc
  which makes the access more familiar.

- support push_back() method for containers that already had append().
  This increases name familiar and can help when porting between
  different C++ code bases.

- support pop_back() method for List containers.
  This is similar to std::vector
2022-11-24 12:21:01 +00:00
Mark Olesen
f3ba6c6da0 ENH: linked-lists accept more familiar STL method names
- ie, front(), back(), push_front(), push_back(), pop_front()

ENH: add CircularBuffer flattening operator() and list() method

- useful if assigning content to a List etc

BUG: CircularBuffer find() did not return logical index
2022-11-24 12:21:01 +00:00
Mark Olesen
a8f369fd2b ENH: region support for foamRestoreFields (#2638) 2022-11-22 13:14:53 +01:00
Mark Olesen
013f3cccc4 ENH: improve handling of finiteArea mesh with distributed roots
- in makeFaMesh, the serial fields are now only read on the master
  process and broadcast to the other ranks. The read+distribute is
  almost identical to that used in redistributePar, except that in
  this case entire fields are sent and not a zero-sized subset.

- improved internal faMesh checking for files so that the TryNew
  method works with distributed roots.
2022-11-20 19:59:52 +01:00
Mark Olesen
21e7ce8f42 STYLE: place HashTable trivial methods in the header (reduce clutter) 2022-11-20 16:55:58 +01:00
Mark Olesen
94c7e180fb ENH: more fault-tolerance in makeFaMesh decomposition
- if the volume faceProcAddressing is missing, it is not readily
  possible to determine equivalent area procAddressing.

  Instead of throwing an error, be more fault-tolerant by having it
  create with READ_IF_PRESENT and then detect and warn
  if there are problems.
2022-11-19 20:49:12 +01:00
Mark Olesen
67b58c28c0 ENH: IOobjectList simpler construction of unregistered
- accept IOobjectOption::registerOption with (MUST_READ, NO_WRITE)
  being implicit. Direct handling of IOobjectOption itself, for
  consistency with IOobject.

  The disabling of object registration is currently the only case
  where IOobjectList doesn't use default construction parameters,
  but it was previously a bit awkward to specify.
2022-11-19 20:48:54 +01:00
Mark Olesen
1b11e4b3ac CONFIG: restrict wmakeLnInclude to header/template files
- source-code (.c, .cpp etc) only adds to clutter in the lnInclude
  directory
2022-11-19 12:41:55 +01:00
Mark Olesen
5e0a23edd5 STYLE: compacter help information for -debug-switch etc. 2022-11-18 21:24:17 +01:00
Mark Olesen
d7bf2d400d BUG: string wrapping (eg, argList help) truncates character (#2625)
- had an off-by-one in the accounting for some corner caes,
  partly because the logic was a bit convoluted

ENH: improved string wrapping (#2625)

- reworked logic (like a state machine) to handle backtracking
  with fallback of splitting near punctuation characters.

  Still doesn't compete with nroff or TeX, but does avoid long lines
  and many funny splits.  With this change the help for mapFieldsPar
  now like this:

  =====
      Specify the mapping method
      (direct|mapNearest|cellVolumeWeight|
      correctedCellVolumeWeight)
  =====

  Since the list of options is very long without any spaces, it takes
  '|' as the best split point, which definitely reads better
2022-11-18 21:14:22 +01:00
Mark Olesen
0fabbcb404 ENH: direct ensight output of float/double
- since ensight format is always float and also always written
  component-wise, perform the double -> float narrowing when
  extracting the components.  This reduces the amount of data
  transferred between processors.

ENH: avoid vtk/ensight parallel communication of empty messages

- since ensight writes by element type (eg, tet, hex, polyhedral) the
  individual written field sections will tend to be relatively sparse.
  Skip zero-size messages, which should help reduce some of the
  synchronization bottlenecks.

ENH: use 'data chunking' when writing ensight files in parallel

- since ensight fields are written on a per-element basis, the
  corresponding segment can become rather sparsely distributed. With
  'data chunking', we attempt to get as many send/recv messages in
  before flushing the buffer for writing. This should make the
  sequential send/recv less affected by the IO time.

ENH: allow use of an external buffer when writing ensight components

STYLE: remove last vestiges of autoPtr<ensightFile> for output routines
2022-11-15 17:26:09 +01:00
Mark Olesen
5338e56c73 ENH: add support for OFstream atomic file creation (#2631)
- with ATOMIC, an intermediary file is created - eg, (fileAbc~tmp~)
  where all of the output is written to. When the stream goes out of
  scope, this intermediary file is moved/renamed to the actually
  output name - eg, (fileAbc~tmp~) -> (fileAbc).

  This adds some safety if the simulation crashes while writing the
  file, since it will the partial (corrupt) file will be left
  behind as (fileAbc~tmp~) and not as (fileAbc), which means it will
  will be treated as a backup file and not loaded again on restart.

ENH: provided enumeration for APPEND/NON_APPEND

- clearer than using bool (with comments).
  Since append mode is primarily only used by masterOFstream etc
  this change is unlikely to affect user coding.

ENH: use file atomic for ensight file creation

- avoids corrupt (truncated) files being referenced by the ensight
  case file if the simulation crashes while writing the ensight file.
2022-11-15 14:10:01 +01:00
Mark Olesen
9f7cfa9419 ENH: support libz disabling via WM_COMPILE_CONTROL (as ~libz)
- eg, for partially incomplete systems (without libz devel header)

ENH: clearer binding of dummy Pstream in OpenFOAM/Make/options

- link of dummy stub Pstream now contingent on linking libOpenFOAM as
  well. This makes the purpose slightly clearer

ENH: cleaner option naming/handling in wmake script

- allow special purpose -no-openfoam option.
  Eg, compiling test programs without OpenFOAM and Pstream libraries
  but using the rest of the wmake system.

ENH: add +openmp support into WM_COMPILE_CONTROL (#2633)

- this adds compile/link flags for openmp.
  For single-use, can also use 'wmake -openmp'.

  If both +openmp and ~openmp are specified in WM_COMPILE_CONTROL
  the ~openmp will have priority.

  This is actually done indirectly since ~openmp will set empty
  COMP_OPENMP, LINK_OPENMP internal variables, which the +openmp then
  adds to the c++FLAGS and linkexe targets (ie, won't actually add
  anything).

ENH: add +ccache or ccache=... support into WM_COMPILE_CONTROL (#2633)

- with the first version (+ccache), simply use ccache from the path
  without any extra options.

- with the second version (ccache=...), can be more specific about
  what is called.

  Using "+ccache" is identical to "ccache=ccache", but the later could
  be used in other ways. For example,

     ccache=/strange/install/path/ccache
     ccache=</path/my-tooling --option>

  Have the choice of unquoted, single or double quoted or '< >' quoted

STYLE: relocate FOAM_EXTRA_LDFLAGS in general makefile

- removes clutter for different linkers (eg, gold, mold, ldd)
  making it easier to extend for other linkers.

STYLE: protect makefile checks with 'strip' function
2022-11-15 14:00:18 +01:00
Mark Olesen
25e874a4f0 ENH: provide MPI native minOp, maxOp reduce multiple values
- consistent with sumOp

ENH: globalIndex with gatherNonLocal tag, and use leading dispatch tags

- useful for gather/write where the master data can be written
 separately.  Leading vs trailing dispatch tags for more similarity to
 other C++ conventions.
2022-11-15 14:00:18 +01:00
sergio
2a406bbb25 ENH: overset: various improvements in the framework
The improvements include:

- Allowing overset patches to be displaced outside background domain.
  - The approach does not support overlapping of multiple inset meshes
    on top of background domain.
- Allowing fringe faces to walk away from hole cells in background domain.
  - The approach was not extensibly tested with overlapping patches.
- Improving mass conservation.
- Various experimental entries are removed: massFluxInterpolation, ddtCorr.
- New entries:
  - oversetAdjustPhi: adds a flux correction outside the pressure equation.
  - massCorrection: adds an implicit correction.
2022-11-11 10:19:47 +00:00
Mark Olesen
5b29ff0e42 ENH: consolidate 'formatOptions' handling for coordSetWriter/surfaceWriter
- replaced ad hoc handling of formatOptions with coordSetWriter and
  surfaceWriter helpers.

  Accompanying this change, it is now possible to specify "default"
  settings to be inherited, format-specific settings and have a
  similar layering with surface-specific overrides.

- snappyHexMesh now conforms to setFormats

  Eg,

      formatOptions
      {
          default
          {
              verbose     true;
              format      binary;
          }
          vtk
          {
              precision   10;
          }
     }

     surfaces
     {
         surf1
         {
             ...

             formatOptions
             {
                 ensight
                 {
                     scale   1000;
                 }
             }
         }
     }
2022-11-08 16:48:08 +00:00
Mark Olesen
799d247142 ENH: PatchTools::gatherAndMerge with recovery of the globalIndex
- support globalIndex for points/faces as an output parameter,
  which allows reuse in subsequent field merge operations.

- make pointMergeMap an optional parameter. This information is not
  always required. Eg, if only using gatherAndMerge to combine faces
  but without any point fields.

ENH: make globalIndex() noexcept, add globalIndex::clear() method
2022-11-08 16:48:08 +00:00
Mark Olesen
70208a7399 ENH: use returnReduceAnd(), returnReduceOr() functions
DOC: document which MPI send/recv are associated with commType
2022-11-08 16:48:08 +00:00
Mark Olesen
473e14418a ENH: more consistent use of broadcast, combineReduce etc.
- broadcast           : (replaces scatter)
  - combineReduce       == combineGather + broadcast
  - listCombineReduce   == listCombineGather + broadcast
  - mapCombineReduce    == mapCombineGather + broadcast
  - allGatherList       == gatherList + scatterList

  Before settling on a more consistent naming convention,
  some intermediate namings were used in OpenFOAM-v2206:

    - combineReduce       (2206: combineAllGather)
    - listCombineReduce   (2206: listCombineAllGather)
    - mapCombineReduce    (2206: mapCombineAllGather)
2022-11-08 16:48:08 +00:00
Mark Olesen
b9c15b8585 COMP: missing linkage for ensightToFoam (ldd linker) 2022-11-08 17:13:46 +01:00
mattijs
5163e52974 ENH: ensightToFoam: Ensight Gold mesh converter 2022-11-07 21:22:18 +00:00
Mark Olesen
2202995f5c ENH: expose IntRange {begin,end}_value() methods
- end_value() corresponds to the infrequently used after() method, but
  with naming that corresponds better to iterator naming conventions.

  Eg,

     List<Type> list = ...;
     labelRange range = ...;

     std::transform
     (
         (list.data() + range.begin_value()),
         (list.data() + range.end_value()),

         outIter,
         op
     );

- promote min()/max() methods from labelRange to IntRange base class

STYLE: change timeSelector from "is-a" to "has-a" scalarRanges.
2022-10-31 18:36:15 +01:00
Mark Olesen
21f037e3a0 ENH: single/double value reset method for MinMax
- resets min/max to be identical to the specified value,
  which can be more convenient (and slightly more efficient) than doing
  a full reset followed by add()

- additional MinMax intersects() query, which works like overlaps()
  but with exclusive checks at the ends

- provide MinMax::operator&=() to replace (unused) intersect() method

ENH: single/double value reset method for boundBox

- boundBox::operator&=() to replace (rarely used) intersect() method.
  Deprecate boundBox::intersect() to avoid confusion with various
  intersects() method

COMP: provide triangleFwd.H
2022-10-31 18:36:14 +01:00
Mark Olesen
c973066646 ENH: supplementary vector comparison methods
- background: for some application it can be useful to have fully
  sorted points. i.e., sorted by x, followed by y, followed by z.

  The default VectorSpace 'operator<' compares *all*
  components. This is seen by the following comparisons

  1.  a = (-2.2 -3.3 -4.4)
      b = (-1.1 -2.2 3.3)

      (a < b) : True
      Each 'a' component is less than each 'b' component

  2.  a = (-2.2 -3.3 -4.4)
      b = (-2.2 3.3 4.4)

      (a < b) : False
      The a.x() is not less than b.x()

  The static definitions 'less_xyz', 'less_yzx', 'less_zxy'
  instead use comparison of the next components as tie breakers
  (like a lexicographic sort).
  - same type of definition that Pair and Tuple2 use.

      a = (-2.2 -3.3 -4.4)
      b = (-2.2 3.3 4.4)

      vector::less_xyz(a, b) : True
      The a.x() == b.x(), but a.y() < b.y()

   They can be used directly as comparators:

      pointField points = ...;

      std::sort(points.begin(), points.end(), vector::less_zxy);

ENH: make VectorSpace named access methods noexcept.

   Since the addressing range is restricted to enumerated offsets
   (eg, X/Y/Z) into storage, always remains in-range.
   Possible to make constexpr with future C++ versions.

STYLE: VectorSpace 'operator>' defined using 'operator<'

- standard rewriting rule
2022-10-31 18:36:14 +01:00
Mark Olesen
9433898941 ENH: support construction of pointIndexHit from pointHit
STYLE: combine templated/non-templated headers (reduced clutter)

STYLE: use hitPoint(const point&) combined setter

- same as setHit() + setPoint(const point&)

ENH: expose and use labelOctBits::pack method for addressing
2022-10-31 18:36:14 +01:00