Commit Graph

19 Commits

Author SHA1 Message Date
5f93f20652 ENH: add stringOps::inplaceRemoveSpace()
Style changes:
  - use std algorithm for some stringOps internals
  - pass SubStrings iterators by const reference

ENH: special nullptr handling for ISstream getLine
  - pass through to istream::ignore to support read and discard
2020-02-19 23:36:46 +01:00
59ed3ba18d ENH: consistency improvements for interpolationTable, table readers
- avoid stealing autoPtr in interpolationTable copy operations

- improve local memory requirements of readers

- make OpenFOAM table reader default constructible

- more code alignment between csvTableReader and Function1::CSV
  (fix #1498 for csvTableReader as well)
2020-01-21 15:17:04 +01:00
b40d1d8e4f BUG: decomposePar fails with csv table in binary (fixes #1498) 2019-11-18 16:59:51 +01:00
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
e596377179 STYLE: avoid flush when dictionary {} closing (issue #1145)
- a holdover from introducing the endBlock() method
2019-01-03 19:12:12 +01:00
8eddcc072a ENH: avoid readScalar, readLabel etc from dictionary (#762, #1033)
- use the dictionary 'get' methods instead of readScalar for
  additional checking

     Unchecked:  readScalar(dict.lookup("key"));
     Checked:    dict.get<scalar>("key");

- In templated classes that also inherit from a dictionary, an additional
  'template' keyword will be required. Eg,

     this->coeffsDict().template get<scalar>("key");

  For this common use case, the predefined getXXX shortcuts may be
  useful. Eg,

     this->coeffsDict().getScalar("key");
2018-10-12 08:14:47 +02:00
a4e63e2bfb STYLE: avoid IStringStream when parsing primitives 2017-09-21 16:10:33 +02:00
328769b25d STYLE: Code clean-up 2017-09-07 14:30:28 +01:00
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
fb724ce113 MRG: Integrated Foundation code to commit 9f37c3c 2017-03-31 15:34:28 +01:00
04c3d535b0 MRG: Integrated Foundation code to commit 47bd8e1 2017-03-23 10:12:38 +00:00
2e2bfd237a Function1: Rationalized construction to support the simpler sub-dictionary format
e.g.
    ramp
    {
        type     quadratic;
        start    200;
        duration 1.6;
    }

but the old format is supported for backward compatibility:

    ramp linear;
    rampCoeffs
    {
        start    200;
        duration 1.6;
    }
2017-03-16 20:53:08 +00:00
126125c185 Rationalized the keyword to specify a file name in a dictionary to 'file'
e.g. in tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/T

    hot
    {
        type            externalCoupledTemperature;
        commsDir        "${FOAM_CASE}/comms";
        file            "data";
        initByExternal  yes;
        log             true;
        value           uniform 307.75; // 34.6 degC
    }

Previously both 'file' and 'fileName' were used inconsistently in different
classes and given that there is no confusion or ambiguity introduced by using
the simpler 'file' rather than 'fileName' this change simplifies the use and
maintenance of OpenFOAM.
2017-01-07 09:38:54 +00:00
00174405c6 ENH: noiseModels - enable models to accept lists of file names 2016-11-24 21:31:08 +00:00
06f22a9bf3 ENH: cleanup Ostream to ease usage (issue #254)
- Include newline in beginBlock/endBlock, since this corresponds to
  the standard usage. The beginBlock now takes keyType instead of word.

- Provide Ostream::writeEntry method to reduce clutter and simplify
  writing of entries.

  Before
  ======
      os << indent << "name" << nl
         << indent << token::BEGIN_BLOCK << incrIndent << nl;
      os.writeKeyword("key1") << val1 << token::END_STATEMENT << nl;
      os.writeKeyword("key2") << val2 << token::END_STATEMENT << nl;
      os << decrIndent << indent << token::END_BLOCK << nl;

  After
  =====
      os.beginBlock("name");
      os.writeEntry("key1", val1);
      os.writeEntry("key2", val2);
      os.endBlock();

- For completeness, support inline use of various Ostream methods.
  For example,

      os << beginBlock;
      os.writeEntry("key1", val1);
      os.writeEntry("key2", val2);
      os << endBlock;

- For those who wish to write in long form, can also use endEntry inline:

      os.beginBlock("name");
      os.writeKeyword("key1") << val2 << endEntry;
      os.writeKeyword("key2") << val2 << endEntry;
      os.endBlock();

The endEntry encapsulates a semi-colon, newline combination.
2016-06-06 11:51:05 +01:00
69fde6b831 ENH: provide Ostream virtual methods beginBlock, endBlock (fixes #112)
- eases creation of dictionary-like output.

- make keyWord() method virtual to allow adaptation for alternative
  outputs
2016-04-15 11:04:13 +02:00
d9c7c671d6 Function1: Simplified files 2016-02-10 09:43:45 +00:00
968c888fc4 Rename DataEntry -> Function1
Function1 is an abstract base-class of run-time selectable unary
functions which may be composed of other Function1's allowing the user
to specify complex functions of a single scalar variable, e.g. time.
The implementations need not be a simple or continuous functions;
interpolated tables and polynomials are also supported.  In fact form of
mapping between a single scalar input and a single primitive type output
is supportable.

The primary application of Function1 is in time-varying boundary
conditions, it also used for other functions of time, e.g. injected mass
is spray simulations but is not limited to functions of time.
2016-02-08 16:18:07 +00:00