Commit Graph

27070 Commits

Author SHA1 Message Date
287025d2df COMP: remove explicit specialisations for CSV reading (fixes #2764)
- can use traits to distinguish label vs scalar types and
  setComponents to properly index into single or multi-component
  types without needing template specialisations for the task.

  This avoids the need for a concrete translation unit and the
  reported problem of multiply-defined specialisations when the header
  is included in different places.
2023-05-02 13:34:12 +02:00
e967305ef2 STYLE: use calculatedType() and zeroGradientType() methods 2023-05-02 13:34:12 +02:00
09ce87135b DOC: kOmega: correct literature reference (fixes #2766) 2023-04-26 17:30:38 +01:00
7a5ecd70b8 BUG: misleading error message in finiteArea construct
- the default (uninitialised) value for edge connections of -1
  could be confused with a tagged finiteArea patch, which used
  (-patchid-1) encoding. This would lead to messages about erroneous
  processor-processor addressing, but is in fact an mismatched edge
  connection.

  Now tag the finiteArea patch as (-patchid-2) to avoid this ambiguity
  and correctly generate an "Undefined connection:" message instead.

  Properly flush the VTP writers before raising a FatalError
  to ensure that they are not prematurely truncated.

Open Point:

  The base problem of "Undefined connection:" is largely related to
  multiply-connected face edges (ie, from the underlying volume mesh).
  Not easily remedied in the finiteArea generation.

TUT: basic finiteArea setup on motorBike
2023-04-25 13:45:08 +02:00
ee39e3d276 STYLE: use explicit REGISTER option when storing fields 2023-04-25 13:45:08 +02:00
d9533e561b ENH: allow null pointer when reading binary block
- have read(nullptr, count) and readRaw(nullptr, count) act like a
  forward seek instead of failing.
  This lets it be used to advance through a file without needing to
  allocate (and discard) storage space etc.
2023-04-25 13:44:33 +02:00
ce282dfbbf ENH: correct the selfComm procNo relative to world communicator
STYLE: qualify worldComm as UPstream instead Pstream

STYLE: PPCG::gSumMagProd() as static function
2023-04-24 15:46:04 +02:00
a7c4c184b8 ENH: respect value of dimensionSet::checking() for pow() function
STYLE: remove unused/meaningless pow(dimensionScalar, dimensionSet)
2023-04-24 15:46:04 +02:00
5042d1296f ENH: consistent UniformDimensionedField naming
- construct from components, or use word::null to ensure
  consistent avoid naming between IOobject vs dimensioned type.

- support construct with parameter ordering as per DimensionedField

ENH: instantiate a uniformDimensionedLabelField

- eg, for registering standalone integer counters
2023-04-24 15:46:04 +02:00
1d39cdaa17 STYLE: support READ_MODIFIED <-> MUST_READ_IF_MODIFIED as aliases 2023-04-24 15:46:04 +02:00
2b1061420c STYLE: remove trailing space, tabs 2023-04-24 15:37:33 +02:00
7bef18a274 STYLE: document const-ness of isA, refCast 2023-04-21 15:49:27 +02:00
35c2b4b603 BUG: splash model - correction and code refactoring 2023-04-20 13:11:42 +01:00
424f913fdd Merge branch 'feature-multiLevel-scotch' into 'develop'
ENH: multiLevel: native scotch implementation of multi-level

See merge request Development/openfoam!599
2023-04-19 13:02:32 +00:00
32df7c2e92 ENH: multiLevel: native scotch implementation of multi-level 2023-04-19 13:02:13 +00:00
8434931c29 CONFIG: support call of 'openfoam' wrapper in other in-project locations
- directory discovery originally designed for a sub-dir location
  (eg, etc/openfoam) but failed if called from within the sub-dir
  itself.

  Now simply assume it is located in the project directory or the etc/
  sub-dir, so that it can also be relocated into the project directory
  in the future (pending changes to RPM and debian packaging)
2023-04-18 20:19:29 +02:00
b12e47d9ab CONFIG: increment API level to 2302 2023-04-18 14:08:39 +02:00
66a7f0c9db ENH: provide UPstream::finishedRequests() support
- for querying all outstanding requests:

     if (UPstream::finishedRequests(startRequest)) ...
     if (UPstream::finishedRequests(startRequest, -1)) ...

- for querying slice of outstanding requests:

     if (UPstream::finishedRequests(startRequest, 10)) ...
2023-04-18 14:08:39 +02:00
80bc1db5b7 ENH: provide UPstream intra-host and inter-host communicators
- simplifies communication structuring with intra-host communication.
  Can be used for IO only, or for specialised communication.

  Demand-driven construction. Gathers the SHA1 of host names when
  determining the connectivity. Internally uses an MPI_Gather of the
  digests and a MPI_Bcast of the unique host indices.

  NOTE:
    does not use MPI_Comm_splt or MPI_Comm_splt_type since these
    return MPI_COMM_NULL on non-participating process which does not
    easily fit into the OpenFOAM framework.

    Additionally, if using the caching version of
    UPstream::commInterHost() and UPstream::commIntraHost()
    the topology is determined simultaneously
    (ie, equivalent or potentially lower communication).
2023-04-18 14:08:39 +02:00
9d3427e0b4 ENH: consolidate UPstream::commsStruct code
- make sizing of commsStruct List demand-driven as well
  for more robustness, fewer unneeded allocations.

- fix potential latent bug with allBelow/allNotBelow for proc 0
  (linear communication).

ENH: remove unused/unusable UPstream::communicator optional parameter

- had constructor option to avoid constructing the MPI backend,
  but this is not useful and inconsistent with what the reset or
  destructor expect.

STYLE: local use of UPstream::communicator

- automatically frees communicator when it leaves scope
2023-04-18 14:08:39 +02:00
b277b913cf ENH: add guards for partially populated communicators
- these are primarily when encountering sparse (eg, inter-host)
  communicators. Additional UPstream convenience methods:

  is_rank(comm)
    => True if process corresponds to a rank in the communicators.
       Can be a master rank or a sub-rank.

  is_parallel(comm)
    => True if parallel algorithm or exchange is used on the process.
       same as

           (parRun() && (nProcs(comm) > 1) && is_rank(comm))
2023-04-18 14:08:39 +02:00
74db18a9c3 ENH: add interface code for MPI_Allgather
COMP: incorrect macro declaration for mpiGather/mpiScatter
2023-04-18 14:08:39 +02:00
2cf200aef4 ENH: more consistent min edge lengths (finite-area)
- for robustness with small edges (which can occur with snappy meshes),
  the Le() and magLe() are limited to SMALL (commit a0f1e98d24).
  Now use factor sqrt(1/3) in the components to maintain magnitude of 1.

ENH: add fvMesh::unitSf() and faMesh::unitLe() methods

- simple wrappers around Sf()/magSf() and Le()/magLe() but with
  the potential for additional/alternative corrections.

STYLE: thisDb() in faMesh code to simplify future changes in storage

ENH: do not register finite-area geometric fields

- consistent with finite-volume treatment
2023-04-18 14:01:17 +02:00
a96dcf706b ENH: robuster handling of inv() of fields with singular tensors (#2724)
- replace the "one-size-fits-all" approach of tensor field inv()
  with individual 'failsafe' inverts.

  The inv() field function historically just checked the first entry
  to detect 2D cases and adjusted/readjusted *all* tensors accordingly
  (to avoid singularity tensors and/or noisy inversions).

  This seems to have worked reasonably well with 3D volume meshes, but
  breaks down for 2D area meshes, which can be axis-aligned
  differently on different sections of the mesh.
2023-04-18 13:59:09 +02:00
3947f3c441 STYLE: use zeroGradientType() instead of hard-coded or typeName 2023-04-13 20:54:50 +02:00
09dd913077 ENH: use primitive fields when calculating triSurface fields (#2758) 2023-04-13 20:54:50 +02:00
6b16a614ca BUG: incorrect function introducer for mixedExpr with point field
- was primed with toPoint(..) expression call instead of point(...)
2023-04-13 20:54:50 +02:00
3d2df7cdf6 COMP: remove unused variables, etc in Cloud 2023-04-13 20:54:50 +02:00
89e1d8c269 ENH: restrict use of MPI_Group to local scope
- don't need to retain group references globally.
  Just retrieve parent group reference on-demand and discard
  immediately afterwards.
2023-04-11 16:00:12 +02:00
1f5cf3958b ENH: add request-driven polling/consumption of processor interfaces
- with (nPollProcInterfaces < 0) it does the following:

  - loop, waiting for some requests to finish
  - for each out-of-date interface, check if its associated
    requests have now finished (ie, the ready() check).
  - if ready() -> call updateInterfaceMatrix()

  In contrast to (nPollProcInterfaces > 0) which loops a specified
  number of times with several calls to MPI_Test each time, the
  (nPollProcInterfaces < 0) variant relies on internal MPI looping
  within MPI_Waitsome to progress communication.

  The actual dispatch still remains non-deterministic (ie, waiting for
  some requests to finish does not mean that any particular interface
  is eligible for update, or in any particular order). However, using
  Waitsome places the tight looping into the MPI layer, which results
  in few calls and eliminates behaviour dependent on the value of
  nPollProcInterfaces.

TUT: add polling to windAroundBuildings case (for testing purposes)
2023-04-11 15:54:32 +02:00
e1cb12509e GIT: remove unused/spurious Amultiplier definition 2023-04-11 14:53:02 +02:00
9fbc484cdf ENH: use bundled MPI_Test when checking processor interface ready()
- fewer calls, potentially more consistent

ENH: update sendRequest state after recvRequest wait

- previously had this type of code:

    // Treat send as finished when recv is done
    UPstream::waitRequest(recvRequest_);
    recvRequest_ = -1;
    sendRequest_ = -1;

  Now refined as follows:

    // Require receive data. Update the send request state.
    UPstream::waitRequest(recvRequest_);
    recvRequest_ = -1;
    if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1;

  Can potentially investigate with requiring both,
  but this may be over-contrained.
  Example,

    // Require receive data, but also wait for sends too
    UPstream::waitRequestPair(recvRequest_, sendRequest_);
2023-04-11 14:07:36 +02:00
11065bb029 ENH: MPI_Waitany / MPI_Waitsome interface for internal list of requests
- checks requests from completion, returning true when some requests
  have completed and false when there are no active requests.
  This allows it to be used in a polling loop to progress MPI
  and then respond when as requests become satisfied.

  When using as part of a dispatch loop, waitSomeRequests() is
  probably more efficient than calling waitAnyRequest() and can help
  avoid biasing which client requests are serviced.

  Takes an optional return parameter, to retrieve the indices,
  but more importantly to avoid inner-loop reallocations.

  Example,

      DynamicList<int> indices;
      while (UPstream::waitSomeRequests(startRequest, &indices))
      {
          // Dispatch something ....
      }

      // Reset list of outstanding requests with 'Waitall' for safety
      UPstream::waitRequests(startRequest);

  ---

  If only dealing with single items and an index is required for
  dispatching, it can be better to use a list of UPstream::Request
  instead.

  Example,

      List<UPstream::Request> requests = ...;

      label index = -1;
      while ((index = UPstream::waitAnyRequest(requests)) >= 0)
      {
          // Do something at index
      }

ENH: pair-wise wrappers for MPI_Test or MPI_Wait

- for send/recv pairs of requests, can bundle both together and use a
  single MPI_Testsome and MPI_Waitall instead of two individual
  calls.
2023-04-11 11:58:05 +02:00
aa002122c2 ENH: simplify handling of pushed/freed requests
- previously had an additional stack for freedRequests_,
  which were used to 'remember' locations into the list of
  outstandingRequests_ that were handled by 'waitRequest()'.

  This was principally done for sanity checks on shutdown,
  but we now just test for any outstanding requests that
  are *not* MPI_REQUEST_NULL instead (much simpler).

  The framework with freedRequests_ also had a provision to 'recycle'
  them by popping from that stack, but this is rather fragile since it
  would only triggered by some collectives
  (MPI_Iallreduce, MPI_Ialltoall, MPI_Igather, MPI_Iscatter)
  with no guarantee that these will all be properly removed again.
  There was also no pruning of extraneous indices.

ENH: consolidate internal reset/push of requests

- replace duplicate code with inline functions
  reset_request(), push_request()

ENH: null out trailing requests

- extra safety (paranoia) for the UPstream::Request versions
  of finishedRequests(), waitAnyRequest()

CONFIG: document nPollProcInterfaces in etc/controlDict

- still experimental, but at least make the keyword known
2023-04-08 18:46:39 +02:00
700156b4c5 DEFEATURE: remove unused UPstream allocateTag(), freeTag() routines
- mechanism has been unused for at least a decade or more
  (or was never used). Message tags are assigned on an ad hoc basis
  locally when collision avoidance is necessary.
2023-04-08 18:33:52 +02:00
d826f9259f ENH: properly trap any sub-rank changes in allocatePstreamCommunicator
- not currently used, but it is possible that communicator allocation
  modifies the list of sub-ranks. Ensure that the correct size is used
  when (re)initialising the linear/tree structures.

STYLE: adjust MPI test applications

- remove some clutter and unneeded grouping.
  Some ideas for host-only communicators
2023-04-08 18:33:52 +02:00
d51967d728 ENH: faceAgglomerate: more robust. Fixes #2741
- feature angle compared to real angle
- stop agglomerating if number of marked edges does not change
2023-04-06 13:35:30 +01:00
5de59417f8 ENH: improve suspend/resume handling of Pstream profiling (#2737)
- allow reporting even when profiling is suspended

- consolidate reporting into profilingPstream itself
  (avoids code scatter).

Example of possible advanced use for timing only one section of
code:

    ====
    // Profile local operations
    profilingPstream::enable();

    ... do something

    // Don't profile elsewhere
    profilingPstream::suspend();
    ====
2023-04-05 18:49:58 +02:00
9577a0f6b5 ENH: extend parProfiling (#2737)
- separate broadcast times from reduce/gather/scatter time
- separate wait times from all-to-all time
- support invocation counts, split off requests time/count
  from others to avoid flooding the counts

- support 'detail' switch to increase the output information.
  Format may change in the future
2023-04-05 11:33:39 +02:00
475ed5cc32 STYLE: readOnProc/writeOnProc instead of 'valid' for IO 2023-04-04 15:04:26 +02:00
188e61af16 STYLE: use readValueEntry in BCs. Assign Zero for refValue/refGrad 2023-04-04 09:56:55 +02:00
f8e05934f1 BUG: incorrect dictionary contruction of alphatPhaseChange mDotL 2023-04-03 17:35:07 +02:00
e5e1440020 ENH: align use of extrapolatedCalculated in faMatrix with fvMatrix
STYLE: prefer GeometricField::New factory methods
2023-04-03 15:43:04 +02:00
87eed5e3b8 ENH: place more patch field attributes under template invariant Base
- attributes such as assignable(), coupled() etc

- common patchField types: calculatedType(), zeroGradientType() etc.
  This simplifies reference to these types without actually needing a
  typed patchField version.

ENH: add some basic patchField types to fieldTypes namespace

- allows more general use of the names

ENH: set extrapolated/calculated from patchInternalField directly

- avoids intermediate tmp
2023-04-03 13:33:56 +02:00
bd1e1ec9c7 ENH: uniformFixedValue: avoid unallocated autoPtr error 2023-03-31 08:59:31 +01:00
ddf9d528e2 COMP: TensorI.H: missing ; 2023-03-29 14:32:08 +01:00
b339be2459 BUG: GAMG: avoid inter-level interpolation. Fixes #2710 2023-03-29 09:55:23 +01:00
ed89d97627 BUG: LES: enable sigma model for compressible flows (fixes #2727) 2023-03-24 08:23:51 +00:00
f903707e4a STYLE: Allwmake report api/patch directly from META-INFO
- avoid dependency on etc/openfoam (location may change)
2023-03-23 12:22:00 +01:00
66cae2b9d1 ENH: robuster handling inv() of singular tensor for finite-area LSQ (#2724)
- with the current handling of small edges (finite-area), the LSQ
  vectors can result in singular/2D tensors. However, the regular
  2D handling in field inv() only detects based on the first element.

  Provide a 'failsafe' inv() method for symmTensor and tensor that
  follows a similar logic for avoiding zero determinates, but it is
  applied on a per element basis, instead of deciding based on the
  first field element.

  The symmTensor::inv(bool) and tensor::inv(bool) methods have a
  fairly modest additional overhead.

- unroll the field inv() function to avoid creating an intermediate
  field.  Reduce the number of operations when adjusting/re-adjusting
  the diagonal.
2023-03-23 12:12:44 +01:00