Compare commits

...

88 Commits

Author SHA1 Message Date
3f19e9033e COMP: finiteArea: dangling reference warning 2024-06-19 09:12:18 +02:00
bbd6219eb2 COMP: finiteArea: dangling reference warning 2024-06-18 17:56:45 +01:00
58aa8c97c2 ENH: report average surface normal in surfaceInertia utility (#3184)
- can be useful for various orientation-related geometry or mesh
  manipulations during pre-/post-processing:
  * combine with linearDirection to achieve better extrusion results.
  * orientation of transformations, blockMesh, result projections, ...

STYLE: minor code modernizations

Co-authored-by: Mark Olesen <>
2024-06-14 12:45:47 +02:00
9f4bb2d432 BUG: createBaffles: incorrect sizing for overlapping zones. Fixes #3183 2024-06-13 18:20:14 +01:00
24ac8308b3 SUBMODULE: update OpenQBMM
SUBMODULE: update data- and turbulence-community plugins
2024-06-13 17:01:51 +01:00
0e23e6c66c CONFIG: set API level to 2406 (pre-release state)
- README updated to v2406, project-version updated to v2406
2024-06-13 12:03:23 +02:00
21c554d7d0 CONFIG: bump adios and paraview versions
- adios: 2.9.2 -> 2.10.1
- paraview: 5.11.2 -> 5.12.1

Ancillary libs:

- hdf5:  1.14.4.3
- hypre: 2.23.0 -> 2.31.0
- petsc: 3.19.2 -> 3.21.2
2024-06-13 12:03:23 +02:00
391f059335 CONFIG: update foamPackRelease packaging 2024-06-13 12:03:23 +02:00
5873ec1b22 ENH: topoSet: allow transformation of input locations 2024-06-12 15:44:23 +01:00
bb483951b7 ENH: compressibleMultiPhaseTurbulenceModels - added some (tested) RAS models 2024-06-12 09:59:49 +01:00
7b5e605b29 Merge branch 'regression-3144-fvsPatchField' into 'develop'
REGRESSION: missing "value" handling for some surface fields (#3144)

See merge request Development/openfoam!691
2024-06-12 07:58:03 +00:00
732872b9cc REGRESSION: missing "value" handling for some surface fields (#3144)
- changes in 8a8b5db977 were overly aggressive.
  Only need to suppress "value" IO for empty patches types
2024-06-12 07:57:40 +00:00
c6501b799e BUG: ddt2, zeroGradient FOs - set candidates using name match 2024-06-11 19:23:11 +01:00
93ee308ebf CONFIG: Added value to cyclicAMI entry 2024-06-11 16:06:13 +00:00
9d6b8a9c28 TUT: mixerVessel2D: add missing MRF-related keyword 2024-06-11 14:15:29 +01:00
d859f7b00f ENH: add comparison operators to exprValue, integrate exprValueFieldTag
- exprValueFieldTag is an extended version of exprValue,
  with additional Field/List uniformity handling

- the exprValueFieldTag reduce() method provides a more efficient
  method than using a regular combine operator. Since fields are
  usually non-uniform, will mostly only need the bitwise reduce and
  not a more expensive gather/combine.

ENH: output of exprValue (scalar type) now includes '.'

- prevents scalar/label ambiguity for values like '100.0', which would
  otherwise be written as '100' and thus interpreted as a label value
  when re-reading.
2024-06-10 16:47:09 +02:00
baa8dccb0a ENH: cellDecomposer: functionObject to map fields.
Left out original files
2024-06-10 11:22:50 +01:00
5059e1ddec COMP: v2406: various missing dependencies 2024-06-10 10:17:10 +01:00
dced6c581e BUG: regionSplit2D: revert to original code. Fixes #3149. 2024-06-10 10:05:36 +01:00
3e64faf605 DOC: cellSetOption: add porous option 2024-06-10 10:05:36 +01:00
3083c32c35 SUBMODULE: update for visualization 2024-06-10 09:39:37 +01:00
f48e617cd2 Merge branch 'feature-cellDecomposer' into 'develop'
ENH: cellDecomposer: functionObject to map fields to 'tet' mesh.

See merge request Development/openfoam!687
2024-06-07 17:21:51 +00:00
1b825b4470 ENH: cellDecomposer: functionObject to map fields to 'tet' mesh. 2024-06-07 17:21:23 +00:00
199a9801ca Merge branch 'feature-mrf' into 'develop'
MRF: compressible energy eqn

See merge request Development/openfoam!689
2024-06-07 14:49:05 +00:00
f6ba6bc40e ENH: MRF - added work term to compressible solver energy eqns 2024-06-07 14:48:47 +00:00
bf9b9204c3 ENH: MRF - added function to return the frame absolute flux 2024-06-07 14:48:47 +00:00
06ee000cb8 Merge branch 'feature-lagrangian-drag' into 'develop'
New Lagrangian models

See merge request Development/openfoam!686
2024-06-07 11:40:15 +00:00
d3861a5dcc ENH: Lagrangian - added tutorial case for particle Tomiyama drag model 2024-06-07 12:39:03 +01:00
8950c9b0c6 ENH: Lagrangian - added particle Tomiyama drag model
Based on the reference

    Tomiyama, A., Kataoka, I., Zun, I., Sakaguchi, T. (1998)
    Drag coefficients of single bubbles under normal and micro gravity
    conditions
    JSME International Journal, 41(2), 472-479.

Example usage

    subModels
    {
        particleForces
        {
            tomiyamaDrag
            {
                sigma       0.07;
                contamination pure; // pure | slight | full
            }
        }
    }
2024-06-07 12:39:03 +01:00
a0fea418e2 ENH: New FreezeParticles cloud function object
Sets the particle active flag to false to freeze the particle in space whilst
allowing it to evolve its physical models.
2024-06-07 12:39:03 +01:00
1bce1e44c4 ENH: propellerInfo - updated to work in postProcess mode. Fixes #2588 2024-06-07 12:36:59 +01:00
440cb83fa7 Merge branch 'feature-axialTurbine_rotating_oneBlade' into 'develop'
INT: cyclicPeriodicAMI: demo case provided by Hakan Nilsson

See merge request Development/openfoam!688
2024-06-07 11:29:01 +00:00
cf5eaef236 INT: cyclicPeriodicAMI: demo case provided by Hakan Nilsson 2024-06-07 09:53:06 +01:00
d148816bfe ENH: snappyHexMesh: initialise in case of 0 layer. Fixes #3177 2024-06-06 15:48:57 +01:00
f7291c4550 SUBMODULE: add data-community plugin (fixes #3146)
SUBMODULE: update turbulence-community plugin

ENH: README: add info to differentiate the modules from the plugins
2024-06-06 12:38:27 +01:00
eea442e209 BUG: cellSetOption: allow geometric selection update (fixes #3161) 2024-06-05 12:02:24 +01:00
755d354f69 Merge branch 'feature-radiation-ft' into 'develop'
Radiation modelling updates

See merge request Development/openfoam!685
2024-06-04 16:40:15 +00:00
d71b3c4633 ENH: radiation - temperature dependent properties
ENH: radiationModel - expose T()
2024-06-04 16:39:56 +00:00
de39878b9b ENH: radiation - temperature dependent absorption, emissivity, transmissivity
- constantAbsorption - updated a_ and e_ (Function1)
- constantTransmissivity - updated tau_  (Function1)
2024-06-04 16:39:56 +00:00
274fee92dd STYLE: radiation - use const ref/pointer; updated header guards 2024-06-04 16:39:56 +00:00
64c15e179a ENH: New viewFactorHeatFlux function object
Determines radiation heat flux between patches when using the viewFactor
radiation model.

Example usage

    viewFactorHeatFlux1
    {
        // Mandatory entries (unmodifiable)
        type        viewFactorHeatFlux;
        libs        (utilityFunctionObjects);

        // Optional entries (runtime modifiable)
        qr          qr;
    }
2024-06-04 16:39:56 +00:00
1bcb90bf79 ENH: surfaceTransformPoints: make consistent with transformPoints.
(added the -cylToCart option)
2024-06-04 16:59:15 +01:00
4deb146118 ENH: cyclicPeriodic: error msg 2024-06-03 17:23:37 +01:00
a87763f6a6 ENH: transformPoints: added cylindrical to Cartesian transform 2024-06-03 17:23:37 +01:00
c61466b6e5 ENH: polyPatch cached areaFraction setter with uniform fraction
STYLE: polyPatch cached areaFraction as std::unique_ptr

- more consistent with other demand-driven data.
  Getter now returns tmp field instead of const reference.
2024-06-03 11:55:01 +01:00
323149ad24 COMP: stray 'inline' prefix, explicit constructor for UniformDimensionedField
STYLE: getObjectPtr instead of const_cast version
2024-05-31 17:06:02 +01:00
e9cf0fba05 SUBMODULE: update for visualization 2024-05-31 16:47:54 +01:00
2d52ee13b1 ENH: icoReactingMultiphaseInterFoam - added frozenFlow option. Fixes #3128 2024-05-31 14:31:00 +01:00
5015883c01 CONFIG: Updated foamPackRelease for plugins directory support 2024-05-31 12:40:07 +01:00
74e118dd32 SUBMODULE: relocate community repos into plugins/ directory
- new landing place for general community repositories
2024-05-31 12:13:21 +01:00
01f501e8e7 CONFIG: increment API level to 2403 2024-05-30 17:30:25 +01:00
60ffaba71d Merge branch 'feature-FaceCellWave-cyclicACMI' into 'develop'
FaceCellWave: travel through coupled ACMI. See #3139

See merge request Development/openfoam!677
2024-05-30 15:15:56 +00:00
056bb4f0a0 FaceCellWave: travel through coupled ACMI. See #3139 2024-05-30 15:15:56 +00:00
30d2e2d3cf Merge branch 'feature-Function1-objectRegistry' into 'develop'
Function1: added 'lookup' Function1

See merge request Development/openfoam!676
2024-05-30 10:25:24 +00:00
c07997d816 Function1: added 'lookup' Function1 2024-05-30 10:25:24 +00:00
495fa6c577 Merge branch 'feature-ensight-single-file' into 'develop'
Add support for reading ensight transient single-file format

See merge request Development/openfoam!682
2024-05-29 14:05:27 +00:00
dfc9a8923a ENH: read support for EnSight single-file transient (#3154)
- the ensightReadFile init() now automatically sets up binary/ascii
  (for geometry files) and checks for the transient "BEGIN TIME STEP"
  marker. If found, will also populate the file offsets for each of
  the timesteps.  If no corresponding footer is found (which would be
  very inefficient), it simply pretends that there is only a single
  time step instead of performing a costly file scan.

- parsing of the ensight case file now also supports the use of

      filename numbers:

  as an alternative to

      filename start number:
      filename increment:

- improved parsing robustness of "time values:" entry.
  Can now also have contents on the same line as the introducer.

ENH: base-level adjustments for writing transient single-file

- beginGeometry() is now separated out from file creation.

- in append mode, ensightFile and ensightGeoFile will attempt to
  parse existing time-step information.
2024-05-29 14:04:52 +00:00
ee895577ae ENH: improve OFstream append behaviour (#3160)
- previous support for file appending (largely unused) always
  specified opening with the std::ios_base::app flag.

  Now differentiate between append behaviours:

  APPEND_APP
  ~~~~~~~~~~
  Corresponds to std::ios_base::app behaviour:

  - Existing files will be preserved and a seek-to-end is performed at
    every write. With this mode seeks/repositioning within the file
    will effectively be ignored on output.

  APPEND_ATE
  ~~~~~~~~~~
  Largely approximates std::ios_base::ate behaviour:

  - Existing files will be preserved and a seek-to-end is performed
    immediately after opening, but not subsequently. Can use seekp()
    to overwrite parts of a file.
2024-05-29 14:04:52 +00:00
9f032057b4 Merge branch 'feature-blockLevel-rays' into 'develop'
ENH: shm: blockLevel through ray-shooting

See merge request Development/openfoam!642
2024-05-29 10:11:19 +00:00
10b0c3cfca ENH: shm: blockLevel through ray-shooting 2024-05-29 10:11:18 +00:00
773548c283 Merge branch 'update-GeometricBoundaryField-evaluate' into 'develop'
Improve flexiblity of GeometricBoundaryField evaluate

See merge request Development/openfoam!683
2024-05-29 08:18:53 +00:00
9335b641f1 ENH: GeometricBoundaryField evaluate with specified communication type
- evaluate()
  the communication type is exposed as a parameter to allow for more
  tuning, but default parameter remains defaultCommsType so there is
  no change in behaviour for existing code

- evaluate_if()
  supports a general selection predicate

- evaluateSelected()
  now does initEvaluate() for all patches, waits and then calls
  evaluate(). This avoids potential deadlocks when multiple patches
  are inter-communicating.

ENH: align DimensionedField reading with GeometricField treatment

- use localIOdictionary to obtain the dictionary contents

ENH: update GeometricField code

- change GeometricField writeData() as primary output method
  (not operator<<) for better clarity of purpose

- use unique_ptr for GeometricField demand-driven data
2024-05-28 17:52:09 +01:00
ffc9894033 STYLE: more consistency in writeEntry() signatures
- boundary entries with writeEntry(const word&, ...) instead of
  writeEntry(const keyType&, ...) to match with most other
  writeEntry() signatures. Also, this content will not be used
  to supply regex matched sub-dictionaries.

STYLE: more consistent patch initEvaluate()/evaluate() coding
2024-05-28 17:50:03 +01:00
1406f9ec26 ENH: robuster handling of unknown stream/float formats 2024-05-23 21:13:14 +02:00
b81fe70830 ENH: extend readContents IO factory methods
- support wantedType for localIOdictionary::readContents()

- add readContents() for GlobalIOList, GlobalIOField
2024-05-23 13:51:53 +02:00
bbde236be5 ENH: simpler internal handling of stderr in message streams
- delay construction of message buffer

- OStringStream count() method to test if anything has been streamed

STYLE: explicit use of std::ios_base in IOstreams

- document the return information of set flag methods
2024-05-23 13:51:53 +02:00
3b9176665f ENH: add dictionary::findStream() - symmetric with findDict()
- can be used with this type of code:

  ITstream* streamPtr = dict.findStream(name);
  if (streamPtr)
  {
      auto& is = *streamPtr;
      ...
  }

  versus:

  const entry* eptr = dict.findEntry(name);
  if (eptr && eptr->isStream())
  {
      auto& is = eptr->stream();
      ...
  }

ENH: add findStream(), streamPtr(), isStream() to dictionary search

- symmetric with findDict(), dictPtr(), isDict() methods

STYLE: use findDict() instead of found() + subDict() pairing

COMP: define is_globalIOobject trait at top of IOobject header

- more visibility, permits reuse for specializations etc.
2024-05-23 13:51:53 +02:00
6a80d4de40 ENH: reduce boundary face queries in streamFunction
BUG: streamFunction used uninitialized values for symmetry patches

- related to 8a8b5db977 changes (#3144)

ENH: improve robustness of surface field flattening

- vtk::surfaceFieldWriter
2024-05-23 13:51:53 +02:00
3f1d181b42 COMP: provide GeometricFieldFwd.H for internal/boundary/full field
- simplifies forward declarations
2024-05-23 07:41:01 +02:00
8d649d1737 FIX: additional shell quoting for foamInstallationTest (fixes #3163)
- the PATH on WSL will usually contain spaces, so it needs quoting
2024-05-22 21:00:00 +02:00
21a84bdf91 Merge remote-tracking branch 'origin/master' into develop 2024-05-22 20:59:28 +02:00
1ad1957c41 ENH: GAMG: bit more testing of procAgglom+cyclicAMI 2024-05-22 18:02:28 +01:00
4510067e63 CONFIG: bump patch level 2024-05-22 16:26:39 +02:00
8cf757daf0 BUG: GAMG: processorAgglomeration not merging proc coeffs. Fixes #3172 2024-05-22 16:26:39 +02:00
6581c5792a BUG: STL: cannot handle files > 2Gb. Fixes #3171 2024-05-22 16:25:37 +02:00
03fb8f043e ENH: cyclicAMI: restart search with large bounding box. Fixes #3175 2024-05-22 12:37:32 +01:00
45ec64e6c8 BUG: STL: cannot handle files > 2Gb. Fixes #3171 2024-05-20 12:17:04 +01:00
eb17ff1ea3 DOC: cyclicPeriodicAMI: bit of comment 2024-05-18 12:55:55 +01:00
a7538fab57 BUG: interfaceHeight: fix header writing to output files (fixes #3115) 2024-05-08 11:20:34 +01:00
4fb85d1f76 Merge branch 'update-Pstream-large-sends' into 'develop'
ENH: improve handling of multi-pass send/recv

See merge request Development/openfoam!680
2024-05-07 14:29:14 +00:00
d9c73ae489 ENH: improve handling of multi-pass send/recv (#3152)
- the maxCommsSize variable is used to 'chunk' large data transfers
  (eg, with PstreamBuffers) into a multi-pass send/recv sequence.

  The send/recv windows for chunk-wise transfers:

      iter    data window
      ----    -----------
      0       [0, 1*chunk]
      1       [1*chunk, 2*chunk]
      2       [2*chunk, 3*chunk]
      ...

  Since we mostly send/recv in bytes, the current internal limit
  for MPI counts (INT_MAX) can be hit rather quickly.

  The chunking limit should thus also be INT_MAX, but since it is
  rather tedious to specify such large numbers, can instead use

      maxCommsSize = -1

  to specify (INT_MAX-1) as the limit.
  The default value of maxCommsSize = 0 (ie, no chunking).

Note
~~~~
  In previous versions, the number of chunks was determined by the
  sender sizes. This required an additional MPI_Allreduce to establish
  an overall consistent number of chunks to walk. This additional
  overhead each time meant that maxCommsSize was rarely actually
  enabled.

  We can, however, instead rely on the send/recv buffers having been
  consistently sized and simply walk through the local send/recvs until
  no further chunks need to be exchanged. As an additional enhancement,
  the message tags are connected to chunking iteration, which allows
  the setup of all send/recvs without an intermediate Allwait.

ENH: extend UPstream::probeMessage to use int64 instead of int for sizes
2024-05-07 15:33:02 +02:00
e15d696a24 STYLE: use Perr instead of Pout for UPstream::debug and warnComm
- avoids polluting standard output for utilities such as
  foamDictionary etc
2024-05-07 14:45:10 +02:00
dbfd1f90b1 ENH: add single-time handling to timeSelector
- the timeSelector is often used to select single or multiple times
  (eg, for post-processing). However, there are a few applications
  where only a *single* time should be selected and set.

  These are now covered by this type of use:

      timeSelector::addOptions_singleTime();  // Single-time options
      ...
      // Allow override of time from specified time options, or no-op
      timeSelector::setTimeIfPresent(runTime, args);

   In some cases, if can be desirable to force starting from the
   initial Time=0 when no time options have been specified:

      // Set time from specified time options, or force start from Time=0
      timeSelector::setTimeIfPresent(runTime, args, true);

   These changes make a number of includes redundant:

     * addTimeOptions.H
     * checkConstantOption.H
     * checkTimeOption.H
     * checkTimeOptions.H
     * checkTimeOptionsNoConstant.H

ENH: add time handling to setFields, setAlphaField (#3143)

    Co-authored-by: Johan Roenby <>

STYLE: replace instant("constant") with instant(0, "constant")

- avoids relying on atof parse behaviour returning zero
2024-05-06 22:22:42 +02:00
883196981d ENH: add offset support to stringOps::split functions
- for example,

     string buffer = ...;
     SubStrings<string> split;
     {
         auto colon = buffer.find(':');

         if (colon != std::string::npos)
         {
             split = stringOps::splitSpace(buffer, colon+1);
         }
     }

    Not really possible with a substr() since that would create a new
    temporary which then disappears.  Similarly awkward to split and
    then scan for the ':' to decide how many to discard.

ENH: add pop_front() and pop_back() methods to SubStrings

- the content is trivial enough (a pair of iterators) and the total
  number of elements is usually reasonable short so that removal of
  elements is inexpensive

  For example,

     string buffer = ...;
     auto split = stringOps::splitSpace(buffer);

     if (!split.empty() && split[0].str() == "face")
     {
         split.pop_front();
     }
2024-05-02 17:53:53 +02:00
3fed41547f COMP: remove template-id for constructor/destructor
- not allowed in C++20

COMP: avoid hidden overloaded-virtual (edgeMesh, surfMesh)
2024-05-02 16:47:46 +02:00
e22edc5dee STYLE: limitTemperature: consolidate standard output stream 2024-05-02 14:17:48 +01:00
0ef7589979 BUG: sampledMeshSurface sampling on "empty" patch fails
- requires a field size check when copying into the flat boundary
2024-05-02 10:24:28 +02:00
e651d63566 ENH: cyclicAMI - clear finished send/recv requests 2024-03-18 17:00:34 +01:00
495 changed files with 22588 additions and 4655 deletions

View File

@ -49,10 +49,10 @@
<!--
Providing details of your set-up can help us identify any issues, e.g.
OpenFOAM version : v2312|v2306|v2212|v2206|v2112 etc
Operating system : ubuntu|openSUSE|centos etc
OpenFOAM version : v2406|v2312|v2306|v2212|v2206 etc
Operating system : ubuntu|openSUSE|RedHat etc
Hardware info : any info that may help?
Compiler : gcc|intel|clang etc
Compiler : gcc|clang etc
-->
- OpenFOAM version :

9
.gitmodules vendored
View File

@ -1,8 +1,8 @@
[submodule "cfmesh"]
path = modules/cfmesh
path = plugins/cfmesh
url = https://develop.openfoam.com/Community/integration-cfmesh.git
[submodule "avalanche"]
path = modules/avalanche
path = plugins/avalanche
url = https://develop.openfoam.com/Community/avalanche.git
[submodule "adios"]
path = modules/adios
@ -18,5 +18,8 @@
path = modules/external-solver
url = https://develop.openfoam.com/Modules/external-solver.git
[submodule "turbulence-community"]
path = modules/turbulence-community
path = plugins/turbulence-community
url = https://gitlab.com/openfoam/community/tc-turbulence/turbulence-community.git
[submodule "plugins/data-community"]
path = plugins/data-community
url = https://gitlab.com/openfoam/community/sig-data-modelling/data-community.git

View File

@ -1,2 +1,2 @@
api=2402
patch=240220
api=2406
patch=0

View File

@ -40,9 +40,9 @@ Violations of the Trademark are monitored, and will be duly prosecuted.
If OpenFOAM has already been compiled on your system, simply source
the appropriate `etc/bashrc` or `etc/cshrc` file and get started.
For example, for the OpenFOAM-v2312 version:
For example, for the OpenFOAM-v2406 version:
```
source /installation/path/OpenFOAM-v2312/etc/bashrc
source /installation/path/OpenFOAM-v2406/etc/bashrc
```
## Compiling OpenFOAM
@ -127,8 +127,8 @@ These 3rd-party sources are normally located in a directory parallel
to the OpenFOAM directory. For example,
```
/path/parent
|-- OpenFOAM-v2312
\-- ThirdParty-v2312
|-- OpenFOAM-v2406
\-- ThirdParty-v2406
```
There are, however, many cases where this simple convention is inadequate:
@ -136,7 +136,7 @@ There are, however, many cases where this simple convention is inadequate:
operating system or cluster installation provides it)
* When we have changed the OpenFOAM directory name to some arbitrary
directory name, e.g. openfoam-sandbox2312, etc..
directory name, e.g. openfoam-sandbox2406, etc..
* When we would like any additional 3rd party software to be located
inside of the OpenFOAM directory to ensure that the installation is
@ -156,9 +156,9 @@ when locating the ThirdParty directory with the following precedence:
2. PREFIX/ThirdParty-VERSION
* this corresponds to the traditional approach
3. PREFIX/ThirdParty-vAPI
* allows for an updated value of VERSION, *eg*, `v2312-myCustom`,
* allows for an updated value of VERSION, *eg*, `v2406-myCustom`,
without requiring a renamed ThirdParty. The API value would still
be `2312` and the original `ThirdParty-v2312/` would be found.
be `2406` and the original `ThirdParty-v2406/` would be found.
4. PREFIX/ThirdParty-API
* same as the previous example, but using an unadorned API value.
5. PREFIX/ThirdParty-common
@ -213,4 +213,4 @@ ThirdParty directory will contain either an `Allwmake` file or a
- [Governance](http://www.openfoam.com/governance/), [Governance Projects](https://www.openfoam.com/governance/projects)
- [Contacting OpenCFD](http://www.openfoam.com/contact/)
Copyright 2016-2023 OpenCFD Ltd
Copyright 2016-2024 OpenCFD Ltd

View File

@ -21,6 +21,11 @@
+ fvOptions(rho, he)
);
if (MRF.active())
{
EEqn += fvc::div(MRF.phi(), p);
}
EEqn.relax();
fvOptions.constrain(EEqn);

View File

@ -20,6 +20,11 @@
fvOptions(rho, he)
);
if (MRF.active())
{
EEqn += fvc::div(MRF.phi(), p);
}
EEqn.relax();
fvOptions.constrain(EEqn);

View File

@ -14,6 +14,11 @@
fvOptions(rho, he)
);
if (MRF.active())
{
EEqn += fvc::div(MRF.phi(), p);
}
EEqn.relax();
fvOptions.constrain(EEqn);

View File

@ -9,6 +9,11 @@
fvOptions(rho, e)
);
if (MRF.active())
{
EEqn += fvc::div(MRF.phi(), p);
}
EEqn.relax();
fvOptions.constrain(EEqn);

View File

@ -130,10 +130,17 @@ int main(int argc, char *argv[])
}
}
}
#include "UEqn.H"
#include "YEqns.H"
#include "TEqn.H"
if (pimple.frozenFlow())
{
continue;
}
#include "UEqn.H"
// --- Pressure corrector loop
while (pimple.correct())
{

View File

@ -188,8 +188,6 @@ int main(int argc, char *argv[])
argList::addBoolOption("label", "Use label for tests (default)");
argList::addBoolOption("ref", "Test writing by ref");
#include "addTimeOptions.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createPolyMesh.H"
@ -280,7 +278,6 @@ int main(int argc, char *argv[])
{
IOFieldRef<vector>(ioOutput, mesh.points()).write();
}
}

View File

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

View File

@ -65,11 +65,11 @@ int main(int argc, char *argv[])
OCountStream cnt;
OCharStream cstr;
OStringStream str;
OStringStream sstr;
ocountstream plain;
generateOutput(cstr);
generateOutput(str);
generateOutput(sstr);
generateOutput(cnt);
generateOutput(plain);
@ -77,7 +77,7 @@ int main(int argc, char *argv[])
Info<< "counter state: " << (cnt.stdStream().rdstate()) << nl
<< "via char-stream: " << label(cstr.view().size()) << " chars" << nl
<< "via string-stream: " << str.str().size() << " chars" << nl
<< "via string-stream: " << label(sstr.count()) << " chars" << nl
<< "via ocountstream: " << plain.count() << " chars" << endl;
fileName outputName;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd.
Copyright (C) 2022-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,10 +32,14 @@ Description
#include "IOstreams.H"
#include "OSspecific.H"
#include "argList.H"
#include "clock.H"
#include "Switch.H"
#include "ListOps.H"
using namespace Foam;
std::string time_stamp;
void listFiles(const fileName& dir)
{
wordList files = ListOps::create<word>
@ -55,25 +59,150 @@ void listFiles(const fileName& dir)
}
OSstream& printInfo(OFstream& os)
{
InfoErr
<< "open: " << os.name() << nl
<< "appending: " << Switch::name(os.is_appending())
<< " tellp: "<< os.stdStream().tellp()
<< " gz: " << Switch::name(os.compression()) << nl;
return InfoErr.stream();
}
void withHeader(OFstream& os)
{
const auto tellp = os.stdStream().tellp();
if (tellp <= 0)
{
InfoErr
<< "Add header" << nl;
os << "HEADER: " << time_stamp.c_str() << nl;
}
}
template<class OSstreamType>
void generateLines(OSstreamType& os, label count = 1)
{
for (label line = 1; line <= count; ++line)
{
os << "[" << line
<< "] =============================================" << nl;
}
}
template<class OSstreamType>
void generateContent
(
OSstreamType& os,
const bool with_seekend,
const bool test_overwrite = false,
const int64_t seek_out = -1
)
{
if (with_seekend)
{
os.stdStream().seekp(0, std::ios_base::end);
// OR? os.seek_end();
}
printInfo(os);
withHeader(os);
if (test_overwrite && seek_out >= 0)
{
InfoErr<< "... seekp(" << seek_out << ")" << nl;
auto& oss = os.stdStream();
// Actually std::streampos, but cannot increment that
int64_t pos(seek_out);
const int64_t tellp_end = oss.tellp();
if (pos >= 0 && pos < tellp_end)
{
InfoErr
<< "... fill from " << label(pos)
<< " to " << label(tellp_end) << nl;
oss.seekp(pos);
while (pos < tellp_end)
{
// Fill with char 'X', rely on streambuf buffering
oss << 'X';
++pos;
}
oss.seekp(seek_out);
os << "More content [at " << seek_out << ']' << endl;
}
}
generateLines(os, 4);
printInfo(os)
<< "... sleep" << endl;
listFiles(os.name().path());
sleep(2);
os << "[new content] +++++++++++++++++++++++++++++++++++" << endl;
}
template<class OSstreamType>
void generateOverwriteContent
(
OSstreamType& os,
const bool with_seekend,
const int64_t seek_out = -1
)
{
generateContent(os, with_seekend, true, seek_out);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::addBoolOption("gz", "Use compression");
argList::addBoolOption("append", "Use append mode");
argList::addBoolOption("append-app", "Use append app mode");
argList::addBoolOption("append-ate", "Use append ate mode");
argList::addBoolOption("seekend", "Seek to end after non-append open");
argList::addOption("seek", "value", "Seek from start (default: 100)");
argList::addBoolOption("atomic", "Use atomic");
argList::addBoolOption("keep", "Do not remove test directory");
argList::addOption("write", "file", "test writing to file");
#include "setRootCase.H"
// Same time-stamp for all generated files
time_stamp = clock::dateTime();
const fileName baseDir("Test-OFstream-directory");
Foam::mkDir(baseDir);
InfoErr<< "mkdir: " << baseDir << endl;
Info<< "start:" << nl;
listFiles(baseDir);
const bool with_seekend = args.found("seekend");
const int seek_out = args.getOrDefault<int>("seek", 100);
IOstreamOption streamOpt;
if (args.found("gz"))
@ -83,10 +212,11 @@ int main(int argc, char *argv[])
IOstreamOption::appendType append =
(
args.found("append")
? IOstreamOption::APPEND
: IOstreamOption::NON_APPEND
args.found("append-app") ? IOstreamOption::APPEND_APP
: args.found("append-ate") ? IOstreamOption::APPEND_ATE
: IOstreamOption::NO_APPEND
);
IOstreamOption::atomicType atomic =
(
args.found("atomic")
@ -97,7 +227,6 @@ int main(int argc, char *argv[])
{
OFstream(baseDir/"dummy")() << "Some file content" << endl;
Foam::ln("dummy", baseDir/"Test2.txt");
Foam::ln("dummy", baseDir/"Test3.txt");
Foam::ln("dummy", baseDir/"Test4.txt");
Foam::ln("dummy", baseDir/"Test4.txt.gz");
@ -114,16 +243,31 @@ int main(int argc, char *argv[])
append
);
os << "=========================" << endl;
generateOverwriteContent(os, with_seekend, seek_out);
}
InfoErr<< "open: " << os.name() << endl;
InfoErr<< "... sleep" << endl;
{
OFstream os
(
atomic,
baseDir/"Test1-app.txt",
streamOpt,
IOstreamOption::APPEND_APP
);
listFiles(baseDir);
generateOverwriteContent(os, with_seekend, seek_out);
}
sleep(2);
{
OFstream os
(
atomic,
baseDir/"Test1-ate.txt",
streamOpt,
IOstreamOption::APPEND_ATE
);
os << "+++++++++++++++++++++++++++++++++++" << endl;
generateOverwriteContent(os, with_seekend, seek_out);
}
{
@ -132,39 +276,21 @@ int main(int argc, char *argv[])
atomic,
baseDir/"Test2.txt",
streamOpt
// NON_APPEND
);
os << "=========================" << endl;
InfoErr<< "open: " << os.name() << endl;
InfoErr<< "... sleep" << endl;
listFiles(baseDir);
sleep(2);
os << "+++++++++++++++++++++++++++++++++++" << endl;
generateContent(os, with_seekend);
}
{
OFstream os
(
atomic,
baseDir/"Test3.txt",
streamOpt,
IOstreamOption::APPEND
IOstreamOption::APPEND_APP
);
os << "=========================" << endl;
InfoErr<< "open: " << os.name() << endl;
InfoErr<< "... sleep" << endl;
listFiles(baseDir);
sleep(2);
os << "+++++++++++++++++++++++++++++++++++" << endl;
generateContent(os, with_seekend, with_seekend);
}
{
OFstream os
@ -174,35 +300,17 @@ int main(int argc, char *argv[])
IOstreamOption::COMPRESSED
);
os << "=========================" << endl;
InfoErr<< "open: " << os.name() << endl;
InfoErr<< "... sleep" << endl;
listFiles(baseDir);
sleep(2);
os << "+++++++++++++++++++++++++++++++++++" << endl;
// No seekend with COMPRESSED
generateContent(os, false);
}
{
OFstream os
(
IOstreamOption::ATOMIC,
baseDir/"Test5.txt"
// ASCII UNCOMPRESSED NON_APPEND
);
os << "=========================" << endl;
InfoErr<< "open: " << os.name() << endl;
InfoErr<< "... sleep" << endl;
listFiles(baseDir);
sleep(2);
os << "+++++++++++++++++++++++++++++++++++" << endl;
generateContent(os, with_seekend);
}
Info<< nl << "done:" << endl;

View File

@ -201,7 +201,6 @@ using namespace Foam;
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
argList::addArgument("patch");
#include "setRootCase.H"
#include "createTime.H"

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2023 OpenCFD Ltd.
Copyright (C) 2017-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -24,7 +24,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
checkDecomposePar
Test-checkDecomposePar
Group
grpParallelUtilities
@ -35,8 +35,9 @@ Description
\*---------------------------------------------------------------------------*/
#include "OSspecific.H"
#include "fvCFD.H"
#include "argList.H"
#include "timeSelector.H"
#include "polyMesh.H"
#include "cpuTime.H"
#include "IFstream.H"
#include "regionProperties.H"
@ -44,10 +45,14 @@ Description
#include "decompositionInformation.H"
#include "decompositionModel.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
timeSelector::addOptions_singleTime(); // Single-time options
argList::addNote
(
"Check decomposition from kaffpa (KaHIP) output"
@ -65,9 +70,6 @@ int main(int argc, char *argv[])
argList::addArgument("kaffpa-output-file");
// Include explicit constant options, have zero from time range
timeSelector::addOptions(true, false);
#include "setRootCase.H"
const auto decompFile = args.get<fileName>(1);
@ -75,8 +77,8 @@ int main(int argc, char *argv[])
// Set time from database
#include "createTime.H"
// Allow override of time
instantList times = timeSelector::selectIfPresent(runTime, args);
// Allow override of time from specified time options, or no-op
timeSelector::setTimeIfPresent(runTime, args);
// Allow override of decomposeParDict location
const fileName decompDictFile =
@ -95,7 +97,7 @@ int main(int argc, char *argv[])
Info<< "\n\nDecomposing mesh " << regionName << nl << endl;
Info<< "Create mesh..." << flush;
fvMesh mesh
polyMesh mesh
(
IOobject
(
@ -111,7 +113,7 @@ int main(int argc, char *argv[])
Info<< " nCells = " << mesh.nCells() << endl;
// Expected format is a simple ASCII list
cellToProc.setSize(mesh.nCells());
cellToProc.resize(mesh.nCells());
{
IFstream is(decompFile);

View File

@ -123,7 +123,7 @@ int main(int argc, char *argv[])
);
Info<< testInput << nl;
SubStrings<string> args = stringOps::splitSpace(testInput);
auto args = stringOps::splitSpace(testInput);
Info<< "split into " << args.size() << " args" << nl;
CStringList inC(args);

View File

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

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -24,7 +24,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-dimField
Test-dimField1
Description
Simple tests for DimensionedField
@ -52,7 +52,12 @@ namespace Foam
int main(int argc, char *argv[])
{
argList::addBoolOption("write", "write some test fields");
#include "setRootCase.H"
const bool doWrite = args.found("write");
#include "createTime.H"
#include "createMesh.H"
@ -60,19 +65,23 @@ int main(int argc, char *argv[])
Info<< "Tensor field\n" << endl;
DimensionedField<tensor, volMesh> tensorfld
(
IOobject
mesh.newIOobject
(
"tensor",
runTime.timeName(),
mesh,
{ IOobject::READ_IF_PRESENT, IOobject::NO_REGISTER }
{ IOobject::READ_IF_PRESENT, IOobject::NO_WRITE }
),
mesh,
dimensioned<tensor>(dimless, tensor(1,2,3,4,5,6,7,8,9))
);
Info().beginBlock("transformed")
<< tensorfld.T() << nl;
if (doWrite)
{
tensorfld.write();
}
Info<< nl;
Info().beginBlock("transformed") << tensorfld.T();
Info().endBlock();
{
@ -84,8 +93,8 @@ int main(int argc, char *argv[])
dimensioned<scalar>(14)
);
Info().beginBlock(tfld().type())
<< tfld << nl;
Info<< nl;
Info().beginBlock(tfld().type()) << tfld;
Info().endBlock();
}
@ -98,8 +107,8 @@ int main(int argc, char *argv[])
dimensioned<scalar>(5)
);
Info().beginBlock(tfld().type())
<< tfld() << nl;
Info<< nl;
Info().beginBlock(tfld().type()) << tfld();
Info().endBlock();
// From dissimilar types
@ -111,8 +120,8 @@ int main(int argc, char *argv[])
dimensioned<vector>(Zero)
);
Info().beginBlock(tfld2().type())
<< tfld2() << nl;
Info<< nl;
Info().beginBlock(tfld2().type()) << tfld2();
Info().endBlock();
}
}
@ -122,20 +131,13 @@ int main(int argc, char *argv[])
Info<< "uint8 field\n" << endl;
DimensionedField<uint8_t, volMesh> statefld
(
IOobject
(
"state",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh.newIOobject("state")
mesh,
dimensioned<uint8_t>(dimless, uint8_t{100})
);
Info().beginBlock("stateField")
<< statefld << nl;
Info<< nl;
Info().beginBlock("stateField") << statefld;
Info().endBlock();
}
#endif

View File

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

View File

@ -1,8 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/conversion/lnInclude
EXE_LIBS = \
-lmeshTools \
-lconversion

View File

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

View File

@ -0,0 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude
EXE_LIBS = \
-lfileFormats

View File

@ -0,0 +1,137 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2024 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-ensightFile
Description
check cleanup of ensight file and variable names
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "ensightFile.H"
#include "ensightGeoFile.H"
#include "Switch.H"
#include "IOstreams.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noBanner();
argList::noParallel();
argList::addBoolOption("ascii", "open as ascii instead of binary");
argList::addBoolOption("binary", "(default)");
argList::addBoolOption("clear", "force clear of time-steps");
argList::addBoolOption("no-end", "skip use of endTimeStep");
argList::addBoolOption("append", "open in append mode");
argList::addOption("geom", "geometry file");
argList::addOption("field", "field file");
#include "setRootCase.H"
const bool with_ascii = args.found("ascii") && !args.found("binary");
// const bool with_binary = args.found("binary");
const bool with_append = args.found("append");
const bool with_clear = args.found("clear");
const bool without_end = args.found("no-end");
const IOstreamOption::streamFormat fmt =
(
with_ascii
? IOstreamOption::ASCII
: IOstreamOption::BINARY
);
const IOstreamOption::appendType append =
(
with_append
? IOstreamOption::APPEND_ATE
: IOstreamOption::NO_APPEND
);
fileName file;
if (args.readIfPresent("geom", file))
{
Info<< "Open " << file << " as geometry "
<< " format:" << (with_ascii ? "ASCII" : "BINARY")
<< " append:" << Switch::name(with_append) << nl;
ensightGeoFile ensFile(append, file, fmt);
if (append)
{
ensFile.beginTimeStep();
// At the moment need to pair begin/end time-step calls
if (!without_end)
{
ensFile.endTimeStep();
}
}
if (with_clear)
{
ensFile.clearTimeSteps();
}
}
if (args.readIfPresent("field", file))
{
Info<< "Open " << file << " as field"
<< " format:" << (with_ascii ? "ASCII" : "BINARY")
<< " append:" << Switch::name(with_append) << nl;
ensightFile ensFile(append, file, fmt);
if (append)
{
ensFile.beginTimeStep();
// At the moment need to pair begin/end time-step calls
if (!without_end)
{
ensFile.endTimeStep();
}
}
if (with_clear)
{
ensFile.clearTimeSteps();
}
}
Info<< "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude
EXE_LIBS = \
-lfileFormats

View File

@ -24,10 +24,10 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-ensightFile
Test-ensightFileName
Description
check cleanup of ensight file and variable names
Check cleanup of ensight file and variable names
\*---------------------------------------------------------------------------*/

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021-2023 OpenCFD Ltd.
Copyright (C) 2021-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -21,6 +21,8 @@ Description
#include "argList.H"
#include "IOstreams.H"
#include "ITstream.H"
#include "OTstream.H"
#include "SpanStream.H"
#include "exprValue.H"
#include "Pstream.H"
@ -34,6 +36,41 @@ void printInfo(const expressions::exprValue& val)
}
void write_read(const expressions::exprValue& val)
{
OCharStream os;
os << val;
ISpanStream is(os.view());
expressions::exprValue val2;
is >> val2;
Pout<< "wrote " << os.count() << " chars: " << os.str() << nl;
printInfo(val);
printInfo(val2);
Pout<< "====" << nl;
}
tokenList tokens_of(const expressions::exprValue& val)
{
OTstream toks;
toks << val;
Pout<< "val with tokens: ";
toks.writeList(Pout, 0) << nl;
for (const auto& t : toks)
{
Pout<< " " << t.info() << nl;
}
Pout<< nl;
return toks;
}
expressions::exprValue tryParse(const std::string& str)
{
expressions::exprValue val, val2;
@ -90,6 +127,7 @@ int main(int argc, char *argv[])
{
expressions::exprValue value;
tokenList toks;
Info<< "exprValue"
<< " sizeof:" << value.size_bytes()
@ -99,21 +137,31 @@ int main(int argc, char *argv[])
// Nothing
printInfo(value);
toks = tokens_of(value);
write_read(value);
value.set(scalar(100));
printInfo(value);
printInfo(value); write_read(value); toks = tokens_of(value);
value.set(scalar(100.01));
printInfo(value); write_read(value); toks = tokens_of(value);
value.set(vector(1,2,3));
printInfo(value);
printInfo(value); write_read(value); toks = tokens_of(value);
value = vector(4,5,6);
printInfo(value);
printInfo(value); write_read(value); toks = tokens_of(value);
value = Zero;
printInfo(value);
printInfo(value); write_read(value); toks = tokens_of(value);
value.clear();
printInfo(value); write_read(value); toks = tokens_of(value);
value.set<bool>(true);
printInfo(value);
printInfo(value); write_read(value); toks = tokens_of(value);
if (UPstream::parRun())
{

View File

@ -1,5 +1,3 @@
exprValueFieldTag.cxx
Test-exprValue2.cxx
EXE = $(FOAM_USER_APPBIN)/Test-exprValue2

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
Copyright (C) 2023-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,7 +36,6 @@ Description
#include "vectorField.H"
#include "DynamicList.H"
#include "Random.H"
#include "exprValue.H"
#include "exprValueFieldTag.H"
using namespace Foam;
@ -61,27 +60,81 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
DynamicList<fieldTag> allTags;
{
scalarField fld1(20);
scalarField fld2a(20, Zero);
scalarField fld2b(10, 3.10);
scalarField fld3;
forAll(fld1, i)
for (auto& val : fld1)
{
fld1[i] = rnd.position<scalar>(0, 20);
val = rnd.position<scalar>(0, 20);
}
if (!UPstream::master())
{
fld2b.resize(5);
fld2b *= 2;
}
fieldTag tag1(fld1.begin(), fld1.end());
fieldTag tag2a(fld2a.begin(), fld2a.end());
fieldTag tag2b(fld2b.begin(), fld2b.end());
fieldTag tag3(fld3.begin(), fld3.end());
fieldTag tag4(fld3.begin(), fld3.end());
printInfo(tag1) << nl;
printInfo(tag2a) << nl;
printInfo(tag2b) << nl;
printInfo(tag3) << nl;
{
Pout<< "Test reduce" << nl;
fieldTag work(fld2b.begin(), fld2b.end());
Pout<< "Before" << nl;
printInfo(work) << nl;
work.reduce();
Pout<< "After" << nl;
printInfo(work) << nl;
Pout<< "====" << nl;
}
allTags.clear();
allTags.push_back(tag1);
allTags.push_back(tag2a);
allTags.push_back(tag2b);
allTags.push_back(tag3);
allTags.push_back(tag4);
allTags.push_back(fieldTag::make_empty<tensor>());
// Add some other types
{
vectorField vfld2a(20, vector::uniform(1.23));
allTags.emplace_back
(
vfld2a.begin(),
vfld2a.end()
);
allTags.emplace_back(vector(1.01, 2.02, 3.03));
allTags.emplace_back(12.4);
allTags.emplace_back().set_value(vector::uniform(2.0));
allTags.back().set_empty();
}
Info<< "all tags: " << allTags << nl;
Foam::sort(allTags);
Info<< "sorted: " << allTags << nl;
fieldTag result;
result = fieldTag::combineOp{}(tag1, tag2a);

View File

@ -1,160 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 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/>.
\*---------------------------------------------------------------------------*/
#include "exprValueFieldTag.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::expressions::exprValueFieldTag::empty() const noexcept
{
return
(
uniformity_ == Foam::Detail::ListPolicy::uniformity::EMPTY
);
}
bool Foam::expressions::exprValueFieldTag::is_uniform() const noexcept
{
return
(
uniformity_ == Foam::Detail::ListPolicy::uniformity::UNIFORM
);
}
bool Foam::expressions::exprValueFieldTag::is_nonuniform() const noexcept
{
return
(
uniformity_ == Foam::Detail::ListPolicy::uniformity::NONUNIFORM
);
}
bool Foam::expressions::exprValueFieldTag::equal
(
const exprValueFieldTag& rhs
) const
{
return (value_ == rhs.value_);
}
void Foam::expressions::exprValueFieldTag::set_nouniform() noexcept
{
uniformity_ = Foam::Detail::ListPolicy::uniformity::NONUNIFORM;
value_ = Foam::zero{};
}
void Foam::expressions::exprValueFieldTag::combine
(
const exprValueFieldTag& b
)
{
if (b.empty())
{
// no-op
return;
}
exprValueFieldTag& a = *this;
if (a.empty())
{
a = b;
}
else if (a.is_nonuniform())
{
// Already non-uniform/mixed
// a.uniformity_ |= b.uniformity_;
a.value_ = Foam::zero{};
}
else if (a.is_uniform() && b.is_uniform())
{
// Both are uniform, but are they the same value?
if (!a.equal(b))
{
a.set_nouniform();
}
}
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
void Foam::expressions::exprValueFieldTag::read(Istream& is)
{
label uniformTag;
is >> uniformTag;
uniformity_ = int(uniformTag);
value_.read(is);
}
void Foam::expressions::exprValueFieldTag::write(Ostream& os) const
{
os << label(uniformity_);
value_.write(os, false); // No pruning
}
void Foam::expressions::exprValueFieldTag::print(Ostream& os) const
{
os << "{ uniform:"
<< label(uniformity_)
<< " type:" << label(value_.typeCode())
<< " value: " << value_ << " }";
}
Foam::Istream& Foam::operator>>
(
Istream& is,
expressions::exprValueFieldTag& tag
)
{
tag.read(is);
return is;
}
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const expressions::exprValueFieldTag& tag
)
{
tag.write(os);
return os;
}
// ************************************************************************* //

View File

@ -32,6 +32,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H"
#include "volFields.H"
#include "Time.H"
@ -126,14 +127,14 @@ void writeStencilStats(const labelListList& stencil)
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
timeSelector::addOptions_singleTime(); // Single-time options
#include "setRootCase.H"
#include "createTime.H"
// Get times list
instantList Times = runTime.times();
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
// Set time from specified time options, or force start from Time=0
timeSelector::setTimeIfPresent(runTime, args, true);
#include "createMesh.H"
// Force calculation of extended edge addressing

View File

@ -32,6 +32,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H"
#include "volFields.H"
#include "surfaceFields.H"
@ -107,14 +108,16 @@ void writeStencilStats(const labelListList& stencil)
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
argList::noFunctionObjects(); // Never use function objects
timeSelector::addOptions_singleTime(); // Single-time options
#include "setRootCase.H"
#include "createTime.H"
// Get times list
instantList Times = runTime.times();
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
// Set time from specified time options, or force start from Time=0
timeSelector::setTimeIfPresent(runTime, args, true);
#include "createMesh.H"

View File

@ -5,4 +5,5 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-ldynamicMesh

View File

@ -32,6 +32,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H"
#include "volFields.H"
#include "Time.H"
@ -51,22 +52,33 @@ using namespace Foam;
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
argList::addArgument("inflate (true|false)");
timeSelector::addOptions_singleTime(); // Single-time options
argList::addBoolOption
(
"inflate",
"Use inflation/deflation for deleting cells"
);
#include "setRootCase.H"
#include "createTime.H"
// Allow override of time from specified time options, or no-op
timeSelector::setTimeIfPresent(runTime, args);
#include "createMesh.H"
const Switch inflate(args[1]);
const bool inflate = args.found("inflate");
if (inflate)
{
Info<< "Deleting cells using inflation/deflation" << nl << endl;
Info<< "Deleting cells using inflation/deflation"
<< nl << endl;
}
else
{
Info<< "Deleting cells, introducing points at new position" << nl
<< endl;
Info<< "Deleting cells, introducing points at new position"
<< nl << endl;
}

View File

@ -47,7 +47,7 @@ using namespace Foam;
template<class PrimitiveType>
static List<PrimitiveType> splitStringToList(const std::string& str)
{
const SubStrings<std::string> items = stringOps::splitAny(str, " ,;");
const auto items = stringOps::splitAny(str, " ,;");
DynamicList<PrimitiveType> values(items.size());

View File

@ -5,4 +5,5 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-ldynamicMesh

View File

@ -33,6 +33,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "volFields.H"
#include "surfaceFields.H"
@ -52,21 +53,28 @@ using namespace Foam;
// Main program:
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
argList::addArgument("inflate (true|false)");
timeSelector::addOptions_singleTime(); // Single-time options
argList::addBoolOption
(
"inflate",
"Use inflation/deflation for splitting/deleting cells"
);
#include "setRootCase.H"
#include "createTime.H"
// Allow override of time from specified time options, or no-op
timeSelector::setTimeIfPresent(runTime, args);
#include "createMesh.H"
const pointConstraints& pc = pointConstraints::New(pointMesh::New(mesh));
const Switch inflate(args[1]);
const bool inflate = args.found("inflate");
if (inflate)
{
Info<< "Splitting/deleting cells using inflation/deflation" << nl
<< endl;
Info<< "Splitting/deleting cells using inflation/deflation"
<< nl << endl;
}
else
{
@ -75,6 +83,8 @@ int main(int argc, char *argv[])
}
const pointConstraints& pc = pointConstraints::New(pointMesh::New(mesh));
Random rndGen(0);

View File

@ -51,7 +51,6 @@ using namespace Foam;
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"

View File

@ -66,13 +66,13 @@ int main(int argc, char *argv[])
for (const entry& dEntry : dict)
{
if (!dEntry.isStream())
if (dEntry.isStream())
{
continue;
List<namedDictionary> list(dEntry.stream());
Info<< "input: " << dEntry << nl
<< "list: " << list << nl;
}
Info<< "input: " << dEntry << nl;
List<namedDictionary> list(dEntry.stream());
Info<< "list: " << list << nl;
}
}
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd.
Copyright (C) 2022-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -44,175 +44,62 @@ Description
using namespace Foam;
// Looks like Pstream::exchangeBuf
template<class T>
void do_exchangeBuf
//- Number of elements corresponding to max byte transfer.
// Normal upper limit is INT_MAX since MPI sizes are limited to <int>.
template<class Type>
inline std::size_t maxTransferCount
(
const label sendSize,
const char* sendData,
const label recvSize,
char* recvData,
const int tag,
const label comm,
const bool wait
)
const std::size_t max_bytes = std::size_t(0)
) noexcept
{
const label startOfRequests = UPstream::nRequests();
// Set up receives
// ~~~~~~~~~~~~~~~
// forAll(recvSizes, proci)
{
// if (proci != Pstream::myProcNo(comm) && recvSizes[proci] > 0)
if (!Pstream::master(comm) && recvSize > 0)
{
UIPstream::read
(
UPstream::commsTypes::nonBlocking,
UPstream::myProcNo(comm), // proci,
recvData,
recvSize*sizeof(T),
tag,
comm
);
}
}
// Set up sends
// ~~~~~~~~~~~~
// forAll(sendBufs, proci)
for (const int proci : Pstream::subProcs(comm))
{
if (sendSize > 0)
// if (proci != Pstream::myProcNo(comm) && sendSizes[proci] > 0)
{
if
(
!UOPstream::write
(
UPstream::commsTypes::nonBlocking,
proci,
sendData,
sendSize*sizeof(T),
tag,
comm
)
)
{
FatalErrorInFunction
<< "Cannot send outgoing message. "
<< "to:" << proci << " nBytes:"
<< label(sendSize*sizeof(T))
<< Foam::abort(FatalError);
}
}
}
// Wait for all to finish
// ~~~~~~~~~~~~~~~~~~~~~~
if (wait)
{
UPstream::waitRequests(startOfRequests);
}
return
(
(max_bytes == 0) // ie, unlimited
? (std::size_t(0)) //
: (max_bytes > std::size_t(INT_MAX)) // MPI limit is <int>
? (std::size_t(INT_MAX) / sizeof(Type)) //
: (max_bytes > sizeof(Type)) // require an integral number
? (max_bytes / sizeof(Type)) //
: (std::size_t(1)) // min of one element
);
}
// Looks like Pstream::exchangeContainer
template<class Container, class T>
void do_exchangeContainer
//- Upper limit on number of transfer bytes.
// Max bytes is normally INT_MAX since MPI sizes are limited to <int>.
// Negative values indicate a subtraction from INT_MAX.
inline std::size_t PstreamDetail_maxTransferBytes
(
const Container& sendData,
const label recvSize,
Container& recvData,
const int tag,
const label comm,
const bool wait
)
const int64_t max_bytes
) noexcept
{
const label startOfRequests = UPstream::nRequests();
// Set up receives
// ~~~~~~~~~~~~~~~
// for (const int proci : Pstream::allProcs(comm))
{
if (!Pstream::master(comm) && recvSize > 0)
// if (proci != Pstream::myProcNo(comm) && recvSize > 0)
{
UIPstream::read
(
UPstream::commsTypes::nonBlocking,
UPstream::myProcNo(comm), // proci,
recvData.data_bytes(),
recvSize*sizeof(T),
tag,
comm
);
}
}
// Set up sends
// ~~~~~~~~~~~~
if (Pstream::master(comm) && sendData.size() > 0)
{
for (const int proci : Pstream::subProcs(comm))
{
if
(
!UOPstream::write
(
UPstream::commsTypes::nonBlocking,
proci,
sendData.cdata_bytes(),
sendData.size_bytes(),
tag,
comm
)
)
{
FatalErrorInFunction
<< "Cannot send outgoing message. "
<< "to:" << proci << " nBytes:"
<< label(sendData.size_bytes())
<< Foam::abort(FatalError);
}
}
}
// Wait for all to finish
// ~~~~~~~~~~~~~~~~~~~~~~
if (wait)
{
UPstream::waitRequests(startOfRequests);
}
return
(
(max_bytes < 0) // (numBytes fewer than INT_MAX)
? std::size_t(INT_MAX + max_bytes)
: std::size_t(max_bytes)
);
}
template<class Container, class T>
template<class Container, class Type>
void broadcast_chunks
(
Container& sendData,
const int tag = UPstream::msgType(),
const label comm = UPstream::worldComm,
const bool wait = true
const label comm = UPstream::worldComm
const int64_t maxComms_bytes = UPstream::maxCommsSize
)
{
// OR static_assert(is_contiguous<T>::value, "Contiguous data only!")
if (!is_contiguous<T>::value)
if (!is_contiguous<Type>::value)
{
FatalErrorInFunction
<< "Contiguous data only." << sizeof(T) << Foam::abort(FatalError);
<< "Contiguous data only." << sizeof(Type)
<< Foam::abort(FatalError);
}
if (UPstream::maxCommsSize <= 0)
if (maxComms_bytes == 0)
{
// Do in one go
Info<< "send " << sendData.size() << " elements in one go" << endl;
@ -227,93 +114,90 @@ void broadcast_chunks
sendData.resize_nocopy(recvSize); // A no-op on master
// Determine the number of chunks to send. Note that we
// only have to look at the sending data since we are
// guaranteed that some processor's sending size is some other
// processor's receive size. Also we can ignore any local comms.
// We need to send chunks so the number of iterations:
// maxChunkSize iterations
// ------------ ----------
// 0 0
// 1..maxChunkSize 1
// maxChunkSize+1..2*maxChunkSize 2
// ...
const label maxChunkSize
// The chunk size (number of elements) corresponding to max byte transfer
// Is zero for non-chunked exchanges.
const std::size_t chunkSize
(
max
PstreamDetail_maxTransferCount<Type>
(
static_cast<label>(1),
static_cast<label>(UPstream::maxCommsSize/sizeof(T))
PstreamDetail_maxTransferBytes(maxComms_bytes)
)
);
label nChunks(0);
{
// Get max send count (elements)
// forAll(sendBufs, proci)
// {
// if (proci != Pstream::myProcNo(comm))
// {
// nChunks = max(nChunks, sendBufs[proci].size());
// }
// }
nChunks = sendSize;
if (chunkSize)
{
// Convert from send count (elements) to number of chunks.
// Can normally calculate with (count-1), but add some safety
if (nChunks)
{
nChunks = 1 + (nChunks/maxChunkSize);
}
reduce(nChunks, maxOp<label>(), tag, comm);
label nChunks = 1 + (sendSize/label(chunkSize));
Info
<< "send " << sendSize << " elements ("
<< (sendSize*sizeof(T)) << " bytes) in " << nChunks
<< " chunks of " << maxChunkSize << " elements ("
<< (maxChunkSize*sizeof(T)) << " bytes) for maxCommsSize:"
<< Pstream::maxCommsSize
<< (sendSize*sizeof(Type)) << " bytes) in " << nChunks
<< " chunks of " << label(chunkSize) << " elements ("
<< label(chunkSize*sizeof(Type)) << " bytes) for maxCommsSize:"
<< label(maxComms_bytes)
<< endl;
}
// stress-test with shortened sendSize
// will produce useless loops, but no calls
// sendSize /= 2;
label nSend(0);
label startSend(0);
char* charPtrSend;
typedef stdFoam::span<Type> sendType;
for (label iter = 0; iter < nChunks; ++iter)
do
{
nSend = min
(
maxChunkSize,
sendSize-startSend
);
sendType payload(sendData.data(), sendData.size());
charPtrSend =
(
nSend > 0
? reinterpret_cast<char*>(&(sendData[startSend]))
: nullptr
);
Info<< "iter " << iter
<< ": beg=" << startSend << " len=" << nSend
<< " (" << (nSend*sizeof(T)) << " bytes)" << endl;
UPstream::broadcast(charPtrSend, nSend*sizeof(T), comm);
// forAll(nSend, proci)
if (!chunkSize)
{
startSend += nSend;
UPstream::broadcast
(
payload.data_bytes(),
payload.size_bytes(),
comm
);
break;
}
// Dispatch chunk-wise until there is nothing left
for (int iter = 0; /*true*/; ++iter)
{
// The begin/end for the data window
const std::size_t beg = (std::size_t(iter)*chunkSize);
const std::size_t end = (std::size_t(iter+1)*chunkSize);
if (payload.size() <= beg)
{
// No more data windows
break;
}
sendType window
(
(end < payload.size())
? payload.subspan(beg, end - beg)
: payload.subspan(beg)
);
Info<< "iter " << iter
<< ": beg=" << label(beg) << " len=" << label(window.size())
<< " (" << label(window.size_bytes()) << " bytes)" << endl;
UPstream::broadcast
(
window.data_bytes(),
window.size_bytes(),
comm
);
}
}
while (false);
Info<< "final: " << startSend << endl;
Info<< "final" << endl;
}
@ -333,7 +217,7 @@ int main(int argc, char *argv[])
}
labelList input1;
if (Pstream::master())
if (UPstream::master())
{
input1 = identity(500);
}
@ -348,7 +232,7 @@ int main(int argc, char *argv[])
// Mostly the same with PstreamBuffers
if (false)
{
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
labelList sendData;
if (Pstream::master())

View File

@ -130,7 +130,7 @@ int main(int argc, char *argv[])
for (bool barrier_active = false, done = false; !done; /*nil*/)
{
std::pair<int, int> probed =
std::pair<int, int64_t> probed =
UPstream::probeMessage
(
UPstream::commsTypes::nonBlocking,
@ -143,8 +143,8 @@ int main(int argc, char *argv[])
{
// Message found and had size: receive it
const label proci = probed.first;
const label count = probed.second;
const label proci(probed.first);
const label count(probed.second);
recvBufs(proci).resize_nocopy(count);
recvFromProc(recvRequests.size()) = proci;

View File

@ -119,7 +119,7 @@ int main(int argc, char *argv[])
for (bool barrier_active = false, done = false; !done; /*nil*/)
{
std::pair<int, int> probed =
std::pair<int, int64_t> probed =
UPstream::probeMessage
(
UPstream::commsTypes::nonBlocking,
@ -132,8 +132,8 @@ int main(int argc, char *argv[])
{
// Message found and had size: receive it
const label proci = probed.first;
const label count = probed.second;
const label proci(probed.first);
const label count(probed.second);
if (optNonBlocking)
{

View File

@ -7,5 +7,6 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-ldynamicFvMesh \
-lsampling \
-loverset

View File

@ -56,6 +56,7 @@ Description
#include "fvCFD.H"
#include "simpleControl.H"
#include "predicates.H"
#include "dynamicFvMesh.H"
#include "dynamicOversetFvMesh.H"
@ -97,6 +98,7 @@ int main(int argc, char *argv[])
component(T.ref(), mesh.C(), 1);
// Interpolate + halo swap
T.correctBoundaryConditions();
// T.boundaryFieldRef().evaluate_if(predicates::always{});
// Check halo swap
dynamicOversetFvMesh::checkCoupledBC(T);
}

View File

@ -148,7 +148,7 @@ int main(int argc, char *argv[])
Info<< "input: " << input << nl
<< "expand: " << output << nl
<< "split: " << stringOps::split(output, "/") << nl << nl;
<< "split: " << stringOps::split(output, '/') << nl << nl;
}
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,6 +34,7 @@ Description
#include "argList.H"
#include "fileName.H"
#include "stringOps.H"
#include "Switch.H"
using namespace Foam;
@ -65,6 +66,9 @@ int main(int argc, char *argv[])
{
argList::noBanner();
argList::noParallel();
argList::noMandatoryArgs();
argList::addArgument("string .. stringN");
argList::addOption
(
"any",
@ -89,6 +93,12 @@ int main(int argc, char *argv[])
"int",
"test split on fixed width"
);
argList::addOption
(
"begin",
"int",
"begin offset for splits"
);
argList::addBoolOption
(
"slash",
@ -104,18 +114,25 @@ int main(int argc, char *argv[])
"empty",
"preserve empty strings in split"
);
argList args(argc, argv, false, true);
argList args(argc, argv);
if (args.size() <= 1 && args.options().empty())
{
args.printUsage();
}
const label beginOffset = args.getOrDefault<label>("begin", 0);
const bool keepEmpty = args.found("empty");
Info<< "begin offset: " << beginOffset << nl;
Info<< "keep empty : " << Switch::name(keepEmpty) << nl;
const label nopts =
args.count({"any", "slash", "space", "sub", "fixed", "char"});
if (args.found("any"))
{
const std::string& str = args["any"];
@ -125,7 +142,7 @@ int main(int argc, char *argv[])
for (label argi=1; argi < args.size(); ++argi)
{
const auto split = stringOps::splitAny(args[argi], str);
auto split = stringOps::splitAny(args[argi], str, beginOffset);
printSubStrings(args[argi], split);
}
@ -144,7 +161,7 @@ int main(int argc, char *argv[])
for (label argi=1; argi < args.size(); ++argi)
{
const auto split = stringOps::split(args[argi], str);
auto split = stringOps::split(args[argi], str, beginOffset);
printSubStrings(args[argi], split);
}
@ -161,7 +178,11 @@ int main(int argc, char *argv[])
for (label argi=1; argi < args.size(); ++argi)
{
const auto split = stringOps::splitSpace(args[argi]);
auto split = stringOps::splitSpace(args[argi], beginOffset);
printSubStrings(args[argi], split);
Info<< "pop_front(2)" << nl;
split.pop_front(2);
printSubStrings(args[argi], split);
}
@ -180,7 +201,8 @@ int main(int argc, char *argv[])
for (label argi=1; argi < args.size(); ++argi)
{
const auto split = stringOps::split(args[argi], delim, keepEmpty);
auto split =
stringOps::split(args[argi], delim, beginOffset, keepEmpty);
printSubStrings(args[argi], split);
}
@ -199,7 +221,7 @@ int main(int argc, char *argv[])
for (label argi=1; argi < args.size(); ++argi)
{
const auto split = stringOps::splitFixed(args[argi], width);
auto split = stringOps::splitFixed(args[argi], width, beginOffset);
printSubStrings(args[argi], split);
}
@ -219,7 +241,8 @@ int main(int argc, char *argv[])
for (label argi=1; argi < args.size(); ++argi)
{
const auto split = stringOps::split(args[argi], delim, keepEmpty);
auto split =
stringOps::split(args[argi], delim, beginOffset, keepEmpty);
printSubStrings(args[argi], split);
}
}

View File

@ -157,7 +157,7 @@ int main(int argc, char *argv[])
// // skip over time=0, unless some other time option has been specified
// if
// (
// !args.found("zeroTime")
// !args.found("noZero")
// && !args.found("time")
// && !args.found("latestTime")
// && Times.size() > 2

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022-2023 OpenCFD Ltd.
Copyright (C) 2022-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -93,29 +93,34 @@ void Foam::fileFormats::ensightMeshReader::readIDs
(
ensightReadFile& is,
const bool doRead,
const label nShapes,
const label elemCount,
labelList& foamToElem,
Map<label>& elemToFoam
) const
{
const label sz = foamToElem.size();
foamToElem.resize(sz+nShapes);
const label begElem = foamToElem.size();
const label endElem = begElem + elemCount;
foamToElem.resize(foamToElem.size()+elemCount);
if (doRead)
{
elemToFoam.reserve(elemToFoam.size()+nShapes);
for (label shapei = 0; shapei < nShapes; shapei++)
elemToFoam.reserve(elemToFoam.size()+elemCount);
for (label elemi = begElem; elemi < endElem; ++elemi)
{
label elemi;
is.read(elemi);
foamToElem[sz+shapei] = elemi;
elemToFoam.insert(elemi, sz+shapei);
label id;
is.read(id);
foamToElem[elemi] = id;
elemToFoam.insert(id, elemi);
}
}
else
{
for (label shapei = 0; shapei < nShapes; shapei++)
// identity
for (label elemi = begElem; elemi < endElem; ++elemi)
{
foamToElem[sz+shapei] = sz+shapei;
foamToElem[elemi] = elemi;
}
}
}
@ -209,37 +214,54 @@ bool Foam::fileFormats::ensightMeshReader::readGoldPart
// Work
DynamicList<label> verts;
string line;
string buffer;
while (is.good())
{
do
{
is.readKeyword(line);
// Get entire line/string
is.read(buffer);
}
while (line.empty() && is.good());
while (buffer.empty() && is.good());
const auto split = stringOps::splitSpace(line);
if (!is.good())
{
break;
}
else if (buffer.contains("BEGIN TIME STEP"))
{
// Graciously handle a miscued start
continue;
}
else if (buffer.contains("END TIME STEP"))
{
// END TIME STEP is a valid means to terminate input
break;
}
const auto split = stringOps::splitSpace(buffer);
if (split.size() == 0)
if (split.empty())
{
continue;
}
if (split[0] == "part")
const auto keyword(split[0].str());
if (keyword == "part")
{
return false;
}
else if (split[0] == "node_ids")
else if (keyword == "node_ids")
{
const label nPoints = points.size();
// Ignore for now
for (label i = 0; i < nPoints; i++)
// Ignore point ids
for (label pointi = 0; pointi < nPoints; ++pointi)
{
label index;
is.read(index);
label id;
is.read(id);
}
}
else if (split[0] == "coordinates")
else if (keyword == "coordinates")
{
label nPoints;
is.read(nPoints);
@ -257,207 +279,205 @@ bool Foam::fileFormats::ensightMeshReader::readGoldPart
nodeIdToPoints
);
points.setSize(nPoints);
for (label pointi = 0; pointi < nPoints; pointi++)
{
is.read(points[pointi].x());
}
for (label pointi = 0; pointi < nPoints; pointi++)
{
is.read(points[pointi].y());
}
for (label pointi = 0; pointi < nPoints; pointi++)
{
is.read(points[pointi].z());
}
is.readPoints(nPoints, points);
}
else if (split[0] == "tetra4")
else if (keyword == "tetra4")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent<< "tetra4 " << nShapes
Pout<< indent<< "tetra4 " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label celli = cells.size();
cells.resize(celli+nShapes);
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
cellToElemIds,
elemIdToCells
);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
cells.resize(startElemi+elemCount);
faceListList::subList myElements = cells.slice(startElemi);
const auto& model = cellModel::ref(cellModel::TET);
for (label shapei = 0; shapei < nShapes; shapei++)
for (auto& cellFaces : myElements)
{
readVerts(is, 4, nodeIdToPoints, verts);
if (setHandedness_)
{
setHandedness(model, verts, points);
}
const cellShape cellVerts(model, verts);
cells[celli+shapei] = cellVerts.faces();
cellFaces = cellShape(model, verts).faces();
}
}
else if (split[0] == "pyramid5")
else if (keyword == "pyramid5")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent<< "pyramid5 " << nShapes
Pout<< indent<< "pyramid5 " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label celli = cells.size();
cells.resize(celli+nShapes);
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
cellToElemIds,
elemIdToCells
);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
cells.resize(startElemi+elemCount);
faceListList::subList myElements = cells.slice(startElemi);
const auto& model = cellModel::ref(cellModel::PYR);
for (label shapei = 0; shapei < nShapes; shapei++)
for (auto& cellFaces : myElements)
{
readVerts(is, 5, nodeIdToPoints, verts);
if (setHandedness_)
{
setHandedness(model, verts, points);
}
const cellShape cellVerts(model, verts);
cells[celli+shapei] = cellVerts.faces();
cellFaces = cellShape(model, verts).faces();
}
}
else if (split[0] == "penta6")
else if (keyword == "penta6")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent<< "penta6 " << nShapes
Pout<< indent<< "penta6 " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label celli = cells.size();
cells.resize(celli+nShapes);
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
cellToElemIds,
elemIdToCells
);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
cells.resize(startElemi+elemCount);
faceListList::subList myElements = cells.slice(startElemi);
const auto& model = cellModel::ref(cellModel::PRISM);
for (label shapei = 0; shapei < nShapes; shapei++)
for (auto& cellFaces : myElements)
{
readVerts(is, 6, nodeIdToPoints, verts);
if (setHandedness_)
{
setHandedness(model, verts, points);
}
const cellShape cellVerts(model, verts);
cells[celli+shapei] = cellVerts.faces();
cellFaces = cellShape(model, verts).faces();
}
}
else if (split[0] == "hexa8")
else if (keyword == "hexa8")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent<< "hexa8 " << nShapes
Pout<< indent<< "hexa8 " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label celli = cells.size();
cells.resize(celli+nShapes);
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
cellToElemIds,
elemIdToCells
);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
cells.resize(startElemi+elemCount);
faceListList::subList myElements = cells.slice(startElemi);
const auto& model = cellModel::ref(cellModel::HEX);
for (label shapei = 0; shapei < nShapes; shapei++)
for (auto& cellFaces : myElements)
{
readVerts(is, 8, nodeIdToPoints, verts);
if (setHandedness_)
{
setHandedness(model, verts, points);
}
const cellShape cellVerts(model, verts);
cells[celli+shapei] = cellVerts.faces();
cellFaces = cellShape(model, verts).faces();
}
}
else if (split[0] == "nfaced")
else if (keyword == "nfaced")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent<< "nfaced " << nShapes
Pout<< indent<< "nfaced " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label celli = cells.size();
cells.resize(celli+nShapes);
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
cellToElemIds,
elemIdToCells
);
for (label shapei = 0; shapei < nShapes; shapei++)
// Extend and fill the new trailing portion
const label startElemi = cells.size();
cells.resize(startElemi+elemCount);
faceListList::subList myElements = cells.slice(startElemi);
for (auto& cellFaces : myElements)
{
label nFaces;
is.read(nFaces);
faceList& cellFaces = cells[celli+shapei];
cellFaces.setSize(nFaces);
cellFaces.resize(nFaces);
}
for (label shapei = 0; shapei < nShapes; shapei++)
for (auto& cellFaces : myElements)
{
faceList& cellFaces = cells[celli+shapei];
forAll(cellFaces, cellFacei)
for (face& f : cellFaces)
{
label nVerts;
is.read(nVerts);
cellFaces[cellFacei].setSize(nVerts);
f.resize(nVerts);
}
}
for (label shapei = 0; shapei < nShapes; shapei++)
for (faceList& cellFaces : myElements)
{
faceList& cellFaces = cells[celli+shapei];
forAll(cellFaces, cellFacei)
for (face& f : cellFaces)
{
face& f = cellFaces[cellFacei];
readVerts(is, f.size(), nodeIdToPoints, verts);
f.labelList::operator=(verts);
}
}
forAll(f, fp)
// Full check
forAll(myElements, elemi)
{
for (const face& f : myElements[elemi])
{
for (label pointi : f)
{
if (f[fp] < 0 || f[fp] >= points.size())
if (pointi < 0 || pointi >= points.size())
{
FatalErrorInFunction<< "Face:" << shapei
FatalErrorInFunction
<< "Face:" << elemi
<< " verts:" << f
<< " indexes outside points:" << points.size()
<< exit(FatalError);
@ -466,107 +486,104 @@ bool Foam::fileFormats::ensightMeshReader::readGoldPart
}
}
}
else if (split[0] == "tria3")
else if (keyword == "tria3")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent << "tria3 " << nShapes
Pout<< indent << "tria3 " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label facei = faces.size();
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
faceToElemIDs,
elemIdToFaces
);
faces.setSize(facei+nShapes);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
faces.resize(startElemi+elemCount, face(3)); // <- tria3
faceList::subList myElements = faces.slice(startElemi);
for (label shapei = 0; shapei < nShapes; shapei++)
for (face& f : myElements)
{
auto& f = faces[facei+shapei];
f.setSize(3);
readVerts(is, f.size(), nodeIdToPoints, verts);
f.labelList::operator=(verts);
}
}
else if (split[0] == "quad4")
else if (keyword == "quad4")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent << "quad4 " << nShapes
Pout<< indent << "quad4 " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label facei = faces.size();
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
faceToElemIDs,
elemIdToFaces
);
faces.setSize(facei+nShapes);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
faces.resize(startElemi+elemCount, face(4)); // <- quad4
faceList::subList myElements = faces.slice(startElemi);
for (label shapei = 0; shapei < nShapes; shapei++)
for (face& f : myElements)
{
auto& f = faces[facei+shapei];
f.setSize(4);
readVerts(is, f.size(), nodeIdToPoints, verts);
f.labelList::operator=(verts);
}
}
else if (split[0] == "nsided")
else if (keyword == "nsided")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent << "nsided " << nShapes
Pout<< indent << "nsided " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label facei = faces.size();
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
faceToElemIDs,
elemIdToFaces
);
faces.setSize(facei+nShapes);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
faces.resize(startElemi+elemCount);
faceList::subList myElements = faces.slice(startElemi);
for (label shapei = 0; shapei < nShapes; shapei++)
for (face& f : myElements)
{
auto& f = faces[facei+shapei];
label nVerts;
is.read(nVerts);
f.setSize(nVerts);
f.resize(nVerts);
}
for (label shapei = 0; shapei < nShapes; shapei++)
for (face& f : myElements)
{
auto& f = faces[facei+shapei];
readVerts(is, f.size(), nodeIdToPoints, verts);
f.labelList::operator=(verts);
}
}
else
{
WarningInFunction << "Unhandled key " << string(split[0])
<< " from line " << line
WarningInFunction << "Unhandled key " << keyword
<< " from line " << buffer
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
}
@ -584,16 +601,21 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
const scalar scaleFactor
)
{
// Auto-detect ascii/binary format,
// skips any initial "BEGIN TIME STEP"
ensightReadFile is(geometryFile_);
// Skip 'binary' tag
is.readBinaryHeader();
string header;
is.read(header);
Info<< "Ensight : " << header << endl;
is.read(header);
Info<< "Ensight : " << header << endl;
string buffer;
// Ensight Geometry File
is.read(buffer);
Info<< "Ensight : " << buffer << nl;
// Description - 1
is.read(buffer);
Info<< "Ensight : " << buffer << nl;
bool read_node_ids = false;
@ -623,61 +645,72 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
// Parse all
string line;
SubStrings<string> split;
while (is.good())
{
do
{
is.readKeyword(line);
// Get entire line/string
is.read(buffer);
}
while (line.empty() && is.good());
const auto split = stringOps::splitSpace(line);
while (buffer.empty() && is.good());
if (buffer.contains("END TIME STEP"))
{
// END TIME STEP is a valid means to terminate input
break;
}
split = stringOps::splitSpace(buffer);
if (split[0] == "extents")
if (split.empty())
{
point min;
point max;
is.read(min.x());
is.read(max.x());
is.read(min.y());
is.read(max.y());
is.read(min.z());
is.read(max.z());
Pout<< indent
<< "Read extents " << boundBox(min, max)
<< endl;
continue;
}
else if (split[0] == "node")
const auto keyword(split[0].str());
if (keyword == "extents")
{
word id(split[1]);
word op(split[2]);
// Optional extents (xmin, xmax, ymin, ymax, zmin, zmax)
boundBox bb;
point& min = bb.min();
point& max = bb.max();
is.read(min.x()); is.read(max.x());
is.read(min.y()); is.read(max.y());
is.read(min.z()); is.read(max.z());
Pout<< indent << "Read extents " << bb << endl;
}
else if (keyword == "node")
{
// "node id (off|assign|given|ignore)"
std::string op(split[2]);
if (op == "given" || op == "ignore")
{
Pout<< indent << "Reading node ids" << endl;
read_node_ids = true;
}
}
else if (split[0] == "element")
else if (keyword == "element")
{
word id(split[1]);
word op(split[2]);
// "element id (off|assign|given|ignore)"
std::string op(split[2]);
if (op == "given" || op == "ignore")
{
Pout<< indent << "Reading element ids" << endl;
read_elem_ids = true;
}
}
else if (split[0] == "part")
else if (keyword == "part")
{
bool finished = false;
do
{
// Make space
partIDs.emplace_back();
is.read(partIDs.back());
partNames.emplace_back();
is.read(partNames.back());
// Read part id and name
is.read(partIDs.emplace_back());
is.read(partNames.emplace_back());
Pout<< indent
<< "Reading part " << partIDs.back()
@ -954,7 +987,7 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
const face& f = rotateFace(cFaces[cFacei], rotatedFace);
const auto fFnd = vertsToCell.find(f);
if (fFnd)
if (fFnd.good())
{
// Already inserted. Internal face.
vertsToCell.erase(fFnd);
@ -1026,7 +1059,12 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
)
);
if (!cAndF)
if (cAndF.good())
{
partCellAndFace[patchFacei++] = cAndF.val();
vertsToCell.erase(cAndF);
}
else
{
//WarningInFunction
// << "Did not find face " << facei
@ -1036,11 +1074,6 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
// << " in part " << parti
// << endl;
}
else
{
partCellAndFace[patchFacei++] = cAndF();
vertsToCell.erase(cAndF);
}
}
partCellAndFace.setSize(patchFacei);
}

View File

@ -1569,7 +1569,7 @@ int main(int argc, char *argv[])
//Get polyMesh to write to constant
runTime.setTime(instant(runTime.constant()), 0);
runTime.setTime(instant(0, runTime.constant()), 0);
repatcher.repatch();

View File

@ -803,6 +803,10 @@ CompactListList<label> regionRenumber
int main(int argc, char *argv[])
{
argList::noFunctionObjects(); // Never use function objects
timeSelector::addOptions_singleTime(); // Single-time options
argList::addNote
(
"Renumber mesh cells to reduce the bandwidth. Use the -lib option or"
@ -863,11 +867,8 @@ int main(int argc, char *argv[])
"eg, 'reverse true;'"
);
argList::noFunctionObjects(); // Never use function objects
#include "addAllRegionOptions.H"
#include "addOverwriteOption.H"
#include "addTimeOptions.H"
// -------------------------
@ -926,14 +927,15 @@ int main(int argc, char *argv[])
// Get region names
#include "getAllRegionOptions.H"
// Get times list
instantList Times = runTime.times();
// Set startTime depending on -time and -latestTime options
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
// Set time from specified time options, or force start from Time=0
timeSelector::setTimeIfPresent(runTime, args, true);
// Capture current time information for non-overwrite
const Tuple2<instant, label> startTime
(
instant(runTime.value(), runTime.timeName()),
runTime.timeIndex()
);
// Start/reset all timings
timer.resetTime();
@ -947,7 +949,10 @@ int main(int argc, char *argv[])
for (fvMesh& mesh : meshes)
{
// Reset time in case of multiple meshes and not overwrite
runTime.setTime(Times[startTime], startTime);
if (!overwrite)
{
runTime.setTime(startTime.first(), startTime.second());
}
const word oldInstance = mesh.pointsInstance();

View File

@ -62,12 +62,13 @@ using namespace Foam;
int main(int argc, char *argv[])
{
timeSelector::addOptions_singleTime(); // Single-time options
argList::addNote
(
"Add point/face/cell Zones from similarly named point/face/cell Sets"
);
timeSelector::addOptions(true, false); // constant(true), zero(false)
argList::addBoolOption
(
"noFlipMap",
@ -75,14 +76,13 @@ int main(int argc, char *argv[])
);
#include "addRegionOption.H"
#include "addTimeOptions.H"
#include "setRootCase.H"
#include "createTime.H"
const bool noFlipMap = args.found("noFlipMap");
// Get times list
(void)timeSelector::selectIfPresent(runTime, args);
// Allow override of time from specified time options, or no-op
timeSelector::setTimeIfPresent(runTime, args);
#include "createNamedPolyMesh.H"

View File

@ -240,9 +240,9 @@ int main(int argc, char *argv[])
// Read set construct info from dictionary
List<namedDictionary> actionEntries(topoSetDict.lookup("actions"));
forAll(timeDirs, timeI)
forAll(timeDirs, timei)
{
runTime.setTime(timeDirs[timeI], timeI);
runTime.setTime(timeDirs[timei], timei);
Info<< "Time = " << runTime.timeName() << endl;
// Optionally re-read mesh

View File

@ -7,6 +7,7 @@
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2024 OpenCFD Ltd.
Copyright (C) 2024 Haakan Nilsson
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -71,6 +72,9 @@ Usage
The any or all of the three options may be specified and are processed
in the above order.
-cylToCart (originVector axisVector directionVector)
Tranform cylindrical coordinates to cartesian coordinates
With -rotateFields (in combination with -rotate/yawPitchRoll/rollPitchYaw)
it will also read & transform vector & tensor fields.
@ -93,6 +97,7 @@ Note
#include "transformGeometricField.H"
#include "axisAngleRotation.H"
#include "EulerCoordinateRotation.H"
#include "cylindricalCS.H"
using namespace Foam;
using namespace Foam::coordinateRotations;
@ -326,6 +331,13 @@ int main(int argc, char *argv[])
"Scale by the specified amount - Eg, for uniform [mm] to [m] scaling "
"use either '(0.001 0.001 0.001)' or simply '0.001'"
);
argList::addOption
(
"cylToCart",
"(originVec axisVec directionVec)",
"Tranform cylindrical coordinates to cartesian coordinates"
);
// Compatibility with surfaceTransformPoints
argList::addOptionCompat("scale", {"write-scale", 0});
@ -348,7 +360,8 @@ int main(int argc, char *argv[])
"rotate-z",
"rollPitchYaw",
"yawPitchRoll",
"scale"
"scale",
"cylToCart"
});
if (!args.count(operationNames))
@ -552,6 +565,23 @@ int main(int argc, char *argv[])
// Output scaling
applyScaling(points, getScalingOpt("scale", args));
if (args.found("cylToCart"))
{
vectorField n1n2(args.lookup("cylToCart")());
n1n2[1].normalise();
n1n2[2].normalise();
cylindricalCS ccs
(
"ccs",
n1n2[0],
n1n2[1],
n1n2[2]
);
points = ccs.globalPosition(points);
}
// More precision (for points data)
IOstream::minPrecision(10);

View File

@ -549,16 +549,17 @@ int main(int argc, char *argv[])
{
Info<< finder.dict();
}
else if (finder.ref().isStream())
else if (finder.isStream())
{
bool addSep = false;
bool separator = false;
const tokenList& tokens = finder.ref().stream();
for (const token& tok : tokens)
for (const token& tok : finder.stream())
{
if (addSep) Info<< token::SPACE;
addSep = true;
if (separator)
{
Info<< token::SPACE;
}
separator = true;
Info<< tok;
}
Info<< endl;

View File

@ -554,7 +554,8 @@ int main(int argc, char *argv[])
{
autoPtr<ensightGeoFile> os =
ensCase.newGeometry(hasMovingMesh);
ensMesh.write(os);
ensMesh.write(os.ref());
}
// finite-area
@ -562,7 +563,8 @@ int main(int argc, char *argv[])
{
autoPtr<ensightGeoFile> os =
ensFaCasePtr->newGeometry(hasMovingMesh);
ensFaMeshPtr->write(os);
ensFaMeshPtr->write(os.ref());
}
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
Copyright (C) 2023-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,6 +36,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H"
#include "volFields.H"
#include "pointFields.H"
@ -145,20 +146,22 @@ void ReadAndMapFields
int main(int argc, char *argv[])
{
argList::noFunctionObjects(); // Never use function objects
timeSelector::addOptions_singleTime(); // Single-time options
argList::addNote
(
"Convert polyMesh results to tetDualMesh"
);
#include "addOverwriteOption.H"
#include "addTimeOptions.H"
#include "setRootCase.H"
#include "createTime.H"
// Get times list
instantList Times = runTime.times();
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
// Set time from specified time options, or force start from Time=0
timeSelector::setTimeIfPresent(runTime, args, true);
// Read the mesh
#include "createNamedMesh.H"

View File

@ -353,7 +353,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
runTime.setTime(instant(runTime.constant()), 0);
runTime.setTime(instant(0, runTime.constant()), 0);
#include "createNamedMesh.H"

View File

@ -106,7 +106,7 @@ int main(int argc, char *argv[])
}
runTime.setTime(instant(runTime.constant()), 0);
runTime.setTime(instant(0, runTime.constant()), 0);
#include "createNamedMesh.H"

View File

@ -26,8 +26,8 @@ License
\*---------------------------------------------------------------------------*/
#ifndef MapConsistentVolFields_H
#define MapConsistentVolFields_H
#ifndef Foam_MapConsistentVolFields_H
#define Foam_MapConsistentVolFields_H
#include "GeometricField.H"
#include "meshToMesh.H"
@ -41,10 +41,9 @@ namespace Foam
template<class Type>
void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
{
auto& fldBf = fld.boundaryFieldRef();
auto& bfld = fld.boundaryFieldRef();
const UPstream::commsTypes commsType = UPstream::defaultCommsType;
const label startOfRequests = UPstream::nRequests();
if
(
@ -52,37 +51,32 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
|| commsType == UPstream::commsTypes::nonBlocking
)
{
forAll(fldBf, patchi)
{
fvPatchField<Type>& tgtField = fldBf[patchi];
const label startOfRequests = UPstream::nRequests();
for (auto& pfld : bfld)
{
if
(
tgtField.type() == tgtField.patch().patch().type()
&& polyPatch::constraintType(tgtField.patch().patch().type())
pfld.type() == pfld.patch().patch().type()
&& polyPatch::constraintType(pfld.patch().patch().type())
)
{
tgtField.initEvaluate(commsType);
pfld.initEvaluate(commsType);
}
}
// Wait for outstanding requests
if (commsType == UPstream::commsTypes::nonBlocking)
{
UPstream::waitRequests(startOfRequests);
}
// Wait for outstanding requests (non-blocking)
UPstream::waitRequests(startOfRequests);
forAll(fldBf, patchi)
for (auto& pfld : bfld)
{
fvPatchField<Type>& tgtField = fldBf[patchi];
if
(
tgtField.type() == tgtField.patch().patch().type()
&& polyPatch::constraintType(tgtField.patch().patch().type())
pfld.type() == pfld.patch().patch().type()
&& polyPatch::constraintType(pfld.patch().patch().type())
)
{
tgtField.evaluate(commsType);
pfld.evaluate(commsType);
}
}
}
@ -94,22 +88,21 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
for (const auto& schedEval : patchSchedule)
{
const label patchi = schedEval.patch;
fvPatchField<Type>& tgtField = fldBf[patchi];
auto& pfld = bfld[patchi];
if
(
tgtField.type() == tgtField.patch().patch().type()
&& polyPatch::constraintType(tgtField.patch().patch().type())
pfld.type() == pfld.patch().patch().type()
&& polyPatch::constraintType(pfld.patch().patch().type())
)
{
if (schedEval.init)
{
tgtField.initEvaluate(commsType);
pfld.initEvaluate(commsType);
}
else
{
tgtField.evaluate(commsType);
pfld.evaluate(commsType);
}
}
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 DHI
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2024 OpenCFD Ltd.
Copyright (C) 2017-2020 German Aerospace Center (DLR)
Copyright (C) 2020 Johan Roenby
-------------------------------------------------------------------------------
@ -39,6 +39,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "timeSelector.H"
#include "triSurface.H"
#include "triSurfaceTools.H"
@ -139,6 +140,10 @@ void setAlpha
int main(int argc, char *argv[])
{
argList::noFunctionObjects(); // Never use function objects
timeSelector::addOptions_singleTime(); // Single-time options
argList::addNote
(
"Uses cutCellIso to create a volume fraction field from an "
@ -151,9 +156,14 @@ int main(int argc, char *argv[])
"file",
"Alternative setAlphaFieldDict dictionary"
);
#include "addRegionOption.H"
#include "setRootCase.H"
#include "createTime.H"
// Set time from specified time options, or no-op
timeSelector::setTimeIfPresent(runTime, args);
#include "createNamedMesh.H"
const word dictName("setAlphaFieldDict");

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022-2023 OpenCFD Ltd.
Copyright (C) 2022-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,6 +36,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "fvMesh.H"
#include "faMesh.H"
@ -656,6 +657,10 @@ struct setAreaField
int main(int argc, char *argv[])
{
argList::noFunctionObjects(); // Never use function objects
timeSelector::addOptions_singleTime(); // Single-time options
argList::addNote
(
"Set values on a selected set of cells/patch-faces via a dictionary"
@ -670,8 +675,15 @@ int main(int argc, char *argv[])
);
#include "addRegionOption.H"
// -------------------------
#include "setRootCase.H"
#include "createTime.H"
// Set time from specified time options, or no-op
timeSelector::setTimeIfPresent(runTime, args);
#include "createNamedMesh.H"
autoPtr<faMesh> faMeshPtr;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd.
Copyright (C) 2015-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -161,25 +161,22 @@ int main(int argc, char *argv[])
// rather than tensors to allow indexed permutation.
// Cartesian basis vectors - right handed orthogonal triplet
List<vector> cartesian(3);
FixedList<vector, 3> cartesian;
cartesian[0] = vector(1, 0, 0);
cartesian[1] = vector(0, 1, 0);
cartesian[2] = vector(0, 0, 1);
// Principal axis basis vectors - right handed orthogonal
// triplet
List<vector> principal(3);
// Principal axis basis vectors - right handed orthogonal triplet
FixedList<vector, 3> principal;
principal[0] = eVec.x();
principal[1] = eVec.y();
principal[2] = eVec.z();
scalar maxMagDotProduct = -GREAT;
// Matching axis indices, first: cartesian, second:principal
Pair<label> match(-1, -1);
scalar maxMagDotProduct = -GREAT;
forAll(cartesian, cI)
{
@ -187,12 +184,11 @@ int main(int argc, char *argv[])
{
scalar magDotProduct = mag(cartesian[cI] & principal[pI]);
if (magDotProduct > maxMagDotProduct)
if (maxMagDotProduct < magDotProduct)
{
maxMagDotProduct = magDotProduct;
match.first() = cI;
match.second() = pI;
}
}
@ -208,7 +204,7 @@ int main(int argc, char *argv[])
// Invert the best match direction and swap the order of
// the other two vectors
List<vector> tPrincipal = principal;
FixedList<vector, 3> tPrincipal = principal;
tPrincipal[match.second()] *= -1;
@ -237,7 +233,7 @@ int main(int argc, char *argv[])
permutationDelta += 3;
List<vector> tPrincipal = principal;
FixedList<vector, 3> tPrincipal = principal;
vector tEVal = eVal;
@ -253,10 +249,9 @@ int main(int argc, char *argv[])
eVal = tEVal;
}
label matchedAlready = match.first();
match =Pair<label>(-1, -1);
const label matchedAlready = match.first();
match = Pair<label>(-1, -1);
maxMagDotProduct = -GREAT;
forAll(cartesian, cI)
@ -275,12 +270,11 @@ int main(int argc, char *argv[])
scalar magDotProduct = mag(cartesian[cI] & principal[pI]);
if (magDotProduct > maxMagDotProduct)
if (maxMagDotProduct < magDotProduct)
{
maxMagDotProduct = magDotProduct;
match.first() = cI;
match.second() = pI;
}
}
@ -295,7 +289,7 @@ int main(int argc, char *argv[])
{
principal[match.second()] *= -1;
List<vector> tPrincipal = principal;
FixedList<vector, 3> tPrincipal = principal;
tPrincipal[(matchedAlready + 1) % 3] =
principal[(matchedAlready + 2) % 3]*-sense;
@ -335,15 +329,16 @@ int main(int argc, char *argv[])
showTransform = false;
}
// calculate the total surface area
// Calculate total surface area and average normal vector
scalar surfaceArea = 0;
vector averageNormal(Zero);
forAll(surf, facei)
{
const labelledTri& f = surf[facei];
if (f[0] == f[1] || f[0] == f[2] || f[1] == f[2])
if (!f.good())
{
WarningInFunction
<< "Illegal triangle " << facei << " vertices " << f
@ -351,20 +346,23 @@ int main(int argc, char *argv[])
}
else
{
surfaceArea += triPointRef
(
surf.points()[f[0]],
surf.points()[f[1]],
surf.points()[f[2]]
).mag();
triPointRef tri = f.tri(surf.points());
surfaceArea += tri.mag();
averageNormal += tri.areaNormal();
}
}
// The unit normal (area-averaged)
averageNormal.normalise();
Info<< nl << setprecision(12)
<< "Density: " << density << nl
<< "Mass: " << m << nl
<< "Centre of mass: " << cM << nl
<< "Surface area: " << surfaceArea << nl
<< "Average normal: " << averageNormal << nl
<< "Inertia tensor around centre of mass: " << nl << J << nl
<< "eigenValues (principal moments): " << eVal << nl
<< "eigenVectors (principal axes): " << nl
@ -398,21 +396,26 @@ int main(int argc, char *argv[])
<< endl;
}
OFstream str("axes.obj");
Info<< nl << "Writing scaled principal axes at centre of mass of "
<< surfFileName << " to " << str.name() << endl;
scalar scale = mag(cM - surf.points()[0])/eVal.component(findMin(eVal));
meshTools::writeOBJ(str, cM);
meshTools::writeOBJ(str, cM + scale*eVal.x()*eVec.x());
meshTools::writeOBJ(str, cM + scale*eVal.y()*eVec.y());
meshTools::writeOBJ(str, cM + scale*eVal.z()*eVec.z());
for (label i = 1; i < 4; i++)
// Write (scaled) principal axes at centre of mass
{
str << "l " << 1 << ' ' << i + 1 << endl;
OFstream str("axes.obj");
Info<< nl << "Writing scaled principal axes at centre of mass of "
<< surfFileName << " to " << str.name() << endl;
scalar scale =
mag(cM - surf.points()[0])/eVal.component(findMin(eVal));
meshTools::writeOBJ(str, cM);
meshTools::writeOBJ(str, cM + scale*eVal.x()*eVec.x());
meshTools::writeOBJ(str, cM + scale*eVal.y()*eVec.y());
meshTools::writeOBJ(str, cM + scale*eVal.z()*eVec.z());
for (label i = 1; i < 4; i++)
{
str << "l " << 1 << ' ' << i + 1 << endl;
}
}
Info<< "\nEnd\n" << endl;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2022,2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -58,6 +58,7 @@ Description
#include "axisAngleRotation.H"
#include "EulerCoordinateRotation.H"
#include "MeshedSurfaces.H"
#include "cylindricalCS.H"
using namespace Foam;
using namespace Foam::coordinateRotations;
@ -257,6 +258,12 @@ int main(int argc, char *argv[])
"type",
"Output format (default: use file extension)"
);
argList::addOption
(
"cylToCart",
"(originVec axisVec directionVec)",
"Tranform cylindrical coordinates to cartesian coordinates"
);
// Backward compatibility and with transformPoints
argList::addOptionCompat("write-scale", {"scale", -2006});
@ -277,7 +284,8 @@ int main(int argc, char *argv[])
"rollPitchYaw",
"yawPitchRoll",
"read-scale",
"write-scale"
"write-scale",
"cylToCart"
});
if (!args.count(operationNames))
@ -461,6 +469,24 @@ int main(int argc, char *argv[])
// Output scaling
applyScaling(points, getScalingOpt("write-scale", args));
// Conversion to cylindrical coords
if (args.found("cylToCart"))
{
vectorField n1n2(args.lookup("cylToCart")());
n1n2[1].normalise();
n1n2[2].normalise();
cylindricalCS ccs
(
"ccs",
n1n2[0],
n1n2[1],
n1n2[2]
);
points = ccs.globalPosition(points);
}
surf1.movePoints(points);
surf1.write(exportName, writeFileType);

View File

@ -210,7 +210,7 @@ reportExecutable()
{
APP_NAME="$1"
APP_SPEC="$2"
APP_PATH="$(findExec $PATH $1)"
APP_PATH="$(findExec "$PATH" "$1")"
VERSION="unknown"
if [ -z "$APP_PATH" ]

View File

@ -6,7 +6,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2019-2023 OpenCFD Ltd.
# Copyright (C) 2019-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -48,8 +48,16 @@ options:
-name=NAME Stem for tar-file (default: auto)
-output=DIR Output directory (default: ".")
-prefix=NAME Prefix directory within tar-file (default: auto)
-pkg-modules Only package submodules - exclude OpenFOAM
-no-modules Exclude submodules
-pkg-modules Package 'modules' exclusively (no OpenFOAM)
-pkg-plugins Package 'plugins' exclusively (no OpenFOAM)
-no-extras Exclude 'modules, plugins,...' from source pack
-no-modules Exclude 'modules' from source pack (default: off)
-no-plugins Exclude 'plugins' from source pack (default: on)
-all-extras Include 'modules, plugins,...' into source pack
-with-modules Include 'modules' into source pack (default: on)
-with-plugins Include 'plugins' into source pack (default: off)
-modules=name1,.. Include specifed 'modules' into source pack
-plugins=name1,.. Include specifed 'plugins' into source pack
-no-patch Ignore '_patch' number for output tar-file
-no-prefix Do not prefix subdirectory
-no-compress Disable compression
@ -67,7 +75,7 @@ Script generator for packing OpenFOAM sources and submodules.
Eg,
$Script -output=some-dir origin/master > create-tar-file
sh ./create-tar-file
bash ./create-tar-file
$Script -tgz origin/master | bash
@ -90,11 +98,16 @@ die()
#-------------------------------------------------------------------------------
outputDir="."
outputDir='.'
versionSeparator='_'
withPatchNum=true
unset compress packageApi withSource withModules prefixDir tarName
unset gitbase
# Default selections
select_source=true
select_modules=true
select_plugins=false
unset compress gitbase packageApi prefixDir tarName
# Cleanup tarName to remove trailing '.tar', detect compression etc
cleanTarName() {
@ -117,7 +130,7 @@ cleanTarName() {
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*)
-h | -help* | --help*)
printHelp
;;
-debian | -debian=[0-9]*)
@ -146,13 +159,43 @@ do
prefixDir="${1#*=}"
prefixDir="${prefixDir%/}"
;;
-pkg-modules)
withModules=true
withSource=false
-all-extras)
select_modules=true
select_plugins=true
;;
-with-modules)
select_modules=true
;;
-modules=*)
select_modules="${1#*=}"
: "${select_modules:=true}"
;;
-with-plugins)
select_plugins=true
;;
-plugins=*)
select_plugins="${1#*=}"
: "${select_plugins:=true}"
;;
-no-extras)
select_modules=false
select_plugins=false
;;
-no-modules)
withModules=false
withSource=true
select_modules=false
;;
-no-plugins)
select_plugins=false
;;
-pkg-modules) # Package modules exclusively
select_modules=true
select_plugins=false
select_source=false
;;
-pkg-plugins) # Package plugins exclusively
select_modules=false
select_plugins=true
select_source=false
;;
-no-patch)
withPatchNum=false
@ -291,9 +334,15 @@ fi
if [ -z "$prefixDir" ]
then
prefixDir="OpenFOAM-v${packageApi}"
if [ "$withSource" = false ]
if [ "$select_source" = false ]
then
prefixDir="OpenFOAM-modules-v${packageApi}"
# Either -pkg-modules or -pkg-plugins, not both
if [ "$select_modules" != false ]
then
prefixDir="OpenFOAM-modules-v${packageApi}"
else
prefixDir="OpenFOAM-plugins-v${packageApi}"
fi
fi
elif [ "$prefixDir" = false ]
then
@ -320,9 +369,15 @@ case "$tarName" in
('')
tarName="OpenFOAM-v${packageApi}"
if [ "$withSource" = false ]
if [ "$select_source" = false ]
then
tarName="OpenFOAM-modules-v${packageApi}"
# Either -pkg-modules or -pkg-plugins, not both
if [ "$select_modules" != false ]
then
tarName="OpenFOAM-modules-v${packageApi}"
else
tarName="OpenFOAM-plugins-v${packageApi}"
fi
fi
if [ "$withPatchNum" = false ]
@ -362,48 +417,56 @@ echo 'tar -cf "$outputDir/$tarName.tar" -T /dev/null'
echo
echo 'buildInfo="${prefixDir}${prefixDir:+@}META-INFO@build-info"'
echo 'manifest0="${prefixDir}${prefixDir:+@}META-INFO@manifest.txt"'
echo 'manifest1="${prefixDir}${prefixDir:+@}META-INFO@modules-manifest.txt"'
echo '#--------'
echo 'manifest1="${prefixDir}${prefixDir:+@}META-INFO@manifest-modules.txt"'
echo 'manifest2="${prefixDir}${prefixDir:+@}META-INFO@manifest-plugins.txt"'
#------------------------------------------------------------------------------
# Sort out particulars related to modules
if [ "$withModules" = false ]
# Sort out particulars related to modules, source
if [ "$select_source" = false ]
then
echo '# No modules'
echo 'unset manifest1'
echo 'unset buildInfo manifest0 # No source'
fi
if [ "$withSource" = false ]
if [ "$select_modules" = false ]
then
echo '# No OpenFOAM source (package modules exclusively)'
echo 'unset buildInfo'
echo 'unset manifest0'
echo 'unset manifest1 # No modules'
fi
if [ "$select_plugins" = false ]
then
echo 'unset manifest2 # No plugins'
fi
echo '#--------'
echo 'set -x'
echo
#------------------------------------------------------------------------------
# OpenFOAM sources
if [ "$withSource" != false ]
# OpenFOAM sources (unless explicitly excluded)
if [ "$select_source" != false ]
then
echo 'git -c tar.umask=0022 archive --format=tar ${prefixDir:+--prefix="$prefixDir/"} -o "$outputDir/$tarName.tar" "$head"'
# Tag build information with underscore to distinguish from "real" build
# information when git is available.
echo 'echo build="${build:+_}$build" > "$outputDir/$buildInfo"'
echo echo 'build="${build:+_}$build" > "$outputDir/$buildInfo"'
echo
echo '# source'
echo 'manifestFile="$manifest0"'
echo '{'
echo ' echo api="$api"'
echo ' echo patch="$patch"'
echo ' echo head="$head"'
echo ' echo'
echo ' git ls-tree -r "$head"'
echo '} > "$outputDir/$manifest0"'
echo '} > "$outputDir/${manifestFile:?}"'
echo 'unset manifestFile'
fi
#------------------------------------------------------------------------------
# Add in modules
# OpenFOAM modules/plugins
# Recursive addition of submodule content.
# NB: must be called from within the respective parent directory.
@ -411,11 +474,15 @@ fi
#
# packModule abc (implied cd)
# packModule abc/def
# packModule abc/def/hij
# packModule abc/def/ghi
#
packModule()
{
local parent="$1"
local filter="$2"
# Using filter=true means accept everything
if [ "$filter" = true ]; then unset filter; fi
(
if [ -n "$parent" ]
@ -424,34 +491,51 @@ packModule()
fi
git ls-tree -d HEAD | \
while read mode gittype sha1 module
while read mode gittype sha1 moduleName
do
[ "$gittype" == commit ] || continue
case "$module" in
case "$moduleName" in
(. | ./)
echo
echo "# ----"
echo "# module $parent : not initialized?"
echo "# submodule $parent : not initialized?"
echo "# ----"
continue
;;
esac
# Fully qualified
module="$parent${parent:+/}$module"
module="$parent${parent:+/}$moduleName"
moduleName="${moduleName##*/}"
echo
echo "# module"
echo "# submodule"
echo "module='$module'"
echo "commit='$sha1'"
echo "tmpTarFile='$tarName-${module##*/}.tar'"
# Simplistic filtering
if [ -n "$filter" ] && [ "${filter/$moduleName/}" = "$filter" ]
then
echo "# ----"
echo '{'
echo ' echo'
echo ' echo "$module"'
echo ' echo commit="$commit"'
echo ' echo "# not exported"'
echo ' echo'
echo '} >> "$outputDir/${manifestFile:?}"'
continue
fi
# Intermediate tar file for module contents
echo "tmpTarFile='$tarName-$moduleName.tar'"
echo "# ----"
echo '('
echo ' cd "$module" || exit'
echo ' newPrefix="$prefixDir${prefixDir:+/}$module"'
echo ' git -c tar.umask=0022 archive --format=tar --prefix="$newPrefix/" -o "$outputDir/$tmpTarFile" "$commit" || exit'
# Without {test,tests,validation} directories (potentially large)
echo ' # Without {test,tests,validation} directories (potentially large)'
echo ' tar --delete -f "$outputDir/$tmpTarFile" "$newPrefix/test" "$newPrefix/tests" "$newPrefix/validation" 2>/dev/null'
echo ' tar -Af "$outputDir/$tarName.tar" "$outputDir/$tmpTarFile"'
echo ' {'
@ -461,32 +545,58 @@ packModule()
echo ' echo'
echo ' # Without {test,tests,validation} directories'
echo ' git ls-tree -r "$commit" | sed -e '"'"'/\t\(test\|\tests\|validation\)\//d'"'"
echo ' } >> "$outputDir/$manifest1"'
echo ' } >> "$outputDir/${manifestFile:?}"'
echo ')'
# Remove tmp tar file, even if git archive failed (creates zero-sized tar)
echo "# ----"
echo 'rm -f "$outputDir/$tmpTarFile"'
# No filter for lower levels...
packModule "$module"
done
)
}
if [ "$withModules" != false ]
# modules/
if [ "$select_modules" != false ]
then
echo
echo '# Modules'
echo '# modules/'
echo 'manifestFile="$manifest1"'
echo '{'
echo ' echo "# OpenFOAM modules"'
echo ' echo api="$api"'
echo ' echo patch="$patch"'
echo ' echo head="$head"'
echo '} > "$outputDir/$manifest1"'
echo '} > "$outputDir/${manifestFile:?}"'
packModule modules
# With all or specified modules
packModule modules "$select_modules"
echo
echo '{ echo; echo "# End"; } >> "$outputDir/$manifest1"'
echo '{ echo; echo "# End"; } >> "$outputDir/${manifestFile:?}"'
echo 'unset manifestFile'
fi
# plugins/
if [ "$select_plugins" != false ]
then
echo
echo '# plugins/'
echo 'manifestFile="$manifest2"'
echo '{'
echo ' echo "# OpenFOAM plugins"'
echo ' echo api="$api"'
echo ' echo patch="$patch"'
echo ' echo head="$head"'
echo '} > "$outputDir/${manifestFile:?}"'
# With all or specified plugins
packModule plugins "$select_plugins"
echo
echo '{ echo; echo "# End"; } >> "$outputDir/${manifestFile:?}"'
echo 'unset manifestFile'
fi
#------------------------------------------------------------------------------
@ -494,10 +604,10 @@ fi
# Decode '@' in the names as '/' directory separator
echo
echo "echo 'Adding build-info and manifest files'"
echo echo 'Adding build-info and manifest files'
echo 'if pushd "$outputDir"; then'
echo "tar --owner=root --group=root --append --transform='s|@|/|g' -v -f \"\$tarName.tar\" \"\$buildInfo\" \"\$manifest0\" \"\$manifest1\""
echo 'rm -f "$buildInfo" "$manifest0" "$manifest1"'
echo "tar --owner=root --group=root --append --transform='s|@|/|g' -v -f \"\$tarName.tar\" \"\$buildInfo\" \"\$manifest0\" \"\$manifest1\" \"\$manifest2\""
echo 'rm -f "$buildInfo" "$manifest0" "$manifest1" "$manifest2"'
echo 'popd; fi'
echo
@ -509,18 +619,18 @@ echo "# -----------------------"
# Compression
case "$compress" in
('')
('')
echo "No compression requested" 1>&2
;;
(gz | gzip)
(gz | gzip)
echo "Using gzip compression" 1>&2
echo 'gzip -f -9 "$outputDir/$tarName.tar"'
echo
echo '# End of compression'
;;
(tgz)
(tgz)
echo "Using gzip compression with tgz ending" 1>&2
echo 'gzip -c -9 "$outputDir/$tarName.tar" > "$outputDir/$tarName.tgz"'
echo 'rm -f "$outputDir/$tarName.tar"'
@ -528,28 +638,28 @@ case "$compress" in
echo '# End of compression'
;;
(bz | bzip | bzip2)
(bz | bzip | bzip2)
echo "Using bzip2 compression" 1>&2
echo 'bzip2 -f -9 "$outputDir/$tarName.tar"'
echo
echo '# End of compression'
;;
(xz)
(xz)
echo "Using xz compression" 1>&2
echo 'xz -f -9 "$outputDir/$tarName.tar"'
echo
echo '# End of compression'
;;
(zst | zstd)
(zst | zstd)
echo "Using zstd compression" 1>&2
echo 'zstd --rm -f -9 "$outputDir/$tarName.tar"'
echo
echo '# End of compression'
;;
(*)
(*)
echo "Unknown compression scheme: $compress" 1>&2
;;
esac

