View Issue Details

IDProjectCategoryView StatusLast Update
0002015OpenFOAM[All Projects] Bugpublic2016-03-06 21:37
ReporterwyldckatAssigned Tohenry 
Status resolvedResolutionfixed 
Product Versiondev 
Fixed in Version 
Summary0002015: Sprucing up the tutorials folder and adding -dict to "collapseEdges"
DescriptionExtending on what was introduced in #1919 - - and in the spirit of the current effort on improving maintainability, the attached contribution aims to remove the need for "Allrun" scripts to delete or rename log files, simply because we need to execute an application more than once, with different settings each time, for the same case.
It was tested with the commit 51f93d3b437 from OpenFOAM-dev, but should still work with the latest changes present in the latest commits.

This contribution adds/modifies the following features:

 1. New "-suffix" argument for the script functions "runApplication" and "runParallel", which receives a second argument which will result in the name being appended to it.
    For example, this:
       runApplication topoSet
       mv log.topoSet log.topoSet.1
    was changed to this:
       runApplication -s 1 topoSet
    Another example:
       - faceAgglomerate -region $i -dict constant/viewFactorsDict > log.faceAgglomerate.$i 2>&1
       + runApplication -s $i \
       + faceAgglomerate -region $i -dict constant/viewFactorsDict

    Note: the line break is used in a lot of the changes to make it easier to read the script code.

    Associated with this change, all "Allrun*" tutorial scripts were updated accordingly with the new suffix option ("-s" to be specific).

 2. All arguments for "runApplication" and "runParallel" now have a shortened alias for them:

      -append or -a
      -overwrite or -o
      -suffix or -s
      -np or -n

 3. A few tutorials were using a somewhat confusing "while" loop to run 3 or 6 passes of a particular mesh manipulation strategy (e.g. refineMesh 6 times), have been changed to use a "for" loop and the new suffix option for "runApplication".

 4. A couple of minor fixes were done in "multiphase/interPhaseChangeDyMFoam/propeller/Allrun.pre".
 5. Changed the way "patchifyObstacles" is executed in "lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun.pre".
 6. Modified "applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C" to accept the usual "-dict" option for these kinds of applications in OpenFOAM. Along with this:

      - the class "src/dynamicMesh/polyMeshFilter" was adjusted accordingly, by adding a new constructor that accepts receiving a preloaded "dict" object, instead of only having options that load a hardcoded "collapseDict";

      - most of the tutorial cases that use "collapseEdges" have been modified to use the new "-dict" option and to no longer need renaming the dictionary files.

      - Note: I didn't add the ability to have a subdict in "foamyHexMeshDict" for a "collapseDict" block, because I wasn't certain if this would have been the best step to take. Nonetheless, now that I think about it, there is already a precedent for the "meshQualityDict" in "snappyHexMeshDict". Please let me know if you want me to provide this change as well, therefore dropping the hard-coded paths to the "dict" in "polyMeshFilter".
 7. The script "tutorials/Allrun" has a small change in the function "logReport()", so that it will properly recognize the name of the application that is in the log file. This changed cryptic reports like the following in "testLoopReport":

      Application 1 - case chtMultiRegionSimpleFoam/heatExchanger: completed

    To this:

      Application topoSet.air.1 - case chtMultiRegionSimpleFoam/heatExchanger: completed

 8. The script "tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-pre" script was broken, because it was hardcoded to moving the contents of the folder "101/polyMesh" to "constant/polyMesh". The correction provided relies in using "foamListTimes -latestTime" instead.
    I didn't simply use the "-overwrite" option in "foamyHexMesh", simply because this tutorial is in "mesh/foamyHexMesh", which is dedicated mostly the demonstrating examples on how to use the meshers and related utilities in OpenFOAM.
    And as indicated in the "Additional Information" section below, this doesn't fix the simulation itself, therefore this ends up not being worth much at this moment.

 9. The script "Allrun" in "multiphase/interFoam/les/nozzleFlow2D" now uses the "-overwrite" option in "refineMesh", to avoid doing the hack'ish way of copying the files from the latest time folder into the constant one.

Steps To ReproduceInstructions on how to use the provided contribution:
 1. Unpack the attached file "sprucingRunFunctionsAndCollapseEdges_v2.tar.gz" inside the folder "OpenFOAM-dev".

 2. The file "tutorials/porousSimpleFoam/straightDuctImplicit/system/collapseDict" should be removed, to avoid accidental use of that dictionary file, which isn't used by "foamyHexMesh" in this specific tutorial case.
Additional InformationThe "Allrun*" scripts for the following cases within the "tutorials" directory, were the ones modified with the attached package:


These cases were tested with the "Alltest" script and compared the results (logs and files) achieved with a custom build (that has the attached contributions) versus a clean build, both using 64-bit labels and Double Precision floating point.

Everything seems to have worked properly, although:

  - the case "incompressible/porousSimpleFoam/straightDuctImplicit" did not give identical meshes. This seems to be because "foamyHexMesh" is currently not designed to create identical meshes between each run.

  - the case "mesh/foamyHexMesh/mixerVessel" crashes in a different place from the original OpenFOAM-dev case snapshot; this particular case is a rather computationally expensive meshing case, which I'll try to address in another bug report, if and when the need arises.

I wanted to have provided this contribution last week, but I ended up not having enough time to test everything back then. But today, hopefully, I didn't miss anything and everything works as intended.
TagsNo tags attached.



2016-03-05 17:40


sprucingRunFunctionsAndCollapseEdges_v2.tar.gz (15,158 bytes)


2016-03-06 19:09

manager   ~0005998

Thanks for the effort you put into this Bruno, any improvement to the tutorial scripts to aid usability and maintainability is greatly appreciated.
Resolved by commit 499c221df4a5733d61cc2f4369a72939bcfd8ed7


2016-03-06 19:54

updater   ~0006002

Sorry, I missed (at least) one tiny detail: The file "src/dynamicMesh/polyMeshFilter/polyMeshFilter.H" that I provided reverted the new convention for the hashes in pre-preprocessor macros.
Attached is the updated file to meet the new convention.


2016-03-06 19:54


polyMeshFilter.H (8,325 bytes)


2016-03-06 21:37

manager   ~0006004

Resolved by commit eae4c1289dace30c60690152f76ae73e5ee64095

Issue History

Date Modified Username Field Change
2016-03-05 17:40 wyldckat New Issue
2016-03-05 17:40 wyldckat Status new => assigned
2016-03-05 17:40 wyldckat Assigned To => henry
2016-03-05 17:40 wyldckat File Added: sprucingRunFunctionsAndCollapseEdges_v2.tar.gz
2016-03-05 20:19 wyldckat Reproducibility have not tried => N/A
2016-03-06 19:09 henry Note Added: 0005998
2016-03-06 19:09 henry Status assigned => resolved
2016-03-06 19:09 henry Resolution open => fixed
2016-03-06 19:54 wyldckat Note Added: 0006002
2016-03-06 19:54 wyldckat Status resolved => feedback
2016-03-06 19:54 wyldckat Resolution fixed => reopened
2016-03-06 19:54 wyldckat File Added: polyMeshFilter.H
2016-03-06 21:37 henry Note Added: 0006004
2016-03-06 21:37 henry Status feedback => resolved
2016-03-06 21:37 henry Resolution reopened => fixed