Commit Graph

27056 Commits

Author SHA1 Message Date
Mark Olesen
411ac5fcfa ENH: adjust return type for token compound factory method
- return autoPtr<token::compound> instead of the derived type,
  otherwise cannot easily construct a token from it

ENH: additional typed version of refCompoundToken()

- symmetric with typed version of transferCompoundToken()
  and isCompound()

- add ITstream::findCompound<Type>() method.
  Useful for searching within token streams
2024-04-23 16:51:38 +02:00
Mark Olesen
880215e8e6 STYLE: use intermediate variable in openFoamTableReader 2024-04-23 12:16:52 +02:00
Andrew Heather
3874c1312e Merge branch 'update-argList-mpi-startup' into 'develop'
reduce communication argList at startup

See merge request Development/openfoam!678
2024-04-23 09:20:19 +00:00
Mark Olesen
09377471a3 ENH: stricter handling when freeing communicator components
- previously automatically skipped the first communicator (which was
  assumed to be MPI_COMM_WORLD), but now simply rely on the
  internal pendingMPIFree_ to track which communicators have actually
  been allocated.
2024-04-23 10:58:41 +02:00
Mark Olesen
2889dc7248 ENH: add wrapped accessor for MPI_Comm
- UPstream::Communicator is similar to UPstream::Request to
  wrap/unwrap MPI_Comm. Provides a 'lookup' method to transcribe
  the internal OpenFOAM communicator tracking to the opaque wrapped
  version.

- provide an 'openfoam_mpi.H' interfacing file, which includes
  the <mpi.h> as well as casting routines.

  Example (caution: ugly!)

     MPI_Comm myComm =
         PstreamUtils::Cast::to_mpi
         (
             UPstream::Communicator::lookup(UPstream::worldComm)
         );