View File

@ -1,23 +1,23 @@
## Getting the code
Links to all code packs are available on https://dl.openfoam.com. For OpenFOAM-v2312:
Links to all code packs are available on https://dl.openfoam.com. For OpenFOAM-v2406:
- https://dl.openfoam.com/source/latest/
- Source: https://dl.openfoam.com/source/v2312/OpenFOAM-v2312.tgz
- ThirdParty: https://dl.openfoam.com/source/v2312/ThirdParty-v2312.tgz
- Source: https://dl.openfoam.com/source/v2406/OpenFOAM-v2406.tgz
- ThirdParty: https://dl.openfoam.com/source/v2406/ThirdParty-v2406.tgz
## OpenFOAM&reg; Quick Build Guide
Prior to building, ensure that the [system requirements][link openfoam-require]
are satisfied (including any special [cross-compiling][wiki-cross-compile]
considerations), and source the correct OpenFOAM environment.
For example, for the OpenFOAM-v2312 version:
For example, for the OpenFOAM-v2406 version:
```
source <installation path>/OpenFOAM-v2312/etc/bashrc
source <installation path>/OpenFOAM-v2406/etc/bashrc
```
e.g. if installed under the `~/openfoam` directory
```
source ~/openfoam/OpenFOAM-v2312/etc/bashrc
source ~/openfoam/OpenFOAM-v2406/etc/bashrc
```
@ -157,4 +157,4 @@ More details in the [ThirdParty build guide][link third-build].
[wiki-config]: https://develop.openfoam.com/Development/openfoam/-/wikis/configuring
---
Copyright 2019-2023 OpenCFD Ltd
Copyright 2019-2024 OpenCFD Ltd

