Commit Graph

27369 Commits

Author SHA1 Message Date
d2dfd115be ENH: provide isolated "*_algorithm" versions of Pstream gather routines
- enables better selection of linear vs tree and improves future reuse.

ENH: optimize listReduce/listCombineReduce for single-value lists
2025-02-24 09:06:21 +01:00
8f3d29c1b7 ENH: retain linear vs tree state in commsStructList
- previously there were two places that used nProcsSimpleSum for
  defining the communication pattern. However, this meant in practice
  that filling of linearCommunication_ and treeCommunication_ themselves
  where globally controlled.

  Now retain the state within commsStructList and use linear/tree
  when populating.
2025-02-24 09:06:12 +01:00
e67fffac3f STYLE: use UPstream::reduceAnd(), UPstream::reduceOr() instead of longer forms 2025-02-24 09:04:04 +01:00
2783e78ae2 STYLE: unify some handling of warn communicator, minor code cleanup 2025-02-24 09:03:56 +01:00
e041af9481 DEFEATURE: remove non-blocking reduce() with global request tracking
- deprecated and replaced (JAN-2023) with a version that uses
  UPstream::Request to track the request. This avoids placing a
  request on the global list and then having difficulty isolating it
  later (or having it cleared out by someone else).

ENH: UPstream::addRequest() now ignores null requests

- avoids placing useless requests on the global list
2025-02-24 09:03:47 +01:00
e8e90a8de3 ENH: support non-worldComm for Dimensioned/Geometric field functions 2025-02-24 09:03:31 +01:00
0aecb25024 ENH: update MinMax to accept multiple values for add()
- now also provide its own member data (previously inherited from
  Tuple2) to provide better isolation from future changes
