Commit Graph

26542 Commits

Author SHA1 Message Date
Mark Olesen
336422e00b ENH: check managed communicator upon construction of fileOperation
- previously checked on destruction, but it is robuster to check for a
  locally defined communicator during construction

- add InfoProxy output for fileOperation

ENH: add fileOperation::storeComm()

- transfers management of the communicator from external to internal.
  Use with caution
2023-05-22 17:54:33 +02:00
Mark Olesen
abc60d4d20 ENH: use refPtr to manage current fileHandler
- for special cases it can simplify sharing of processor communication
  patterns, but no visible change for most code.

- make fileHandler communicator modifiable (mutable), for special
  cases. The changes from 9711b7f1b9 now make this safer to do.

Continue to support legacy global function using an autoPtr:

   autoPtr<fileOperation> Foam::fileHandler(autoPtr<fileOperation>&&);

However, new code using refPtr uses the following static method since
swapping out file handlers is an infrequent operation that should
also stand out a bit more.

    fileOperation::fileHandler(...);
2023-05-22 17:51:14 +02:00
Mark Olesen
19254d0cf2 ENH: parallel-consistent check for dynamic library loading
- consolidate file synchronization checks in dynamicCode

STYLE: report missing library on master only (not every rank)

- avoid flooding the output with messages

Co-authored-by: mattijs <mattijs>
2023-05-22 17:49:21 +02:00
mattijs
8320a1e421 ENH: additional routines to extract number of collated data blocks
- uses file seek instead of read

ENH: broadcast instead of scatterv to sending sizes

Co-authored-by: Mark Olesen <>
2023-05-22 17:48:45 +02:00
Mark Olesen
11742301f1 ENH: add support for file/directory broadcasting
Co-authored-by: mattijs <mattijs>
2023-05-22 17:48:09 +02:00
mattijs
1abea53d1a ENH: lazy reading of old volume, old surface area
- avoid explicit isFile() check in favour of a lazy-read.
  With redistributePar + fileHandler, for example, it is possible that
  the master processor finds file but not the subprocs

ENH: lazy reading of tetBasePtIs

- delay reading until needed

Co-authored-by: Mark Olesen <>
2023-05-22 17:47:48 +02:00
mattijs
16064b60e2 ENH: respect IOobject::readOpt in hexRef8 constructor 2023-05-22 17:47:22 +02:00
mattijs
505704d290 ENH: allow numberOfSubdomains to be optional in parallel
- allows for a missing or empty file
2023-05-22 17:47:20 +02:00
Mark Olesen
9cd14bc8b0 STYLE: remove unused isWriteProc() methods from distribute fields 2023-05-22 17:46:16 +02:00
Mark Olesen
f15e58d3d5 ENH: add nbx.tuning to enable/disable initial barrier
- to prevent NBX from intercepting previous messages an initial
  barrier can help with synchronization. (Gregor Weiss)
2023-05-22 17:43:42 +02:00
Mark Olesen
5eebc75845 ENH: improved UPstream gather/scatter functionality
- added UPstream::allGatherValues() with a direct call to MPI_Allgather.
  This enables possible benefit from a variety of internal algorithms
  and simplifies the caller

    Old:
        labelList nPerProc
        (
            UPstream::listGatherValues<label>(patch_.size(), myComm)
        );
        Pstream::broadcast(nPerProc, myComm);

    New:

        const labelList nPerProc
        (
            UPstream::allGatherValues<label>(patch_.size(), myComm)
        );

- Pstream::allGatherList uses MPI_Allgather for contiguous values
  instead of the hand-rolled tree walking involved with
  gatherList/scatterList.

-
- simplified the calling parameters for mpiGather/mpiScatter.

  Since send/recv data types are identical, the send/recv count
  is also always identical. Eliminates the possibility of any
  discrepancies.

  Since this is a low-level call, it does not affect much code.
  Currently just Foam::profilingPstream and a UPstream internal.

BUG: call to MPI_Allgather had hard-coded MPI_BYTE (not the data type)

- a latent bug since it is currently only passed char data anyhow
2023-05-22 17:18:35 +02:00
Mark Olesen
b687c4927c ENH: update UPstream communicator handling
UPstream::allocateCommunicator
  - with contiguous sub-procs. Simpler, more compact handling, ranks
    are guaranteed to be monotonic

UPstream::commWorld(label)
  - ignore placeholder values, prevents accidental negative values

- make communicator non-optional for UPstream::broadcast(), which
  means it has three mandatory parameters and thus always fully
  disambiguated from Pstream::broadcast().

ENH: relax size checking on gatherList/scatterList

- only fatal if the List size is less than nProcs.
  Can silent ignore any trailing elements: they will be untouched.