View File

@ -1,4 +1,4 @@
## Known Build Issues (v2312, v2306, v2212, v2206, v2112, v2106, v2012)
## Known Build Issues (v2406, v2312, v2306, v2212, v2206, v2112, v2106, v2012)
### Windows cross-compilation
@ -188,4 +188,4 @@ and attempt to install a `paraview~qt` version instead.
[wiki-config]: https://develop.openfoam.com/Development/openfoam/-/wikis/configuring
---
Copyright 2019-2023 OpenCFD Ltd
Copyright 2019-2024 OpenCFD Ltd

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2023 OpenCFD Ltd.
# Copyright (C) 2016-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -55,7 +55,7 @@
# [WM_PROJECT_VERSION] - A human-readable version name
# A development version is often named 'com' - as in www.openfoam.com
export WM_PROJECT_VERSION=v2312
export WM_PROJECT_VERSION=v2406
#------------------------------------------------------------------------------
# Configuration environment variables.

View File

@ -34,6 +34,16 @@ cellSet_doc
// or
min (0 0 0);
max (1 1 1);
// Optional the cell centres can be transformed before being used. This
// can be used to simulate moving selections in transient simulations.
// Any solidBodyMotionFunction can be used. Note: the same optional
// transformation can be used for any selection requiring face centres
// or point locations.
solidBodyMotionFunction linearMotion
{
velocity (-0.1 -0.1 0);
}
}
@ -58,6 +68,8 @@ cellSet_doc
radius 5.0;
// optional
innerRadius 1.0;
// See boxToCell for optional transformation of the cell centres
}
//- Select based on faceSet
@ -117,6 +129,8 @@ cellSet_doc
{
source nearestToCell;
points ((0 0 0) (1 1 1)(2 2 2));
// See boxToCell for optional transformation of the cell centres
}
@ -162,6 +176,8 @@ cellSet_doc
i (0.2 0.2 0);
j (-0.2 0.2 0);
k (10 10 10);
// See boxToCell for optional transformation of the cell centres
}
@ -170,6 +186,8 @@ cellSet_doc
source searchableSurfaceToCell;
surfaceType triSurfaceMesh; // Type of surface
surfaceName blob.obj; // Name for surface object
// See boxToCell for optional transformation of the cell centres
}
@ -188,6 +206,8 @@ cellSet_doc
// optional
innerRadius 1.0;
// See boxToCell for optional transformation of the cell centres
}
@ -209,6 +229,7 @@ cellSet_doc
useSurfaceOrientation false; // use closed surface inside/outside
// test (ignores includeCut,
// outsidePoints)
// See boxToCell for optional transformation of the cell centres
}
@ -257,6 +278,8 @@ faceSet_doc
// or
min (0 0 0);
max (1 1 1);
// See boxToCell for optional transformation of the face centres
}
@ -286,6 +309,8 @@ faceSet_doc
radius 5.0;
// optional
innerRadius 1.0;
// See boxToCell for optional transformation of the face centres
}
@ -352,6 +377,8 @@ faceSet_doc
source searchableSurfaceToFace;
surfaceType triSurfaceMesh; // Type of surface
surfaceName blob.obj; // Name for surface object
// See boxToCell for optional transformation of the face centres
}
@ -362,6 +389,8 @@ faceSet_doc
radius 5.0;
// optional
innerRadius 1.0;
// See boxToCell for optional transformation of the face centres
}
@ -410,6 +439,8 @@ pointSet_doc
// or
min (0 0 0);
max (1 1 1);
// See boxToCell for optional transformation of the points
}
@ -436,6 +467,7 @@ pointSet_doc
radius 5.0;
// optional
innerRadius 1.0;
// See boxToCell for optional transformation of the points
}
@ -465,6 +497,7 @@ pointSet_doc
{
source nearestToPoint;
points ((0 0 0) (1 1 1));
// See boxToCell for optional transformation of the points
}
@ -486,6 +519,7 @@ pointSet_doc
source searchableSurfaceToCell;
surfaceType triSurfaceMesh; // Type of surface
surfaceName blob.obj; // Name for surface object
// See boxToCell for optional transformation of the points
}
@ -496,6 +530,7 @@ pointSet_doc
radius 5.0;
// optional
innerRadius 1.0;
// See boxToCell for optional transformation of the points
}
@ -508,6 +543,7 @@ pointSet_doc
// (requires closed surface with consistent
// normals)
includeOutside false; // ,, outside ,,
// See boxToCell for optional transformation of the points
}

