Commit Graph

218 Commits

Author SHA1 Message Date
dd8341f659 ENH: make format of ExecutionTime = ... output configurable (issue #788)
- controlled by the the 'printExecutionFormat' InfoSwitch in
  etc/controlDict

      // Style for "ExecutionTime = " output
      // - 0 = seconds (with trailing 's')
      // - 1 = day-hh:mm:ss

   ExecutionTime = 112135.2 s  ClockTime = 113017 s

   ExecutionTime = 1-07:08:55.20  ClockTime = 1-07:23:37

- Callable via the new Time::printExecutionTime() method,
  which also helps to reduce clutter in the applications.
  Eg,

     runTime.printExecutionTime(Info);

  vs

     Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
         << "  ClockTime = " << runTime.elapsedClockTime() << " s"
         << nl << endl;

--

ENH: return elapsedClockTime() and clockTimeIncrement as double

- previously returned as time_t, which is less portable.
2018-04-27 15:00:34 +02:00
018124e3bf STYLE: use 'return nullptr' for empty autoPtr/tmp returns
- both autoPtr and tmp are defined with an implicit construct from
  nullptr (but with explicit construct from a pointer to null).
  Thus is it safe to use 'nullptr' when returning an empty autoPtr or tmp.
2018-03-21 09:31:09 +01:00
795ece8bb7 ENH: writeFile: check for opening status. Fixes #783. 2018-03-28 11:45:28 +01:00
d17bc72585 ENH: consistency of HashSet setMany(), insertMany() with packed-list version
- this also provides a better separation of the intent
  (ie, inserting a single value, or inserting multiply values)
2018-03-14 21:08:29 +01:00
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
37e248c74b STYLE: consistent use of wordHashSet instead of HashSet<word>
- the wordHashSet typedef is always available when HashSet has been
  included.

- use default HashTable key (word) instead of explicitly mentioning it
2018-02-22 11:19:47 +01:00
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
6d75552a77 Merge remote-tracking branch 'origin/master' into develop 2018-01-25 11:59:12 +01:00
20125b36a3 BUG: timeControlFunctionObject swallows dictionary modifications (closes #716)
- runTimeModifiable change to the dictionary not being propagated to
  the underlying functionObjects
2018-01-24 20:45:59 +01:00
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
9dc361dae9 STYLE: avoid unnecessary use of optionLookup
- direct parsing of -funcs to ITstream.
- use direct lookup when the option is a word/string
2018-01-08 12:38:53 +01:00
5d5ef73f74 COMP: adjust type for dummy postProcess fields 2017-12-14 01:17:21 +01:00
3da2aee4ef ENH: Updated wildcard handling for function object field entries 2017-12-13 20:57:56 +00:00
610c290969 ENH: added functionObject::execute(int) method
- this is a provision for defining execute actions that can be called
  largely independently of the normal time-loop constraints. This can
  be useful to provide hooks for sub-cycling, or to define an action
  that can be triggered manually or on some other event.
2017-11-28 10:00:15 +01:00
416a3790ea STYLE: prefer autoPtr::reset() to autoPtr::set()
- in most cases already checked valid() so don't need additional check
  for setting an existing pointer
2017-11-22 19:11:11 +01:00
4039933b89 Merge branch 'feature-function-object-field-input' into 'develop'
Feature function object field input

See merge request Development/OpenFOAM-plus!167
2017-11-13 09:10:55 +00:00
ec9a7cc016 ENH: function objects - enabled 'fields' entry to use patterns for some objects 2017-11-07 17:33:09 +00:00
4fc4f49cef ENH: Updated fieldAverage FO windowing. See #525
When specifying the averaging data, a new `windowType` option is
available, taking the values:

- none: no windowing
- approximate: past functionality (v1706 and earlier)
- exact: exact moving average - will store and write (for restart) all
  fields in the window
2017-08-09 16:52:03 +01:00
a79d2835f1 ENH: functionObjectList: format errors from FO reading. Fixes #575. 2017-10-30 11:43:12 +00:00
fb20bc107e INT: Updated dependent code following latest set of integrations 2017-09-06 16:05:12 +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
0e7954c22b BUG: sampledTriSurfaceMesh: sampling outside of mesh. Fixes #575.
There are a few issues:
- error would only throw exceptions if not parallel
- if we change this we also need to make sure the functionObjectList
  construction is synchronised
- bounding box overlap was not returning the correct status so the code
  to avoid the issue of 'badly formed bounding box' was not triggered.
2017-08-29 14:41:22 +01:00
e70fc61660 ENH: consolidate, cleanup some string methods
- consolidate word::validated() into word::validate() and also allow
  as short form for string::validate<word>(). Also less confusing than
  having similarly named methods that essentially do the same thing.

- more consistent const access when iterating over strings

- add valid(char) for keyType and wordRe
2017-08-02 12:33:35 +02:00
797155f862 ENH: additional method for switching error throwing on/off (issue #552)
- error::throwExceptions(bool) returning the previous state makes it
  easier to set and restore states.

- throwing() method to query the current handling (if required).

- the normal error::throwExceptions() and error::dontThrowExceptions()
  also return the previous state, to make it easier to restore later.
2017-07-29 12:25:30 +02:00
8df433860f STYLE: use string substr instead of string::operator()
- makes the purpose clearer.
  In some places, string::resize() is even simpler.

- use C++11 string::back() in preference to str[str.size()-1]
2017-07-21 12:30:42 +02:00
2c69b7d7c4 STYLE: adjust some line lengths, doxygen comments 2017-07-20 13:50:35 +02:00
2fe3a62057 STYLE: use nullptr instead of 0 in autoPtr, tmp etc. 2017-07-14 16:50:21 +02:00
9e88a8a21e ENH: enable profiling output for postProcess and -postProcess (closes #526)
- added an explicit print, but only report profiling to the log
  file from master process.

  We don't wish to overwrite any profiling that was conducted during
  the simulation. Besides which, we don't have a proper Time object
  for handling the write nicely either.
2017-07-12 15:48:25 +02:00
bc1f2fa97e STYLE: use auto and cfind to simplify selector usage (issue #512) 2017-07-03 10:36:03 +02:00
f55c568f13 ENH: upgrade from NamedEnum to Enum (issue #515) 2017-07-03 21:43:33 +02:00
d415bf77bf Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop 2017-06-26 13:33:19 +01:00
89e175958f ENH: function object: added helper function to return a local scope name 2017-06-26 13:23:45 +01:00
e0e457bd7d STYLE: Updated to read from parent instead of skipping to base class 2017-06-26 13:21:34 +01:00
2dc8038092 ENH: timeControl: adds some more #423. 2017-06-26 11:51:14 +01:00
34a1a5dec2 STYLE: Minor corrections to comments/fix typos 2017-06-23 12:13:46 +01:00
7e6faf049c Squashed commit of the following:
commit 510b9353f8cb932a87f1588b17a4dea230c29d3c
Author: mattijs <mattijs>
Date:   Wed Jun 14 16:36:35 2017 +0100

    ENH: timeControl: propagate time-change logic from Time.C

commit 6dc57a8f1e0e7605ea819deb6f11dd4b7874ff30
Author: mattijs <mattijs>
Date:   Thu Jun 1 11:28:56 2017 +0100

    ENH: timeControl: cleanup; avoid division by zero

commit 5ac4bc2dd8c1f4676eef9d7a03215caba23a2e19
Author: mattijs <mattijs>
Date:   Wed May 31 12:04:52 2017 +0100

    ENH: timeControl: allow ramping down as well as up.

commit a6b2db9e791f29258f04f3a9cbd6354aa468977d
Author: mattijs <mattijs>
Date:   Wed May 17 15:29:22 2017 +0100

    ENH: timeControl: limit any timestep change if deltaTCoeff enabled.

commit 004115ee03a6637ae0d23cce303a30d1b3af046f
Author: mattijs <mattijs>
Date:   Wed May 17 11:40:26 2017 +0100

    ENH: setTimeStep: have timeStart, timeEnd controls on time step adjustment.

    Also added smoothly varying time step change (through optional deltaTCoeff)
2017-06-14 16:40:17 +01:00
bb67ccd37d ENH: Cleaned up hash table item found checks 2017-05-19 11:15:35 +01:00
99f31a75f0 COMP: Removed override directives to remove compiler warnings 2017-05-18 12:40:48 +01:00
4ce77f6843 Merge branch 'master' into develop 2017-04-25 12:31:22 +01:00
d26ed93389 BUG: writeFile - corrected write of output file at start time 2017-04-25 12:30:35 +01:00
da6e90de63 Merge branch 'feature-readNow' into 'develop'
Feature read now

See merge request !102
2017-04-19 17:22:28 +01:00
140c5110fe STYLE: remove tabs from files and shorten line-length. 2017-04-10 16:11:33 +02:00
2da2970c7c BUG: timeActivatedFileUpdate: was potentially rereading itself!
Fixed by setting flag which then gets queried by Time. Fixes #420.
2017-04-06 10:26:16 +01:00
836d04ffc1 ENH: various general improvments to the POSIX functions
- ensure proper and sensible handling of empty names.
  Eg, isDir(""), isFile("") are no-ops, and avoid file-stat

- rmDir:
  * optional 'silent' option to suppress messages.
  * removes all possible sub-entries, instead of just giving up on
    the first problem encountered.

- reduced code duplication in etcFiles

ENH: provide WM_USER_RESOURCE_DIRNAME define (in foamVersion.H)

- this is still a hard-coded value, but at least centrally available
2017-03-30 11:45:25 +02:00
6b3742c3f1 BUG: Missed change during fix for #437 2017-03-21 13:57:55 +00:00
69bc13f300 BUG: Function objects - updated to enable user time emtries, e.g. if using engineTime. Fixes #437 2017-03-21 13:32:55 +00:00
2853678a60 ENH: support operations on surfFields in surfaceFieldValue
- this makes it possible to perform additional operations
  on surface values that have been previously sampled.

- support vectorField for weighting operations.

- reduce overhead by avoiding creation of weight fields, Sf fields
  and combined surface geometries unless they are actually required.

- extend some similar concepts and operations to volFieldValue
2017-03-02 14:50:36 +01:00
eed3b77060 ENH: Function objects - updated logic to determine whether or not to instantiate a time-based function object. Fixes #439 2017-03-21 16:55:24 +00:00
694a03dfeb Merge branch 'master' into develop 2017-03-21 13:58:06 +00:00
2f41df18e3 Merge branch 'master' into develop 2017-03-21 13:36:26 +00:00