2023-05-22 17:13:41 +02:00
Mark Olesen
b45ea8c2aa ENH: centralise communicator clearing (GAMG) 2023-05-22 17:09:50 +02:00
Mark Olesen
a64357983c BUG: uniformMixed fields not always full initialised (#2703)
- calling the mixed BC dictionary construct with NO_READ leaves the
  fields properly sized, but not initialised.

ENH: add mixed BC constructor zero initialise
2023-05-22 11:51:04 +02:00
Mark Olesen
302eb7b560 REGRESSION: createBaffles : incorrect dictionary lookup
- was introduced with f7a7f1c14c, only affected very recent develop
2023-05-20 18:59:20 +02:00
Mark Olesen
6d76b31f29 TUT: provide more git history context for tutorials/Alltest
- sometimes the last commit is not enough information about
  the tested state (especially with extensive rebasing).
  Also provide the short context of some previous commits.
2023-05-20 18:58:37 +02:00
Mark Olesen
bc51caac32 ENH: remove sign from SHA1Digest cdata_bytes(), data_bytes()
- this refinement of commit 81807646ca makes these methods
  consistent with other objects/containers.

  The 'unsigned char' access is still available via cdata()
2023-05-19 15:54:23 +02:00
Mark Olesen
28ac15f933 ENH: minor adjustment to BitOps and PackedList
- extend toc/sortedToc wrappers to bitSet and labelHashSet to allow
  use of BitOps::toc(...) in templated code

- size_data() method to return the number of addressed integer blocks
  similar to size_bytes() does, but for int instead of char.
2023-05-19 00:48:14 +02:00
Mark Olesen
f41d1879b9 STYLE: prefer isHeaderClass<Type>() check instead of Type::typeName
- use typeHeaderOk<regIOobject>(false) for some generic file existence
  checks. Often had something like labelIOField as a placeholder, but
  that may be construed to have a particular something.
2023-05-19 00:48:14 +02:00
Mark Olesen
bdd384c767 ENH: reset headerClassName within typeHeaderOk
- ensures that read failures can be properly detected

COMP: include refPtr.H instead of autoPtr.H in IOobject.H

- ensures inclusion of autoPtr/refPtr/tmp/stdFoam

ENH: add IOobject::resetHeader() method

- when re-using an IOobject for repeated read operations it enforces
  resetting of headerClassName, scalar/label sizes etc prior to
  reading. Permits convenient resetting of the name too (optional).

  Example,

      IOobject rio("none", ..., IOobject::LAZY_READ);

      rio.resetHeader("U")
      if (returnReduceOr(rio.typeHeaderOk<volVectorField>(false)))
          ...

      io.resetHeader("p")
      if (returnReduceOr(rio.typeHeaderOk<volScalarField>(false)))
         ...
2023-05-19 00:48:14 +02:00
Mark Olesen
87cb811db2 COMP: fix library linkage (#2784), silence some unused variable warnings 2023-05-19 00:46:52 +02:00
Mark Olesen
a5d9ad3a5c STYLE: use noexcept creation of InfoProxy and dereference as '*iproxy'
- this removes the 'magic' use of the exposed t_ member in favour
  of a generic dereference
2023-05-18 18:23:46 +02:00
Mark Olesen
a0005c3a54 ENH: make InfoProxy noexcept, add 'operator*' dereference
- conforms better to general use of '*' dereference.
2023-05-17 11:46:57 +02:00
Mark Olesen
f7a7f1c14c ENH: reduced warnings about createBaffles on processor patches (#2781)
- coupled patches are treated distinctly and independently of
  internalFacesOnly, it makes little sense to report them with a
  warning about turning off boundary faces (which would not work
  anyhow).

STYLE: update code style for createBaffles
2023-05-17 11:46:57 +02:00
Mark Olesen
a581a8cb8d ENH: disallow implicit cast of autoPtr to non-const pointer
- permitting a cast to a non-const pointer adds uncertainty of
  ownership.

- adjust PtrDynList transfer. Remove the unused 'PtrDynList::remove()'
  method, which is better handled with pop().
2023-05-17 11:46:57 +02:00
Mark Olesen
521043094e ENH: replace autoPtr<bool> with Switch (#2777)
- initialise with Switch::INVALID and then test if good() to
  trigger the initial update.

  This avoids some overhead, but primarily avoids ambiguity with
  implicit casting to a 'bool' that autoPtr<bool> has.
2023-05-17 11:46:57 +02:00
Mark Olesen
687a9528b0 DOC: include 'Environment' as filtered doxygen paragraph 2023-05-17 11:46:57 +02:00
Andrew Heather
5aeb02e23d Merge branch 'feature-forces-fo-performance' into 'develop'
ENH: forces: avoid redundant volumetric operations

See merge request Development/openfoam!598
2023-05-15 16:19:09 +00:00
Kutalmis Bercin
59b1cf080e ENH: Tensor/SymmTensor: add devSymm and devTwoSymm funcs to avoid intermediates 2023-05-15 17:05:10 +01:00
Kutalmis Bercin
f98ecb38dc ENH: forces: avoid redundant volumetric operations 2023-05-15 17:05:10 +01:00
Andrew Heather
fe50b745ae Merge branch 'feature-particle-coulomb-force' into 'develop'
ENH: Coulomb: new particle electric force model calculating Coulomb forces

See merge request Development/openfoam!602
2023-05-15 15:35:10 +00:00
Kutalmis Bercin
8dee603193 ENH: Coulomb: new particle electric force model calculating Coulomb forces 2023-05-15 15:34:06 +00:00
Kutalmis Bercin
c7e5e7f4a2 ENH: electricPotential: enable electric field calculations 2023-05-15 15:34:06 +00:00
Kutalmis Bercin
efe8220a26 STYLE: electricPotential: simplify read function
- change 'fieldName' to 'Vname' for better clarity
2023-05-15 15:34:06 +00:00
Kutalmis Bercin
7269cc1d3b ENH: electricPotential: replace operandField with getOrReadField 2023-05-15 15:34:06 +00:00
mattijs
d92583f4b6 BUG: extrudePatchMesh: disable walking across non-manifold. See #2780
This code can be removed if nInternalEdges excludes non-manifold ones
2023-05-15 16:17:27 +01:00
Mark Olesen
e9160673a1 CONFIG: update paraview patch version. From 5.11.0 to 5.11.1 2023-05-10 19:14:59 +02:00
Mark Olesen
d069ffa16a SUBMODULE: removed catalyst handling for paraview 5.5 and earlier 2023-05-10 19:14:51 +02:00
Mark Olesen
c7fc4891ae COMP: adapt solveScalar to scalar for GAMG residual calculation
STYLE: use tmp<xyz>::New factory in matrix operations

COMP: fix bad non-access tmp access (in unused faceH method)
2023-05-10 18:23:13 +02:00
Mark Olesen
62a68eeea0 ENH: free/nullify of PtrList and UPtrList
- Allows clearing or freeing pointers without touching the underlying
  list size. Was previously only for PtrDynList, but now available on
  UPtrList, PtrList as well.

- add transfer() method to PtrDynList to avoid potential slicing.
2023-05-10 18:23:13 +02:00
Mark Olesen
139a8fc6ff STYLE: use SPDX-style for scripts 2023-05-10 18:23:13 +02:00
Mark Olesen
e8bcf4cb1b ENH: additional uniform boundary conditions (#2703)
- provide uniformMixed conditions for finite-area and finite-volume.

  These are intended to replace the exprMixed condition but allow
  the full range of different PatchFunction1 and Function1 types.

- add uniformFixedGradient to finite-area for completeness.

Note:
   - still some possible difficulties with the order of evaluation.
   - eg, using an expression within the 'U' field that depends
     of the surface 'phi' field before that is constructed.
     In this case, the 'value' entry is really needed.
2023-05-09 19:30:58 +02:00
Mattijs Janssens
3d091a0d6a ENH: separate nonBlocking send/receive mapDistribute (#2775) 2023-05-09 19:30:58 +02:00
Mark Olesen
b3fa59db92 ENH: additional handling for multiply-connected finite-area edges (#2771)
- multiply-connected edges can arise at the centre of a "star"
  connection or because the patch faces are actually baffles.

- In the serial case these internal edges are also rather dubious in
  terms of modelling. However, when they are split across multiple
  processors there can only be a single processor-to-processor
  connectivity.

  We don't necessary have enough information to know how things should
  be connected, so connect pair-wise as the first remedial solution

- Any extra dangle edges are relegated to an 'ignore' faPatch
  to tag as needing different handling.
2023-05-09 19:30:58 +02:00
Mark Olesen
b62e4b06fa ENH: add finite-area 'ignore' boundary condition
- this is a placeholder boundary BC for using with bad or illegal
  edges. It is currently functionally identical to zero-gradient.
  Naming and definition still subject to change.
2023-05-09 19:30:58 +02:00
Mark Olesen
783934ccad ENH: add global topology check in checkMesh and makeFaMesh (#2771)
- detect when boundary patches are multiply connected across edges

STYLE: initialize some faMesh values
2023-05-09 19:30:58 +02:00
Mark Olesen
1bef57d018 ENH: optional saving of illegal edges in patch surfaceType() check
- reduce some intermediate storage in looping

STYLE: explicit iterator dereference in syncTools
2023-05-09 19:30:58 +02:00
Mark Olesen
31600c96d4 ENH: output finiteArea patchID with foamToVTK -with-ids
- can be quite useful for debugging/orientation with complex
  geometries
2023-05-09 19:30:58 +02:00
Mark Olesen
f462a850ce ENH: added polyBoundaryMesh patchID(meshFacei) method
- this complements the whichPatch(meshFacei) method [binary search]
  and the list of patchID() by adding internal range checks.

  eg,
     Before
     ~~~~~~
     if (facei >= mesh.nInternalFaces() && facei < mesh.nFaces())
     {
         patchi = pbm.patchID()[facei - mesh.nInternalFaces()];
         ...
     }

     After
     ~~~~~
     patchi = pbm.patchID(facei);

     if (patchi >= 0)
     {
         ...
     }
2023-05-09 19:30:58 +02:00
Mark Olesen
dfa5c05a16 ENH: use New factory methods for Dimensioned/Geometric functions (#2723) 2023-05-09 19:30:58 +02:00