View File

@ -14,6 +14,7 @@ cyclic
cyclicAMI
{
type cyclicAMI;
value $internalField;
}
cyclicACMI

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2017-2023 OpenCFD Ltd.
# Copyright (C) 2017-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -20,7 +20,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
set adios2_version=ADIOS2-2.9.2
set adios2_version=ADIOS2-2.10.1
setenv ADIOS2_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version"
# END OF (NORMAL) USER EDITABLE PART

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2021 OpenCFD Ltd.
# Copyright (C) 2018-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -30,7 +30,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
set hypre_version=hypre-2.23.0
set hypre_version=hypre-2.31.0
setenv HYPRE_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version"
# END OF (NORMAL) USER EDITABLE PART

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2023 OpenCFD Ltd.
# Copyright (C) 2016-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -52,7 +52,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
set ParaView_VERSION=5.11.2
set ParaView_VERSION=5.12.1
set ParaView_QT=qt-system
# END OF (NORMAL) USER EDITABLE PART

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2023 OpenCFD Ltd.
# Copyright (C) 2018-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -30,7 +30,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
set petsc_version=petsc-3.19.2
set petsc_version=petsc-3.21.2
setenv PETSC_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$petsc_version"
# END OF (NORMAL) USER EDITABLE PART

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2017-2023 OpenCFD Ltd.
# Copyright (C) 2017-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -21,7 +21,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
adios2_version=ADIOS2-2.9.2
adios2_version=ADIOS2-2.10.1
export ADIOS2_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version"
# END OF (NORMAL) USER EDITABLE PART