2024-04-23 10:58:38 +02:00
Mark Olesen
d75c60d8ae ENH: reduce communication argList at startup (#3142)
- replace point-to-point transmission of the argList args/options with
  a broadcast. This is sufficient for most cases (without distributed
  roots).

  For "normal" cases (non-distributed roots) this will replace the
  nProcs-1 messages with a single broadcast.

- for cases with distributed roots, distinguish between a single,
  identical root and different roots.  An identical root can also be
  subsequently handled with a broadcast. Different roots will still
  require individual point-to-point communication.

  For cases with distributed roots, it will add the overhead of an
  additional broadcast.
2024-04-23 10:55:44 +02:00
Mark Olesen
582b613d5f ENH: add send/recv static methods for broadcast streams
- adds consistency with regular point-to-point parallel streams.

ENH: add ITstream::tokens() methods

- useful, for example, to disambiguate constructing tokenList from
  a ITstream.

  ITstream& is = otherDict.lookup("original");

  tokenList deepCopy(is);  // Error: from Istream or tokenList??
  tokenList deepCopy(is.tokens());  // OK: from tokenList
2024-04-22 11:46:27 +02:00
Mark Olesen
6cce1cdc8b STYLE: add push_back() method to dlLibraryTable, cellTable, boundaryRegion
- same as append() did, but with more consistent names

STYLE: replace special purpose append() with container method

STYLE: update code style
2024-04-22 11:46:24 +02:00
mattijs
b6203a7de5 BUG: overlapping zones: incorrect sizing 2024-04-19 20:19:45 +01:00
Andrew Heather
701c916764 Merge branch 'update-finiteArea' into 'develop'
update to internal accounting for finite-area

See merge request Development/openfoam!675
2024-04-19 15:52:41 +00:00
Mark Olesen
d1c4a225a2 CONFIG: increment API level to 2402 (finite-area API changes) 2024-04-19 17:20:09 +02:00
Mark Olesen
4cfa2ea304 TUT: update for new finite-area location (with foamUpgradeFiniteArea) 2024-04-19 17:20:09 +02:00
Mark Olesen
b5435cc83e ENH: separate registry and revised file locations for finite-area
- The internal storage location of finite-area changes from being
  piggybacked on the polyMesh registry to a having its own dedicated
  registry:

  * allows a clearer separation of field types without name clashes.
  * prerequisite for supporting multiple finite-area regions (future)

Old Locations:
```
   0/Us
   constant/faMesh
   system/faMeshDefinition
   system/faSchemes
   system/faSolution
```

New Locations:
```
   0/finite-area/Us
   constant/finite-area/faMesh
   system/finite-area/faMeshDefinition  (or system/faMeshDefinition)
   system/finite-area/faSchemes
   system/finite-area/faSolution
```

NOTES:
    The new locations represent a hard change (breaking change) that
    is normally to be avoided, but seamless compatibility handling
    within the code was found to be unworkable.

    The `foamUpgradeFiniteArea` script provides assistance with migration.

    As a convenience, the system/faMeshDefinition location continues
    to be supported (may be deprecated in the future).
2024-04-19 17:20:09 +02:00
mattijs
1d5b95b5fe BUG: redistributePar: Distributing refinement data. Fixes #3137.
- was using blocking (=buffered) comms
- was running out of MPI_COMM_SIZE buffer space
- now using PstreamBuffers to have non-blocing comms
2024-04-18 11:52:34 +01:00
Mark Olesen
31aadc5c4d ENH: prefer objectRegistry sorted to lookupClass
- lower memory overhead, consistent access pattern
2024-04-16 10:18:08 +02:00
Mark Olesen
a803516b16 ENH: use typedef for MeshObject within derived classes
- use an internal 'typedef MeshObject<...> MeshObject_type' within
  derived classes. Reduces clutter and eases any updates.
2024-04-16 10:18:08 +02:00
Mark Olesen
1b212789e5 ENH: add MeshObject Release() static method
- Delete() will perform a 'checkOut()' which does the following:
  * remove the object from the registry
  * delete the pointer (if owned by the registry)

- Release() does the following:
  * transfer ownership of the pointer (if owned by the registry)

- Store() does the following:
  * transfer ownership of the pointer to the registry

ENH: use UPtrList of sorted objects for MeshObject updates

- few allocations and lower overhead than using a HashTable,
  ensures the same walk order over the objects (in parallel)

STYLE: adjust meshObject debug statements
2024-04-16 10:18:08 +02:00
Mark Olesen
688fd5f3f1 ENH: add separate handling for clearing mesh phi
STYLE: update code style for phi modification (engine motion)

ENH: pass isMeshUpdate param in fvMesh/polyMesh clearOut() methods

- top-level use of isMeshUpdate parameter to clearOut and
  clearAddressing was being inadvertently filtered out
2024-04-16 10:18:08 +02:00
Mark Olesen
75e19c3116 REGRESSION: distributedTriSurfaceMesh:::findLocalInstance failure (#3135)
- after the modification of d578d48a4f, the parent was now actually
  searched. However, should be returning "constant" and not trigger a
  FatalError if the file/directory is not found.
2024-04-16 10:18:08 +02:00
Mark Olesen
16dd92b38e ENH: reduce reliance on stringListOps functions
- findStrings, findMatchingStrings now mostly covered by matching
  intrinsics in wordRe and wordRes.

  Add static wordRes match() and matching() variants

COMP: remove stringListOps include from objectRegistry.H

- was already noted for removal (NOV-2018)
2024-04-16 10:18:08 +02:00
Mark Olesen
92c329a8a9 ENH: add const_cast variants for isA<> and refCast<>
- an example of the new, more succinct refConstCast version:

      auto& abc = refConstCast<adjointVectorBoundaryCondition>(Uab);

  older:
      adjointVectorBoundaryCondition& abc =
          refCast<adjointVectorBoundaryCondition>
          (
              const_cast<fvPatchVectorField&>(Uab)
          );
  or:
      adjointVectorBoundaryCondition& abc =
          const_cast<adjointVectorBoundaryCondition&>
          (
              refCast<const adjointVectorBoundaryCondition>(Uab)
          );

- an example of the new, more succinct isA_constCast version:

      auto* acapPtr = isA_constCast<fieldType>(abf[patchi]);

      if (acapPtr)
      {
          auto& acap = *acapPtr;
          ...
      }

  older:
      if (isA<fieldType>(abf[patchi]))
      {
          fieldType& acap =
              const_cast<fieldType&>
              (
                  refCast<const fieldType>(abf[patchi])
              );
          ...
      }

STYLE: remove spurious 'const' qualifier from isA<> use
2024-04-16 10:18:08 +02:00
mattijs
6546dd3f5b BUG: redistributePar: bypassing reading remote file. See #3137.
- NewIFstream would read complete remote file to decide if
  was collated.
- This limits files to 31bit size
- Instead now have master-only opening of file.
- Still has problem with refinement history/cellLevel etc.
2024-04-15 16:49:45 +01:00
Kutalmis Bercin
752ab418c9 COMP: avoid ambiguous type conversion in Clang (fixes #3138) 2024-04-11 09:33:51 +01:00
Mark Olesen
d578d48a4f ENH: improve findInstance handling for optional files
- previously would always return "constant" as the instance for
  an optional dir/file that wasn't found.
  However, this meant retesting to screen out false positives.
  Now support an additional parameter
      'bool constant_fallback = ...'
  to return "constant" or an empty word.

  The method signature changes slightly with a new optional bool
  parameter:

      //! Return \c "constant" instead of \c "" if the search failed
      const bool constant_fallback = true

ENH: code consolidation for findInstancePath

- relocate from Time to TimePaths and provide an additional static
  version that is reused in fileOperations

BUG: distributedTriSurfaceMesh:::findLocalInstance broken (#3135)

- was not checking the parent at all.

COMP: remove unused findInstancePath(const fileName&, ..) method
2024-04-10 15:55:29 +02:00
Mark Olesen
85771c8985 ENH: simpler topoSet handling of zone/set
- support construct faceZoneSet from faceSet (#3126)

ENH: support unregistered loading of cell/face/point sets
2024-04-10 15:55:29 +02:00
Mark Olesen
68c5d90ad0 STYLE: rename readContents -> readIOcontents for private/protected method
- leave 'readContents' method name for exposed (public) methods.
  Generally not a problem, but can confuse the compiler when various
  public/private versions are available with the same number of
  parameters.

STYLE: adjust meshObject debug statements
2024-04-10 15:55:29 +02:00
Mark Olesen
0dcc53ab03 ENH: additional std::unique_ptr support for regIOobject and IOobjectList
- regIOobject::store(std::unique_ptr<...>&& ptr)
- IOobjectList::add(std::unique_ptr<...>&& ptr)

STYLE: io.globalCaseName() instead of io.time().globalCaseName() [#3007]
2024-04-10 15:55:29 +02:00
Mark Olesen
6ac572a179 BUG: masterUncollatedFileOperation::read() masked return value (#3135)
ENH: combine broadcasts for uncollated master-only handling
2024-04-10 15:55:29 +02:00
Mark Olesen
7fd962926d ENH: simplify Pstream broadcast stream construction
- the rootProcNo is usually == UPstream::masterNo()
2024-04-10 15:55:29 +02:00
Kutalmis Bercin
bca093d89c SUBMODULE: update OpenQBMM (compilation change only) 2024-04-08 19:21:12 +01:00
Mark Olesen
0ef981adbc BUG: cached ensight type not a word (fixes #3133)
- the type/name for field caching were saved as word, but ensight has
  things like "tensor symm" etc, which do not parse very well as
  'word'. Now save as 'string' type.

  Backwards compatibility is OK since a word token will also be
  readable as string etc.
2024-04-05 14:06:36 +02:00
Mark Olesen
2d61127606 ENH: accept reading unquoted string (ie, word)
- makes string reading consistent with fileName reading.

  Related to #3133 to also allow compatibility when reading existing
  dictionaries written with unquoted string contents.
2024-04-05 14:05:36 +02:00
Mark Olesen
e099e98b8b STYLE: remove defunct restore0Dir expand of #include [collated]
- used defunct "processors/" directory naming, and includes are now
  addressed by the file-handler anyhow.

ENH: support 'tutorials/Alltest -init'

- for copying/creating test directory without running
2024-04-03 19:00:39 +02:00
mattijs
2ff67f8ce4 BUG: overlapping zones: incorrect indexing 2024-03-30 16:29:23 +00:00
mattijs
13f66313d1 BUG: redistributePar: restore. Fix AMIInterpolation. fixes #3125
Problem was that the zero fvMeshSubset constructed did not reset
the distributed flag.
2024-03-28 14:52:28 +00:00
Kutalmis Bercin
483075b4aa BUG: KinematicCloud: remove hard-coded debug condition 2024-03-27 19:47:32 +00:00
mattijs
1668519996 BUG: redistributePar: disable parallel when redistributing. Fixes #3125 2024-03-27 11:52:38 +00:00
mattijs
5091c79e96 BUG: topoSet: allow use of 'set' as input for zones. Fixes #3126 2024-03-27 10:32:16 +00:00
mattijs
6bd1486a38 ENH: solution: allow Function1 with database 2024-03-27 09:17:18 +00:00
mattijs
93f6cae46a DOC: topoSet: add zones instead of sets 2024-03-27 09:17:18 +00:00
Kutalmis Bercin
68e36946fd BUG: externalWallHeatFluxTemperature: prevent FPE in mixedEnergy condition (fixes #3123) 2024-03-21 16:36:22 +00:00
mattijs
c6ecf3113a COMP: syncTools: move attribute 2024-03-20 09:32:43 +00:00
Mark Olesen
46e1b00c34 ENH: handle sub-mesh connectivity by subsetting of adjacency matrix
- in renumberMesh replace calculation of a subMesh connectivity
  with calculation of the full mesh connectivity followed by subsetting
  of the full adjacency matrix. This should reduce the overall number of
  operations. (MR !669)
2024-03-19 14:09:22 +01:00
Mark Olesen
a431e0fe9a ENH: additional parRun selection/protection on syncTools
- allow more control over using parallel communication or not.
2024-03-18 20:59:21 +01:00
Mark Olesen
6d69506294 STYLE: adjust comments and iterator de-reference
STYLE: replace PackedListCore.H with in-file definition
2024-03-18 20:59:21 +01:00
Mark OLESEN
77ec7ab679 Merge branch 'feature-topoSet-with-zone' into 'develop'
topoSet: allow use of 'zone' instead 'set', 'zones' instead of 'sets' in all set sources

See merge request Development/openfoam!674
2024-03-18 19:58:07 +00:00
Mattijs Janssens
6692ecfbbc topoSet: allow use of 'zone' instead 'set', 'zones' instead of 'sets' in all set sources 2024-03-18 19:58:06 +00:00
Mark OLESEN
3ef892b980 Merge branch 'feature-topoSet' into 'develop'
Feature topo set

See merge request Development/openfoam!668
2024-03-18 16:13:52 +00:00
mattijs
a7d6f2720f ENH: add for geometric transformation properties for topoSet
- added solidBodyMotionFunctions to topoSet which allows things like
  moving cellSet selection for fvOptions etc.

COMP: relocate solidBodyMotionFunctions to meshTools

Co-authored-by: Kutalmis Bercin <>
2024-03-18 16:50:16 +01:00
mattijs
4a0a63999e BUG: cyclicAMI: start without 'value'. Fixes #3119 2024-03-18 12:14:36 +00:00