Commit Graph

148 Commits

Author SHA1 Message Date
Mark Olesen
d8a55e46b6 ENH: align foamToEnsightParts internals with foamToEnsight
- add -region option and -fields filtering
2018-11-25 12:12:19 +01:00
Mark Olesen
b5432011fa ENH: improve option naming consistency in
- foamToVTK, foamToEnsight, foamToEnsightParts
2018-11-25 10:47:00 +01:00
Mark Olesen
2b42076d58 ENH: restructuring of foamToEnsight code
- align with foamToVTK code base
2018-10-09 21:28:53 +02:00
Mark Olesen
4f2ec88d24 ENH: improvements to the parallelization of ensightCloud output
- communication mode is now selectable (default is blocking)

- eliminate serial-only version as being redundant
2018-10-10 10:32:14 +02:00
Mark Olesen
e4fac35d60 ENH: cleanup ensightMesh method names and handling of internal vs boundary
- this removes the old 'magically' means of suppressing the internal
  mesh in favour of specifying it directly.
2018-10-09 17:49:15 +02:00
Mark Olesen
2fb382bf8a ENH: multiple zone selection for fvMeshSubsetProxy (#973)
- handle tmp fields in interpolate methods

- special method interpolateInternal() for creating a volume field
  with zero-gradient treatment for patches from an internal field.

  This method was previously also called interpolate(), but that
  masked the ability to subset the internal field only.

  Ensight output needs the volume field:
      uses interpolateInternal().

  VTK output has separate handling of internal and patch fields:
      uses interpolate().

ENH: added fvMeshSubset mesh() method for baseMesh or subMesh.

- simplies coding when the fvMeshSubset may or may not be in active use.

ENH: update foamToEnsight to use newer methods in wrapped form

- static interpolate functions with renaming for manual use with
  fvMeshSubset (when fvMeshSubsetProxy may be too limiting in
  functionality)
2018-10-02 17:06:44 +02:00
Mark Olesen
69f6f63810 ENH: add globalPath() to argList and TimePaths
- simply combines (rootPath()/globalCaseName())
2018-09-28 15:24:59 +02:00
Mark Olesen
ae36f5f504 ENH: change argList get<> and getList<> from read<>, readList<>
- more consistent with dictionary method naming. The get<> or
  getList<> returns a value, doesn't read into a existing location.
2018-08-09 11:27:36 +02:00
Mark Olesen
cb919a6c41 ENH: tag some options as 'advanced' (only shown with -help-full)
General:
    * -roots, -hostRoots, -fileHandler

Specific:
    * -to <coordinateSystem> -from <coordinateSystem>

- Display -help-compat when compatibility or ignored options are available

STYLE: capitalization of options text
2018-07-31 11:54:15 +02:00
Mark Olesen
ff26b96a80 STYLE: use 'cloudObjects' instead of 'sprayObjects' 2018-07-30 13:15:38 +02:00
Mark Olesen
02ad76df4f ENH: allow wordHashSet filter for IOobjectList::names
- simplifies usage.
  Support syncPar check on names() to detect inconsistencies.

- simplify readFields, ReadFields and other routines by using these
  new methods.
2018-07-26 14:56:52 +02:00
Mark Olesen
a8ef5610d0 STYLE: renamed meshSubsetHelper -> fvMeshSubsetProxy 2018-07-26 01:57:16 +02:00
Mark Olesen
c0766ce8ea STYLE: consistent '// End namespace' markers 2018-04-27 09:51:35 +02:00
Mark Olesen
660f3e5492 ENH: cleanup autoPtr class (issue #639)
Improve alignment of its behaviour with std::unique_ptr

  - element_type typedef
  - release() method - identical to ptr() method
  - get() method to get the pointer without checking and without releasing it.
  - operator*() for dereferencing

Method name changes

  - renamed rawPtr() to get()
  - renamed rawRef() to ref(), removed unused const version.

Removed methods/operators

  - assignment from a raw pointer was deleted (was rarely used).
    Can be convenient, but uncontrolled and potentially unsafe.
    Do allow assignment from a literal nullptr though, since this
    can never leak (and also corresponds to the unique_ptr API).

Additional methods

  - clone() method: forwards to the clone() method of the underlying
    data object with argument forwarding.

  - reset(autoPtr&&) as an alternative to operator=(autoPtr&&)

STYLE: avoid implicit conversion from autoPtr to object type in many places

- existing implementation has the following:

     operator const T&() const { return operator*(); }

  which means that the following code works:

       autoPtr<mapPolyMesh> map = ...;
       updateMesh(*map);    // OK: explicit dereferencing
       updateMesh(map());   // OK: explicit dereferencing
       updateMesh(map);     // OK: implicit dereferencing

  for clarity it may preferable to avoid the implicit dereferencing

- prefer operator* to operator() when deferenced a return value
  so it is clearer that a pointer is involve and not a function call
  etc    Eg,   return *meshPtr_;  vs.  return meshPtr_();
2018-02-26 12:00:00 +01:00
Mark Olesen
bcabe827f6 ENH: dedicated HashSetOps, HashTableOps namespaces
- relocated HashSetPlusEqOp and HashTablePlusEqOp to
  HashSetOps::plusEqOp and HashTableOps::plusEqOp, respectively

- additional functions for converting between a labelHashSet
  and a PackedBoolList or List<bool>:

  From lists selections to labelHashSet indices:

      HashSetOps::used(const PackedBoolList&);
      HashSetOps::used(const UList<bool>&);

  From labelHashSet to list forms:

      PackedBoolList bitset(const labelHashSet&);
      List<bool> bools(const labelHashSet&);
2018-03-06 11:41:34 +01:00
Mark Olesen
c126464d1c ENH: change wordRes to be a List of wordRe instead of a wrapper (issue #259)
- this permits direct storage of a list with additional matcher
  capabilities

- provide wordRes::matcher class for similar behaviour as previously
2018-02-21 10:05:30 +01:00
Mark Olesen
7f3d4b3554 Merge branch 'master' into develop 2018-01-23 16:11:28 +01:00
Mark Olesen
294a3d05ba BUG: problems converting clouds to ensight or vtk format (closes #708)
- problems when the cloud was not available on all processors.

- NB: ensight measured data only allows a single cloud, but
  foamToEnsight writes all clouds.
2018-01-23 15:39:45 +01:00
Mark Olesen
345a2a42f1 ENH: simplify method names for reading argList options and arguments
- use succincter method names that more closely resemble dictionary
  and HashTable method names. This improves method name consistency
  between classes and also requires less typing effort:

    args.found(optName)        vs.  args.optionFound(optName)
    args.readIfPresent(..)     vs.  args.optionReadIfPresent(..)
    ...
    args.opt<scalar>(optName)  vs.  args.optionRead<scalar>(optName)
    args.read<scalar>(index)   vs.  args.argRead<scalar>(index)

- the older method names forms have been retained for code compatibility,
  but are now deprecated
2018-01-08 15:35:18 +01:00
Andrew Heather
bd181f9a6c BUG: lagrangian - corrected references to position() 2017-12-19 21:25:12 +00:00
Andrew Heather
c2ff8ea99e ENH: Added finiteArea support to foamToVTK 2017-11-21 16:33:33 +00:00
Andrew Heather
2defba00a9 ENH: Lagrangian - provided backwards compatibility for cases using the
old "positions" file form

The change to barycentric-based tracking changed the contents of the
cloud "positions" file to a new format comprising the barycentric
co-ordinates and other cell position-based info.  This broke
backwards compatibility, providing no option to restart old cases
(v1706 and earlier), and caused difficulties for dependent code, e.g.
for post-processing utilities that could only infer the contents only
after reading.

The barycentric position info is now written to a file called
"coordinates" with provision to restart old cases for which only the
"positions" file is available. Related utilities, e.g. for parallel
running and data conversion have been updated to be able to support both
file types.

To write the "positions" file by default, use set the following option
in the InfoSwitches section of the controlDict:

    writeLagrangianPositions 1;
2017-09-13 13:13:36 +01:00
Andrew Heather
d8d6030ab6 INT: Integration of Mattijs' collocated parallel IO additions
Original commit message:
------------------------

Parallel IO: New collated file format

When an OpenFOAM simulation runs in parallel, the data for decomposed fields and
mesh(es) has historically been stored in multiple files within separate
directories for each processor.  Processor directories are named 'processorN',
where N is the processor number.

This commit introduces an alternative "collated" file format where the data for
each decomposed field (and mesh) is collated into a single file, which is
written and read on the master processor.  The files are stored in a single
directory named 'processors'.

The new format produces significantly fewer files - one per field, instead of N
per field.  For large parallel cases, this avoids the restriction on the number
of open files imposed by the operating system limits.

The file writing can be threaded allowing the simulation to continue running
while the data is being written to file.  NFS (Network File System) is not
needed when using the the collated format and additionally, there is an option
to run without NFS with the original uncollated approach, known as
"masterUncollated".

The controls for the file handling are in the OptimisationSwitches of
etc/controlDict:

OptimisationSwitches
{
    ...

    //- Parallel IO file handler
    //  uncollated (default), collated or masterUncollated
    fileHandler uncollated;

    //- collated: thread buffer size for queued file writes.
    //  If set to 0 or not sufficient for the file size threading is not used.
    //  Default: 2e9
    maxThreadFileBufferSize 2e9;

    //- masterUncollated: non-blocking buffer size.
    //  If the file exceeds this buffer size scheduled transfer is used.
    //  Default: 2e9
    maxMasterFileBufferSize 2e9;
}

When using the collated file handling, memory is allocated for the data in the
thread.  maxThreadFileBufferSize sets the maximum size of memory in bytes that
is allocated.  If the data exceeds this size, the write does not use threading.

When using the masterUncollated file handling, non-blocking MPI communication
requires a sufficiently large memory buffer on the master node.
maxMasterFileBufferSize sets the maximum size in bytes of the buffer.  If the
data exceeds this size, the system uses scheduled communication.

The installation defaults for the fileHandler choice, maxThreadFileBufferSize
and maxMasterFileBufferSize (set in etc/controlDict) can be over-ridden within
the case controlDict file, like other parameters.  Additionally the fileHandler
can be set by:
- the "-fileHandler" command line argument;
- a FOAM_FILEHANDLER environment variable.

A foamFormatConvert utility allows users to convert files between the collated
and uncollated formats, e.g.
    mpirun -np 2 foamFormatConvert -parallel -fileHandler uncollated

An example case demonstrating the file handling methods is provided in:
$FOAM_TUTORIALS/IO/fileHandling

The work was undertaken by Mattijs Janssens, in collaboration with Henry Weller.
2017-07-07 11:39:56 +01:00
Mark Olesen
cce74d493b ENH: remove deprecated ensight output order (issue #523)
- Added for transition purposes only in 1612 but can now be removed.
2017-07-11 14:57:05 +02:00
Mark Olesen
2d530401fd ENH: add foamToVTK -name option
- as per foamToEnsight, foamToEnsightParts.
  Allows the user to specify different output directories.
2017-06-14 08:14:24 +02:00
Mark Olesen
49500b0194 STYLE: more meaningful variable name when using meshSubsetHelper 2017-06-14 07:56:57 +02:00
Andrew Heather
db5348880e MRG: resolved merge conflicts from merge from develop branch 2017-05-19 16:29:54 +01:00
Mark Olesen
3814762785 ENH: relocate triSurface classes into surfMesh library (issue #294)
- simplifies organization, includes, linkage etc.
2017-05-18 10:42:05 +02:00
Mark Olesen
b2edd73881 ENH: simplify foamToEnsight using new IOobjectList methods
BUG: foamToEnsight fails with missing field at time 0 (fixes #473)
2017-05-17 14:41:21 +02:00
Andrew Heather
e6b67f6790 ENH: Clean-up after latest Foundation integrations 2017-03-28 14:21:07 +01:00
Andrew Heather
cbf793fca2 ENH: Updated header file documentation 2017-03-21 09:40:35 +00:00
Mark Olesen
7b4680482e ENH: use string endsWith in a few places
fieldName.endsWith("_0")
vs
    fieldName.size() > 2 && fieldName(fieldName.size()-2, 2) == "_0"
2016-12-18 23:58:45 +01:00
Mark Olesen
784461b2fa ENH: make search of instances in IOobject::typeHeaderOk optional (issue #245)
- in specific cases it can be useful to suppress searching the instances.
  For example, if one only wishes to check if a "points" is available at
  the given time instance, without searching backwards through all
  times.
2016-11-21 14:28:40 +01:00
Mark Olesen
e5d9fd13c2 ENH: relocate meshSubsetHelper into dynamicMesh for re-use
- reuse for foamToTecplot360 and foamToVTK.
- remove dependency on vtkMesh where possible.
2016-11-09 23:33:24 +01:00
Mark Olesen
aca0b1ca04 COMP: ensight writer compilation for 64-bit labels (issue #263)
GIT: added missing source file.

ENH: add tutorial example under incompressible/simpleFoam/motorBike
2016-10-28 11:49:05 +02:00
Mark Olesen
b2ee629a94 BUG: removed oddness in pointer allocations (ensight parts).
- manifest in some parallel operations.

STYLE: update foamToEnsight, foamToEnsightParts to use C++ initializer_list

- avoid warning message when removing a non-existent directory (ensight output).
2016-10-27 15:11:30 +02:00
Mark Olesen
b04a6a05e5 GIT: relocate ensight components to library locations 2016-10-05 13:13:12 +02:00
Mark Olesen
e57ca15bda ENH: complete reworking of foamToEnsight to make into a library (issue #241)
- eliminate ensightAsciiStream, ensightBinaryStream, ensightStream in
  favour of using ensightFile and ensightGeoFile classes throughout.

- encapsulate mesh-parts sorting with the ensightCells, ensightFaces
  class.

- handle of patches/faceZones entirely within ensightMesh for a lighter
  interaction with field output. Both faceZones and point fields need
  more testing to see if they behave properly for all cases.

- move some output functionality into its own namespace
  'ensightOutput', move into a library.

- use the ensightCase class to open new ensight output streams
  in the proper sub-directory locations.
2016-10-06 10:43:22 +02:00
Mark Olesen
3e0e4532fd STYLE: minor adjustments to doxygen comments 2016-10-04 09:16:08 +02:00
Andrew Heather
47eb24bed5 GIT: Resolved conflicts arising from merge with develop branch 2016-09-26 10:57:34 +01:00
Mark Olesen
88ca081c8c ENH: reduce startup time for ensight conversion (issue #240).
- Less looping when detecting lagrangian clouds and their fields.

- Avoid using Time::setTime() and IOobjectList in tight loops.
  They both kill performance immensely.

ENH: provide a -noLagrangian option to foamToEnsight and foamToEnsightParts
for even more control.
2016-09-23 17:45:47 +02:00
Andrew Heather
b9940cbbb1 COMP: Multiple changes - first clean build after latest merge - UNTESTED 2016-09-23 15:36:53 +01:00
Mark Olesen
06699f17f5 BUG: ensight output failing with dimensioned field (fixes #244)
- The new field needs initialization with a dimensioned<Type> not just
  the dimensionSet.

- The new field was also incorrectly being registered, which could
  cause issues later.
2016-09-23 13:13:12 +02:00
Mark Olesen
3c25f26aab BUG: incorrect symmTensor order for some ensight output (fixes #243)
- affects foamToEnsightParts, sampled surfaces

- Use ensightPTraits mechanism throughout to avoid this issue
2016-09-23 09:10:57 +02:00
Mark Olesen
0c168c43fa ENH: improve startup time for foamToEnsight conversion (issue #240).
Old code:
    Found 10990 time steps
    Search for moving mesh ... no moving mesh detected.
    Startup in 329.09 s

Updated:
    Found 10990 time steps
    Search for moving mesh ... no moving mesh detected.
    Startup in 1.6 s

- Cause was checking "polyMesh/points" via an IOobject.
  Short-circuit with a check for a polyMesh/ directory first.

  Limit the check to the master-node as well to further reduce
  load on the file-system.

------------------------------

ENH: improve per-step conversion times for foamToEnsight.

Old code:
    Converting 11001 time steps
    Time [0] = 0       Wrote in 1.53 s
    Time [1] = 1       Wrote in 1.52 s
    ...
    Time [100] = 100   Elapsed time 205.35 s

Updated:
    Converting 11001 time steps
    Time [0] = 0       Wrote in 1.4 s
    Time [1] = 1       Wrote in 0.07 s
    ...
    Time [100] = 100   Elapsed time 42.4 s

- Speedup by hashing test results from the first conversion step
  instead of checking each time.

  Check data on all nodes to avoid problems with incomplete writes.

------------------------------

BUG: moving mesh detection failed for foamToEnsightParts

- adjusted to agree with updated foamToEnsight

------------------------------

Note:

- foamToEnsightParts (serial) still has about twice the throughput of
  foamToEnsight.
2016-09-21 18:15:19 +02:00
Andrew Heather
9fbd612672 GIT: Initial state after latest Foundation merge 2016-09-20 14:49:08 +01:00
Mark Olesen
9de4a75813 ENH: expand data mask for foamToEnsight (issue #231)
- Default is a width of 8 characters, but this can be extended up to 31
  characters via the '-width' command-line option.

- Now use a similar structure as foamToEnsightParts for the masking.
  This reduces the clutter within the directory, makes it easier to
  selectively delete some time steps (using shell commands).

- Added in a "time" information data in each sub-directory to
  make it possible to reconstruct the case file with an external
  script.

- Conversion of cloud data should now also work in parallel
  (may need more testing).

- Support binary output for cloud data.

- Better avoidance of illegal ensight variable names.
  But still partially incomplete (due to patch fields).

==================================================
Example of NEW file structure:

    EnSight/verticalChannel.case        # case name
    EnSight/geometry                    # for non-moving geometry

    EnSight/data/                       # time-varying data
    EnSight/data/00000000/
    EnSight/data/00000001/
    ...

  Fields are stored by name within the data/********/ directories:

    EnSight/data/00000001/time          # human-readable time info
    EnSight/data/00000001/U
    EnSight/data/00000001/p
    ...
    EnSight/data/00000001/geometry      # for moving geometry

  Clouds are stored at the next sub-directory level:

    EnSight/data/00000001/lagrangian/<cloudName>/positions
    EnSight/data/00000001/lagrangian/<cloudName>/U
    ...

==================================================
The old structure was significantly more cluttered:

    EnSight/verticalChannel.case
    EnSight/verticalChannel.0000.mesh
    EnSight/verticalChannel.0001.p
    EnSight/verticalChannel.0001.<cloudName>
    EnSight/verticalChannel.0001.<cloudName>.U

==================================================
2016-09-13 18:26:00 +02:00
Henry Weller
58f905ff70 C++11: Replaced the C NULL with the safer C++11 nullptr
Requires gcc version 4.7 or higher
2016-08-05 17:19:38 +01:00
Henry Weller
b8614eca07 Make/options: Removed duplicate entries
Thanks to Bruno Santos for providing the script to check the files
Resolves bug-report http://bugs.openfoam.org/view.php?id=2169
2016-08-01 20:55:16 +01:00
Henry Weller
1319df48d9 Rationalized Doxygen documentation of command-line options 2016-06-17 09:11:58 +01:00