61
etc/config.sh/hdf5 Normal file
View File

@ -0,0 +1,61 @@
#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/hdf5
# [optional/experimental: not sourced by OpenFOAM-*/etc/bashrc]
#
# Description
# Setup for HDF5 include/libraries (usually ThirdParty installation).
#
# To disable its use: hdf5_version=hdf5-none
# For system-wide installations: hdf5_version=hdf5-system
#
# For central installations not located under ThirdParty:
# 1. use hdf5-system
# 2. and provide full path for HDF5_ARCH_PATH
#
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
hdf5_version=hdf5-1.14.4.3
export HDF5_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$hdf5_version"
# END OF (NORMAL) USER EDITABLE PART
#------------------------------------------------------------------------------
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
then
echo "Using hdf5 ($hdf5_version) -> $HDF5_ARCH_PATH" 1>&2
fi
if command -v _foamAddLibAuto >/dev/null
then
# Normal sourcing (not makeHDF5)
_foamAddLibAuto $HDF5_ARCH_PATH
unset hdf5_version
elif [ "$1" = "-force" ]
then
# Forced command-line sourcing
if output="$($WM_PROJECT_DIR/bin/tools/lib-dir -sh $HDF5_ARCH_PATH 2>/dev/null)"
then
eval "$output"
fi
unset hdf5_version output
fi
#------------------------------------------------------------------------------

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2021 OpenCFD Ltd.
# Copyright (C) 2018-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -27,7 +27,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
hypre_version=hypre-2.23.0
hypre_version=hypre-2.31.0
export HYPRE_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version"
# END OF (NORMAL) USER EDITABLE PART

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2023 OpenCFD Ltd.
# Copyright (C) 2016-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -57,7 +57,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
ParaView_VERSION=5.11.2
ParaView_VERSION=5.12.1
ParaView_QT=qt-system
# END OF (NORMAL) USER EDITABLE PART

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2023 OpenCFD Ltd.
# Copyright (C) 2018-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -27,7 +27,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
petsc_version=petsc-3.19.2
petsc_version=petsc-3.21.2
export PETSC_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$petsc_version"
# END OF (NORMAL) USER EDITABLE PART

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@ -146,13 +146,18 @@ OptimisationSwitches
// The default and minimum is (20000000).
mpiBufferSize 0;
// Optional max size (bytes) for unstructured data exchanges. In some
// phases of OpenFOAM it can send over very large data chunks
// Optional max size (bytes) for unstructured data exchanges.
// In some phases of OpenFOAM it can send over very large data chunks
// (e.g. in parallel load balancing) and some MPI implementations have
// problems with this. Setting this variable > 0 indicates that the
// data exchange needs to be done in multiple passes, each of maxCommsSize.
// This is not switched on by default since it requires an additional
// global reduction, even if multi-pass is not needed)
// problems with this.
//
// This tuning parameter specifies the max number of bytes before
// switching to a multi-pass send/recv
// (currently only affects PstreamBuffers exchanges).
//
// 0 : disabled
// >0 : limit exchanges to specified number of bytes
// <0 : limit exchanges to INT_MAX minus specified number of bytes
maxCommsSize 0;
// Optional (experimental) feature in lduMatrixUpdate

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2023 OpenCFD Ltd.
# Copyright (C) 2016-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -55,7 +55,7 @@
# [WM_PROJECT_VERSION] - A human-readable version name
# A development version is often named 'com' - as in www.openfoam.com
setenv WM_PROJECT_VERSION v2312
setenv WM_PROJECT_VERSION v2406
#------------------------------------------------------------------------------
# Configuration environment variables.

