Compare commits

..

71 Commits

Author SHA1 Message Date
e65dc2d578 BUG: integratedNonUniformTable: correct offsets (fixes #2614) 2022-11-01 14:55:59 +00:00
37db8ccd20 ENH: support direct calculation of finiteArea edgeNormals (#2592)
- with geometryOrder=1, calculate the edge normals from the adjacent
  faces (area-weighted, inverse distance squared) and also
  use that for the Le() calculation.

  Includes the contributions from processor edge neighbours, so it
  should be consistent on both sides.

  This new method (consider as 'beta') contrasts with the current
  standard method that first calculates area-weighted point normals
  and uses the average of them for the edge normal.

  Enable for testing either with a controlDict OptimisationSwitch entry
  "fa:geometryOrder", or on the command-line:

      solverName -opt-switch=fa:geometryOrder=1
2022-09-28 17:47:18 +02:00
a5d6c8ced0 ENH: use fallback value if calculated Le() is degenerate (#2592)
- the Le vector is calculated from (edgeVec ^ edgeNorm)
  and should be oriented in direction (faceCentre -> edgeCentre).

  If, however, the edgeNorm value is bad for any reason, the
  cross-product falls apart and Le vector is calculated as a zero
  vector!

  For these cases, revert to using (faceCentre -> edgeCentre)
  as a better approximation than a zero vector.

  In the future, will very likely switch calculating the edge normals
  directly from the attached faces, instead of from the attached
  points as is currently done, which should improve robustness.

ENH: expose fa:geometryOrder as a registered OptimisationSwitch

ENN: reuse polyMesh data (eg, faceCentres) if possible in faMesh

STYLE: add code lambdas and static functions to isolate logic
2022-09-28 17:47:17 +02:00
f276366a05 ENH: snappyHexMesh: add mesh-quality control for edge lengths 2022-09-28 08:57:43 +01:00
a7ef33da6b ENH: add finite-area support to setFields (#2591)
- for example,

    defaultFieldValues
    (
        areaScalarFieldValue h 0.00014
    );

    regions
    (
        clipPlaneToFace
        {
            point  (0 0 0);
            normal (1 0 0);

            fieldValues
            (
                areaScalarFieldValue h 0.00015
            );
        }
    );

ENH: additional clipPlaneTo{Cell,Face,Point} topo sets

- less cumbersome than defining a semi-infinite bounding box
2022-09-26 18:03:23 +02:00
56e9f7bf4b BUG: blockMesh mergePatchPairs fails with edge-shared points (fixes #2589)
- remedy by performing the attach() action sequentially (as per
  stitchMesh changes). This ensures that the current point addressing
  is always used and avoids references to the already-merged points
  (which is what causes the failure).

ENH: improve handling of empty patch removal

- only remove empty *merged* patches, but leave any other empty
  patches untouched since they may intentional placeholders for other
  parts of a workflow.

- remove any empty point/face zones created for patch merging
2022-09-26 18:03:23 +02:00
9fa37ba068 ENH: add static centre(), {area,unit}Normal() methods to triangle
- commonly used calculations

ENH: add faPatch::patchRawSlice method

- slices using the nEdges() instead of the virtual size(),
  which provides similar functionality as finite-volume has with
  its distinction between polyPatch vs fvPatch patchSlice

- use patchInternal for obtaining faPatch, fvPatch information
2022-09-26 18:03:23 +02:00
5130c7bcbc STYLE: use polyPatchList instead of List<polyPatch*> in more places 2022-09-26 18:03:23 +02:00
3c7088b6c0 STYLE: provide GeometricField internalFieldRef()
- similar to boundaryFieldRef(), primitiveFieldRef() for providing
  write access. Complimentary naming to internalField(). Identical to
  ref() but more explicitly named, and less likely to be confused with
  a tmp::ref(), for example.

- prefer .primitiveFieldRef() over .ref().field()

- mark some access methods noexcept
2022-09-26 09:53:22 +02:00
4710528448 ENH: reduce allocations/overhead when reading PtrList
- replace SLList with direct handling (like a hand-rolled DynamicList)

ENH: support PtrList transfer for polyMesh::addZones
2022-09-26 09:52:59 +02:00
cbace69896 ENH: more consistent naming of MPI reductions
- combineReduce     (older: combineAllGather)
- listCombineReduce (older: listCombineAllGather)
- mapCombineReduce  (older: mapCombineAllGather)
2022-09-23 19:19:03 +02:00
39fc7cc957 GIT: missing tutorial files 2022-09-23 12:35:07 +02:00
dc28dbc3ad TUT: add multi-patch versions using regionFaModels 2022-09-22 17:24:21 +02:00
b1a8bb1b12 STYLE: remove old/fragile volSurfaceMapping mappings 2022-09-22 17:18:20 +02:00
a00997f32f ENH: extend regionFaModels to handle multiple volume patches 2022-09-22 16:09:14 +02:00
0302ba4418 ENH: construct fa::options from fvMesh instead of fvPatch
- these were previously constructing from an fvPatch (for simpler
  integration with regionFaModel) but this unnecessarily restricts
  the finiteArea to a single volume patch.

- adjusted derived faOptions to support multiple patches
2022-09-22 16:09:14 +02:00
fe7dd51258 BUG: incorrect local face addressing for fa::faceSetOption subset
- list of faces() was using mesh-faces, not area-faces

ENH: provision for patch and faceSet selection in fa::faceSetOption

- adjust most of the faOptions to respect subset of faces

ENH: support Function1 for externalHeatFluxSource

BUG: incorrect handling of fixedPower (externalHeatFluxSource)

- used local areas instead of global total area
2022-09-22 16:09:14 +02:00
c59dc00623 STYLE: update code style for regionFaModels, optionsList 2022-09-22 16:09:14 +02:00
a8057c4bc6 ENH: avoid undefined method in temperatureCoupledBase
- old constructor interface allowed arbitrary strings to specify the
  method enumeration. If actually used at runtime, they could/would
  raise a FatalError (unknown enumeration).
  Define a simpler default constructor instead.
2022-09-22 16:09:14 +02:00
1695f2f5b9 TUT: use simpler faMeshDefinition 2022-09-22 16:09:14 +02:00
84db37f62f ENH: improved bookkeeping for finite-area to volume mesh correspondence
- whichPolyPatches() = the polyPatches related to the areaMesh.

  This helps when pre-calculating (and caching) any patch-specific
  content.

- whichPatchFaces() = the poly-patch/patch-face for each of the faceLabels.

  This allows more convenient lookups and, since the list is cached on
  the area mesh, reduces the number of calls to whichPatch() etc.

- whichFace() = the area-face corresponding to the given mesh-face

ENH: more flexible/consistent volume->area mapper functions
2022-09-22 16:09:14 +02:00
e8863cd091 ENH: extend polyBoundaryMesh patch/face query
- whichPatchFace() returns the (patchi, patchFacei) tuple,
  whichPatch() simply wraps whichPatchFace()

- groupNames() : similar to zones

ENH: simplify calls to faPatch/fvPatch patchField, lookupPatchField

- make second (ununsed) template parameter optional.
  Was previously needed for old compilers (2008 and earlier).
2022-09-22 16:09:14 +02:00
4393ffa8dc ENH: template invariant base classes for {fa,fae,fv,fvs,point}PatchField
- simplifies construction/inheritance

ENH: add {fa,fv}PatchField::zeroGradientType() static

- can be used to avoid literal "zeroGradient" in places

STYLE: adjust naming of pointPatch runtime selection table

- simply use 'patch' as per fa/fv fields

STYLE: add zero-size guard to patch constraintType(const word&)
2022-09-22 16:09:14 +02:00
88f5be479e ENH: support assign or construct Field from primitiveEntry
For example, instead of

   if (dict.found("value"))
   {
       fvScalarField::operator=
       (
           Field<scalar>("value", dict, p.size())
       );
   }

can use more precise specifications, and also eliminate searching
the dictionary multiple times:

   const auto* eptr = dict.findEntry("value", keyType::LITERAL);

   //or:  dict.findCompat("value", {{"oldName" ... }}, keyType::LITERAL);

   if (eptr)
   {
       fvScalarField::assign(*eptr, p.size());
   }

STYLE: combine declaration of FieldBase into Field.H
2022-09-22 16:09:14 +02:00
88061f3b28 ENH: improved argList handling of libs, functionObjects
- include -no-libs option by default, similar to '-lib',
  which makes it available to all solvers/utilities.
  Add argList allowLibs() method to query it.

- relocate with/no functionObjects logic from Time to argList
  itself as argList allowFunctionObjects()

- add libs/functionObjects override handling to decomposePar etc

ENH: report the stream relativeName for IOerrors (see c9333a5ac8)
2022-09-22 16:08:52 +02:00
c031f7d00a ENH: improve autoPtr/refPtr/tmp consistency (#2571)
- disallow inadvertant casting and hidden copy constructions etc
2022-09-22 11:50:51 +02:00
052d8b13e3 ENH: support tuple (pair) indexing into FieldField
- can use a (patchi, elemi) pair to access an element of a FieldField
2022-09-22 11:50:51 +02:00
a0282c7e41 ENH: prefer PtrList set/get/test instead of PtrList::operator() access
- clearer coding intent. Mark operator() as 'deprecated'

- add bounds checking to get(label) and set(label) methods.

  This gives failsafe behaviour for get() that is symmetric with
  HashPtrTable, autoPtr etc and aligns the set(label) methods
  for UPtrList, PtrList and PtrDynList.

- use top-level PtrList::clone() instead of cloning individual elements

ENH: support HashPtrTable set with refPtr/tmp (flexibility)
2022-09-22 11:50:51 +02:00
b9ca63b118 ENH: use pointer checks for dynamicCast, refCast
- avoids try/catch exception handling

STYLE: prefer refCast (shorter) to dynamicCast where possible
2022-09-22 11:50:51 +02:00
512f558549 COMP: native MPI reduce not triggered (fixes #2569)
- define returnReduce *after* defining all specializations for reduce
  so that the compiler does not take the generic templated reduce.

ENH: add UPstream::reduceAnd, UPstream::reduceOr

- direct wrapper of MPI_LAND, MPI_LOR intrinsics

ENH: provide special purpose returnReduce for logical operations

- returnReduceAnd(bool), returnReduceOr(bool) as a inline wrappers
  for returnReduce with andOp<bool>(), orOp<bool>() operators,
  respectively.

  These forms are more succinct and force casting of the parameter
  into a bool. Using MPI bool operations allows vendor/hardware MPI
  optimisations.

  * Test for existence on any rank:

      1.  if (returnReduceOr(list.size()) { ... }
      1b. if (returnReduceOr(!list.empty()) { ... }

      2.  if (returnReduce(bool(list.size(), orOp<bool>())) { ... }
      3.  if (returnReduce(list.size(), sumOp<label>()) != 0) { ... }
      3b. if (returnReduce(list.size(), sumOp<label>()) > 0) { ... }

  * Test for non-existence on all ranks:

      1.  if (returnReduceAnd(list.empty()) { ... }
      1b. if (!returnReduceOr(list.size()) { ... }

      2.  if (returnReduce(list.empty(), andOp<bool>())) { ... }
      3.  if (returnReduce(list.size(), sumOp<label>()) == 0) { ... }

  Notes:
      Form 1. succinct
      Form 2. may require explicit bool() for correct dispatch
      Form 3. more expensive sumOp<label> just for testing size!
      There are also some places using maxOp<label> instead of sumOp<label>
2022-09-22 11:50:51 +02:00
968c1db1af ENH: use combined &=, |=, ^= forms for bitAndEqOp, bitOrEqOp, bitXorEqOp
- these also work for bitSet, HashSet with slightly lower overhead

ENH: locate FOAM_NODISCARD attribute macro in stdFoam.H
2022-09-22 11:50:50 +02:00
47e172e6ef ENH: add internal parRun guards to some UPstream methods
- simplifies coding
  * finishedRequest(), waitRequest(), waitRequests() with parRun guards
  * nRequests() is noexcept

- more consistent use of UPstream::defaultCommsType in branching
2022-09-22 11:50:50 +02:00
716d330547 COMP: link finiteArea whenever regionFaModel is used 2022-09-22 11:50:50 +02:00
6f764c8d02 ENH: checkMesh: check patches across processors 2022-09-22 09:24:01 +01:00
1a15bd08f7 BUG: viewFactor: incorrect number of unknowns. Fixes #2585 2022-09-20 11:34:27 +01:00
afffec446a DOC: snappyHexMeshDict: more comment 2022-09-14 13:38:41 +01:00
51dbc84ddb ENH: coded bc: evaluate if no 'value' supplied. Fixes #2561 2022-09-14 13:37:01 +01:00
a964c364b6 ENH: viewFactorsGen: stabilise calculation. Fixes #2583 2022-09-14 13:26:05 +01:00
ff4c776b8b BUG: tetDecomposer: illegal tet face. Fixes #2580 2022-09-12 16:35:30 +01:00
f9b85dbfbb BUG: bad detection of Ensight binary/ascii (fixes #2579)
- related to #2535
2022-09-09 11:55:33 +02:00
c841aaed83 ENH: use atomic move in wmkdepend
- avoids truncated files if dependency generation is interrupted
2022-09-09 11:55:33 +02:00
793f4e3a37 CONFIG: add support for WM_COMPILE_OPTION='Dbg'
- uses '-g -DFULLDEBUG' (like Debug), but with -O3 (like Opt).

  This adds in debug symbols and FULLDEBUG code segments (good for
  code development) but retains -O3 optimizations and code paths and
  avoids the much slower -O0 associated with 'Debug'.

- add in central wmake/General/common/{c,c++}XXX tuning,
  which helps reduce the number of nearly identical files

ENH: add support for wmake -debug-Og
2022-09-09 11:55:33 +02:00
0ed79f3bc1 COMP: pass phase-change YInf by reference not by copy
- copying was inadvertently added by 85a2ae6eaa
2022-09-09 11:55:33 +02:00
c624590e26 ENH: stricter handling of missing timeActivatedFileUpdate files (#2573)
- previously threw FatalError, which downgrades to a Warning only when
  loading the functionObject. Now throw a FatalIOError so that missing
  control files are treated as a critical error.
2022-09-07 16:25:45 +02:00
2a9e68c2bf ENH: add -opt-switch support for strings (eg, named enums) - issue #2222 2022-09-07 16:25:45 +02:00
500ec9dd12 ENH: more consistent order of ITstream constructor parameters 2022-09-07 16:25:45 +02:00
097008544c STYLE: adjust range check in Foam::factorial (FULLDEBUG)
STYLE: consistent use of $(LIB_SRC) in Make/options
2022-09-07 16:25:45 +02:00
0b37234804 Merge remote-tracking branch 'origin/master' into develop 2022-09-07 16:24:54 +02:00
f1da147925 CONFIG: bump patch level 2022-09-07 16:02:10 +02:00
d3123a1107 BUG: redistributePar fails with some area fields (fixes #2574)
- this is especially evident in -reconstruct mode when
  the fields have several processor boundaries.

  Testing for an existing patch edge mapping must use the `test`
  method (with range-checking) instead of the more common `set`
  method since the source field will likely have many more boundaries
  than physical edge mappings.
2022-09-07 16:00:54 +02:00
4965dc4cfb COMP: declare forceCoeffs operator<< in Foam namespace (fixes #2576) 2022-09-07 16:00:50 +02:00
a39b50d783 COMP: incorrect type in valueAverageBase (fixes #2568)
- caused inadvertent truncation of label types
2022-09-07 16:00:50 +02:00
0f5cc77b61 Merge branch 'feature-sorption-wall-function' into 'develop'
ENH: sorptionWallFunction: new wall boundary condition

See merge request Development/openfoam!559
2022-09-07 13:58:39 +00:00
9bc46bc0d7 ENH: sorptionWallFunction: new wall boundary condition
The sorptionWallFunction is a wall boundary condition to
specify scalar/concentration gradient for turbulent and laminar flows.
2022-09-07 13:57:52 +00:00
941dd0bec7 Merge branch 'feature-heat-exchangers' into 'develop'
ENH: fvOptions: refactor and extend effectivenessHeatExchangerSource

See merge request Development/openfoam!557
2022-09-07 13:55:01 +00:00
332026644d ENH: fvOptions: refactor and extend effectivenessHeatExchangerSource
- rename effectivenessHeatExchangerSource -> heatExchangerSource
- introduce submodels:
  - effectivenessTable (previous behaviour)
  - referenceTemperature
- the referenceTemperature submodel uses a reference temperature
  which is either a scalar or calculated from a 2D interpolation
  table in order to calculate the heat exchange.
2022-09-07 13:54:38 +00:00
2a007b007e BUG: PPCR: check outstanding request. Fixes #2577
If the exit is through maxIter it should still wait
for outstanding requests
2022-09-07 14:16:43 +01:00
4730c381ef COMP: avoid cpp replacement of linux,unix,... in Make/options (fixes #2548)
- the cpp command is used to process Make/{files,options}, but builtin
  defines such as `linux` will cause problems (macro replacement) if
  these is present in the Make/{files,options}.

  Solve by undefining -Ulinux, -Uunix macros, which will leave directory
  names such as "/usr/lib/x86_64-linux-gnu/..." intact.

  Directories with _linux, __linux__ content (for example), could
  still pose future issues.
2022-08-19 15:01:43 +02:00
7ea185b0b5 ENH: support rotationCentre for surface output formats (#2565)
- as an alternative output transform (supplementary to the regular
  coordinate system specification - issue #2505) it is now possible to
  specify the rotation centre directly.

  Example:

      formatOptions
      {
          vtk
          {
              scale 1000;  // m -> mm
              transform
              {
                  origin  (0 0 0);
                  rotationCentre  (1 0 0);
                  rotation axisAngle;
                  axis    (0 0 1);
                  angle   -45;
              }
          }
      }

   This behaves like the transformPoints and surfaceTransformPoints
   '-centre' option (formerly '-origin') in that it removes the
   specified amount from the point locations, applies the rotation and
   finally adds the specified amount back to the newly rotated point
   locations.

   The results of specifying a `rotationCentre` and a non-zero
   coordinate system `origin` may not be intuitively evident.
2022-08-19 12:52:29 +02:00
e827c117e3 CONFIG: fixes for MacOS (#2555)
- introduce a FOAM_LD_LIBRARY_PATH variable to shadow
  DYLD_LIBRARY_PATH on MacOS.

  The DYLD_LIBRARY_PATH and LD_LIBRARY_PATH cannot be modified via sub
  shells etc when SIP is active. This helps circumvent these
  restrictions, which is obviously a hack, but seems to be required.

COMP: disable -ftrapping-math in geompack for MacOS
2022-08-19 12:52:11 +02:00
5218bfd721 Merge remote-tracking branch 'origin/master' into develop 2022-08-19 12:50:50 +02:00
b6a6e40c27 BUG: incorrect order for output scaling (transformPoints, ...)
- the output write scaling should be applied *after* undoing the
  effects of the specified rotation centre. Fixes #2566

ENH: update option names for transformPoints and surfaceTransformPoints

- prefer  '-auto-centre' and '-centre', but also accept the previous
  options '-auto-origin' and '-origin' as aliases.

  Changing to '-centre' avoids possible confusion with
  coordinate system origin().
2022-08-18 11:46:08 +02:00
bc3bff8ef5 BUG: binModels: ensure main processor writes out binned data (fixes #2530) 2022-08-09 16:03:55 +01:00
b0cd2ea991 BUG: binModels: read and use writeFile settings (fixes #2553) 2022-08-09 16:03:48 +01:00
9f40db8977 BUG: forceCoeffs: correct the order of pressure and viscous components (fixes #2552) 2022-08-02 16:59:41 +01:00
a72d4a1708 BUG: externalHeatFluxSource: memory leakage (fixes #2545) 2022-07-27 13:11:21 +01:00
71a612085b BUG: caseDicts: fix pressureDifferencePatch and pressureDifferenceSurface scripts (fixes #2482) 2022-07-25 14:41:31 +01:00
92f38b589a BUG: solidBodyMotionFunction: avoid reading model name from subdictionary (fixes #2526) 2022-07-08 09:20:51 +01:00
ce486da6bd Merge branch 'issue-2527-setTurbulenceFields' into 'master'
BUG: setTurbulenceFields: update processor boundaries (fixes #2527)

Closes #2527

See merge request Development/openfoam!554
2022-07-04 15:26:53 +00:00
de21a6bc0e BUG: setTurbulenceFields: update processor boundaries (fixes #2527) 2022-07-04 13:34:13 +01:00
76d719d1e6 RELEASE: Updated version to v2206 2022-06-24 15:41:02 +01:00
1022 changed files with 15500 additions and 6861 deletions

View File

@ -1,2 +1,2 @@
api=2206
patch=0
patch=220907

View File

@ -11,4 +11,5 @@ EXE_LIBS = \
-lfvOptions \
-lmeshTools \
-lsampling \
-lregionFaModels
-lregionFaModels \
-lfiniteArea

View File

@ -1,8 +1,8 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \

View File

@ -26,4 +26,5 @@ EXE_LIBS = \
-ltopoChangerFvMesh \
-lsampling \
-latmosphericModels \
-lregionFaModels
-lregionFaModels \
-lfiniteArea

View File

@ -21,4 +21,5 @@ EXE_LIBS = \
-lcompressibleTurbulenceModels \
-lthermoTools \
-latmosphericModels \
-lregionFaModels
-lregionFaModels \
-lfiniteArea

View File

@ -28,4 +28,5 @@ EXE_LIBS = \
-ldynamicMesh \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-lregionFaModels
-lregionFaModels \
-lfiniteArea

View File

@ -22,4 +22,5 @@ EXE_LIBS = \
-lcompressibleTurbulenceModels \
-lthermoTools \
-latmosphericModels \
-lregionFaModels
-lregionFaModels \
-lfiniteArea

View File

@ -40,4 +40,5 @@ EXE_LIBS = \
-lthermoTools \
-lradiationModels \
-lregionModels \
-lregionFaModels
-lregionFaModels \
-lfiniteArea

View File

@ -36,5 +36,5 @@ EXE_LIBS = \
-lfaOptions \
-lregionModels \
-lsampling \
-lregionFaModels
-lregionFaModels \
-lfiniteArea

View File

@ -22,4 +22,5 @@ EXE_LIBS = \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-latmosphericModels \
-lregionFaModels
-lregionFaModels \
-lfiniteArea

View File

@ -1,7 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \

View File

@ -2,10 +2,10 @@ EXE_INC = \
-I../reactingParcelFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \

View File

@ -2,8 +2,8 @@ EXE_INC = \
-I.. \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \

View File

@ -1,7 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \

View File

@ -2,7 +2,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \

View File

@ -2,8 +2,8 @@ EXE_INC = \
-I../reactingParcelFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \

View File

@ -4,8 +4,8 @@ EXE_INC = \
-I../../reactingParcelFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \

View File

@ -2,7 +2,7 @@ EXE_INC = \
-I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam/simpleReactingParcelFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \

View File

@ -4,8 +4,8 @@ EXE_INC = \
-I../../../compressible/rhoPimpleFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \

View File

@ -42,4 +42,5 @@ EXE_LIBS = \
-lregionModels \
-lregionFaModels \
-lsurfaceFilmModels \
-lfiniteArea \
-lcompressibleTwoPhaseMixtureTurbulenceModels

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -104,7 +104,7 @@ void readList
{
OTstream os;
os << input;
ITstream is("input", os.tokens());
ITstream is(os.tokens());
is >> output;
}
@ -118,7 +118,7 @@ void readList
{
OTstream os;
os << input;
ITstream is("input", os.tokens());
ITstream is(os.tokens());
is >> output;
}

View File

@ -0,0 +1,3 @@
Test-FieldFields1.C
EXE = $(FOAM_USER_APPBIN)/Test-FieldFields1

View File

@ -0,0 +1,117 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-FieldFields1
\*---------------------------------------------------------------------------*/
#include "symmTensorField.H"
#include "tensorField.H"
#include "FieldFields.H"
#include "Random.H"
using namespace Foam;
template<class Cmpt>
void printFieldField(const FieldField<Field, Cmpt>& ff)
{
forAll(ff, i)
{
Info<< i << ": " << flatOutput(ff[i]) << nl;
}
Info<< nl;
}
template<class Type>
tmp<Field<Type>> randomField(Random& rnd, label dim)
{
auto tfld = tmp<Field<Type>>::New(dim);
auto& fld = tfld.ref();
for (Type& val : fld)
{
for (direction cmpt=0; cmpt < pTraits<Type>::nComponents; ++cmpt)
{
setComponent(val, cmpt) = rnd.position<label>(0, 100);
}
}
return tfld;
}
template<class Type>
tmp<Field<Type>> randomField(label dim)
{
Random rnd;
return randomField<Type>(rnd, dim);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
// scalarField
{
Info<< nl << "scalarFieldField" << nl;
Random rnd;
FieldField<Field, scalar> sff1(6);
forAll(sff1, i)
{
sff1.set(i, randomField<scalar>(rnd, 8));
}
printFieldField(sff1);
Info<< nl << "indexing:" << nl;
{
labelPair index;
const label range1 = sff1.size()-1;
const label range2 = sff1[0].size()-1;
for (label iter = 0; iter < 10; ++iter)
{
index.first() = rnd.position<label>(0, range1);
index.second() = rnd.position<label>(0, range2);
Info<< index << " => " << sff1[index] << nl;
}
}
}
Info<< nl << "End\n" << nl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
Test-FieldFields2.C
EXE = $(FOAM_USER_APPBIN)/Test-FieldFields2

View File

@ -0,0 +1,2 @@
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -24,7 +24,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-tensorFieldFields1
Test-FieldFields2
\*---------------------------------------------------------------------------*/
@ -73,21 +73,29 @@ void allocComponents
}
vectorField randomVectorField(label size)
template<class Type>
tmp<Field<Type>> randomField(Random& rnd, label dim)
{
Random rnd;
auto tfld = tmp<Field<Type>>::New(dim);
auto& fld = tfld.ref();
vectorField vf(size);
forAll(vf, i)
for (Type& val : fld)
{
for (direction cmpt=0; cmpt < vector::nComponents; ++cmpt)
for (direction cmpt=0; cmpt < pTraits<Type>::nComponents; ++cmpt)
{
vf[i][cmpt] = rnd.position<label>(0, 100);
setComponent(val, cmpt) = rnd.position<label>(0, 100);
}
}
return vf;
return tfld;
}
template<class Type>
tmp<Field<Type>> randomField(label dim)
{
Random rnd;
return randomField<Type>(rnd, dim);
}
@ -191,7 +199,7 @@ int main(int argc, char *argv[])
printFieldField(sf1);
Info<< nl;
for (direction cmpt = 0; cmpt < vector::nComponents; ++cmpt)
for (direction cmpt = 0; cmpt < pTraits<vector>::nComponents; ++cmpt)
{
unzipRow(sf1, cmpt, slice[0]);
@ -253,8 +261,9 @@ int main(int argc, char *argv[])
{
Info<< nl << "vectorField" << nl;
Random rnd;
FieldField<Field, vector> vf1(1);
vf1.set(0, new vectorField(randomVectorField(4)));
vf1.set(0, randomField<vector>(rnd, 4));
FixedList<FieldField<Field, scalar>, 3> cmpts;
allocComponents(cmpts, 4);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,7 +31,10 @@ Description
#include <memory>
#include <iostream>
#include "autoPtr.H"
#include "HashPtrTable.H"
#include "refPtr.H"
#include "tmp.H"
#include "PtrMap.H"
#include "primitiveFields.H"
using namespace Foam;
@ -250,6 +253,42 @@ int main()
Info<< "Table: " << tbl << nl;
}
{
PtrMap<scalarField> fields;
{
const label patchi = 2;
scalarField fld1(patchi, 5.0);
scalarField fld2(patchi, 8.0);
// assign from tmp<>
fields.set( patchi, (fld1 * fld2));
}
{
const label patchi = 3;
scalarField fld1(patchi, 6.0);
// From tmp (clone)
fields.set(patchi, tmp<scalarField>(fld1));
}
{
const label patchi = 4;
// From refPtr
fields.set(patchi, refPtr<scalarField>::New(patchi, 10.0));
}
Info<< nl
<< "PtrMap:" << nl
<< fields << endl;
}
Info<< "\nEnd" << nl;
return 0;
}

View File

@ -1,3 +1,3 @@
EXE_INC = ${c++LESSWARN}
EXE_INC = $(c++LESSWARN)
/* EXE_LIBS = */

View File

@ -1,3 +1,3 @@
EXE_INC = ${c++LESSWARN}
EXE_INC = $(c++LESSWARN)
/* EXE_LIBS = */

View File

@ -1,3 +1,3 @@
EXE_INC = ${c++LESSWARN}
EXE_INC = $(c++LESSWARN)
/* EXE_LIBS = */

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
OTstream os;
os << poly;
ITstream is("input", std::move(os.tokens()));
ITstream is(std::move(os.tokens()));
is >> polyfunc;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,7 +27,6 @@ License
// #define Foam_autoPtr_deprecate_setMethod
#include <memory>
#include "autoPtr.H"
#include "labelList.H"
#include "ListOps.H"
@ -77,6 +76,14 @@ autoPtr<T> testNullReturn2()
}
template<class T>
struct DerivedList : public List<T>
{
// Inherit constructors
using List<T>::List;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
@ -254,6 +261,16 @@ int main(int argc, char *argv[])
// autoPtr<labelList> ptr2 = testNullReturn2<labelList>();
}
{
auto input1 = autoPtr<DerivedList<label>>::New(label(10), 1);
auto input2 = autoPtr<DerivedList<scalar>>::New(label(10), 1.0);
autoPtr<labelList> ptr1(std::move(input1));
// Does not compile: ptr1 = std::move(input2);
// Does not compile: ptr1 = autoPtr<List<scalar>>::New(label(10), 2);
}
return 0;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2021 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -46,8 +46,8 @@ int main(int argc, char *argv[])
profiling::disable(); // No profiling output
argList::noBanner();
argList::noParallel();
argList::noFunctionObjects();
argList::removeOption("case");
argList::removeOption("noFunctionObjects");
argList::addBoolOption("no-close", "Skip dlclose");
argList::addBoolOption("quiet", "Disable verbosity");

View File

@ -1,3 +1,3 @@
EXE_INC = ${c++LESSWARN}
EXE_INC = $(c++LESSWARN)
/* EXE_LIBS = */

View File

@ -1,7 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I${LIB_SRC}/finiteVolume/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteArea \

View File

@ -1,4 +1,4 @@
EXE_INC = ${COMP_OPENMP} /* -UUSE_OMP */
EXE_INC = $(COMP_OPENMP) /* -UUSE_OMP */
/* Mostly do not need to explicitly link openmp libraries */
/* EXE_LIBS = ${LINK_OPENMP} */
/* EXE_LIBS = $(LINK_OPENMP) */

View File

@ -55,7 +55,7 @@ void do_exchangeBuf
const bool wait
)
{
const label startOfRequests = Pstream::nRequests();
const label startOfRequests = UPstream::nRequests();
// Set up receives
// ~~~~~~~~~~~~~~~
@ -132,7 +132,7 @@ void do_exchangeContainer
const bool wait
)
{
const label startOfRequests = Pstream::nRequests();
const label startOfRequests = UPstream::nRequests();
// Set up receives
// ~~~~~~~~~~~~~~~

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2021 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -19,6 +19,9 @@ Description
\*---------------------------------------------------------------------------*/
#include "primitiveFields.H"
#include "autoPtr.H"
#include "refPtr.H"
#include "tmp.H"
#include "Switch.H"
using namespace Foam;
@ -29,6 +32,36 @@ struct myScalarField : public scalarField
};
template<class T>
void constructInfo()
{
Info<< " move-constructible:"
<< std::is_move_constructible<T>::value
<< " move-assignable:"
<< std::is_move_assignable<T>::value
<< " nothrow:"
<< std::is_nothrow_move_assignable<T>::value
<< " trivially:"
<< std::is_trivially_move_assignable<T>::value
<< nl;
}
template<class T>
void printInfo(const autoPtr<T>& item, const bool verbose = false)
{
Info<< "autoPtr good:" << Switch::name(item.good())
<< " addr: " << Foam::name(item.get());
constructInfo<autoPtr<T>>();
if (verbose && item)
{
Info<< "content: " << item() << nl;
}
}
template<class T>
void printInfo(const refPtr<T>& item, const bool verbose = false)
{
@ -37,15 +70,24 @@ void printInfo(const refPtr<T>& item, const bool verbose = false)
<< " addr: " << Foam::name(item.get())
<< " movable:" << Switch(item.movable());
Info<< " move-constructible:"
<< std::is_move_constructible<refPtr<T>>::value
<< " move-assignable:"
<< std::is_move_assignable<refPtr<T>>::value
<< " nothrow:"
<< std::is_nothrow_move_assignable<refPtr<T>>::value
<< " trivially:"
<< std::is_trivially_move_assignable<refPtr<T>>::value
<< nl;
constructInfo<refPtr<T>>();
if (verbose && item)
{
Info<< "content: " << item() << nl;
}
}
template<class T>
void printInfo(const tmp<T>& item, const bool verbose = false)
{
Info<< "tmp good:" << Switch::name(item.good())
<< " pointer:" << Switch::name(item.is_pointer())
<< " addr: " << Foam::name(item.get())
<< " movable:" << Switch(item.movable());
constructInfo<tmp<T>>();
if (verbose && item)
{
@ -101,6 +143,62 @@ int main()
printInfo(tfld3, true);
}
{
refPtr<scalarField> tfld1;
auto aptr = autoPtr<scalarField>::New(2, scalar(2));
tmp<scalarField> tfld2;
printInfo(tfld2, true);
tfld2 = new scalarField(10, Zero);
/*
tfld2 = aptr.get();
// tfld1.reset(aptr);
// tfld1 = std::move(aptr);
// tfld1 = aptr;
Info<< nl << "From autoPtr" << nl;
printInfo(aptr, true);
//& Info<< nl << "Construct from autoPtr" << nl;
//& // refPtr<scalarField> tfld2(autoPtr<scalarField>::New(10, scalar(2)));
//& printInfo(tfld2, true);
*/
}
{
auto aptr1 = autoPtr<labelField>::New(2, Zero);
//auto aptr1 = autoPtr<scalarField>::New(2, scalar(2));
auto aptr2 = autoPtr<scalarField>::New(2, scalar(2));
refPtr<scalarField> tfld2(std::move(aptr2));
// aptr2 = std::move(aptr1);
}
{
auto tptr1 = tmp<labelField>::New(2, Zero);
auto aptr1 = autoPtr<labelField>::New(2, Zero);
auto tfld2 = refPtr<labelField>::New(2, Zero);
// Deleted: refPtr<labelField> tfld1(aptr1);
refPtr<labelField> tfld1;
// refPtr<labelField> tfld1(std::move(tptr1));
// refPtr<labelField> tfld1(tptr1);
tfld1 = std::move(aptr1);
// tfld1.reset(aptr1);
// tfld1.reset(tfld2);
// tfld1 = std::move(tptr1);
// Does not compile: tfld1.ref(tptr1);
// Deleted: tfld1.cref(tptr1);
// Deleted: tfld1.ref(aptr1);
}
Info<< "\nEnd" << endl;
return 0;

View File

@ -126,6 +126,9 @@ int main(int argc, char *argv[])
testDivide<vector>(vectors);
//(void) compareOp<vector>()(vector::zero, vector::one);
Info<< "\nEnd\n" << endl;
return 0;

View File

@ -1,3 +0,0 @@
Test-tensorFieldFields1.C
EXE = $(FOAM_USER_APPBIN)/Test-tensorFieldFields1

View File

@ -34,21 +34,29 @@ Application
using namespace Foam;
vectorField randomVectorField(label size)
template<class Type>
tmp<Field<Type>> randomField(Random& rnd, label dim)
{
Random rnd;
auto tfld = tmp<Field<Type>>::New(dim);
auto& fld = tfld.ref();
vectorField vf(size);
forAll(vf, i)
for (Type& val : fld)
{
for (direction cmpt=0; cmpt < vector::nComponents; ++cmpt)
for (direction cmpt=0; cmpt < pTraits<Type>::nComponents; ++cmpt)
{
vf[i][cmpt] = rnd.position<label>(0, 100);
setComponent(val, cmpt) = rnd.position<label>(0, 100);
}
}
return vf;
return tfld;
}
template<class Type>
tmp<Field<Type>> randomField(label dim)
{
Random rnd;
return randomField<Type>(rnd, dim);
}
@ -251,7 +259,7 @@ int main(int argc, char *argv[])
{
Info<< nl << "vectorField" << nl;
vectorField vf1(randomVectorField(4));
vectorField vf1(randomField<vector>(4));
FixedList<scalarField, 3> cmpts(scalarField(vf1.size()));
Info<< nl

View File

@ -63,7 +63,6 @@ int main(int argc, char *argv[])
argList::addNote("Test timeSelector and TimePaths");
timeSelector::addOptions(true, true);
argList::noLibs();
argList::noFunctionObjects();
argList::addOption("relative", "PATH", "Test relativePath");

View File

@ -19,6 +19,9 @@ Description
\*---------------------------------------------------------------------------*/
#include "primitiveFields.H"
#include "autoPtr.H"
#include "refPtr.H"
#include "tmp.H"
#include "Switch.H"
using namespace Foam;
@ -126,6 +129,28 @@ int main()
printInfo(tfld2);
}
{
auto tptr1 = refPtr<labelField>::New(2, Zero);
auto aptr1 = autoPtr<labelField>::New(2, Zero);
// Deleted: tmp<labelField> tfld1(aptr1);
// tmp<labelField> tfld1(std::move(aptr1));
// tmp<labelField> tfld1(std::move(tptr1));
tmp<labelField> tfld1;
//tfld1.cref(tptr1);
//tfld1.cref(aptr1);
// refPtr<labelField> tfld1(std::move(tptr1));
// refPtr<labelField> tfld1(tptr1);
// tfld1 = std::move(aptr1);
// tfld1 = std::move(tptr1);
// Does not compile: tfld1.ref(tptr1);
// Deleted: tfld1.cref(tptr1);
// Deleted: tfld1.ref(aptr1);
}
Info<< "\nEnd" << endl;
return 0;

View File

@ -116,12 +116,16 @@ Description
{
const faPatch& p = patches[patchi];
Info<< " " << "patch " << p.index()
<< " (size: " << returnReduce(p.size(), sumOp<label>())
<< ") name: " << p.name()
<< nl;
// Report physical size (nEdges) not virtual size
Info<< " " << "patch " << p.index()
<< " (size: " << returnReduce(p.nEdges(), sumOp<label>())
<< ") name: " << p.name()
<< nl;
}
Info<< "----------------" << nl
<< "Used polyPatches: " << flatOutput(aMesh.whichPolyPatches()) << nl;
// Geometry information
Info<< nl;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -36,12 +36,17 @@ Description
{
const faPatch& p = patches[patchi];
Info<< " " << "patch " << p.index()
<< " (size: " << returnReduce(p.size(), sumOp<label>())
<< ") name: " << p.name()
<< nl;
// Report physical size (nEdges) not virtual size
Info<< " " << "patch " << p.index()
<< " (size: " << returnReduce(p.nEdges(), sumOp<label>())
<< ") name: " << p.name()
<< nl;
}
Info<< "----------------" << nl
<< "Used polyPatches: " << flatOutput(aMesh.whichPolyPatches()) << nl;
// Geometry information
Info<< nl;
{

View File

@ -226,14 +226,18 @@ int main(int argc, char *argv[])
// Add the boundary patches
const polyBoundaryMesh& patches = mesh.boundaryMesh();
List<polyPatch*> p(patches.size());
polyPatchList newPatches(patches.size());
forAll(p, patchi)
forAll(newPatches, patchi)
{
p[patchi] = patches[patchi].clone(fMesh.boundaryMesh()).ptr();
newPatches.set
(
patchi,
patches[patchi].clone(fMesh.boundaryMesh())
);
}
fMesh.addFvPatches(p);
fMesh.addFvPatches(newPatches);
// Refinement level

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -205,34 +205,43 @@ label addPatch(polyMesh& mesh, const word& patchName)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
List<polyPatch*> newPatches(patches.size() + 1);
polyPatchList newPatches(patches.size() + 1);
label nPatches = 0;
// Add empty patch as 0th entry (Note: only since subsetMesh wants this)
patchi = 0;
newPatches[patchi] =
new emptyPolyPatch
(
Foam::word(patchName),
0,
mesh.nInternalFaces(),
patchi,
patches,
emptyPolyPatch::typeName
);
forAll(patches, i)
{
const polyPatch& pp = patches[i];
newPatches.set
(
nPatches,
new emptyPolyPatch
(
patchName,
0,
mesh.nInternalFaces(),
nPatches,
patches,
emptyPolyPatch::typeName
)
);
++nPatches;
}
newPatches[i+1] =
for (const polyPatch& pp : patches)
{
newPatches.set
(
nPatches,
pp.clone
(
patches,
i+1,
nPatches,
pp.size(),
pp.start()
).ptr();
)
);
++nPatches;
}
mesh.removeBoundary();

View File

@ -1678,7 +1678,7 @@ int main(int argc, char *argv[])
label defaultPatchID = mesh.boundaryMesh().findPatchID(defaultFacesName);
if (mesh.boundaryMesh()[defaultPatchID].size() == 0)
{
List<polyPatch*> newPatchPtrList((mesh.boundaryMesh().size() - 1));
polyPatchList newPatches((mesh.boundaryMesh().size() - 1));
label newPatchi = 0;
forAll(mesh.boundaryMesh(), patchi)
{
@ -1686,18 +1686,21 @@ int main(int argc, char *argv[])
{
const polyPatch& patch = mesh.boundaryMesh()[patchi];
newPatchPtrList[newPatchi] = patch.clone
newPatches.set
(
mesh.boundaryMesh(),
newPatchi,
patch.size(),
patch.start()
).ptr();
newPatchi++;
patch.clone
(
mesh.boundaryMesh(),
newPatchi,
patch.size(),
patch.start()
)
);
++newPatchi;
}
}
repatcher.changePatches(newPatchPtrList);
repatcher.changePatches(newPatches);
}
// Set the precision of the points data to 10

View File

@ -1,30 +1,56 @@
// Handle merging of patch pairs
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2009 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
Description
Handle merging of patch pairs
\*---------------------------------------------------------------------------*/
{
wordPairList mergePatchPairs;
// Read in a list of dictionaries for the merge patch pairs
// Read in a list of merge patch pairs
if
(
meshDict.readIfPresent("mergePatchPairs", mergePatchPairs)
&& mergePatchPairs.size()
)
{
Info<< "Creating merge patch pairs" << nl << endl;
Info<< "Merging " << mergePatchPairs.size() << " patch pairs" << nl;
Info<< "Adding point and face zones" << endl;
// Cleanup
wordHashSet cleanupPatches(4*mergePatchPairs.size());
wordHashSet cleanupPointZones(2*mergePatchPairs.size());
wordHashSet cleanupFaceZones(2*mergePatchPairs.size());
Info<< " Adding point and face zones" << endl;
{
auto& pzs = mesh.pointZones();
pzs.clearAddressing();
auto& fzs = mesh.faceZones();
fzs.clearAddressing();
const auto& pbm = mesh.boundaryMesh();
auto& pzs = mesh.pointZones(); pzs.clearAddressing();
auto& fzs = mesh.faceZones(); fzs.clearAddressing();
forAll(mergePatchPairs, pairi)
{
// Patch pairs
const polyPatch& patch0 = pbm[mergePatchPairs[pairi].first()];
const polyPatch& patch1 = pbm[mergePatchPairs[pairi].second()];
const word mergeName
(
mergePatchPairs[pairi].first()
+ mergePatchPairs[pairi].second()
+ name(pairi)
+ Foam::name(pairi)
);
// An empty zone for cut points
@ -37,40 +63,35 @@
pzs
)
);
cleanupPointZones.insert(pzs.last().name());
// Master patch
const word masterPatchName(mergePatchPairs[pairi].first());
const polyPatch& masterPatch =
mesh.boundaryMesh()[masterPatchName];
// Coupling side 0 (master)
fzs.append
(
new faceZone
(
mergeName + "MasterZone",
identity(masterPatch.range()),
mergeName + "Side0Zone",
identity(patch0.range()),
false, // none are flipped
fzs.size(),
fzs
)
);
cleanupFaceZones.insert(fzs.last().name());
// Slave patch
const word slavePatchName(mergePatchPairs[pairi].second());
const polyPatch& slavePatch =
mesh.boundaryMesh()[slavePatchName];
// Coupling side 1 (slave)
fzs.append
(
new faceZone
(
mergeName + "SlaveZone",
identity(slavePatch.range()),
mergeName + "Side1Zone",
identity(patch1.range()),
false, // none are flipped
fzs.size(),
fzs
)
);
cleanupFaceZones.insert(fzs.last().name());
// An empty zone for cut faces
fzs.append
@ -82,35 +103,38 @@
fzs
)
);
} // end of all merge pairs
cleanupFaceZones.insert(fzs.last().name());
}
}
Info<< "Creating attachPolyTopoChanger" << endl;
Info<< " Merging with attachPolyTopoChanger" << endl;
attachPolyTopoChanger polyMeshAttacher(mesh);
polyMeshAttacher.setSize(mergePatchPairs.size());
polyMeshAttacher.resize(1);
forAll(mergePatchPairs, pairi)
{
cleanupPatches.insert(mergePatchPairs[pairi].first());
cleanupPatches.insert(mergePatchPairs[pairi].second());
const word mergeName
(
mergePatchPairs[pairi].first()
+ mergePatchPairs[pairi].second()
+ name(pairi)
+ Foam::name(pairi)
);
// Add the sliding interface mesh modifier
polyMeshAttacher.set
(
pairi,
0,
new slidingInterface
(
"couple" + name(pairi),
"couple" + Foam::name(pairi),
pairi,
polyMeshAttacher,
mergeName + "MasterZone",
mergeName + "SlaveZone",
mergeName + "Side0Zone",
mergeName + "Side1Zone",
mergeName + "CutPointZone",
mergeName + "CutFaceZone",
mergePatchPairs[pairi].first(),
@ -120,12 +144,135 @@
intersection::VISIBLE
)
);
polyMeshAttacher.attach(false); // Do not yet remove empty patches
}
polyMeshAttacher.attach(true);
// Re-do the boundary patches, removing empty merge patches
// but keeping any other empty patches
{
const polyBoundaryMesh& oldPatches = mesh.boundaryMesh();
polyPatchList newPatches(oldPatches.size());
label nNewPatches = 0;
wordHashSet removedPatches(cleanupPatches.capacity());
forAll(oldPatches, patchi)
{
const word& patchName = oldPatches[patchi].name();
if
(
!cleanupPatches.found(patchName)
|| returnReduceOr(oldPatches[patchi].size())
)
{
newPatches.set
(
nNewPatches,
oldPatches[patchi].clone
(
mesh.boundaryMesh(),
nNewPatches,
oldPatches[patchi].size(),
oldPatches[patchi].start()
)
);
++nNewPatches;
}
else
{
removedPatches.insert(patchName);
}
}
newPatches.resize(nNewPatches);
mesh.removeBoundary();
mesh.addPatches(newPatches);
Info<< "Removed " << removedPatches.size()
<< " empty merged patches:" << nl
<< " " << flatOutput(removedPatches.sortedToc()) << endl;
}
// Cleanup empty merged point zones
{
PtrList<pointZone>& zones = mesh.pointZones();
mesh.pointZones().clearAddressing();
wordHashSet removedZones(2*zones.size());
label nZones = 0;
forAll(zones, zonei)
{
if
(
!cleanupPointZones.found(zones[zonei].name())
|| returnReduceOr(zones[zonei].size())
)
{
zones.set(nZones, zones.release(zonei));
zones[nZones].index() = nZones; // re-index
++nZones;
}
else
{
removedZones.insert(zones[zonei].name());
}
}
zones.resize(nZones);
if (removedZones.size())
{
Info<< "Removed " << removedZones.size()
<< " empty point zones:" << nl
<< " " << flatOutput(removedZones.sortedToc()) << endl;
}
}
// Cleanup empty merged face zones
{
PtrList<faceZone>& zones = mesh.faceZones();
mesh.faceZones().clearAddressing();
wordHashSet removedZones(2*zones.size());
label nZones = 0;
forAll(zones, zonei)
{
if
(
!cleanupFaceZones.found(zones[zonei].name())
|| returnReduceOr(zones[zonei].size())
)
{
zones.set(nZones, zones.release(zonei));
zones[nZones].index() = nZones; // re-index
++nZones;
}
else
{
removedZones.insert(zones[zonei].name());
}
}
zones.resize(nZones);
if (removedZones.size())
{
Info<< "Removed " << removedZones.size()
<< " empty merged face zones:" << nl
<< " " << flatOutput(removedZones.sortedToc()) << endl;
}
}
}
else
{
Info<< nl << "There are no merge patch pairs" << endl;
Info<< "No patch pairs to merge" << endl;
}
}
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -167,28 +167,32 @@ int main(int argc, char *argv[])
);
Info<< "Constructing patches." << endl;
List<polyPatch*> patches(poly2DMesh.patchNames().size());
label countPatches = 0;
polyPatchList newPatches(poly2DMesh.patchNames().size());
label nPatches = 0;
forAll(patches, patchi)
forAll(newPatches, patchi)
{
if (poly2DMesh.patchSizes()[patchi] != 0)
{
patches[countPatches] = new polyPatch
newPatches.set
(
poly2DMesh.patchNames()[patchi],
poly2DMesh.patchSizes()[patchi],
poly2DMesh.patchStarts()[patchi],
countPatches,
pMesh.boundaryMesh(),
word::null
nPatches,
new polyPatch
(
poly2DMesh.patchNames()[patchi],
poly2DMesh.patchSizes()[patchi],
poly2DMesh.patchStarts()[patchi],
nPatches,
pMesh.boundaryMesh(),
word::null
)
);
countPatches++;
++nPatches;
}
}
patches.setSize(countPatches);
pMesh.addPatches(patches);
newPatches.resize(nPatches);
pMesh.addPatches(newPatches);
if (extrude)
{

View File

@ -191,7 +191,7 @@ int main(int argc, char *argv[])
const PtrList<boundaryPatch>& patches = bMesh.patches();
// Create new list of patches with old ones first
List<polyPatch*> newPatchPtrList(patches.size());
polyPatchList newPatches(patches.size());
newPatchi = 0;
@ -200,34 +200,41 @@ int main(int argc, char *argv[])
{
const polyPatch& patch = mesh.boundaryMesh()[patchi];
newPatchPtrList[newPatchi] =
newPatches.set
(
newPatchi,
patch.clone
(
mesh.boundaryMesh(),
newPatchi,
patch.size(),
patch.start()
).ptr();
)
);
newPatchi++;
++newPatchi;
}
// Add new ones with empty size.
for (label patchi = newPatchi; patchi < patches.size(); patchi++)
{
const boundaryPatch& bp = patches[patchi];
const word& patchName = patches[patchi].name();
newPatchPtrList[newPatchi] = polyPatch::New
newPatches.set
(
polyPatch::typeName,
bp.name(),
0,
mesh.nFaces(),
newPatchi,
mesh.boundaryMesh()
).ptr();
polyPatch::New
(
polyPatch::typeName,
patchName,
0,
mesh.nFaces(),
newPatchi,
mesh.boundaryMesh()
)
);
newPatchi++;
++newPatchi;
}
if (!overwrite)
@ -238,7 +245,7 @@ int main(int argc, char *argv[])
// Change patches
repatchPolyTopoChanger polyMeshRepatcher(mesh);
polyMeshRepatcher.changePatches(newPatchPtrList);
polyMeshRepatcher.changePatches(newPatches);
// Change face ordering

View File

@ -40,6 +40,7 @@ License
#include "vtkSurfaceWriter.H"
#include "checkTools.H"
#include "treeBoundBox.H"
#include "syncTools.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,25 +49,113 @@ void Foam::checkPatch
(
const bool allGeometry,
const word& name,
const polyMesh& mesh,
const PatchType& pp,
const labelList& meshFaces,
const labelList& meshEdges,
pointSet& points
)
{
typedef typename PatchType::surfaceTopo TopoType;
const label globalSize = returnReduce(pp.size(), sumOp<label>());
Info<< " "
<< setw(20) << name
<< setw(9) << returnReduce(pp.size(), sumOp<label>())
<< setw(9) << globalSize
<< setw(9) << returnReduce(pp.nPoints(), sumOp<label>());
if (!Pstream::parRun())
if (globalSize == 0)
{
Info<< setw(34) << "ok (empty)";
}
else if (Pstream::parRun())
{
// Parallel - use mesh edges
// - no check for point-pinch
// - no check for consistent orientation (if that is posible to
// check?)
// (see addPatchCellLayer::globalEdgeFaces)
// From mesh edge to global face labels. Non-empty sublists only for
// pp edges.
labelListList globalEdgeFaces(mesh.nEdges());
const labelListList& edgeFaces = pp.edgeFaces();
// Global numbering
const globalIndex globalFaces(mesh.nFaces());
forAll(edgeFaces, edgei)
{
label meshEdgei = meshEdges[edgei];
const labelList& eFaces = edgeFaces[edgei];
// Store face and processor as unique tag.
labelList& globalEFaces = globalEdgeFaces[meshEdgei];
globalEFaces.setSize(eFaces.size());
forAll(eFaces, i)
{
globalEFaces[i] = globalFaces.toGlobal(meshFaces[eFaces[i]]);
}
//Pout<< "At edge:" << meshEdgei
// << " ctr:" << mesh.edges()[meshEdgei].centre(mesh.points())
// << " have eFaces:" << globalEdgeFaces[meshEdgei]
// << endl;
}
//DebugVar(globalEdgeFaces);
// Synchronise across coupled edges.
syncTools::syncEdgeList
(
mesh,
globalEdgeFaces,
ListOps::uniqueEqOp<label>(),
labelList() // null value
);
//DebugVar(globalEdgeFaces);
label labelTyp = TopoType::MANIFOLD;
forAll(meshEdges, edgei)
{
const label meshEdgei = meshEdges[edgei];
const labelList& globalEFaces = globalEdgeFaces[meshEdgei];
if (globalEFaces.size() == 1)
{
//points.insert(mesh.edges()[meshEdgei]);
labelTyp = max(labelTyp, TopoType::OPEN);
}
else if (globalEFaces.size() == 0 || globalEFaces.size() > 2)
{
points.insert(mesh.edges()[meshEdgei]);
labelTyp = max(labelTyp, TopoType::ILLEGAL);
}
}
reduce(labelTyp, maxOp<label>());
if (labelTyp == TopoType::MANIFOLD)
{
Info<< setw(34) << "ok (closed singly connected)";
}
else if (labelTyp == TopoType::OPEN)
{
Info<< setw(34)
<< "ok (non-closed singly connected)";
}
else
{
Info<< setw(34)
<< "multiply connected (shared edge)";
}
}
else
{
typedef typename PatchType::surfaceTopo TopoType;
TopoType pTyp = pp.surfaceType();
if (pp.empty())
{
Info<< setw(34) << "ok (empty)";
}
else if (pTyp == TopoType::MANIFOLD)
if (pTyp == TopoType::MANIFOLD)
{
if (pp.checkPointManifold(true, &points))
{
@ -549,15 +638,8 @@ Foam::label Foam::checkTopology
);
{
if (!Pstream::parRun())
{
Info<< "\nChecking patch topology for multiply connected"
Info<< "\nChecking patch topology for multiply connected"
<< " surfaces..." << endl;
}
else
{
Info<< "\nChecking basic patch addressing..." << endl;
}
const polyBoundaryMesh& patches = mesh.boundaryMesh();
@ -566,11 +648,8 @@ Foam::label Foam::checkTopology
Info<< " "
<< setw(20) << "Patch"
<< setw(9) << "Faces"
<< setw(9) << "Points";
if (!Pstream::parRun())
{
Info<< setw(34) << "Surface topology";
}
<< setw(9) << "Points"
<< "Surface topology";
if (allGeometry)
{
Info<< " Bounding box";
@ -583,7 +662,16 @@ Foam::label Foam::checkTopology
if (!isA<processorPolyPatch>(pp))
{
checkPatch(allGeometry, pp.name(), pp, points);
checkPatch
(
allGeometry,
pp.name(),
mesh,
pp,
identity(pp.size(), pp.start()),
pp.meshEdges(),
points
);
Info<< endl;
}
}
@ -592,15 +680,8 @@ Foam::label Foam::checkTopology
}
{
if (!Pstream::parRun())
{
Info<< "\nChecking faceZone topology for multiply connected"
<< " surfaces..." << endl;
}
else
{
Info<< "\nChecking basic faceZone addressing..." << endl;
}
Info<< "\nChecking faceZone topology for multiply connected"
<< " surfaces..." << endl;
Pout.setf(ios_base::left);
@ -611,12 +692,8 @@ Foam::label Foam::checkTopology
Info<< " "
<< setw(20) << "FaceZone"
<< setw(9) << "Faces"
<< setw(9) << "Points";
if (!Pstream::parRun())
{
Info<< setw(34) << "Surface topology";
}
<< setw(9) << "Points"
<< setw(34) << "Surface topology";
if (allGeometry)
{
Info<< " Bounding box";
@ -625,7 +702,16 @@ Foam::label Foam::checkTopology
for (const faceZone& fz : faceZones)
{
checkPatch(allGeometry, fz.name(), fz(), points);
checkPatch
(
allGeometry,
fz.name(),
mesh,
fz(), // patch
fz, // mesh face labels
fz.meshEdges(), // mesh edge labels
points
);
Info<< endl;
}
}

View File

@ -1,4 +1,4 @@
#include "label.H"
#include "labelList.H"
#include "autoPtr.H"
namespace Foam
@ -14,7 +14,10 @@ namespace Foam
(
const bool allGeometry,
const word& name,
const polyMesh& mesh,
const PatchType& pp,
const labelList& meshFaces,
const labelList& meshEdges,
pointSet& points
);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -136,46 +136,55 @@ void Foam::mergePolyMesh::sortProcessorPatches()
const polyBoundaryMesh& oldPatches = boundaryMesh();
DynamicList<polyPatch*> newPatches(oldPatches.size());
polyPatchList newPatches(oldPatches.size());
labelList oldToSorted(oldPatches.size());
label nPatches = 0;
forAll(oldPatches, patchi)
{
const polyPatch& pp = oldPatches[patchi];
if (!isA<processorPolyPatch>(pp))
{
oldToSorted[patchi] = newPatches.size();
newPatches.append
newPatches.set
(
nPatches,
pp.clone
(
oldPatches,
oldToSorted[patchi],
nPatches,
0,
nInternalFaces()
).ptr()
)
);
oldToSorted[patchi] = nPatches;
++nPatches;
}
}
forAll(oldPatches, patchi)
{
const polyPatch& pp = oldPatches[patchi];
if (isA<processorPolyPatch>(pp))
{
oldToSorted[patchi] = newPatches.size();
newPatches.append
newPatches.set
(
nPatches,
pp.clone
(
oldPatches,
oldToSorted[patchi],
0,
nInternalFaces()
).ptr()
)
);
oldToSorted[patchi] = nPatches;
++nPatches;
}
}
@ -461,7 +470,7 @@ void Foam::mergePolyMesh::merge()
{
Info<< "Copying old patches" << endl;
List<polyPatch*> newPatches(patchNames_.size());
polyPatchList newPatches(patchNames_.size());
const polyBoundaryMesh& oldPatches = boundaryMesh();
@ -470,7 +479,11 @@ void Foam::mergePolyMesh::merge()
for (patchi = 0; patchi < oldPatches.size(); patchi++)
{
newPatches[patchi] = oldPatches[patchi].clone(oldPatches).ptr();
newPatches.set
(
patchi,
oldPatches[patchi].clone(oldPatches)
);
}
Info<< "Adding new patches. " << endl;
@ -487,15 +500,18 @@ void Foam::mergePolyMesh::merge()
dict.set("nFaces", 0);
dict.set("startFace", endOfLastPatch);
newPatches[patchi] =
newPatches.set
(
polyPatch::New
patchi,
(
patchNames_[patchi],
dict,
patchi,
oldPatches
).ptr()
polyPatch::New
(
patchNames_[patchi],
dict,
patchi,
oldPatches
)
)
);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017-2018 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -404,20 +404,24 @@ Foam::mirrorFvMesh::mirrorFvMesh
fvMesh& pMesh = mirrorMeshPtr_();
// Add the boundary patches
List<polyPatch*> p(newPatchSizes.size());
polyPatchList newPatches(newPatchSizes.size());
forAll(p, patchi)
forAll(newPatches, patchi)
{
p[patchi] = boundaryMesh()[patchi].clone
newPatches.set
(
pMesh.boundaryMesh(),
patchi,
newPatchSizes[patchi],
newPatchStarts[patchi]
).ptr();
boundaryMesh()[patchi].clone
(
pMesh.boundaryMesh(),
patchi,
newPatchSizes[patchi],
newPatchStarts[patchi]
)
);
}
pMesh.addPatches(p);
pMesh.addPatches(newPatches);
}

View File

@ -3,7 +3,7 @@
*/
EXE_INC = \
${COMP_FLAGS} \
$(COMP_FLAGS) \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -564,7 +564,7 @@ int main(int argc, char *argv[])
mesh.faceZones()
(
mergePatchName + "MasterZone",
mergePatchName + "Side0Zone",
true // verbose
).resetAddressing(std::move(faceIds), false);
@ -574,7 +574,7 @@ int main(int argc, char *argv[])
mesh.faceZones()
(
mergePatchName + "SlaveZone",
mergePatchName + "Side1Zone",
true // verbose
).resetAddressing(std::move(faceIds), false);
@ -595,8 +595,8 @@ int main(int argc, char *argv[])
"couple" + Foam::name(actioni),
0,
stitcher,
mergePatchName + "MasterZone",
mergePatchName + "SlaveZone",
mergePatchName + "Side0Zone",
mergePatchName + "Side1Zone",
mergePatchName + "CutPointZone",
cutZoneName,
masterPatchName,

View File

@ -62,8 +62,8 @@ Usage
-rotate-z angle
Rotate (degrees) about z-axis.
or -yawPitchRoll (yawdegrees pitchdegrees rolldegrees)
or -rollPitchYaw (rolldegrees pitchdegrees yawdegrees)
or -yawPitchRoll : (yaw pitch roll) degrees
or -rollPitchYaw : (roll pitch yaw) degrees
-scale scalar|vector
Scale the points by the given scalar or vector on output.
@ -268,15 +268,18 @@ int main(int argc, char *argv[])
);
argList::addBoolOption
(
"auto-origin",
"Use bounding box centre as origin for rotations"
"auto-centre",
"Use bounding box centre as centre for rotations"
);
argList::addOption
(
"origin",
"centre",
"point",
"Use specified <point> as origin for rotations"
"Use specified <point> as centre for rotations"
);
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
argList::addOptionCompat("centre", {"origin", 2206});
argList::addOption
(
"rotate",
@ -437,18 +440,18 @@ int main(int argc, char *argv[])
points += v;
}
vector origin;
bool useOrigin = args.readIfPresent("origin", origin);
if (args.found("auto-origin") && !useOrigin)
vector rotationCentre;
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
if (args.found("auto-centre") && !useRotationCentre)
{
useOrigin = true;
origin = boundBox(points).centre();
useRotationCentre = true;
rotationCentre = boundBox(points).centre();
}
if (useOrigin)
if (useRotationCentre)
{
Info<< "Set origin for rotations to " << origin << endl;
points -= origin;
Info<< "Set centre of rotation to " << rotationCentre << endl;
points -= rotationCentre;
}
@ -545,15 +548,15 @@ int main(int argc, char *argv[])
}
}
if (useRotationCentre)
{
Info<< "Unset centre of rotation from " << rotationCentre << endl;
points += rotationCentre;
}
// Output scaling
applyScaling(points, getScalingOpt("scale", args));
if (useOrigin)
{
Info<< "Unset origin for rotations from " << origin << endl;
points += origin;
}
// Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2021 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -65,8 +65,8 @@ int main(int argc, char *argv[])
profiling::disable(); // No profiling output
argList::noBanner();
argList::noParallel();
argList::noFunctionObjects();
argList::removeOption("case");
argList::removeOption("noFunctionObjects");
argList::addBoolOption
(
"or",

View File

@ -1014,7 +1014,9 @@ int main(int argc, char *argv[])
Time::controlDictName,
args.rootPath(),
args.caseName()
/ ("processor" + Foam::name(proci))
/ ("processor" + Foam::name(proci)),
args.allowFunctionObjects(),
args.allowLibs()
)
);
}

View File

@ -244,7 +244,9 @@ int main(int argc, char *argv[])
(
Time::controlDictName,
args.rootPath(),
args.caseName()/("processor" + Foam::name(proci))
args.caseName()/("processor" + Foam::name(proci)),
args.allowFunctionObjects(),
args.allowLibs()
)
);
}

View File

@ -731,7 +731,9 @@ int main(int argc, char *argv[])
(
Time::controlDictName,
args.rootPath(),
args.caseName()/("processor" + Foam::name(proci))
args.caseName()/("processor" + Foam::name(proci)),
args.allowFunctionObjects(),
args.allowLibs()
)
);
}
@ -1184,7 +1186,7 @@ int main(int argc, char *argv[])
false
);
masterMeshPtr = fvMeshes[0];
masterMeshPtr.cref(fvMeshes[0]);
}

View File

@ -168,7 +168,6 @@ int main(int argc, char *argv[])
// Less frequently used - reduce some clutter
argList::setAdvanced("decomposeParDict");
argList::setAdvanced("noFunctionObjects");
argList::addVerboseOption("Additional verbosity");

View File

@ -65,7 +65,7 @@ label writeDimFields
{
typedef VolumeInternalField<Type> FieldType;
const fvMesh& mesh = dynamicCast<const fvMesh>(ensMesh.mesh());
const auto& mesh = refCast<const fvMesh>(ensMesh.mesh());
label count = 0;

View File

@ -88,7 +88,7 @@ label writeVolFields
{
typedef VolumeField<Type> FieldType;
const fvMesh& mesh = dynamicCast<const fvMesh>(ensMesh.mesh());
const auto& mesh = refCast<const fvMesh>(ensMesh.mesh());
label count = 0;

View File

@ -268,7 +268,6 @@ int main(int argc, char *argv[])
// Less frequently used - reduce some clutter
argList::setAdvanced("decomposeParDict");
argList::setAdvanced("noFunctionObjects");
argList::addVerboseOption("Additional verbosity");

View File

@ -87,7 +87,6 @@ int main(int argc, char *argv[])
// Less frequently used - reduce some clutter
argList::setAdvanced("decomposeParDict");
argList::setAdvanced("noFunctionObjects");
argList::addOption
(

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -100,7 +100,9 @@ int main(int argc, char *argv[])
(
Time::controlDictName,
args.rootPath(),
args.caseName()/("processor" + Foam::name(proci))
args.caseName()/("processor" + Foam::name(proci)),
args.allowFunctionObjects(),
args.allowLibs()
)
);
}

View File

@ -43,7 +43,8 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
{
auto& fldBf = fld.boundaryFieldRef();
const UPstream::commsTypes commsType(UPstream::defaultCommsType);
const UPstream::commsTypes commsType = UPstream::defaultCommsType;
const label startOfRequests = UPstream::nRequests();
if
(
@ -51,8 +52,6 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
|| commsType == UPstream::commsTypes::nonBlocking
)
{
const label startOfRequests = UPstream::nRequests();
forAll(fldBf, patchi)
{
fvPatchField<Type>& tgtField = fldBf[patchi];
@ -68,11 +67,7 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
}
// Wait for outstanding requests
if
(
UPstream::parRun()
&& commsType == UPstream::commsTypes::nonBlocking
)
if (commsType == UPstream::commsTypes::nonBlocking)
{
UPstream::waitRequests(startOfRequests);
}

View File

@ -56,6 +56,7 @@ using namespace Foam;
int main(int argc, char *argv[])
{
// Normally without functionObjects, with -withFunctionObjects to enable
argList::noFunctionObjects(true);
// No -constant, no special treatment for 0/

View File

@ -494,6 +494,7 @@ void evaluate
int main(int argc, char *argv[])
{
// Normally without functionObjects, with -withFunctionObjects to enable
argList::noFunctionObjects(true);
// No -constant, no special treatment for 0/
@ -741,7 +742,7 @@ int main(int argc, char *argv[])
);
}
if (args.found("withFunctionObjects"))
if (args.allowFunctionObjects())
{
runTime.functionObjects().start();
}

View File

@ -1,8 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfiniteArea \
-lmeshTools \
-lgenericPatchFields

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -37,214 +38,311 @@ Description
#include "argList.H"
#include "Time.H"
#include "fvMesh.H"
#include "faMesh.H"
#include "topoSetSource.H"
#include "cellSet.H"
#include "faceSet.H"
#include "volFields.H"
#include "areaFields.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Simple tuple of field type and name (read from stream)
class fieldDescription
{
word type_;
word name_;
public:
const word& type() const noexcept { return type_; }
const word& name() const noexcept { return name_; }
explicit fieldDescription(Istream& is)
{
is >> type_;
is >> name_;
// Eg, read as "volScalarFieldValue", but change to "volScalarField"
if (type_.ends_with("Value"))
{
type_.erase(type_.size()-5);
}
}
};
// Consume unused field information
template<class Type>
bool consumeUnusedType(const fieldDescription& fieldDesc, Istream& is)
{
typedef GeometricField<Type, faPatchField, areaMesh> fieldType1;
typedef GeometricField<Type, fvPatchField, volMesh> fieldType2;
//? typedef GeometricField<Type, faePatchField, areaMesh> fieldType3;
//? typedef GeometricField<Type, fvsPatchField, volMesh> fieldType4;
if
(
fieldDesc.type() == fieldType1::typeName
|| fieldDesc.type() == fieldType2::typeName
)
{
(void) pTraits<Type>(is);
return true;
}
return false;
}
// Consume unused field information
static bool consumeUnused(const fieldDescription& fieldDesc, Istream& is)
{
return
(
consumeUnusedType<scalar>(fieldDesc, is)
|| consumeUnusedType<vector>(fieldDesc, is)
|| consumeUnusedType<sphericalTensor>(fieldDesc, is)
|| consumeUnusedType<symmTensor>(fieldDesc, is)
|| consumeUnusedType<tensor>(fieldDesc, is)
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Setting volume fields
template<class Type>
bool setCellFieldType
(
const word& fieldTypeDesc,
const fieldDescription& fieldDesc,
const fvMesh& mesh,
const labelList& selectedCells,
Istream& fieldValueStream
Istream& is
)
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
if (fieldTypeDesc != fieldType::typeName + "Value")
if (fieldDesc.type() != fieldType::typeName)
{
return false;
}
word fieldName(fieldValueStream);
// Get value from stream
const Type fieldValue = pTraits<Type>(is);
// Check the current time directory
IOobject fieldHeader
(
fieldName,
mesh.time().timeName(),
mesh,
fieldDesc.name(),
mesh.thisDb().time().timeName(),
mesh.thisDb(),
IOobject::MUST_READ
);
// Check the "constant" directory
if (!fieldHeader.typeHeaderOk<fieldType>(true))
bool found = fieldHeader.typeHeaderOk<fieldType>(true);
if (!found)
{
// Fallback to "constant" directory
fieldHeader = IOobject
(
fieldName,
mesh.time().constant(),
mesh,
fieldDesc.name(),
mesh.thisDb().time().constant(),
mesh.thisDb(),
IOobject::MUST_READ
);
found = fieldHeader.typeHeaderOk<fieldType>(true);
}
// Check field exists
if (fieldHeader.typeHeaderOk<fieldType>(true))
// Field exists
if (found)
{
Info<< " Setting internal values of "
Info<< " - set internal values of "
<< fieldHeader.headerClassName()
<< " " << fieldName << endl;
<< ": " << fieldDesc.name()
<< " = " << fieldValue << endl;
fieldType field(fieldHeader, mesh, false);
const Type value = pTraits<Type>(fieldValueStream);
if (selectedCells.size() == field.size())
if (isNull(selectedCells) || selectedCells.size() == field.size())
{
field.primitiveFieldRef() = value;
field.primitiveFieldRef() = fieldValue;
}
else
{
forAll(selectedCells, celli)
for (const label celli : selectedCells)
{
field[selectedCells[celli]] = value;
field[celli] = fieldValue;
}
}
typename GeometricField<Type, fvPatchField, volMesh>::
Boundary& fieldBf = field.boundaryFieldRef();
forAll(field.boundaryField(), patchi)
// Make boundary fields consistent - treat like zeroGradient
for (auto& pfld : field.boundaryFieldRef())
{
fieldBf[patchi] = fieldBf[patchi].patchInternalField();
pfld = pfld.patchInternalField();
}
if (!field.write())
{
FatalErrorInFunction
<< "Failed writing field " << fieldName << endl;
<< "Failed writing field " << field.name() << endl;
}
}
else
{
WarningInFunction
<< "Field " << fieldName << " not found" << endl;
// Consume value
(void)pTraits<Type>(fieldValueStream);
Warning
<< "Field " << fieldDesc.name() << " not found" << endl;
}
return true;
}
class setCellField
{
public:
setCellField()
{}
autoPtr<setCellField> clone() const
{
return autoPtr<setCellField>::New();
}
class iNew
{
const fvMesh& mesh_;
const labelList& selectedCells_;
public:
iNew(const fvMesh& mesh, const labelList& selectedCells)
:
mesh_(mesh),
selectedCells_(selectedCells)
{}
iNew(const fvMesh& mesh, labelList&& selectedCells)
:
mesh_(mesh),
selectedCells_(std::move(selectedCells))
{}
autoPtr<setCellField> operator()(Istream& fieldValues) const
{
word fieldType(fieldValues);
if
(
!(
setCellFieldType<scalar>
(fieldType, mesh_, selectedCells_, fieldValues)
|| setCellFieldType<vector>
(fieldType, mesh_, selectedCells_, fieldValues)
|| setCellFieldType<sphericalTensor>
(fieldType, mesh_, selectedCells_, fieldValues)
|| setCellFieldType<symmTensor>
(fieldType, mesh_, selectedCells_, fieldValues)
|| setCellFieldType<tensor>
(fieldType, mesh_, selectedCells_, fieldValues)
)
)
{
WarningInFunction
<< "field type " << fieldType << " not currently supported"
<< endl;
}
return autoPtr<setCellField>::New();
}
};
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Setting finite-area face fields
template<class Type>
bool setFaceFieldType
bool setAreaFieldType
(
const word& fieldTypeDesc,
const fvMesh& mesh,
const fieldDescription& fieldDesc,
const faMesh& mesh,
const labelList& selectedFaces,
Istream& fieldValueStream
Istream& is
)
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
typedef GeometricField<Type, faPatchField, areaMesh> fieldType;
if (fieldTypeDesc != fieldType::typeName + "Value")
if (fieldDesc.type() != fieldType::typeName)
{
return false;
}
word fieldName(fieldValueStream);
// Get value from stream
const Type fieldValue = pTraits<Type>(is);
// Check the current time directory
IOobject fieldHeader
(
fieldName,
mesh.time().timeName(),
mesh,
fieldDesc.name(),
mesh.thisDb().time().timeName(),
mesh.thisDb(),
IOobject::MUST_READ
);
// Check the "constant" directory
if (!fieldHeader.typeHeaderOk<fieldType>(true))
bool found = fieldHeader.typeHeaderOk<fieldType>(true);
if (!found)
{
// Fallback to "constant" directory
fieldHeader = IOobject
(
fieldName,
mesh.time().constant(),
mesh,
fieldDesc.name(),
mesh.thisDb().time().constant(),
mesh.thisDb(),
IOobject::MUST_READ
);
found = fieldHeader.typeHeaderOk<fieldType>(true);
}
// Check field exists
if (fieldHeader.typeHeaderOk<fieldType>(true))
// Field exists
if (found)
{
Info<< " Setting patchField values of "
Info<< " - set internal values of "
<< fieldHeader.headerClassName()
<< " " << fieldName << endl;
<< ": " << fieldDesc.name()
<< " = " << fieldValue << endl;
fieldType field(fieldHeader, mesh);
const Type value = pTraits<Type>(fieldValueStream);
if (isNull(selectedFaces) || selectedFaces.size() == field.size())
{
field.primitiveFieldRef() = fieldValue;
}
else
{
for (const label facei : selectedFaces)
{
field[facei] = fieldValue;
}
}
if (!field.write())
{
FatalErrorInFunction
<< "Failed writing field " << field.name() << endl;
}
}
else
{
Warning
<< "Field " << fieldDesc.name() << " not found" << endl;
}
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Setting volume boundary fields
template<class Type>
bool setFaceFieldType
(
const fieldDescription& fieldDesc,
const fvMesh& mesh,
const labelList& selectedFaces,
Istream& is
)
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
if (fieldDesc.type() != fieldType::typeName)
{
return false;
}
// Get value from stream
const Type fieldValue = pTraits<Type>(is);
// Check the current time directory
IOobject fieldHeader
(
fieldDesc.name(),
mesh.thisDb().time().timeName(),
mesh.thisDb(),
IOobject::MUST_READ
);
bool found = fieldHeader.typeHeaderOk<fieldType>(true);
if (!found)
{
// Fallback to "constant" directory
fieldHeader = IOobject
(
fieldDesc.name(),
mesh.thisDb().time().constant(),
mesh.thisDb(),
IOobject::MUST_READ
);
found = fieldHeader.typeHeaderOk<fieldType>(true);
}
// Field exists
if (found)
{
Info<< " - set boundary values of "
<< fieldHeader.headerClassName()
<< ": " << fieldDesc.name()
<< " = " << fieldValue << endl;
fieldType field(fieldHeader, mesh);
// Create flat list of selected faces and their value.
Field<Type> allBoundaryValues(mesh.nBoundaryFaces());
@ -260,34 +358,47 @@ bool setFaceFieldType
}
// Override
bool hasWarned = false;
unsigned hasWarned = 0;
labelList nChanged
(
returnReduce(field.boundaryField().size(), maxOp<label>()),
0
Zero
);
forAll(selectedFaces, i)
for (const label facei : selectedFaces)
{
label facei = selectedFaces[i];
if (mesh.isInternalFace(facei))
const label bFacei = facei-mesh.nInternalFaces();
if (bFacei < 0)
{
if (!hasWarned)
if (!(hasWarned & 1))
{
hasWarned = true;
hasWarned |= 1;
WarningInFunction
<< "Ignoring internal face " << facei
<< ". Suppressing further warnings." << endl;
}
}
else if (bFacei >= mesh.nBoundaryFaces())
{
if (!(hasWarned & 2))
{
hasWarned |= 2;
WarningInFunction
<< "Ignoring out-of-range face " << facei
<< ". Suppressing further warnings." << endl;
}
}
else
{
label bFacei = facei-mesh.nInternalFaces();
allBoundaryValues[bFacei] = value;
nChanged[mesh.boundaryMesh().patchID()[bFacei]]++;
label patchi = mesh.boundaryMesh().patchID()[bFacei];
allBoundaryValues[bFacei] = fieldValue;
++nChanged[patchi];
}
}
Pstream::listCombineAllGather(nChanged, plusEqOp<label>());
Pstream::listCombineReduce(nChanged, plusEqOp<label>());
auto& fieldBf = field.boundaryFieldRef();
@ -299,6 +410,7 @@ bool setFaceFieldType
Info<< " On patch "
<< field.boundaryField()[patchi].patch().name()
<< " set " << nChanged[patchi] << " values" << endl;
fieldBf[patchi] == SubField<Type>
(
allBoundaryValues,
@ -312,85 +424,222 @@ bool setFaceFieldType
if (!field.write())
{
FatalErrorInFunction
<< "Failed writing field " << field.name() << exit(FatalError);
<< "Failed writing field " << field.name() << endl;
}
}
else
{
WarningInFunction
<< "Field " << fieldName << " not found" << endl;
// Consume value
(void)pTraits<Type>(fieldValueStream);
Warning
<< "Field " << fieldDesc.name() << " not found" << endl;
}
return true;
}
class setFaceField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Dispatcher for setting volume fields
struct setCellField
{
autoPtr<setCellField> clone() const { return nullptr; } // placeholder
public:
setFaceField()
{}
autoPtr<setFaceField> clone() const
static bool apply
(
const fieldDescription& fieldDesc,
const fvMesh& m,
const labelList& selectedCells,
Istream& is
)
{
return autoPtr<setFaceField>::New();
return
(
setCellFieldType<scalar>(fieldDesc, m, selectedCells, is)
|| setCellFieldType<vector>(fieldDesc, m, selectedCells, is)
|| setCellFieldType<sphericalTensor>(fieldDesc, m, selectedCells, is)
|| setCellFieldType<symmTensor>(fieldDesc, m, selectedCells, is)
|| setCellFieldType<tensor>(fieldDesc, m, selectedCells, is)
);
}
class iNew
{
const fvMesh& mesh_;
const labelList& selectedFaces_;
const labelList& selected_;
public:
iNew(const fvMesh& mesh, const labelList& selectedCells)
:
mesh_(mesh),
selected_(selectedCells)
{}
autoPtr<setCellField> operator()(Istream& is) const
{
const fieldDescription fieldDesc(is);
bool ok = setCellField::apply(fieldDesc, mesh_, selected_, is);
if (!ok)
{
ok = consumeUnused(fieldDesc, is);
if (ok)
{
// Not meant for us
Info<< "Skip " << fieldDesc.type()
<< " for finite-volume" << nl;
}
else
{
WarningInFunction
<< "Unsupported field type: "
<< fieldDesc.type() << endl;
}
}
return nullptr; // Irrelevant return value
}
};
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Dispatcher for setting volume boundary fields
struct setFaceField
{
autoPtr<setFaceField> clone() const { return nullptr; } // placeholder
static bool apply
(
const fieldDescription& fieldDesc,
const fvMesh& m,
const labelList& selectedFaces,
Istream& is
)
{
return
(
setFaceFieldType<scalar>(fieldDesc, m, selectedFaces, is)
|| setFaceFieldType<vector>(fieldDesc, m, selectedFaces, is)
|| setFaceFieldType<sphericalTensor>(fieldDesc, m, selectedFaces, is)
|| setFaceFieldType<symmTensor>(fieldDesc, m, selectedFaces, is)
|| setFaceFieldType<tensor>(fieldDesc, m, selectedFaces, is)
);
}
class iNew
{
const fvMesh& mesh_;
const labelList& selected_;
public:
iNew(const fvMesh& mesh, const labelList& selectedFaces)
:
mesh_(mesh),
selectedFaces_(selectedFaces)
selected_(selectedFaces)
{}
iNew(const fvMesh& mesh, labelList&& selectedFaces)
:
mesh_(mesh),
selectedFaces_(std::move(selectedFaces))
{}
autoPtr<setFaceField> operator()(Istream& fieldValues) const
autoPtr<setFaceField> operator()(Istream& is) const
{
word fieldType(fieldValues);
const fieldDescription fieldDesc(is);
if
(
!(
setFaceFieldType<scalar>
(fieldType, mesh_, selectedFaces_, fieldValues)
|| setFaceFieldType<vector>
(fieldType, mesh_, selectedFaces_, fieldValues)
|| setFaceFieldType<sphericalTensor>
(fieldType, mesh_, selectedFaces_, fieldValues)
|| setFaceFieldType<symmTensor>
(fieldType, mesh_, selectedFaces_, fieldValues)
|| setFaceFieldType<tensor>
(fieldType, mesh_, selectedFaces_, fieldValues)
)
)
bool ok = setFaceField::apply(fieldDesc, mesh_, selected_, is);
if (!ok)
{
WarningInFunction
<< "field type " << fieldType << " not currently supported"
<< endl;
ok = consumeUnused(fieldDesc, is);
if (ok)
{
// Not meant for us
Info<< "Skip " << fieldDesc.type()
<< " for finite-volume" << nl;
}
else
{
WarningInFunction
<< "Unsupported field type: "
<< fieldDesc.type() << endl;
}
}
return autoPtr<setFaceField>::New();
return nullptr; // Irrelevant return value
}
};
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Dispatcher for setting area face fields
struct setAreaField
{
autoPtr<setAreaField> clone() const { return nullptr; } // placeholder
static bool apply
(
const fieldDescription& fieldDesc,
const faMesh& m,
const labelList& selectedFaces,
Istream& is
)
{
return
(
setAreaFieldType<scalar>(fieldDesc, m, selectedFaces, is)
|| setAreaFieldType<vector>(fieldDesc, m, selectedFaces, is)
|| setAreaFieldType<sphericalTensor>(fieldDesc, m, selectedFaces, is)
|| setAreaFieldType<symmTensor>(fieldDesc, m, selectedFaces, is)
|| setAreaFieldType<tensor>(fieldDesc, m, selectedFaces, is)
);
}
class iNew
{
const faMesh& mesh_;
const labelList& selected_;
public:
iNew(const faMesh& mesh, const labelList& selectedFaces)
:
mesh_(mesh),
selected_(selectedFaces)
{}
autoPtr<setAreaField> operator()(Istream& is) const
{
const fieldDescription fieldDesc(is);
bool ok = setAreaField::apply(fieldDesc, mesh_, selected_, is);
if (!ok)
{
ok = consumeUnused(fieldDesc, is);
if (ok)
{
// Not meant for us
Info<< "Skip " << fieldDesc.type()
<< " for finite-volume" << nl;
}
else
{
WarningInFunction
<< "Unsupported field type: "
<< fieldDesc.type() << endl;
}
}
return nullptr; // Irrelevant return value
}
};
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -403,11 +652,28 @@ int main(int argc, char *argv[])
argList::addOption("dict", "file", "Alternative setFieldsDict");
argList::addBoolOption
(
"no-finite-area",
"Suppress handling of finite-area mesh/fields"
);
#include "addRegionOption.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createNamedMesh.H"
autoPtr<faMesh> faMeshPtr;
if (!args.found("no-finite-area"))
{
faMeshPtr = faMesh::TryNew(mesh);
}
if (faMeshPtr)
{
Info<< "Detected finite-area mesh" << nl;
}
const word dictName("setFieldsDict");
#include "setSystemMeshDictionaryIO.H"
@ -415,70 +681,144 @@ int main(int argc, char *argv[])
IOdictionary setFieldsDict(dictIO);
if (setFieldsDict.found("defaultFieldValues"))
// Note.
// The PtrList + iNew mechanism is used to trigger the callbacks
// and perform the desired actions. The contents of the PtrList
// itself are actually irrelevant.
// Default field values
{
Info<< "Setting field default values" << endl;
PtrList<setCellField> defaultFieldValues
(
setFieldsDict.lookup("defaultFieldValues"),
setCellField::iNew(mesh, labelList(mesh.nCells()))
);
Info<< endl;
const entry* eptr =
setFieldsDict.findEntry("defaultFieldValues", keyType::LITERAL);
if (eptr)
{
ITstream& is = eptr->stream();
Info<< "Setting volume field default values" << endl;
PtrList<setCellField> defaultFieldValues
(
is,
setCellField::iNew(mesh, labelList::null())
);
if (faMeshPtr)
{
const faMesh& areaMesh = faMeshPtr();
is.rewind();
Info<< "Setting area field default values" << endl;
PtrList<setAreaField> defaultFieldValues
(
is,
setAreaField::iNew(areaMesh, labelList::null())
);
}
Info<< endl;
}
}
Info<< "Setting field region values" << endl;
Info<< "Setting field region values" << nl << endl;
PtrList<entry> regions(setFieldsDict.lookup("regions"));
forAll(regions, regionI)
for (const entry& region : regions)
{
const entry& region = regions[regionI];
autoPtr<topoSetSource> source =
topoSetSource::New(region.keyword(), mesh, region.dict());
if (source().setType() == topoSetSource::CELLSET_SOURCE)
{
cellSet selectedCellSet
cellSet subset
(
mesh,
"cellSet",
mesh.nCells()/10+1 // Reasonable size estimate.
);
source->applyToSet
(
topoSetSource::NEW,
selectedCellSet
);
source->applyToSet(topoSetSource::NEW, subset);
labelList selectedCells(subset.sortedToc());
Info<< " Selected "
<< returnReduce(selectedCells.size(), sumOp<label>())
<< '/'
<< returnReduce(mesh.nCells(), sumOp<label>())
<< " cells" << nl;
ITstream& is = region.dict().lookup("fieldValues");
PtrList<setCellField> fieldValues
(
region.dict().lookup("fieldValues"),
setCellField::iNew(mesh, selectedCellSet.sortedToc())
is,
setCellField::iNew(mesh, selectedCells)
);
}
else if (source().setType() == topoSetSource::FACESET_SOURCE)
{
faceSet selectedFaceSet
faceSet subset
(
mesh,
"faceSet",
mesh.nBoundaryFaces()/10+1
);
source->applyToSet
(
topoSetSource::NEW,
selectedFaceSet
);
source->applyToSet(topoSetSource::NEW, subset);
labelList selectedFaces(subset.sortedToc());
Info<< " Selected " << selectedFaces.size()
<< " faces" << nl;
ITstream& is = region.dict().lookup("fieldValues");
PtrList<setFaceField> fieldValues
(
region.dict().lookup("fieldValues"),
setFaceField::iNew(mesh, selectedFaceSet.sortedToc())
is,
setFaceField::iNew(mesh, selectedFaces)
);
if (faMeshPtr)
{
const faMesh& areaMesh = faMeshPtr();
const labelUList& faceLabels = areaMesh.faceLabels();
// Transcribe from mesh faces to finite-area addressing
labelList areaFaces(faceLabels.size());
label nUsed = 0;
forAll(faceLabels, facei)
{
const label meshFacei = faceLabels[facei];
if (subset.test(meshFacei))
{
areaFaces[nUsed] = facei;
++nUsed;
}
}
areaFaces.resize(nUsed);
Info<< " Selected "
<< returnReduce(areaFaces.size(), sumOp<label>())
<< '/'
<< returnReduce(faceLabels.size(), sumOp<label>())
<< " area faces" << nl;
is.rewind();
PtrList<setAreaField> fieldValues
(
is,
setAreaField::iNew(areaMesh, areaFaces)
);
}
}
}

View File

@ -109,6 +109,7 @@ Note
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "processorFvPatchField.H"
#include "wallFvPatch.H"
#include "fixedValueFvPatchFields.H"
@ -122,6 +123,40 @@ void InfoField(const word& fldName)
}
template<class Type>
void correctProcessorPatches
(
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
if (!Pstream::parRun())
{
return;
}
// Not possible to use correctBoundaryConditions on fields as they may
// use local info as opposed to the constraint values employed here,
// but still need to update processor patches
auto& bf = vf.boundaryFieldRef();
forAll(bf, patchi)
{
if (isA<processorFvPatchField<Type>>(bf[patchi]))
{
bf[patchi].initEvaluate();
}
}
forAll(bf, patchi)
{
if (isA<processorFvPatchField<Type>>(bf[patchi]))
{
bf[patchi].evaluate();
}
}
}
IOobject createIOobject
(
const fvMesh& mesh,
@ -447,22 +482,26 @@ int main(int argc, char *argv[])
// (M:Eq. 9)
const dimensionedScalar maxU(dimVelocity, SMALL);
U *= min(scalar(1), fRei*uTau/max(mag(U), maxU));
correctProcessorPatches<vector>(U);
}
if (tepsilon.valid())
{
tepsilon.ref() = epsilon;
correctProcessorPatches<scalar>(tepsilon.ref());
}
if (tk.valid())
{
tk.ref() = k;
correctProcessorPatches<scalar>(tk.ref());
}
if (tomega.valid())
{
const dimensionedScalar k0(sqr(dimLength/dimTime), SMALL);
tomega.ref() = Cmu*epsilon/(k + k0);
correctProcessorPatches<scalar>(tomega.ref());
}
if (tR.valid())
@ -475,6 +514,7 @@ int main(int argc, char *argv[])
{
R[celli] = Rdiag[celli];
}
correctProcessorPatches<symmTensor>(R);
}

View File

@ -1062,7 +1062,12 @@ int main(int argc, char *argv[])
}
}
scalar err = (F2LIij-oldEToeInt)/F2LIij;
const scalar err
(
mag(F2LIij) > ROOTVSMALL
? (F2LIij-oldEToeInt)/F2LIij
: 0
);
if
(

View File

@ -120,7 +120,6 @@ int main(int argc, char *argv[])
// Less frequently used - reduce some clutter
argList::setAdvanced("decomposeParDict");
argList::setAdvanced("noFunctionObjects");
argList::addArgument("output", "The output surface file");

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020-2021 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -58,7 +58,7 @@ label addPatch(polyMesh& mesh, const word& patchName)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
List<polyPatch*> newPatches(patches.size() + 1);
polyPatchList newPatches(patches.size() + 1);
patchi = 0;
@ -67,20 +67,25 @@ label addPatch(polyMesh& mesh, const word& patchName)
{
const polyPatch& pp = patches[i];
newPatches[patchi] =
newPatches.set
(
patchi,
pp.clone
(
patches,
patchi,
pp.size(),
pp.start()
).ptr();
)
);
patchi++;
}
// Add zero-sized patch
newPatches[patchi] =
newPatches.set
(
patchi,
new polyPatch
(
patchName,
@ -89,7 +94,8 @@ label addPatch(polyMesh& mesh, const word& patchName)
patchi,
patches,
polyPatch::typeName
);
)
);
mesh.removeBoundary();
mesh.addPatches(newPatches);

View File

@ -188,15 +188,18 @@ int main(int argc, char *argv[])
);
argList::addBoolOption
(
"auto-origin",
"Use bounding box centre as origin for rotations"
"auto-centre",
"Use bounding box centre as centre for rotations"
);
argList::addOption
(
"origin",
"centre",
"point",
"Use specified <point> as origin for rotations"
"Use specified <point> as centre for rotations"
);
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
argList::addOptionCompat("centre", {"origin", 2206});
argList::addOption
(
"rotate",
@ -352,18 +355,18 @@ int main(int argc, char *argv[])
points += v;
}
vector origin;
bool useOrigin = args.readIfPresent("origin", origin);
if (args.found("auto-origin") && !useOrigin)
vector rotationCentre;
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
if (args.found("auto-centre") && !useRotationCentre)
{
useOrigin = true;
origin = boundBox(points).centre();
useRotationCentre = true;
rotationCentre = boundBox(points).centre();
}
if (useOrigin)
if (useRotationCentre)
{
Info<< "Set origin for rotations to " << origin << endl;
points -= origin;
Info<< "Set centre of rotation to " << rotationCentre << endl;
points -= rotationCentre;
}
@ -455,15 +458,15 @@ int main(int argc, char *argv[])
transform(points, rot, points);
}
if (useRotationCentre)
{
Info<< "Unset centre of rotation from " << rotationCentre << endl;
points += rotationCentre;
}
// Output scaling
applyScaling(points, getScalingOpt("write-scale", args));
if (useOrigin)
{
Info<< "Unset origin for rotations from " << origin << endl;
points += origin;
}
surf1.movePoints(points);
surf1.write(exportName, writeFileType);

View File

@ -7,7 +7,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2017-2021 OpenCFD Ltd.
# Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -48,26 +48,29 @@
# - Similarly for c-shell
# eval `foamCleanPath -csh-path dir1:dir2`
#
# For library paths, it is suggested to use -sh-lib, or -csh-lib.
# The will use DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH on Darwin.
# For library paths, it is suggested to use -sh-lib, -env=-lib etc.
#
# On Darwin it uses FOAM_LD_LIBRARY_PATH instead of LD_LIBRARY_PATH.
# This should actually be DYLD_LIBRARY_PATH on Darwin, but setting that
# or LD_LIBRARY_PATH via a shell-script is disallowed when SIP is active.
#
#------------------------------------------------------------------------------
printHelp() {
cat<<USAGE
Usage: foamCleanPath [OPTION] ENV [filter] .. [filter]
Usage: foamCleanPath [OPTION] ENVNAME [filter] .. [filter]
foamCleanPath [OPTION] -env=name [filter] .. [filter]
options:
-env=NAME Evaluate NAME to obtain initial content,
Accepts "-env=-path", "-env=-lib" shortcuts for PATH
and LD_LIBRARY_PATH (DYLD_LIBRARY_PATH on Darwin)
and LD_LIBRARY_PATH (FOAM_LD_LIBRARY_PATH on Darwin)
-sh=NAME Produce 'NAME=...' output for sh eval
-csh=NAME Produce 'setenv NAME ...' output for csh eval
-sh-env=NAME Same as -sh=NAME -env=NAME
-csh-env=NAME Same as -csh=NAME -env=NAME
-sh-path | -csh-path Same as -[c]sh-env=PATH
-sh-lib | -csh-lib Same as -[c]sh-env=LD_LIBRARY_PATH
or DYLD_LIBRARY_PATH on Darwin
(FOAM_LD_LIBRARY_PATH on Darwin)
-debug Print debug information to stderr
-strip Remove inaccessible directories
-verbose Report some progress (input, output, ...)
@ -81,7 +84,7 @@ Prints its argument (which should be a ':' separated list) cleansed from
Exit status
0 on success
1 general error
2 initial value of 'path' is empty
2 initial value of ENVNAME is empty
USAGE
exit 0 # A clean exit
@ -103,63 +106,69 @@ die()
#-------------------------------------------------------------------------------
# Input and outputs
unset dirList shellOutput shellFlavour
unset dirList shellFlavour shellOutput
unset optDebug optEnvName optStrip optVerbose
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*)
(-h | -help*)
printHelp
;;
-env=*)
name="${1#*=}"
[ -n "$name" ] || die "Option '$1' missing an ENVNAME"
# Accept aliases
case "$name" in
(-path) name='PATH';;
(-lib)
case "$(uname -s 2>/dev/null)" in
(Darwin) name='DYLD_LIBRARY_PATH';;
(*) name='LD_LIBRARY_PATH';;
esac
(-csh-lib | -csh-path | -sh-lib | -sh-path)
shellFlavour="$1"
case "$1" in
(*-lib)
name='LD_LIBRARY_PATH'
if [ "$(uname -s 2>/dev/null)" = Darwin ]
then
name='FOAM_LD_LIBRARY_PATH' # Shadow DYLD_LIBRARY_PATH
fi
;;
(*-path)
name='PATH'
;;
esac
optEnvName="$name" # Use for input evaluation
;;
-csh-path | -sh-path)
shellFlavour="$1"
name='PATH'
optEnvName="$name" # Use for input evaluation
shellOutput="$name" # Use for output
;;
-csh-lib | -sh-lib)
shellFlavour="$1"
case "$(uname -s 2>/dev/null)" in
(Darwin) name='DYLD_LIBRARY_PATH';;
(*) name='LD_LIBRARY_PATH';;
esac
optEnvName="$name" # Use for input evaluation
shellOutput="$name" # Use for output
;;
-csh=* | -sh=* | -csh-env=* | -sh-env=*)
(-env=*)
name="${1#*=}"
[ -n "$name" ] || die "Option '$1' missing an ENVNAME"
# Handle (-lib | -path) aliases
case "$1" in
(*=-lib)
name='LD_LIBRARY_PATH'
if [ "$(uname -s 2>/dev/null)" = Darwin ]
then
name='FOAM_LD_LIBRARY_PATH' # Shadow DYLD_LIBRARY_PATH
fi
;;
(*=-path)
name='PATH'
;;
esac
optEnvName="$name" # Use for input evaluation
;;
(-csh=* | -csh-env=* | -sh=* | -sh-env=*)
shellFlavour="$1"
name="${1#*=}"
[ -n "$name" ] || die "Option '$1' missing an ENVNAME"
# Accept aliases
case "$name" in
(-path) name='PATH';;
(-lib)
case "$(uname -s 2>/dev/null)" in
(Darwin) name='DYLD_LIBRARY_PATH';;
(*) name='LD_LIBRARY_PATH';;
esac
# Handle (-lib | -path) aliases
case "$1" in
(*=-lib)
name='LD_LIBRARY_PATH'
if [ "$(uname -s 2>/dev/null)" = Darwin ]
then
name='FOAM_LD_LIBRARY_PATH' # Shadow DYLD_LIBRARY_PATH
fi
;;
(*=-path)
name='PATH'
;;
esac
shellOutput="$name" # Use for output
@ -167,16 +176,16 @@ do
case "$1" in (*-env=*) optEnvName="$name";; esac
;;
-debug)
(-debug)
optDebug=true
;;
-strip)
(-strip)
optStrip=true
;;
-verbose)
(-verbose)
optVerbose=true
;;
*)
(*)
break
;;
esac

View File

@ -26,9 +26,9 @@
[ -d "$FOAM_TUTORIALS" ] || echo "No OpenFOAM tutorials? : $FOAM_TUTORIALS" 1>&2
# Darwin workaround - SIP clearing DYLD_LIBRARY_PATH variable
if [ -n "$FOAM_DYLD_LIBRARY_PATH" ] && [ -z "$DYLD_LIBRARY_PATH" ]
if [ -n "$FOAM_LD_LIBRARY_PATH" ] && [ -z "$DYLD_LIBRARY_PATH" ]
then
export DYLD_LIBRARY_PATH="$FOAM_DYLD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH="$FOAM_LD_LIBRARY_PATH"
fi

View File

@ -49,8 +49,8 @@ then
foamClean="$WM_PROJECT_DIR/bin/foamCleanPath"
if [ -x "$foamClean" ]
then
cleaned=$($foamClean "$PATH" "$foamOldDirs") && PATH="$cleaned"
cleaned=$($foamClean "$LD_LIBRARY_PATH" "$foamOldDirs") \
cleaned=$($foamClean -env=PATH "$foamOldDirs") && PATH="$cleaned"
cleaned=$($foamClean -env=LD_LIBRARY_PATH "$foamOldDirs") \
&& LD_LIBRARY_PATH="$cleaned"
fi

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2017-2020 OpenCFD Ltd.
# Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -49,8 +49,8 @@ then
foamClean="$WM_PROJECT_DIR/bin/foamCleanPath"
if [ -x "$foamClean" ]
then
cleaned=$($foamClean "$PATH" "$foamOldDirs") && PATH="$cleaned"
cleaned=$($foamClean "$LD_LIBRARY_PATH" "$foamOldDirs") \
cleaned=$($foamClean -env=PATH "$foamOldDirs") && PATH="$cleaned"
cleaned=$($foamClean -env=LD_LIBRARY_PATH "$foamOldDirs") \
&& LD_LIBRARY_PATH="$cleaned"
fi

View File

@ -79,7 +79,7 @@ export WM_PRECISION_OPTION=DP
export WM_LABEL_SIZE=32
# [WM_COMPILE_OPTION] - Optimised(default), debug, profiling, other:
# = Opt | Debug | Prof
# = Opt | Dbg | Debug | Prof
export WM_COMPILE_OPTION=Opt
# [WM_COMPILE_CONTROL] - additional control for compiler rules

View File

@ -564,7 +564,10 @@ snapControls
// multiRegionFeatureSnap) have the other points follow these points
// instead of having their own independent movement, i.e. have snapping
// to multi-region edges/points take priority. This might aid snapping
// to sharp edges that are also region edges. The default is false.
// to sharp edges that are also region edges. The default is false
// since it might also introduce problems - at morphing the patching
// might still be wrong so points get 'released' instead of behaving
// as any other point.
//releasePoints true;
//- Walk along feature edges, adding missing ones. Default is true.
//stringFeatures false;

View File

@ -67,12 +67,14 @@ minVolRatio 0.01;
// for Fluent compatibility
minTriangleTwist -1;
//- If >0 : preserve cells with all points on the surface if the
// resulting volume after snapping (by approximation) is larger than
// minVolCollapseRatio times old volume (i.e. not collapsed to flat cell).
// If <0 : delete always.
//minVolCollapseRatio 0.1;
//- Minimum edge length. Set to <0 to disable
minEdgeLength 0.001;
// ************************************************************************* //

View File

@ -22,12 +22,14 @@ functions
#includeEtc "caseDicts/postProcessing/surfaceFieldValue/surfaceRegion.cfg"
operation areaAverage;
fields (p);
$region1;
}
region2
{
#includeEtc "caseDicts/postProcessing/surfaceFieldValue/surfaceRegion.cfg"
operation areaAverage;
fields (p);
$region2;
}
}