2025-02-24 09:03:19 +01:00
14b2302b38 COMP: remove 'special purpose' minMaxOp (#3326)
- replace with plusOp for reductions. The old use didn't necessarily work
  well with compiler resolution in all cases.
  Simplify to use plusOp (and removed the old version).
  [Does not affect very much code...]

COMP: incorrect include ordering for GeometricFieldFunctions

- header was included after the template code

REGRESSION: combineAllGather mapped to incorrect method (81fa7d08ee)

STYLE: use UPstream::commWarn(...) setter method
2025-02-24 08:57:36 +01:00
d655c2d343 ENH: print node/topology information in human-readable form at startup 2025-02-24 08:56:25 +01:00
533d3b58f8 TUT: backwardFacingStep2D: add missing probes (fixes #3319) 2025-02-21 16:49:36 +00:00
0c282bda65 Merge branch 'pstream-adjustments' into 'develop'
Additional refinements for Pstream and minor restructuring of combine vs reduce operations

See merge request Development/openfoam!727
2025-02-19 14:47:27 +00:00
4720b61313 REGRESSION: globalIndex::gatherInplaceOp was not forwarding to gatherInplace
- regression introduced by 512ec01328 (recent develop only)
2025-02-17 13:40:44 +01:00
a66be057c2 GIT: relocate Pstream template '.C' files to '.txx' prior to further changes
- reduces confusion about 'real' code vs template code
2025-02-17 13:40:44 +01:00
eae448c7aa CONFIG: handle embedded WM_COMPILE_CONTROL flags in wmakeLnInclude
- with WM_COMPILE_CONTROL="... lnInclude-extra ..." will treat like
  'wmakeLnInclude -extra' and include all source files into the
  lnInclude/ directory
2025-02-17 13:40:44 +01:00
81fa7d08ee ENH: extend Pstream gather templates to support combine or assign operation
- eliminates nearly identical code between 'gather' and 'combineGather'

  * Normal gather updates by assigning the result of the binary operation.
  * Combine gather updates by using a binary operator that modifies
    its first parameter in-place

  By-product of this refactoring are these new variants:

      listGather(), listGatherReduce()
      mapGather(), mapGatherReduce()

  that mirror the previously existing ones

      listCombineGather(), listCombineReduce()
      mapCombineGather(), mapCombineReduce()

  except that they use the 'regular' binary operator
2025-02-17 13:40:44 +01:00
0ce5053c75 ENH: mpiGather/mpiScatter now also support in-place use
- the general OpenFOAM way of collecting data often looks like this:

      List<scalar> allValues(numProcs);
      allValues[myProc] = localValue;

      Pstream::gatherList(allValues);

      // Now possible like this

      List<scalar> allValues(numProcs);
      allValues[myProc] = localValue;

      UPstream::mpiGather(nullptr, allValues.data_bytes(), sizeof(scalar));

- adjusted Pstream::gatherList accordingly.
  Split out the manual implementations, give them new names
  (..._tree_algorithm) and make them private.

STYLE: rename UPstream::gather -> UPstream::mpiGatherv

- easier to identify and establishes the connection to the MPI call
2025-02-17 13:40:44 +01:00
eb4345ed44 ENH: misc Pstream adjustments
- additional startup guard for inter-node/local-node queries (UPstream)

- impose linear communication tree for inter-node/local-node
  communicators. Was previously defaulted to a basic tree, but more
  consistent to have flat addressing for these types of connections.

- demand-driven UPstream::interNode_offsets() for walking
  inter-node ranges instead of creating it manually in various places.

- (style): List<int> instead of labelList for internal commsStruct
  since the communication structures are tied to MPI sizes
  and not to the OpenFOAM label sizes

- reduce the number of intermediate buffer allocations within
  gatherList, scatterList.
2025-02-17 13:40:44 +01:00
15ac0bc30b BUG: GAMG: processor agglomeration. Fixes #3323 2025-02-17 12:33:14 +00:00
21f36b18e5 Merge branch 'feature-UPstream-startup' into 'develop'
enhance UPstream communicator support

See merge request Development/openfoam!725
2025-02-13 15:12:42 +00:00
3852f7c5b7 ENH: add node-based globalIndex::gather (topology-aware handling) 2025-02-13 12:31:16 +01:00
a3e1376117 ENH: combine gathers of sizes in GAMGAgglomeration
- replace two listGatherValues with listGatherValues of labelPair and
  calculate offsets from the corresponding tuple members.
2025-02-13 12:31:16 +01:00
512ec01328 ENH: rationalize some globalIndex gather routines
- replace gatherValues() with listGatherValues(), which returns the
  gathered values instead of passing by argument. This makes it less
  fragile and more convenient. Naming as per
  Pstream::listGatherValues(), but still retaining the original
  parameter order.

- rename inplace 'gather' variant as 'gatherInplace' for clarity.

- changed signature of lowest-level globalIndex::gather routines from
  List<Type> to UList<Type> for the output and removed any resizing.
  This means that the caller is responsible for ensuring that the
  receiving field is adequately sized (on master). This change allows
  potential reuse of 'work' arrays etc.

  The only code change for using this low-level gather was in
  GAMGAgglomeration.
2025-02-13 12:31:16 +01:00
3e8b0a2c73 ENH: introduce UPstream::commsStructList class
- was previously simply a List<commsStruct>, but now wrap it into a
  class so that the associated communicator index can be easily
  recovered etc.
2025-02-13 12:31:16 +01:00
831a55f1ba ENH: expand UPstream communicator support
- split/duplicate functionality

- rework inter-node/intra-node handling to allow selection of
  splitting based on 'shared' or hostname (default).

- always creates node communicators at startup:
  * commInterNode() - between nodes
  * commLocalNode() - within a node

- world-comm is now always a duplicate of MPI_COMM_WORLD to provide
  better separation from other processes.

NB:
   the inter-node comm is a slight exception to other communicators
   in that we always retain its list of (global) ranks, even if the
   local process is not in that communicator.
   This can help when constructing topology-aware patterns.

FIX: non-participating ranks still had knowledge of their potential siblings

- after create by group, the procIDs_ of non-participating ranks
  should be empty (except for the inter-node exception)
2025-02-13 12:31:12 +01:00
579f8ef7c6 ENH: respect stdout/stderr preference for "Finalising parallel run" info
STYLE: namespace qualify macros use of Info, InfoErr, ...
2025-02-13 11:28:06 +01:00
0ba4f36c60 ENH: use List containers for Pstream read/write calls
- using the List containers, and not their low-level data_bytes(),
  size_bytes() methods is more convenient and allows future
  adjustments to be centralized

ENH: trivial intptr_t wrapper for MPI_Win

STYLE: minor adjustments to mpirunDebug
2025-02-11 11:09:30 +01:00
0adc745b50 CONFIG: mpirunDebug 2025-02-10 14:27:51 +01:00
3b40dd8c29 ENH: add prescan handling of -debug-switch etc
- allows use of registered switches before startup of UPstream etc.
2025-02-10 14:27:51 +01:00
6f2fadb48f ENH: extrudeToRegionMesh: ignore zone boundaries. Fixes #3318 2025-02-10 12:01:48 +00:00
559ed6c464 SUBMODULE: update adios module (fixes compilation change) 2025-02-07 14:49:28 +01:00
0cb812f6ac Merge branch 'feature-assignable' into 'develop'
ENH: assignable: extend to pointPatchFields and fvsPatchFields

See merge request Development/openfoam!726
2025-02-05 15:47:55 +00:00
4ae8ce3f0c ENH: assignable: extend to pointPatchFields and fvsPatchFields 2025-02-05 15:47:55 +00:00
9f0d1c7121 Merge branch 'style-demand-driven-memory' into 'develop'
ENH: use unique_ptr instead of raw pointers for demand-driven data

See merge request Development/openfoam!697
2025-02-05 09:44:26 +00:00
e1d40646cc ENH: use unique_ptr instead of raw pointers for demand-driven data
- simplifies construct/destruct and any later code extensions
2025-02-05 09:43:52 +00:00
9013c9941d STYLE: mark SHA1Digest as having is_contiguous content
- send/recv List<SHA1Digest> without serialization
2025-02-04 11:21:11 +01:00
0cc5273d0a GIT: cleanup old 'removed' files (ones left only for dependency checks)
GIT: minor directory structure cleanup
2025-02-04 08:27:55 +01:00
8f83ed786c Merge branch 'c++17-updates' into 'develop'
upgrade code to use some C++17 constructs

See merge request Development/openfoam!724
2025-01-31 14:17:34 +00:00
cf2b305b4f ENH: upgrade to use some C++17 constructs
- 'if constexpr (...)'
   * instead of std::enable_if
   * terminate template recursion
   * compile-time elimination of code

- use C++14 '_t', '_v' versions,
  eg, std::is_integral_v<T> instead of std::is_integral<T>::value

- std::begin, std::end, std::void_t instead of prev stdFoam versions

- provide is_contiguous_v<..> as short form of is_contiguous<..>::value
  with the additional benefit of removing any cv qualifiers.

ENH: include is_rotational_vectorspace trait

- tests for vector-space and nComponents > 1 (ie, not sphericalTensor)

ENH: improve robustness of pTraits_.. tests by removing cv qualifiers
2025-01-31 09:51:44 +01:00
b9f05bdc01 ENH: refineMesh: user-specified coordinate system 2025-01-29 09:25:40 +00:00
0b831572f3 ENH: refineMesh: tutorial to demo directional refinement 2025-01-27 17:24:35 +00:00
6dc57a1a8b STYLE: consistent parameter naming 2025-01-27 15:41:06 +00:00
a18c15a4cf ENH: add VectorSpace component fill() method
- as per std::array and FixedList

STYLE: rename Scalar.[CH] -> scalarImpl.[CH] (these are internal files)

- added inclusion guards to protect against bad use
2025-01-27 10:31:09 +01:00
39e1eb9dc6 Merge remote-tracking branch 'origin/master' into develop 2025-01-27 09:45:18 +01:00
97c8e62fe4 COMP: disambiguate some reactingEuler/multiphaseSystem file names
- poor naming (eg, 'exponential.[CH]') within the same set of library
  files means that the lnInclude/ contents are inconsistent or partly
  meaningless (related to #2520 and !542).
  Remedied by adding model-type qualifiers to the file names.
2025-01-27 09:39:18 +01:00
297fee00f1 COMP: adjustments for nvc++ compiler
- remove unneeded -Wno-old-style flags with boost/cgal elements
- add nvc equivalent to gcc/clang -Wno-invalid-offsetof
- avoid warnings about set-but-unused variable and change of scoping

STYLE: remove wmake 'CGAL' rule
- was a transitional forward to 'cgal' rule since DEC-2020
2025-01-24 10:46:06 +00:00
c987ac228c SUBMODULE: update visualization for v2412 (with c++17 standand) 2025-01-24 11:40:32 +01:00
c77b0e14a1 MISC: extend foamGrep...Targets tools 2025-01-16 16:30:37 +01:00
77cdf22eac STYLE: cellDecomposer: print operand fields in rows 2025-01-13 11:29:44 +00:00
4fe3f55e4d BUG: Fixes bug in plicRDF interface reconstruction across cyclic boundaries (fixes #3279)
Description:
The plicRDF interface reconstruction scheme calculates a reconstructed distance
function (RDF) in all interface cells and their point neighbours.
In point neighbours to interface cells, the RDF is calculated as a weighted
average of the distances to all adjacent interface cell centres with the weight
being the inverse distance to the cell centre.
By using the zoneDistribute class written by Henning Scheufler, the required
stencil data is communicated efficiently for stencil cells living on different
sides of one or more processor patches.
Some of the data required for the RDF reconstruction are cell centre and
interface centre positions. When a stencil extends across a cyclic patch these
positions have so far not been properly transformed in OpenFOAM. This issue is
fixed by the current contribution.
The fix is done by modifying the zoneDistribute class to hold the required
information about zone cells adjacent to cyclic patches. Positions are then
communicated with a new getPosition function which replaces getValue for
position data in the reconstructedDistanceFunction and plicRDF classes.
The implementation does not change the behaviour for cells not on
a cyclic patch and should have insignificant effect on efficiency for these.
The implementation can probably be optimised in terms of efficiency for zone
cells on cyclic patches, but we note that there are generally only very few of
these (interface cells and their point neighbours on cyclic patches) and so
the potential for speedup is expected to be limited.

Current limitations:

- In parallel, the user must constrain the decomposition to preserve cyclic
patches on the same processor, for the implementation to work properly.
  - See an example here: tutorials/discInConstantFlowCyclicBCs/system/decomposeParDict
- In the case of parallel rotational cyclics that are split by the decomposition
the current bugfix does not work and therefore throws an error. This is ongoing
work and should be reported and fixed by a future patch.

For further details, please see the modified files and the comments therein:
- $FOAM_SRC/finiteVolume/fvMesh/zoneDistribute/zoneDistribute.H
- $FOAM_SRC/finiteVolume/fvMesh/zoneDistribute/zoneDistribute.C
- $FOAM_SRC/finiteVolume/fvMesh/zoneDistribute/zoneDistributeI.H
- $FOAM_SRC/transportModels/geometricVoF/reconstructedDistanceFunction/reconstructedDistanceFunction.C
- $FOAM_SRC/src/transportModels/geometricVoF/reconstructionSchemes/plicSchemes/plicRDF/plicRDF.C

Co-authored-by: David Müller <> KIT
Co-authored-by: Konstantinos Missios <> Roskilde University
Co-authored-by: Johan Roenby <> Roskilde University and STROMNING
2025-01-10 15:52:52 +00:00
cb1aa273fd SUBMODULE: update external-solver, OpenQBMM for v2412 2025-01-09 11:45:11 +01:00