View File

@ -1,12 +1,17 @@
[[_TOC_]]
## OpenFOAM Modules
## OpenFOAM modules
This directory is a location for additional OpenFOAM components or
tools to placed and have them built as part of the normal OpenFOAM
build process. It is assumed that each subdirectory contain an
appropriate `Allwmake` (or `Allwmake.override`) file.
The primary distinction between `modules` and `plugins` is that `modules` are
mainly maintained and released by OpenFOAM developers, whereas `plugins` are an
open and welcoming area for add-ons, predominantly maintained and driven by
OpenFOAM community members and groups.
### How to use
On the first use, you need to register the submodules, and then update them.
@ -91,7 +96,7 @@ To build the doxygen information for the components, it is also
necessary to link the directories to the doc/ subdirectory.
This is a purely manual operation.
### Developer Information
### Developer information
#### Build locations

42
plugins/Allwmake Executable file
View File

@ -0,0 +1,42 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
targetType=libso
. "${WM_PROJECT_DIR:?}"/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
# Default build into OpenFOAM project locations unless specified with
# -prefix or FOAM_MODULE_PREFIX env varable
# Long form to avoid dash 0.5.8 error (issue #1757)
[ -n "$FOAM_MODULE_PREFIX" ] || FOAM_MODULE_PREFIX="${FOAM_LIBBIN%/*}"
export FOAM_MODULE_PREFIX
echo "========================================"
case "$FOAM_MODULE_PREFIX" in
(false | none)
echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})"
echo
exit 0
esac
echo "prefix = $FOAM_MODULE_PREFIX"
echo
echo " ignoring possible compilation errors"
echo " make certain to check the output file"
echo
set +e
export WM_CONTINUE_ON_ERROR=true
#------------------------------------------------------------------------------
for name in $(./list-plugins)
do
if [ -d "$name" ]
then
# Use wmake -all instead of Allwmake to allow for overrides
( cd "$name" && wmake -all $targetType )
fi
done
#------------------------------------------------------------------------------