View File

@ -6,8 +6,6 @@
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/pressure/pressureDifference.cfg"
region1
{
regionType patch;
@ -19,4 +17,6 @@ region2
name $patch2;
}
#includeEtc "caseDicts/postProcessing/pressure/pressureDifference.cfg"
// ************************************************************************* //

View File

@ -6,16 +6,14 @@
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/pressure/pressureDifference.cfg"
region1
{
regionType sampledSurface;
regionType sampledSurface;
name $triSurface1;
sampledSurfaceDict
{
type meshedSurface;
regionType cells;
source cells;
interpolate true;
surface $triSurface1;
}
@ -24,10 +22,13 @@ region1
region2
{
$region1;
name $triSurface2;
sampledSurfaceDict
{
surface $triSurface2;
}
}
#includeEtc "caseDicts/postProcessing/pressure/pressureDifference.cfg"
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2020 OpenCFD Ltd.
# Copyright (C) 2018-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -46,10 +46,10 @@ alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
# Special treatment for Darwin
# - DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH
if ("${_foam_uname_s}" == "Darwin") then
alias _foamAddLib 'setenv DYLD_LIBRARY_PATH \!*\:${DYLD_LIBRARY_PATH}'
if ("${_foam_uname_s}" == 'Darwin') then
alias _foamAddLib 'if (-e \!*) setenv DYLD_LIBRARY_PATH \!*\:${DYLD_LIBRARY_PATH}; if (-e \!*) setenv FOAM_LD_LIBRARY_PATH \!*\:${FOAM_LD_LIBRARY_PATH}'
else
alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
endif
# Prefix to LD_LIBRARY_PATH with additional checking

View File

@ -69,6 +69,13 @@ set archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER"
eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-path "$ParaView_DIR $archDir/ParaView- $archDir/qt-"`
eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-lib "$ParaView_DIR $archDir/ParaView- $archDir/qt-"`
# Darwin
switch ("$WM_ARCH")
case darwin*:
setenv DYLD_LIBRARY_PATH "${FOAM_LD_LIBRARY_PATH}"
breaksw
endsw
# Evaluate command-line parameters for ParaView
while ( $#argv > 0 )
switch ($argv[1])
@ -206,10 +213,11 @@ default:
if ( "$pv_libdirs" != "" ) then
switch ("$WM_ARCH")
case darwin*:
setenv DYLD_LIBRARY_PATH "${pv_libdirs}:$DYLD_LIBRARY_PATH"
setenv FOAM_LD_LIBRARY_PATH "${pv_libdirs}:${FOAM_LD_LIBRARY_PATH}"
setenv DYLD_LIBRARY_PATH "${FOAM_LD_LIBRARY_PATH}"
breaksw
default:
setenv LD_LIBRARY_PATH "${pv_libdirs}:$LD_LIBRARY_PATH"
setenv LD_LIBRARY_PATH "${pv_libdirs}:${LD_LIBRARY_PATH}"
breaksw
endsw
endif

View File

@ -148,16 +148,21 @@ endif
# Clean standard environment variables (PATH, MANPATH, [DY]LD_LIBRARY_PATH)
# - avoid local variables shadowing setenv variables
unset PATH MANPATH LD_LIBRARY_PATH DYLD_LIBRARY_PATH
unset PATH MANPATH LD_LIBRARY_PATH DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH
if (! $?MANPATH ) setenv MANPATH
if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH
if ("${_foam_uname_s}" == "Darwin" ) then
if ("${_foam_uname_s}" == 'Darwin') then
if (! $?DYLD_LIBRARY_PATH ) setenv DYLD_LIBRARY_PATH
if (! $?FOAM_LD_LIBRARY_PATH ) setenv FOAM_LD_LIBRARY_PATH
else
if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH
endif
_foamClean PATH "$foamOldDirs"
_foamClean MANPATH "$foamOldDirs"
_foamClean -lib "$foamOldDirs"
if ("${_foam_uname_s}" == 'Darwin') then
setenv DYLD_LIBRARY_PATH "${FOAM_LD_LIBRARY_PATH}"
endif
#------------------------------------------------------------------------------
@ -213,6 +218,9 @@ endif
_foamClean PATH
_foamClean MANPATH
_foamClean -lib
if ("${_foam_uname_s}" == 'Darwin') then
setenv DYLD_LIBRARY_PATH "${FOAM_LD_LIBRARY_PATH}"
endif
# Add trailing ':' for system manpages
if ( $?MANPATH ) then
@ -224,8 +232,8 @@ if ($?LD_LIBRARY_PATH) then
endif
# Darwin
if ($?DYLD_LIBRARY_PATH) then
if ("${DYLD_LIBRARY_PATH}" == "") unsetenv DYLD_LIBRARY_PATH
if ($?FOAM_LD_LIBRARY_PATH) then
if ("${FOAM_LD_LIBRARY_PATH}" == "") unsetenv DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH
endif

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd.
# Copyright (C) 2016-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -172,8 +172,10 @@ if ( $?foamClean ) then
if ($?LD_LIBRARY_PATH) then
eval `$foamClean -csh-env=LD_LIBRARY_PATH "$foamOldDirs"`
endif
if ($?DYLD_LIBRARY_PATH) then
eval `$foamClean -csh-env=DYLD_LIBRARY_PATH "$foamOldDirs"`
# Darwin
if ($?FOAM_LD_LIBRARY_PATH) then
eval `$foamClean -csh-env=FOAM_LD_LIBRARY_PATH "$foamOldDirs"`
setenv DYLD_LIBRARY_PATH ${FOAM_LD_LIBRARY_PATH}
endif
endif
@ -188,7 +190,7 @@ if ($?DYLD_LIBRARY_PATH) then
endif
# Remove any shadow env variables
unsetenv FOAM_DYLD_LIBRARY_PATH
unsetenv FOAM_DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH
#------------------------------------------------------------------------------
# Cleanup aliases

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2017-2021 OpenCFD Ltd.
# Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -31,7 +31,7 @@
# _foamEtc : resolve etc files (silent or verbose)
# _foamAddPath : prepend to PATH
# _foamAddMan : prepend to MANPATH
# _foamAddLib : prepend to [DY]LD_LIBRARY_PATH
# _foamAddLib : prepend to {DY,FOAM_}LD_LIBRARY_PATH
# _foamAddLibAuto: prepend to lib64/lib resolved name
#
#------------------------------------------------------------------------------
@ -56,7 +56,7 @@ then
foamVar_name="$1"
shift
eval "$($foamClean -sh-env="$foamVar_name" "$@")"
unset "foamVar_name"
unset foamVar_name
}
# Echo values to stderr when FOAM_VERBOSE is on, no-op otherwise
@ -94,14 +94,18 @@ then
_foamAddLib()
{
case "$1" in (/?*)
export DYLD_LIBRARY_PATH="${1}${DYLD_LIBRARY_PATH:+:}${DYLD_LIBRARY_PATH}" ;;
if [ -e "$1" ]
then
export FOAM_LD_LIBRARY_PATH="${1}${FOAM_LD_LIBRARY_PATH:+:}${FOAM_LD_LIBRARY_PATH}"
export DYLD_LIBRARY_PATH="$FOAM_LD_LIBRARY_PATH"
fi
esac
}
else
_foamAddLib()
{
case "$1" in (/?*)
export LD_LIBRARY_PATH="${1}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}" ;;
export LD_LIBRARY_PATH="${1}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
esac
}
fi

View File

@ -76,6 +76,12 @@ eval \
"$($WM_PROJECT_DIR/bin/foamCleanPath -sh-lib \
$ParaView_DIR $archDir/ParaView- $archDir/qt-)"
# Darwin
case "$WM_ARCH" in
(darwin*)
export DYLD_LIBRARY_PATH="${FOAM_LD_LIBRARY_PATH}" ;;
esac
# Evaluate command-line parameters for ParaView
for i
do
@ -186,8 +192,12 @@ case "$ParaView_VERSION" in
then
case "$WM_ARCH" in
(darwin*)
export DYLD_LIBRARY_PATH="${pv_libdirs}:$DYLD_LIBRARY_PATH" ;;
(*) export LD_LIBRARY_PATH="${pv_libdirs}:$LD_LIBRARY_PATH" ;;
export FOAM_LD_LIBRARY_PATH="${pv_libdirs}:${FOAM_LD_LIBRARY_PATH}"
export DYLD_LIBRARY_PATH="${FOAM_LD_LIBRARY_PATH}"
;;
(*)
export LD_LIBRARY_PATH="${pv_libdirs}:${LD_LIBRARY_PATH}"
;;
esac
fi

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2019-2021 OpenCFD Ltd.
# Copyright (C) 2019-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -34,6 +34,12 @@ eval \
"$($WM_PROJECT_DIR/bin/foamCleanPath -sh-lib \
$ParaView_DIR $archDir/ParaView-)"
# Darwin
case "$WM_ARCH" in
(darwin*)
export DYLD_LIBRARY_PATH="${FOAM_LD_LIBRARY_PATH}" ;;
esac
#------------------------------------------------------------------------------
ParaView_DIR="$(command -v paraview 2>/dev/null)"

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2021 OpenCFD Ltd.
# Copyright (C) 2018-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -178,12 +178,23 @@ else
fi
# Clean standard environment variables
# Clean standard environment variables (PATH, MANPATH, [DY]LD_LIBRARY_PATH)
export PATH MANPATH
if [ "${_foam_uname_s}" = Darwin ]
then
export DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH
else
export LD_LIBRARY_PATH
fi
export PATH MANPATH LD_LIBRARY_PATH
_foamClean PATH "$foamOldDirs"
_foamClean MANPATH "$foamOldDirs"
_foamClean -lib "$foamOldDirs"
if [ "${_foam_uname_s}" = Darwin ]
then
export DYLD_LIBRARY_PATH="$FOAM_LD_LIBRARY_PATH"
fi
#------------------------------------------------------------------------------
# Base setup (OpenFOAM compilation), MPI and third-party packages
@ -237,11 +248,21 @@ fi
#------------------------------------------------------------------------------
# Remove duplicates from environment paths
export PATH MANPATH LD_LIBRARY_PATH
export PATH MANPATH
if [ "${_foam_uname_s}" = Darwin ]
then
export DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH
else
export LD_LIBRARY_PATH
fi
_foamClean PATH
_foamClean MANPATH
_foamClean -lib
if [ "${_foam_uname_s}" = Darwin ]
then
export DYLD_LIBRARY_PATH="$FOAM_LD_LIBRARY_PATH"
fi
# Add trailing ':' for system manpages
if [ -n "$MANPATH" ]

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2021 OpenCFD Ltd.
# Copyright (C) 2016-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -164,7 +164,9 @@ then
eval "$($foamClean -sh-env=PATH $foamOldDirs)"
eval "$($foamClean -sh-env=MANPATH $foamOldDirs)"
eval "$($foamClean -sh-env=LD_LIBRARY_PATH $foamOldDirs)"
eval "$($foamClean -sh-env=DYLD_LIBRARY_PATH $foamOldDirs)"
# Darwin
eval "$($foamClean -sh-env=FOAM_LD_LIBRARY_PATH $foamOldDirs)"
export DYLD_LIBRARY_PATH="$FOAM_LD_LIBRARY_PATH"
fi
[ -n "$MANPATH" ] || unset MANPATH
@ -172,7 +174,7 @@ fi
[ -n "$DYLD_LIBRARY_PATH" ] || unset DYLD_LIBRARY_PATH
# Remove any shadow env variables
unset FOAM_DYLD_LIBRARY_PATH
unset FOAM_DYLD_LIBRARY_PATH FOAM_LD_LIBRARY_PATH
#------------------------------------------------------------------------------
# Cleanup aliases and functions

View File

@ -79,7 +79,7 @@ setenv WM_PRECISION_OPTION DP
setenv WM_LABEL_SIZE 32
# [WM_COMPILE_OPTION] - Optimised(default), debug, profiling, other:
# = Opt | Debug | Prof
# = Opt | Dbg | Debug | Prof
setenv WM_COMPILE_OPTION Opt
# [WM_COMPILE_CONTROL] - additional control for compiler rules

View File

@ -776,6 +776,7 @@ $(Fields)/fieldTypes.C
pointPatchFields = fields/pointPatchFields
$(pointPatchFields)/pointPatchField/pointPatchFieldBase.C
$(pointPatchFields)/pointPatchField/pointPatchFields.C
basicPointPatchFields = $(pointPatchFields)/basic

Some files were not shown because too many files have changed in this diff Show More