Commit Graph

25480 Commits

Author SHA1 Message Date
5bcf9b7997 ENH: effectivenessHeatExchangerSource: add secondaryOutletT functionality 2022-05-18 16:07:25 +00:00
9118ffb31e ENH: effectivenessHeatExchangerSource: add writeFile functionality 2022-05-18 16:07:25 +00:00
796715b029 Merge branch 'issue-1457-refcast' into 'develop'
ENH: Improve the handling of wall-function coefficients and blenders

See merge request Development/openfoam!486
2022-05-18 16:05:20 +00:00
b2610f19db ENH: wall functions: remove redundant and inconsistent virtual specifiers 2022-05-18 16:07:56 +01:00
e2a1076129 STYLE: wall functions: use more modern coding practices
The most frequent changes have been as follows.

from:

    tmp<scalarField> tuTau(new scalarField(patch().size(), Zero));
    scalarField& uTau = tuTau.ref();

to:

    auto tuTau = tmp<scalarField>::New(patch().size(), Zero);
    auto& uTau = tuTau.ref();

- Other changes involved the addition of - wherever approapriate -:

    const
    noexcept
    auto
2022-05-18 16:07:56 +01:00
dcfbdd2cad DOC: wall functions: update header-file documentation 2022-05-18 16:07:56 +01:00
876fc94bc8 ENH: wall functions: new class for wall-function blending methods 2022-05-18 16:07:53 +01:00
c7836f9d83 BUG: nutWallFunction: prevent casting errors (fixes #1457, #1966)
Previously, a nutWallFunctionFvPatchScalarField ref should be
created in epsilon, k, and omega wall functions to fetch various
common wall-function coefficients necessary to carry out and complete
local operations inside these wall functions.

However, this arrangement required the use of a nut wall function,
even when unnecessary, when any of non-nut wall functions are being used.
Therefore, some users had been redundantly restrained and
obstructed with rather obscure casting-error messages.

Also, the wall-function coefficients Cmu, kappa and E have been obtained
from the specified nutWallFunction in order to ensure that each patch
possesses the same set of values for these coefficients.

Although the motivation sounds reasonable, it has also been putting redundant
restraints on users and disregarding the specifics of each wall-function.
For example, the variation of epsilon in near-wall regions is usually very
steep and non-monotonic specific - an expert user may therefore want to use
an epsilon-specific coefficient, and this was not allowed by the previous
arrangement.

This commit introduces a new class (i.e. wallFunctionCoefficients) comprising
all common wall-function coefficients and yPlus calculations.
2022-05-18 14:54:26 +01:00
486be34631 BUG: wall functions: ensure consistent writing of traits
Previously, a number of wall functions were not not writing
their boundary-condition entries in the defacto order
(i.e. from type to value) while writing a field. For example:

    <patchName>
    {
        lowReCorrection 1;
        blending    stepwise;
        n           2;
        type        epsilonWallFunction; <!-- expected to be the first entry
        value       uniform 1;           <!-- expected to be the last entry
    }

Also, various wall functions have been writing out entries that
have not been being used by the wall function. For example:

    <patchName>
    {
        type        nutUSpaldingWallFunction;
        ...
        blending    stepwise;     <!-- no blending treatment in nutUSpaldingWF
        ...
    }

Additionally, various derived wall functions (e.g. atmOmegaWallFunction)
have been failing to write some of the inherited entries even though
these entries have been being used in carrying out wall-function calculations.

Taken these into consideration, wall functions have been reworked to obtain
reliable and consistent way of writing their traits while writing out a field.

- writeLocalEntries uses writeIfDifferent if constructed with getOrDefault.
2022-05-18 14:54:22 +01:00
06b353f8cd ENH: add faMeshTools for new/load mesh, proc addressing etc
ENH: simple faMeshSubset (zero-sized meshes only)

ENH: additional access methods for faMesh, primitive geometry mode

- wrapped walking of boundary edgeLabels as list of list
  (similar to edgeFaces).

- primitive finiteArea geometry mode with reduced communication:
  primarily interesting for decomposition/redistribution (#2436)

ENH: extra vtk debug outputs for checkFaMesh

- report per-processor sizes in the mesh summary
2022-05-17 17:36:34 +02:00
68b692fdfc ENH: combine loadOrCreateMesh from redistributePar into fvMeshTools.
- similar functionality as newMesh etc.
  Relocated to finiteVolume since there are no dynamicMesh dependencies.

- use simpler procAddressing (with updated mapDistributeBase).
  separated from redistributePar
2022-05-17 17:35:51 +02:00
b712e7289e ENH: use typed lookup versions instead of xyz::typeName literals 2022-05-17 17:35:51 +02:00
95e2a2e887 ENH: add sorted() to objectRegistry and IOobjectList
- returns UPtrList view (read-only or read/write) of the objects

- shorter names for IOobject checks: hasHeaderClass(), isHeaderClass()

- remove unused IOobject::isHeaderClassName(const word&) method.
  The typed versions are preferable/recommended, but can still check
  directly if needed:

     (io.headerClassName() == "foo")
2022-05-17 17:35:51 +02:00
f1098673c0 STYLE: compare Dynamic{Field,List} by casting address to common class
- previously used cdata() comparison but that tends to obscure what is
  going on
2022-05-17 17:35:51 +02:00
87f3866f20 ENH: support move append lists for PtrList and UPtrList 2022-05-17 17:35:51 +02:00
60e07d1f93 ENH: refine mapDistribute methods
- additional distribute/reverseDistribute with specified commsType.
  Improves flexibility.

- distribute with nullValue

- support move construct mapDistribute from mapDistributeBase

- refactor handling of schedules (as whichSchedule method) to
  simplify code.

- renumberMap helper for working with compact sub maps
  and renumberVisit for handling walk-ordered compaction.

COMP: make mapDistributeBase data private

- accessor methods are available - direct access is unnecessary
- mapDistribute : inherit mapDistributeBase constructors

STYLE: use List<labelPair>::null() for schedule placeholders

- clearer that they are doing nothing
2022-05-17 17:35:51 +02:00
ae0ef3efed COMP: make Function1 writeEntries virtual 2022-05-17 17:35:51 +02:00
9e2214131c COMP: Removed unused variable 2022-05-17 16:20:32 +01:00
edb0c5880b ENH: surfaceNoise - added optional areaAveraging for 1/3 octave data 2022-05-17 16:20:32 +01:00
6cafe441f8 ENH: valueAverageBase - added support for averaging label values 2022-05-17 16:20:32 +01:00
5d9456187d ENH: zero tag for constructing various IO types
- for int64 compilations this disambiguates between '0' as int32 (size)
  or as bool 'false' for local processor validity

  Eg,

     IOList list(io, 0);     <- With label-size 64: is this bool or label?
     IOList list(io, Zero);  <- Size = 0 (int32/int64), not a bool
2022-05-12 13:47:03 +02:00
812f4c4f09 BUG: globalIndex fails non-blocking gather of indirect list (fixes #2467)
- for indirect lists we use element-wise output streaming and read
  back as a regular list. This approach cannot however work with
  non-blocking mode - the receive buffers will simply not be filled
  before attempting to read from them.

  For contiguous data, the lowest overhead solution is to locally
  flatten the indirect list and use the regular gather routines
  for non-blocking mode. For non-contiguous data, can continue to
  use the element-wise output, but cannot use non-blocking for it.

STYLE: use non-blocking consistently as default for globalIndex gather(s)

- most of the front-facing code was already using non-blocking,
  but there were a few low-level routines defaulting to scheduled
  (but never relied upon in the code).
2022-05-12 11:29:38 +02:00
809fc70166 BUG: redistributePar: reconstruct mesh 2022-05-11 16:06:52 +01:00
efe057897f ENH: foamToVTK attempt finite-area write if -with-ids is specified
- previously filtered on the existence of area fields, but with
  faMesh::TryNew this is not required anymore.

STYLE: enable -verbose for various parallel utilities (consistency)
2022-05-11 11:34:04 +02:00
9c727abb84 COMP: increment lemon sources, fix stray comment char (wmkdepend)
COMP: compile utilites before solvers

- there are no inter-dependencies,
  so favour getting utilities working first
2022-05-11 09:53:58 +02:00
0ed0856593 COMP: avoid Istream/List operator() ambiguity (gcc-4.8.5)
- introduced UList<bool>::operator()(label) as part of bf0b3d8872
  but with gcc-4.8.5 this participates in operator resolution even
  for non-bool lists!!
  Partial revert until this predicate handling is really required.
2022-05-11 08:57:05 +02:00
dd560a6e3c ENH: reduce allocations/sorting when setting time (#2461)
- use DynamicList instead of List in the cache, which reduces the
  number of allocations occuring each time.

- since the cached times are stored in sorted order, first check if the
  new time is greater than the last list entry. Can then simply append
  without performing a binary search and can obviously also skip any
  subsequent sorting.

STYLE: add noexcept to Instant methods, declare in header (like Tuple2)
2022-05-10 21:16:09 +02:00
525f77f8bb TUT: add constraint types for finiteArea tutorials
STYLE: accept '-proc' as shortcut in restore0Dir function
2022-05-10 21:16:09 +02:00
de59875147 BUG: probes not written to probes/0 output (fixes #2452)
- as part of #2358 the writing was changed to be lazy.
  Which means that files are only created before they are actually
  written, which helps avoid flooding the filesystem if sample-only
  is required and also handles case such as "rho.*" where the sampled
  fields are not known from the objectRegistry at startup.

- now create any new files using the startTime value, which means they
  are easier to find but still retains the lazy construct.

  Don't expect any file collisions with this, but there could be some
  corner cases where the user has edited to remove fields (during
  runtime) and then re-edits to add them back in. In this case the
  file pointers would be closed but reopened later and overwriting
  the old probed values. This could be considered a feature or a bug.

BUG: bad indexing for streamlines (fixes #2454)

- a cut-and-paste error
2022-05-10 21:16:09 +02:00
762c095f4e COMP: WM_SCHEDULER breaks compilation (fixes #2439)
- only wrap compiler calls (not things like flex/bison)
- avoid single quoted '&&' (causes syntax errors)

STYLE: report WM_COMPILE_CONTROL value in top-level Allwmake
2022-05-10 21:15:39 +02:00
ebc634a425 Merge branch 'feature-reorganise' into 'develop'
code style, bug fixes

See merge request Development/openfoam!535
2022-05-10 11:07:46 +00:00
42de624344 ENH: consolidate processorTopology handling for volume and area meshes
- relocate templating to factory method 'New'.
  Adds provisions for more general re-use.

- expose processor topology in globalMesh as topology()

- wrap proc->patch lookup as processorTopology::procPatchLookup method
  (failsafe). May consider using Map<label> for its storage in the
  future.
2022-05-10 10:47:01 +02:00
dea2f23afd COMP: combine uindirectPrimitivePatch.H into indirectPrimitivePatch.H
- similarly combine typedef headers for primitiveFacePatch,
  foamVtkUIndPatchWriter, foamVtkUIndPatchGeoFieldsWriter etc
  (reduce file clutter)
2022-05-10 10:47:01 +02:00
33693f32b6 ENH: wrapped IOField, IOList, IOmapDistributePolyMesh
- Uses a refPtr to reference external content.
  Useful (for example) when writing data without copying.
  Reading into external locations is not implemented
  (no current requirement for that).

    * IOFieldRef -> IOField
    * IOListRef -> IOList
    * IOmapDistributePolyMeshRef -> IOmapDistributePolyMesh

  Eg,

    labelList addressing = ...;

    io.rename("cellProcAddressing");
    IOListRef<label>(io, addressing).write();

  Or,
    primitivePatch patch = ...;
    IOFieldRef<vector>(io, patch.localPoints()).write();
2022-05-10 10:47:01 +02:00
036abb8ecb BUG: bitSet &= operation does not mask out non-overlapping (#2456)
- the values from non-overlapping blocks were simply ignored,
  which meant that ('111111111111' & '111111') would not mask out
  the unset values at all.

- similar oddities in other operations (|=, ^= etc)
  where the original implementation tried hard to avoid touching the
  sizing at all, but now better resolved as follows:

  - '|=' : Set may grow to accommodate new 'on' bits.
  - '^=' : Set may grow to accommodate new 'on' bits.
  - '-=' : Never changes the original set size.
  - '&=' : Never changes the original set size.
           Non-overlapping elements are considered 'off'.

  These definitions are consistent with HashSet behaviour
  and also ensures that (a & b) == (b & a)

ENH: improve short-circuiting within bitSet ops

- in a few places can optimise by checking for none() instead of
  empty() and avoid unnecessary block operations.

ENH: added bitSet::resize_last() method

- as the name says: resizes to the last bit set.
  A friendlier way of writing `resize(find_last()+1)`
2022-05-10 10:47:01 +02:00
a34357b1a6 ENH: additional IndirectList static methods
- uniq() : creates an IndirectList with duplicated entries
  filtered out

- subset() : creates an IndirectList with positions that satisfy
  a condition predicate.

- subset_if() : creates an IndirectList with values that satisfy a
  given predicate.

  An indirect subset will be cheaper than creating a subset copy
  of the original data, and also allows modification.

STYLE: combine UIndirectList.H into UIndirectList.H (reduce file clutter)
2022-05-10 10:47:01 +02:00
7afebef509 ENH: HashTable sorted() method
- the sorted() method fills a UPtrList with sorted entries. In some
  places this can provide a more convenient means of traversing a
  HashTable in consistent order, without the extra step of creating
  a sortedToc(). The sorted() method with a UPtrList will also have
  a lower overhead than creating any sortedToc() or toc() since it is
  list of pointers and not full copies of the keys.

  Instead of this:

      HashTable<someType> table = ...;

      for (const word& key : table.sortedToc())
      {
          Info<< key << " => " << table[key] << nl;
      }

  can write this:

      for (const auto& iter : table.sorted())
      {
          Info<< iter.key() << " => " << iter.val() << nl;
      }

STYLE:

- declare hash entry key 'const' since it is immutable
2022-05-10 10:47:01 +02:00
d68902f4a7 ENH: relocate Foam::sort from PtrListOps to UPtrList.H
- can sort directly without ListOps or other intermediates
  (eg labelList order).

- PtrListOps::less/greater wrappers -> UPtrList::less/greater
2022-05-10 10:04:27 +02:00
cb6f908798 STYLE: IOobject/regIOobject - noexcept methods, isolate local functions
- local writeHeaderEntry helper was not marked as file-scope static.

- use do/while to simplify handling of padding spaces

ENH: IOobject - copy construct, resetting name and local component

- when copying with a new local component, this is simpler than
  constructing from all of the components, which was previously the
  only possibility for setting a new local component.
2022-05-09 14:52:47 +02:00
bf0b3d8872 ENH: relocate sortedOrder from ListOps.H to List.H
- commonly used, only depends on routines defined in UList
  (don't need the rest of ListOps for it).

ENH: implement boolList::operator() const

- allows use as a predicate functor, as per bitSet and labelHashSet

GIT: combine SubList, UList into List directory (intertwined concepts)

STYLE: default initialize DynamicList instead of with size 0
2022-05-09 14:52:47 +02:00
0e01e530a8 ENH: add optional agglomeration coefficent to random decomposition
- specifies the number of consecutive cells to assign to the same
  randomly chosen processor. Can be used to have a less extremely
  random distribution for testing possible breaking points.

Eg,
    method random;

    coeffs
    {
        agglom  4;
    }

- Add finiteArea cellID (actually face ids) / faceLabel and procID
  for foamToVTK with -write-ids. Useful when this type of information
  is needed.
2022-05-09 14:52:47 +02:00
8ee4efc64b ENH: checkMesh: weights on AMI patches. 2022-05-09 13:46:05 +01:00
2ba2814c50 ENH: mpirunDebug: preserve ". Fixes #2459 2022-05-06 18:09:54 +01:00
df63b47fbc BUG: masterCoarsest: do not agglomerate: Fixes #2455.
If the initial mesh does not have enough levels
do not do any agglomeration
2022-05-04 17:57:22 +01:00
d00445ace9 Merge branch 'feature-multiple-outletMappedUniformInlet' into 'develop'
ENH: outletMappedUniformInlet: add multiple fraction, offset and time delays

See merge request Development/openfoam!531
2022-04-29 20:00:22 +00:00
0a6e368289 TUT: airRecirculationRoom: update the tutorial 2022-04-29 19:59:41 +00:00
009f8dd1e8 ENH: outletMappedUniformInlet: add multiple fraction, offset and time delays
- Arbitrary number of outlets can be connected to a single inlet
  - Each inlet can be connected to different and arbitrary
    combination of outlets
- Each outlet-inlet connection has:
  - Optional filtration fraction as a Function1 type
  - Optional offset as a Function1 type (i.e. adding/substracting a substance)
  - Optional time delay (from outlet to inlet) as a Function1 type
- Each inlet has an optional base inlet-field as a PatchFunction1 type
2022-04-29 19:59:41 +00:00
32d3fabcfe ENH: scalarTransport: transfer write control from controlDict to function object 2022-04-29 19:59:41 +00:00
ab976a5ac0 ENH: interpolateXY: enable UList parameters for wider applications 2022-04-29 19:59:41 +00:00
7460fb259b Merge branch 'issues-2022-1.kbc' into 'develop'
BUG: 2022-1: Various bug fixes

See merge request Development/openfoam!530
2022-04-29 19:59:18 +00:00