139
plugins/README.md Normal file
View File

@ -0,0 +1,139 @@
[[_TOC_]]
## OpenFOAM plugins
This directory is a location for additional OpenFOAM components or
tools to placed and have them built as part of the normal OpenFOAM
build process. It is assumed that each subdirectory contain an
appropriate `Allwmake` (or `Allwmake.override`) file.
The primary distinction between `modules` and `plugins` is that `modules` are
mainly maintained and released by OpenFOAM developers, whereas `plugins` are an
open and welcoming area for add-ons, predominantly maintained and driven by
OpenFOAM community members and groups.
### How to use
On the first use, you need to register the submodules, and then update them.
You can execute both steps for all the available submodules (including the
nested ones) as follows while you are at `$WM_PROJECT_DIR`:
```bash
cd $WM_PROJECT_DIR
git submodule update --init --recursive
```
Executing this single-line command clones all the submodules from their
respective repositories and prepares them for compilation. Note that you can
also make only a certain group of submodules ready by explicitly specifying the
requested submodules' names at the end of the command above. For example, if
you would like to use only the `turbulence-community` submodule, you specify:
```bash
git submodule update --init --recursive plugins/turbulence-community
```
You can display information about the status of submodules as follows:
```bash
git submodule status --recursive
```
An easy way to see which submodules are actually in use:
```bash
cat .gitmodules
```
Which will reveal content resembling the following:
```
[submodule "xyz"]
path = plugins/xyz
url = ...
...
```
If you need to remove a specific submodule or wish to restart the process,
you can simply carry out the task as follows:
```bash
git submodule deinit plugins/turbulence-community
```
This command deregisters the specified submodule and clears the
`plugins/turbulence-community` directory.
A quick overview of `git submodules` can be found in this
[*blog*][blog git-submodule] with full details in the
[*manpage*][man git-submodule].
### Build locations
Any individual _plugin_ will normally also be able to exist outside of
the plugins directory structure and will typically build into user
locations (`$FOAM_USER_APPBIN`, `$FOAM_USER_LIBBIN`).
When compiled from the top-level OpenFOAM `Allwmake` or the
`plugins/Allwmake`, they should build into OpenFOAM project locations
(`$FOAM_APPBIN`, `$FOAM_LIBBIN`). This can be adjusted by
supplying an alternative `-prefix=` to the corresponding Allwmake
command.
| Command | Install location |
|------------|------------------|
| ./Allwmake -prefix=user | `$FOAM_USER_APPBIN`, `$FOAM_USER_LIBBIN` |
| ./Allwmake -prefix=group | `$FOAM_SITE_APPBIN`, `$FOAM_SITE_LIBBIN` |
| ./Allwmake -prefix=openfoam | `$FOAM_APPBIN`, `$FOAM_LIBBIN` |
| ./Allwmake -prefix=/some/pathname | `/some/pathname/bin`, `/some/pathname/lib` |
### Documentation (doxygen)
To build the doxygen information for the components, it is also
necessary to link the directories to the doc/ subdirectory.
This is a purely manual operation.
### Developer information
#### Build locations
To accomodate building into various locations, the plugin code should
be adapted with the following changes:
- ***Make/files***
```
...
EXE = $(FOAM_MODULE_APPBIN)/someExecutable
LIB = $(FOAM_MODULE_LIBBIN)/libSomeLibrary
```
- `Make/options` should include this
```
include $(GENERAL_RULES)/module-path-user
...
```
The following changes to `Make/options` are universally applicable
(ie, work with older or other versions of OpenFOAM), but more verbose.
- `Make/options` with the following
```
sinclude $(GENERAL_RULES)/module-path-user
/* Failsafe - user locations */
ifeq (,$(FOAM_MODULE_APPBIN))
FOAM_MODULE_APPBIN = $(FOAM_USER_APPBIN)
endif
ifeq (,$(FOAM_MODULE_LIBBIN))
FOAM_MODULE_LIBBIN = $(FOAM_USER_LIBBIN)
endif
...
```
<!-- General Information -->
[man git-submodule]: https://git-scm.com/docs/git-submodule
[blog git-submodule]: http://blog.joncairns.com/2011/10/how-to-use-git-submodules/
---

85
plugins/list-plugins Executable file
View File

@ -0,0 +1,85 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# SPDX-License-Identifier: (GPL-3.0-or-later)
#
# Script
# list-modules
#
# Description
# List module directories
# - each first-level directory with an Allwmake file
#
#------------------------------------------------------------------------------
cd "${0%/*}" || exit # Run from this directory
printHelp() {
cat<< HELP 1>&2
Usage: ${0##*/} [OPTION]
options:
-help Display help and exit
List module directories - each first-level directory with an Allwmake file
HELP
exit 0 # A clean exit
}
# Report error and exit
die()
{
exec 1>&2
echo
echo "Error encountered:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo
echo "See '${0##*/} -help' for usage"
echo
exit 1
}
#------------------------------------------------------------------------------
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*) # Short help
printHelp
;;
*)
die "Unknown option/argument: '$1'"
;;
esac
shift
done
# Each first-level directory with an Allwmake file
for moduleName in *
do
if [ -f "$moduleName/Allwmake" ]
then
case "$moduleName" in
# Skip some directory names
(build | doc | platform*)
;;
(*)
echo "$moduleName"
;;
esac
fi
done
#------------------------------------------------------------------------------

View File

@ -185,6 +185,7 @@ $(expr)/scanToken/exprScanToken.C
$(expr)/traits/exprTraits.C
$(expr)/value/exprValue.C
$(expr)/value/exprValueFieldTag.C
$(expr)/exprDriver/exprDriver.C
$(expr)/exprDriver/exprDriverFields.C

View File

@ -121,6 +121,12 @@ class IOobject;
template<>
Ostream& operator<<(Ostream&, const InfoProxy<IOobject>&);
// Traits
//- Trait for specifying global vs. local IOobject file types
template<class T>
struct is_globalIOobject : std::false_type {};
/*---------------------------------------------------------------------------*\
Class IOobject Declaration
@ -712,6 +718,8 @@ public:
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Specialization for \c void always returns true (no headerClassName check).
template<>
inline bool IOobject::isHeaderClass<void>() const
@ -720,11 +728,6 @@ inline bool IOobject::isHeaderClass<void>() const
}
//- Trait for specifying global vs. local file types
template<class T>
struct is_globalIOobject : std::false_type {};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -122,6 +122,26 @@ Foam::GlobalIOField<Type>::GlobalIOField
}
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
template<class Type>
Foam::Field<Type> Foam::GlobalIOField<Type>::readContents(const IOobject& io)
{
IOobject rio(io, IOobjectOption::NO_REGISTER);
if (rio.readOpt() == IOobjectOption::READ_MODIFIED)
{
rio.readOpt(IOobjectOption::MUST_READ);
}
// The object is global
rio.globalObject(true);
GlobalIOField<Type> reader(rio);
return Field<Type>(std::move(static_cast<Field<Type>&>(reader)));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
@ -135,7 +155,8 @@ bool Foam::GlobalIOField<Type>::readData(Istream& is)
template<class Type>
bool Foam::GlobalIOField<Type>::writeData(Ostream& os) const
{
return (os << static_cast<const Field<Type>&>(*this)).good();
os << static_cast<const Field<Type>&>(*this);
return os.good();
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2017 OpenFOAM Foundation
Copyright (C) 2016-2018 OpenCFD Ltd.
Copyright (C) 2016-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -85,13 +85,19 @@ public:
GlobalIOField(const IOobject& io, const tmp<Field<Type>>& tfld);
// Factory Methods
//- Read and return contents. The IOobject is never registered
static Field<Type> readContents(const IOobject& io);
//- Destructor
virtual ~GlobalIOField() = default;
// Member Functions
//- Is object global
//- The object is global
virtual bool global() const
{
return true;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -106,6 +106,26 @@ Foam::GlobalIOList<Type>::GlobalIOList
}
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
template<class Type>
Foam::List<Type> Foam::GlobalIOList<Type>::readContents(const IOobject& io)
{
IOobject rio(io, IOobjectOption::NO_REGISTER);
if (rio.readOpt() == IOobjectOption::READ_MODIFIED)
{
rio.readOpt(IOobjectOption::MUST_READ);
}
// The object is global
rio.globalObject(true);
GlobalIOList<Type> reader(rio);
return List<Type>(std::move(static_cast<List<Type>&>(reader)));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
@ -119,7 +139,8 @@ bool Foam::GlobalIOList<Type>::readData(Istream& is)
template<class Type>
bool Foam::GlobalIOList<Type>::writeData(Ostream& os) const
{
return (os << *this).good();
os << static_cast<const List<Type>&>(*this);
return os.good();
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2017 OpenFOAM Foundation
Copyright (C) 2018-2023 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -85,6 +85,12 @@ public:
GlobalIOList(const IOobject& io, List<Type>&& content);
// Factory Methods
//- Read and return contents. The IOobject is never registered
static List<Type> readContents(const IOobject& io);
//- Destructor
virtual ~GlobalIOList() = default;

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