- 1. Version 0.6.4 - 2014-11-24
- 1.1. Requirements
- 1.2. Future changes
- 1.3. Major changes
- 1.4. Incompatibilities
- 1.5. Bugfixes
- 1.5.1. Templates in
pyFoamPrepareCase.py
did not keep permissions - 1.5.2.
pyFoamComparator.py
failed due to circular dependency - 1.5.3.
pyFoamDumpRunDatabaseToCSV.py
fails if Pandas-data is requested - 1.5.4.
sort
for list broke code on Python 3 - 1.5.5. Changing the OF-version does not work in Python 3
- 1.5.6.
addData
inPyFoamDataFrame
extrapolates for invalid values - 1.5.7.
--keep-last
did not work forpyFoamClearCase.py
and parallel cases - 1.5.8.
pyFoamDumpRunDatabaseToCSV.py
does not add basic run information - 1.5.9. Restore of
FileBasisBackup
did not work - 1.5.10. Remove circular dependency in
DataStructures
- 1.5.1. Templates in
- 1.6. New features/Utilities
- 1.7. Enhancements to Utilities
- 1.7.1.
pyFoamChangeBoundaryType.py
allows setting additional values - 1.7.2.
pyFoamPrepareCase.py
now has OF-version and fork as defined variables - 1.7.3.
pyFoamPrepareCase.py
now allows "overloading" another directory - 1.7.4.
pyFoamIPythonNotebook.py
adds improvements to the notebook - 1.7.5.
pyFoamListCases.py
more tolerant to faultycontrolDict
- 1.7.6.
pyFoamDumpConfiguration.py
prints sections and keys alphabetically - 1.7.7.
pyFoamJoinCSV.py
andpyFoamConvertToCSV.py
read and write Excel-files - 1.7.8. Flexible variable filtering in
pyFoamJoinCSV.py
andpyFoamConvertToCSV.py
- 1.7.9. Columns in
pyFoamJoinCSV.py
andpyFoamConvertToCSV.py
can be recalculated - 1.7.10. Testing for
Numeric
removed frompyFoamVersion.py
- 1.7.1.
- 1.8. Enhancements to the Library
- 1.8.1. Subclass of
ClusterJob
that supportPrepareCase
- 1.8.2. Subclass of
ClusterJob
that supportRunParameterVariation
- 1.8.3.
execute
inPyFoam/Utilities
fails if script is not executable - 1.8.4.
foamVersion
uses a separate wrapper class fortuple
- 1.8.5. Move calculation of disk usage to
Utilities
- 1.8.6. Enhancement of
--help
- 1.8.7.
which
-routine inUtitlities
uses native Python-routine - 1.8.8.
FileBasis
now allows file handles instead of the filename - 1.8.9.
BlockMesh
doesn't force writing to file anymore - 1.8.10. Additional methods for
BlockMesh
-class - 1.8.11.
LineReader
allows keeping spaces on left - 1.8.12.
TemplateFile
now allows writing of assignment-results in file - 1.8.13.
SolverJob
now allows passing of parameters to the solver - 1.8.14.
SpreadsheetData
now allows reading from an Excel file - 1.8.15.
SpreadsheetData
allows recalculating columns
- 1.8.1. Subclass of
- 1.9. Known bugs
- 2. Version 0.6.3 - 2014-06-23
- 2.1. Requirements
- 2.2. Major changes
- 2.3. Incompatibilities
- 2.4. Bugfixes
- 2.4.1. PlotWatcher has long times between updates if pickling takes long
- 2.4.2.
pyFoamPVSnapshot.py
fails for newer paraview-versions - 2.4.3. SamplePlot failed when valueNames are unspecified
- 2.4.4.
pyFoamTimelinePlot.py
failed Numpy/Pandas output of vector fields - 2.4.5.
alternateAxis
ignored for slave - 2.4.6.
pyFoamCaseReport.py
more stable for binaryboundary
-files - 2.4.7.
SpreadsheetData
returns data which breaks certain Pandas-operations - 2.4.8.
pyFoamCloneCase.py
added duplicates to the archive - 2.4.9.
nonuniform
of length 3 not correctly printed
- 2.5. New features/Utilities
- 2.6. Enhancements to Utilities
- 2.6.1.
pyFoamSampleplot
has option to use index instead of time in filenames - 2.6.2.
pyFoamListCases.py
Allows addition of custom data - 2.6.3. Switch compiler versions
- 2.6.4.
pyFoamVersion.py
reports the installed versions better - 2.6.5. Offscreen rendering can be switched off in
pyFoamPVSnapshot.py
- 2.6.6. Write 3D-data in
pyFoamPVSnapshot.py
- 2.6.7. Added capabilities to
pyFoamSTLUtility
- 2.6.8.
pyFoamDecomposer.py
switches off function objects - 2.6.9.
pyFoamCloneCase.py
clones more stuff
- 2.6.1.
- 2.7. Enhancements to the Library
- 2.7.1.
BasicRunner
now can print the command line that is actually used - 2.7.2.
ClusterJob
now can live without a machinefile - 2.7.3. Enhanced treatment of symlinks during cloning
- 2.7.4.
AnalyzedCommon
clears theanalyzed
-directory - 2.7.5.
TimelineDirectory
is more tolerant - 2.7.6. Possibility of a subcommand-interface for utilities
- 2.7.7.
STLUtility
accepts file-handles - 2.7.8.
addClone
inSolutionDirectory
accepts glob patterns - 2.7.9.
execute
inUtilities
allows specification of working directory and echoing of output - 2.7.10.
rmtree
andcopytree
more tolerant - 2.7.11. Enhanced support for booleans in the parser
- 2.7.12. Application classes now allow specifying options as keyword parameters
- 2.7.13.
SolutionDirector
now can classify directories in thepostProcessing
-directory - 2.7.14.
pyFoamSamplePlot.py
now more flexible for distributions - 2.7.15.
DictProxy
now has adict
-likeupdate
-method - 2.7.16.
FoamFileGenerator
automatically quotes strings - 2.7.17. Children of
FileBasis
now can be used with thewith
-statement
- 2.7.1.
- 3. Version 0.6.2 - 2013-11-03
- 3.1. Major changes
- 3.2. Incompatibilities
- 3.3. Bugfixes
- 3.4. Utilities
- 3.5. Library
- 3.5.1.
SolutionDirectory
andTimeDirectory
are more tolerant - 3.5.2.
ClusterJob
now handles template files - 3.5.3. Additional parameters in
ClusterJob
- 3.5.4. Custom data in directory easier accessible
- 3.5.5.
SolverJob
now allows compression of output - 3.5.6.
PyFoamApplication
-class now allows quick access to data
- 3.5.1.
- 3.6. New features/Utilities
- 3.7. Enhancements
- 3.7.1.
pyFoamRedoPlot.py
can plot in XKCD-mode - 3.7.2.
pyFoamListCases.py
now displays disk usage in human readable form - 3.7.3.
pyFoamClearCase.py
more flexible in selection of data to be removed - 3.7.4.
pyFoamFromTemplate.py
automatically chooses template and default values - 3.7.5.
pyFoamDumpRunDatabaseToCSV.py
can disable standard-fields - 3.7.6.
pyFoamDumpRunDatabaseToCSV.py
printspandas
-object - 3.7.7. Better debugging with
ipdb
- 3.7.8. Interactive shell after execution for utilities
- 3.7.9. Utilities that read quantitative data convert to
pandas
-data and/ornumpy
- 3.7.10. Utilities that read quantitative data write Excel files
- 3.7.11. Specify additional settings for
GnuPlot
incustomRegexp
- 3.7.12. More flexible data specification for
pyFoamSamplePlot.py
- 3.7.13.
pyFoamSamplePlot.py
now allows specification of x-range
- 3.7.1.
- 4. Version 0.6.1 - 2013-05-24
- 4.1. Major changes
- 4.2. Bugfixes
- 4.3. Utilities
- 4.3.1.
pyFoamBuildHelper.py
now allow more than one action - 4.3.2. Utilities warn if OpenFOAM-version is unset
- 4.3.3.
pyFoamUpgradeDictionariesTo20.py
allows single files - 4.3.4.
pyFoamUpgradeDictionariesTo20.py
transforms reaction-schemes - 4.3.5.
pyFoamUpgradeDictionariesTo20.py
transforms thermophysical data - 4.3.6.
pyFoamCloneCase
now allows creating directory that symlinks to the original - 4.3.7.
pyFoamClearCase.py
now removespostProcessing
and allows removal of additional files - 4.3.8. Improvements to
pyFoamVersion.py
- 4.3.9. Additional files automatically cloned
- 4.3.10.
pyFoamDisplayBlockMesh.py
uses the same options for template format aspyFoamFromTemplate.py
- 4.3.1.
- 4.4. Library
- 4.5. New features/Utilities
- 5. Version 0.6.0 - 2013-03-14
- 5.1. Major changes
- 5.2. Third-Party
- 5.3. Infrastructure
- 5.3.1. Parameters can't be modified in
CTestRun
after initialization - 5.3.2. Treat timeouts in the
MetaServer
right - 5.3.3. Add
execute
-method toClusterJob
- 5.3.4. Add possibility to run specific modules before or after the solver
- 5.3.5. Parameters added to the info about the run
- 5.3.6. Parameter handling in
ClusterJob
extended - 5.3.7. Run data written alongside
PickledPlots
- 5.3.8.
BasicRunner
collects error and warning texts
- 5.3.1. Parameters can't be modified in
- 5.4. Library
- 5.4.1.
TemplateFile
now usespyratemp
- 5.4.2. Clearer error message in Application-classes
- 5.4.3. Output is only colored if it goes to the terminal
- 5.4.4.
error
-method of application classes now raises an exception - 5.4.5.
ParsedParameterFile
now knows how to handle binary files - 5.4.6.
LabledReSTTable
for more flexible table generation - 5.4.7. Plotting classes now allow setting of
xlabel
- 5.4.1.
- 5.5. Utilities
- 5.5.1.
pyFoamFromTemplate.py
with new templating engine - 5.5.2.
pyFoamSamplePlot.py
allows using the reference data as basis for comparison - 5.5.3. Scaling and offsets are now used in plots of
pyFoamSamplePlot.py
- 5.5.4.
pyFoamPrintData2DStatistics.py
prints relative average error - 5.5.5. Enhancements to
pyFoamVersion.py
- 5.5.6.
pyFoamRunner.py
allows hooks - 5.5.7.
pyFoamRedoPlots.py
supports range for plots - 5.5.8.
pyFoamDisplayBlockMesh.py
no supports templates - 5.5.9.
pyFoamCaseReport.py
is tolerant towards binary files - 5.5.10.
pyFoamSamplePlot.py
andpyFoamTimelinePlot.py
raise error if no plots are generated - 5.5.11.
pyFoamSurfacePlot.py
can wait for a key - 5.5.12.
pyFoamEchoDictionary.py
is more flexible with binary files - 5.5.13. All utilities now have a switch that starts the debugger even with syntax-errors
- 5.5.14. Utilities now can be killed with
USR1
and will give a traceback - 5.5.15. Switch to switch on all debug options
- 5.5.16. Plotting utilities now allow specification of x-Axis label
- 5.5.17. Metrics and compare for
pyFoamTimelinePlot.py
andpyFoamSamplePlot.py
support time ranges - 5.5.18.
pyFoamDisplayBlockMesh.py
allows graphical selection of blocks and patches - 5.5.19.
pyFoamCloneCase.py
andpyFoamPackCase.py
accept additional parameters - 5.5.20.
pyFoamListCases.py
now calculates estimated end-times
- 5.5.1.
- 5.6. New features
- 5.7. Bugfixes
- 5.7.1. Only binary packages of 1.x were found
- 5.7.2. Option group Regular expressions was listed twice
- 5.7.3.
--clear
-option forpyFoamDecompose.py
not working - 5.7.4.
pyFoamDisplayBlockmesh.py
not working with variable substitution - 5.7.5. Option
--function-object-data
ofpyFoamClearCase.py
not working with directories - 5.7.6.
nonuniform
of length 0 not correctly printed - 5.7.7. Building of pseudocases with
pyFoamRunner.py
broken - 5.7.8.
pyFoamRedoPlot.py
did not correctly honor--end
and--start
- 5.7.9.
WriteParameterFile
does not preserve the order of additions - 5.7.10. Wrong number of arguments when using
TimelinePlot
inpositions
-mode - 5.7.11.
ClusterJob
uses onlymetis
for decomposition - 5.7.12.
pyFoamSamplePlot.py
andpyFoamTimelinePlot.py
produced no pictures for regions - 5.7.13. Barplots in
pyFoamTimelinePlot.py
not working if value is a vector - 5.7.14. Mysterious deadlocks while plotting long logfiles
- 5.7.15. Scanning linear expressions form the block coupled solver failed
- 5.7.16.
#include
not correctly working with macros in the included file - 5.7.17. Macros not correctly expanded to strings
- 5.7.18.
pyFoamPackCase.py
in the working directory produces 'invisible' tar - 5.7.19. String at the end of a linear solver output makes parsing fail
- 5.7.20. Paraview utilities not working with higher Paraview versions
- 5.7.21. Camera settings not honored with
pyFoamPVSnapshot.py
- 6. Version 0.5.7 - 2012-04-13
- 7. Older Versions
The only requirement is a python-installation. The main testing and development has been done with 2.7 and 2.6. Python 2.5 should work but not for all utilities. Currently 2.6, 2.7 and 3.4 are used during development.
Certain functionalities need special Python-libraries. The main one
is numpy
for plotting. Other libraries that might be of interest
are matplotlib
, pandas
and IPython
. For
pyFoamDisplayBlockmesh.py
the libraries PyQt4
and vtk
are
needed. Other libraries are tested for and reported by
pyFoamVersion.py
but not required (only install if you're sure
that you need it)
These two utilities are almost indistinguishable and will be unified into one
If in customRegexp
an expr
is found with \n
then this
expression is matched over multiple consecutive lines. Types like
dynamic
work as usual.
This makes it possible to match for instance the output of the
forces
-function objects
The utility which was introduced in the last version is becomong
more usable and will be central to all things that set up the case
(for instance a special ClusterJob
)
These utilities are now more flexible and allow writing and reading of Excel-files too
Both variables are not necessary but PYFOAM_SITE_DIR
allows
consistent insertion of site-specific libraries and utilities.
PYFOAM_DIR
is set by some Foam-distributions and tested for by
pyFoamVersion.py
. It is supposed to point to the currents
PyFoam-installation.
PYFOAM_SITE_DIR
points to a directory with site-specific scripts
and configurations. The sub-directories supported (and thested py
pyFoamVersion.py
) are
- bin: directory with scripts. It has to be added to the
PATH
outside of PyFoam (for instance in the.bashrc
) - etc: Optional directory which is searched for configuration files. Priority is below the user settings and above the global settings
- lib: Optional directory to allow mixing in site-specific
library files. Imported as
PyFoam.Site
: For instance if a fileFoo.py
is present inlib
it can be imported asPyFoam.Site.Foo
. This directory does not have to be (in fact: it shouldn't) added toPYTHONPATH
Purpose of PYFOAM_SITE_DIR
is to allow administrators to provide
site-wide scripts and settings for all users on a site
Option has been renamed to --no-complain
SQLite does not support case-sensitive column-names (s_max
and
S_max
are the same). To change this the upper case letters in
the column names are replaced by an underscore and the letter
(S_max
becomes _s__max
)
This means that old databases might not be read correctly
The algorithm to make variable names unique has changed (basically it uses the part of the filenames that differ) and scripts relying on these names might fail
The name of the module crashed in certain instances (especially
unit-testing) with the regular IPython
-library. To avoid these
crashes it has been renamed to IPythonHelpers
. This raises two
potential problems:
- scripts that
import
the module have to be adapted to the new name - IPython-notebooks created with
pyFoamIPythonNotebook.py
have two imports pointing to this module. These notebooks have to be adapted to be usable again
This was a problem for script-templates which were not executable any more. Fixed
This has been fixed by adding an import in BasicRunner.py
This is now fixed
Some calls for sort
still used the cmp
-parameter which does
not exist for Python3 anymore. These calls have been replaced with
key
and reverse
Because the output of subprocess
is now binary instead of a
regular string. Fixed
This was due to incorrect use of the interpolate
-method
This was because there was a problem in the library code and the utility did not consider the parallel time-steps. Fixed
Basic run information was not added to the file. Now it is with
the prefix runInfo//
The logic for checking whether a file was "backupable" was
wrong. This affected the proper restore of files with utilities
for instance for --write-all
According to the bug
http://sourceforge.net/p/openfoam-extend/ticketspyfoam/219/ it was
not possible to import DataStructures
because of a circular
dependency with FoamFileGenerator
. Fixed by moving an import to
the back of the file
This utility takes a template case and a file specifying the
parameter variation and creates cases with the
pyFoamPrepareCase.py
-engine, runs a solver on these cases and
collects the data into a database. The database can then be
extracted with pyFoamDumpRunDatabaseToCSV.py
Calculates the size of the binaries in an OpenFOAM-installation separated by compile-option
Assists the user in rewriting the blockMeshDict
by doing simple,
but error-prone transformations. Assumes "sensible" formatting:
one block/vertex etc per line.
Sub-commands are:
- refine: refines mesh by multiplying cell numbers in the blocks
- number: Adds comments with the vertex numbers. Should help the user when editing/modifying the mesh
- stripNumber: Remove the comments added by
number
- mergeVertices: Adds vertices from other blockMeshes that are not present in the current blockMesh
- renumberVertices: Take another
blockMeshDict
, copy over thevertices
-section of that mesh and rewriteblocks
andpatches
so that they conform to thesevertices
. The originalvertices
have to be a sub-set of thevertices
in the other mesh - normalizePatches: Rotates patches so that the lowest number is in front
The option --additional-values
allows specifying a dictionary
with additional values for the boundary (stuff that is needed by
mappedWall
etc)
This allows to write case-templates that can distinguish between different OF-versions
Before doing anything else the contents of different directories are copied into the current case. This allows for instance to use tutorial cases as the basis for a case
Additional code added to the generated notebook:
- Code to change the default size of the plots
- Distribution-directories in subdirectories
distributions
(generated by someswak
-function objects) added
If the controlDict
is acceptable to OpenFOAM but syntactically
incorrect for PyFoam (for instance because of a missing semicolon)
the utility does not fail anymore (but no data is collected for
that case).
This should make it easier to find items
Both utilities now allow writing Excel-files
In addition to regular text files the first sheet from xls
-files
can be read
Now it is possible to filter for regular expressions
The functionality of the two utilities now is very similar and it is possible that one of them will be discontinued
The two utilities now can add columns or recalculate columns based on the existing column values
Testing for the library Numeric
library removed as it is no
longer supported as a fallback for numpy
. Test also removed from
setup.py
The class PrepareCaseJob
supports cases that are set up with
pyFoamPrepareCase.py
. Additional parameters to the constructor are
- the name of the parameter-file
- a list with the parameters. The list is composed of name/value-pairs
The class VariationCaseJob
supports cases that are set up with
pyFoamRunParameterVariation.py
. Additional parameters to the constructor are
- the name of the parameter-file
- the name of the variations-file
The function checks if the file exists and is not executable. The program fails in that case
This ensures that it is printed in a form that is valid in OF-dictionaries
This has until now only been used in ListCases
but moved to a
separate method/function diskUsage
in the Utilities
-module
Added the possibility to have an epilog and usage examples with
the epilog
and examples
-keyword arguments for applications.
These and descriptions now have the possibility for line-breaks: if two line-breaks are encountered in the text a new paragraph is created
For Python-version where shutil
has a which
-function this is
used instead of calling an external program
This currently only works for reading, Backups, zipping etc won't work but it makes algorithms more flexible
Instead content is stored in memory. Old behaviour is the default to preserve compatibility with old scripts
- numberVertices: Adds comments with the vertex numbers to the vertices
Previous behaviour was stripping all spaces from the lines. Now the left hand spaces can be ket. Old behaviour is still default for compatibility
This allows faster debugging of template-files. This can be enabled with a switch in the utilities using templates
And additional parameter solverArgs
will now be passed to the
solver (if the solver accepts arguments)
During construction if an Excel-file is specified and the
xlrd
-library and pandas
are installed then the first sheet in
the file is read
Columns can be recalculated using expressions. This includes other
data items. Currently present column names are available as
variables. There is also a variable data
that can be subscripted
for items that are not valid variable names. A variable this
points to the item to be recalculated
This manifests with pyFoamRunParameterVariation.py
. The custom
timelines are still kept in memory. Not a problem. Just annoying
The only requirement is a python-installation. The main testing and development has been done with 2.7 and 2.6. Python 2.5 should work but not for all utilities. Unit tests run on Python 3.4 but it is currently not used in a production environment (reports of success or failure most welcome)
Certain functionalities need special Python-libraries. The main one
is numpy
for plotting. Other libraries that might be of interest
are matplotlib
, pandas
and IPython
. For
pyFoamDisplayBlockmesh.py
the libraries PyQt4
and vtk
are
needed. Other libraries are tested for and reported by
pyFoamVersion.py
but not required (only install if you're sure
that you need it)
Now pyFoam
supports different versions of OpenFOAM for switching.
Out of the box openfoam
and extend
are supported. If only the
version number is specified (for instance by --foamVersion=1.7.x
)
and such a version exists only for one fork it is correctly
expanded with the correct fork( in the example with
openfoam-1.7.x
). If more than one fork has the same version then
the fork name has to be specified as well
Note: additional forks can be easily specified with the
configurations. In section OpenFOAM
the parameter forks
has to
be extended. For each new fork a dirpatterns
and
installation
-parameter has to be specified
The selection of what is to be done is now selected by subcommands instead of options. This will break scripts using this
The reason is that the utilities assume that this directory is
produced from 0.org
The reason was that it used the same throttling that made sense for the PlotRunner. Fixed
Reason is that the class vtkPythonStdStreamCaptureHelper
does
not support isatty
Reported in https://sourceforge.net/apps/mantisbt/openfoam-extend/view.php?id=208 and fixed
Vector fields only were added to the data fields if they were the first in the list. Fixed
This is now fixed. The alternate values have to be specified in the master (specifying in the slave gives an error)
Usually these files are ascii
(even if the header says
binary
). In some cases the parsing failed for these. Fixed by
enforcing reading as ascii
. Can be switched off
The reason was that if there were duplicate times in the table the index was non-unique which certain Pandas-operations don't appreciate. Solved by dropping duplicate times. Can be switched off
If things are specified twice they were added twice. Now it is checked whether the item already exists in the tar-file before adding them
The reason was that this was interpreted as a vector and the numeric prefix was removed. Reported at http://sourceforge.net/apps/mantisbt/openfoam-extend/view.php?id=218
Fixed by introducing an extra parameter to FoamFileGenerator
This utility aims to reduce the need for boilerplate scripts to set up cases. The steps it executes are
- Clear old data from the case (including processor directories)
- if a folder
0.org
is present remove the0
folder too - go through all folders and for every found file with the
extension
.template
do template expansion using the pyratemp-engine - create a mesh (either by using a script or if a
blockMeshDict
is present by running blockMesh. If none of these is present assume that there is a valid mesh present) - copy every
foo.org
that is found to tofoo
(recursively if directory) - do template replacement for every
.postTemplate
- execute another preparation script
This utility creates and manipulates IPython-notebooks for analyzing OpenFOAM cases. It has a number of subcommands:
-
create: this is the main command. All other commands assume that the notebooks they work with were created with this.
The utility looks at the case specified and creates a notebook that has the capabilities to quickly build a report about the case:
- reporting general properties of the case. This
basically is the capability of the
pyFoamCaseReport.py
-utility - It searches for data that can be visualized by
pyFoamTimelinePlot.py
orpyFoamSamplePlot.py
and generates selectors that allow the user to select which data to import. The selectors import the data as Pandas-=DataFrames= and create the commands necessary to do this. It is recommended to erase the selector afterwards - Selectors for pickled case data and pickled plot generated by PyFoam
- Capability to store read data in the notebook file. This feature is experimental and has performance issues for medium to large datasets
The created notebook can be executed but needs to be edited to be useful
- reporting general properties of the case. This
basically is the capability of the
-
clear: removes selected cells (but only cells created with
create
) or output from the notebook. -
info: prints information about the notebook
-
copy: copies notebook to a different case and rewrites it so that data is read from that case
Recommended way of working with this utility is
- Create notebook with utility
- Edit it to contain standardized evaluations
- Copy it over to another, similar case
The purpose of this submodule is to support
pyFoamIPythonNotebook.py
. It has the classes
- Notebook: read a file and interpret it as an IPython-notebook. Do manipulations on this notebook
- PermanentStorage: Implements permanent storage in an IPython-notebook. Only works inside a notebook and allows only one instance at once. Passing the data from the notebook (through JavaScript) to Python currently is a performance bottleneck
- Case: Convenience object that exposes the functionality of some of the PyFoam-utilities through a simple interface
Wraps popular Python-libraries to add functions that make it easier to work with OpenFOAM-data.
Currently only one Wrapper is implemented:
-
Pandas
-wrappersThis provides
PyFoamDataFrame
as a wrapper forDataFrame
. The functionality added is- addData: Conveniently add new data from different
Series
,DataFrames
. It is assumed that the index is the same property (time or for samples the distance) but with a different resolution. The indexes are joined and missing data is interpolated - integrate, validLength, weightedAverage: uses the index as
the (x)-axis and calculates these properties for a
Series
.validLength
is the extent on which data is defined (weightedAverage
is basicallyintegrate
divided byvalidLength
). Forintegrate
the trapezoid-rule is used - describe: adds the three above quantities to the regular
describe
-command
- addData: Conveniently add new data from different
The option -index-instead-of-filename
switches this on. This
makes it easier to generate movies from the files
The option --custom-data
now allows the specification of custom
data items. These are read from the pickledData
-files and
displayed in the table like regular data items
Now all utilities allow switching the compiler version (for
instance from Gcc47
to Gcc48
). The relevant options are
--force-system-compiler
, --force-openfoam-compiler
and
--force-compiler
Now the location of the installations is reported as well
This is a workaround where the writer produces a segmentation fault
In addition to writing out bitmaps allows writing out 3D-data (for importing into other applications). Sources can be selected by name
The utility can now also:
- erase selected patches
- merge selected patches into one
This now automatically happens for OF-versions that support it (2.0 and greater). They can be switched on again
Files that are assumed to be used by pyFoamPrepareCase.py
are
automatically added to the clone. This includes all files (and
directories) with the extensions .sh
, .template
and
.org
. Also IPython notebooks (extension .ipynb
are added)
This should help with diagnosing problems with MPI etc.
Can be switched on in some utilities with --echo-command-prefix
Using the machine-file now can be switched off for job-schedulers with a tight integration
If a item in the case itself is a symlink then it used to be a
copy of the file the symlink is pointing to. Now it is created as
a symlink to the target the original symlink. If the
--follow-symlink
-option is used the old behaviour is used
(copying). In this case the option noForceSymlink
in the
Cloning
-section of the configuration can be used to change this
behaviour for selected files
The directory is cleared if it exits from a previous run.
Used to fail if incompatible data types were used. Now ignores them
The subclass SubclassFoamOptionParser
now allows the parsing of
subclasses. The base class for utilities PyFoamApplication
now
supports this as an option. As an example this is implemented in
pyFoamSTLUtilities.py
The class checks whether arguments are filehandles and in this case doesn't try to open a file for reading or writing but uses the handle
If no file matching the name is found it is assumed that this is a
glob-pattern and all matching files are added. This affects all
utilities that use that method (especially pyFoamCloneCase.py
)
This method now allows the specification of a working directory. Before executing the command the method changes to the working directory. Afterwards it changes back to the regular working directory.
There is also an option echo
that immediately prints the output
to the screen
rmtree
now also works if the "tree" is a file.
copytree
now has a parameter force
that allows removing the
destination directory if it exists
Strings that are usually interpreted as boolean in OF-dictionaries
(for instance on
, yes
, …) are now stored as a special type
that allows treating them like 'real' booleans.
For instance an expression test no;
in a dictionary now allows
things like if d['test']:
in the script
Until now the options to be used had to be specified as a list of
string modeled on the way the command line looked like. This is
still possible. In addition it is now possible to specify these
things as keyword parameters on the command line. Rudimentary type
checking is done. The names of the parameters are generated from
the command line options: the -
are removed and the words are
converted to CamelCase. So for instance --list-custom-Regexp = becomes =listCustomRegexp
. Also for switches like these a boolean
value has to be passed. So the correct usage in a call would be
listCustomRegexp=True
.
A number of properties has been added that list data generated by function objects:
- timelines: timeline data (like
propes
) that can be visualized bypyFoamTimelinePlot.py
- samples: data from
set
(assuming it is inraw
-format) that can be processed bypyFoamSamplePlot.py
- surfaces: data from
surface
(assumesVTK
-format) that can be used bypyFoamSurfacePlot.py
- distributions: special cases of
sample
with distribution data
These properties only list the subdirectories of the case with that data
Additional properties are
- pickledData: a list of pickled data files that are found
- pickledPlots: list of found pickled plots
These lists are sorted in descending temporal order (newest first)
Tries to determine the names of the values from the first line in the files
This also allows enforcing string values
If strings are unquoted but contain characters that make it illegal as a word then the string is quoted before output
This mainly concerns ParsedParameterFile
Starting with this version the pandas
-library is used for
data-analysis. When possible and appropriate classes return
pandas
-objects. Currently these are:
CSVCollection
. With a call-operator this class returns the collected data as aDataFrame
of the collected dataSpreadsheetData
now has methods to returnSeries
andDataFrame
objects
It is not necessary to install pandas
if these classes are not
used (and even then most of their functionality works)
The class RunDatabase
(and therefor also the utility
pyFoamDumpRunDatabaseToCSV.py
) now write as a separator for data
from sub-tables a //
instead of the space. This especially means
that scripts that rely on a data-item foo
in analyzed
might
break because this is now called analyzed//foo
instead of
analyzed foo
. On the other hand this makes the names more
consistent and easier to parse as //
is the saperator for other
levels of dictionaries
Instead of col0
this is now coord
. This could cause problems
with scripts that use that column name in the resulting
SpreadsheetData
-object
Symbolic links were copied as is and did not work correctly afterwards. This is fixed. If the symbolic link is an absolute path or points outside the case directory it is replaced with the file it points to. Otherwise it is preserved as a symbolic link
These versions require an entry potentialFlow
in the
fvSolution
-file instead of the old SIMPLE
Fixed by first trying to read that with preprocessing. Without if that fails
Now using a set
instead of a list
makes sure that no file is
cloned twice
The utility now allows removing these entries in case that they
don't work with potentialFoam
Some of the options of pyFoamClearCase.py
for clearing cases
(for instance specifying additional files) have been ported to the
Runner
-utilities. Also is the postProcessing
-directory
removed by default
If there are field files and their zipped counterpart than instead of an error a warning can be given
A new method templateFile
gets the name of a file which is
constructed from a template of the same name plus the extension
.template
The method additionalParameters
can return a dictionary with
additional parameters
In the written data in the sub-dictionary analyzed
there is now
a subdictionary Custom
with the values of the custom expressions
with the prefix CustomXX_
removed. This means that values that
were available as
data['Custom02_velCheck']['min']
are now available as
data['Custom']['velCheck']['min']
The advantage is that the number part which was dependent on the order the expressions were specified is now no longer necessary (this should make scripts more stable)
The old notation is still available but deprecated
The parameter solverLogCompress
compresses the log-file while
writing it to disc. Attention: This may lead to corrupted
log-files if the run crashes
The dictionary returned by getData()
now allows access to all
the elements as attributes.
The hook-module MailToAddress
sends a mail at the end of a
run. Prerequisite is an SMTP-Server that doesn't need
authentication
This utility goes through cases and compresses single files. The cases can be searched recursively to.
Purpose of this utility is to shrink cases where
writeCompression
was not turned on during the run
A new module PyFoam.Paraview.Data
reads additional data usually
written by OpenFOAM. These are converted to vtkArray
using the
following functions and can be used in Programmable filters
:
- setSampleData: reads the data from sampled sets
- setTimelineData: reads data from a timeline directory
- setPlotData: reads pickled plot data using
RedoPlot
When used with the option --implementation=xkcd
and version of
matplotlib
that supports it is installed then plots are done in
the style of the webcomics http://xkcd.com
If the disk usage of the cases is calculated then it is displayed in human readable form (as KB, MB, GB or TB) for sizes larger than one Kilobyte
Options to be more flexible in removing data are added:
- keep-interval: keep timesteps at a specified interval. For
instance
--keep-interval=0.1
will keep times like (1), (1.1) etc but remove (1.05) - keep-parallel: this will not remove any times in the
processor
-directories. Also are things likekeep-last
now honored for processor directories - remove-analyzed: Remove the directories with the analyzed data too. Old behavior was to remove them. Now they are kept by default
If an output file foo
is specified and no template then the
utility looks for a file foo.template
as a template.
If a file foo.defaults
is present then this file is read and
used as default parameter values. Other specifications override
these defaults
Additional option --disable-run-data
With the -pandas-print
-option a DataFrame
is generated and
printed
If the ipdb
-package (basically pdb
with IPython
-additions)
is installed then it is used. This gives additions like
tab-completion
The option --interactive-after-execution
drops the user to an
interactive shell where the namespace can be inspected. If present
IPython
will be used, otherwise the regular shell is used
This is mainly to be used on the interactive shell to do further analysis or write this data out. The utilities are:
- pyDumpRunDatabaseToCSV.py: add an item
dump
with the whole data as aDataFrame
- pyFoamTimelinePlot.py: add element
series
with all the data asSeries
anddataFrame
with the same data as aDataFrame
- pyFoamSamplePlot.py: Like
pyFoamTimelinePlot.py
- pyFoamRedoPlot.py: Now can get series and the whole plot data as pandas-objects
The utilities pyDumpRunDatabaseToCSV.py
,
pyFoamTimelinePlot.py
, pyFoamSamplePlot.py
and
pyFoamRedoPlot.py
now have options to write Excel-files
If an item in customRegexp
has an item gnuplotCommands
then
it is assumed that this is a list of strings which are executed
before the first plotting. For instance
gnuplotCommands (
"set format y '%.2e'"
);
changes the number format on the y-axis
Instead of determining the names of the fields and lines form the filenames it is now also possible to specify them through options.
The option --is-distribution
is a shorthand that sets these
options for distribution files
The range of the x-axis of the plots can either be set by
automatically scaling to the domains of all the data sets with
--scale-domain
or by specifying them with --domain-minimum
or
--domain-maximum
.
These domains are set for all plots
When activating an on-demand write the constrolDict
was not
restored because the output-line about the file being read was not
recognized (due to a change in the output in recent
OF-versions). Now a number of different formats is recognized
That plot-type needs a master
. Fixed to fail if none is defined
This did affect all utilities that use that option and also calls
with listOnly
to the library class
If multiple actions like --update
and --build
are specified
they are executed in a sensible order (update before build etc)
If the environment variable that determines the OpenFOAM-version is unset a warning is issued by the utilities
If single file is specified then the action to transform it has can be specified
Now knows how to transform "old" reaction files (where the
reactions
-entry was a list) to the new format (where it is a
dictionary). Only a limited number of reaction types is supported.
Now the old form of thermophysical data (lists) is transformed into the new dictionary-form
Now with the option --symlink-mode
instead of copying the
directories from the original new directories art created and
populated with symlinks to the files in the original. The depth
until which no symlinks to directories are created can be
specified. This allows the clone to share the configuration files
with the original
The directory postProcessing
is now automatically removed (can be
switched off with --keep-postprocessing
). Also with the
--additional
-option patterns with additional files to remove
can be specified.
- Now reports the location of the
python
-executable - Reports locations of used libraries
The files Allrun
, Allclean
and 0.org
are automatically
added during cloning as these are often used by the standard-utilities
This makes sure that templates are handled consistently and also
allows different delimiters in the blockMeshDict.template
- Now the new relative scoping that was introduced in OF 2.2 is supported
Added a function find
that approxiamtes the find
-command
Some more patterns have been added that will be ignored in a VSC-controlled case. All of them concerning files that PyFoam creates during operation
This utility replaces a symlink with a copy of the
file/directories it points to. To be used after a
pyFoamCloneCase.py
in --symlink-mode
Sources are adapted so that PyFoam
works with Python3 too. This
breaks support for Python 2.4 and earlier (possibly also Python
2.5)
Some of the Libraries in PyFoam.ThirdParty
had to be adapted to
work with Python3:
- Gnuplot.py: The original version 1.8 is quite old. It was
adapted with the help of the
six
-library (see below) to work with Python2 and Python3 (inspired by [https://github.com/oblalex/gnuplot.py-py3k/commits/master] which is a pure port to Python3 without backwards compatibility)
- six: Library that helps supporting Python 2 and Python 3 in the same source code. Currently version 1.2 from [https://bitbucket.org/gutworth/six] is used
- pyratemp: Templating library to support the new templating format. Version 0.2.0 from [http://www.simple-is-better.org/template/pyratemp.html] is used
Port to allow running PyFoam on Windows was done by Bruno Santos of blueCAPE ([email protected])
Patch was originally posted at http://sourceforge.net/apps/mantisbt/openfoam-extend/view.php?id=166
Note: many of PyFoam's features are not yet fully functional on Windows.
Sources are executed in pypy
but it seems there are problems
with numpy
and also with code like for l in open(f).readlines()
This brings virtually no changes. README
with copyright
information has been added
This should help to avoid side-effects
Due to a previous workaround timeouts when collecting information about new machines was not treated correctly
This allows the execution of a shell-script in the directory of the case
These modules are found in PyFoam.Infrastructure.RunHooks
. Two
concrete implementations:
PrintMessageHook
: to print a text to the terminalSendToWebservice
: encode an URL and send it to a webservice (example forpushover.net
added)
Hooks are automatically instantiated from the configuration data (examples are hardcoded))
The Runner-classes now have a parameter parameters
. This data
(usually it would be a dictionary) is added verbatim to the run
info.
Most runner applications now have the possibility to add this info.
Purpose of this facility is to identify different runs in the database better.
Parameter values are now handed to the actual job. Also a dictionary with parameters can be handed to the constructor and will be used in the relevant callbacks
During the run whenever the PickledPlots
-file is written a file
pickledUnfinishedData
gets written. This has the current solver
data and is similar to pickledData
.
Also a file pickledStartData
gets written that has the data that
is available at the start of the run.
The runner collects
- at every warning the next 20 lines of the output until a total of 500 lines is reached (this avoids filling disk and memory if the solver produces too many warnings)
- All output from an error message until the end
And stores them in the application data
The class TempalteFile
now uses an enhanced templating
engine. The old implementation is in the class
TemplateFileOldFormat
If used as classes (not as utilities) these classes print the class name instead of the calling utilities name
Error and warning messages don't decorate the output if it goes to files or other non-terminal streams
An exception is now raised by self.error()
. This makes it easier
to handle such errors if the application class is used. The
exception is passed up until there is a "real" application
When the format of a file is binary
lists with a length prefix
are being read as binary blobs.
For reading the blobs a simple heuristics is used: a multiple of
the length in bytes is read. If the next character is a )
and
the characters after that are a certain combination of characters
(newlines and ;
) then it is assumed that the blob has
ended. This may fail on certain occasions:
- if the combination of characters appears at these places
- if the objects inside the binary data are of different sizes
It would be hard to work around these restrictions without reprogramming the full functionality of OpenFOAM
New class in the RestructuredTextHelper
allows more flexible
generation of tables. Items are added with column
and row
and
if these don't exist in the first row/column the table is extended
appropriately
This is implemented for Gnuplot
and Matplotlib
. Default for
the label on the x-Axis is now "Time [s]"
The utility can now use the pyratemp-templating engine which allows templates with loops, conditions and other fancy stuff
Instead of using the x-values from the original data the y-values
of the reference data can be used for comparing (with the
--use-reference
-option)
Same for pyFoamTimelimePlot.py
If scales not equal to (1) and offsets not equal to (0) are
specified they are used in the gnuplot
-output
With the --relative-average-error
-option
- More tolerant if no library was found
- Reports the location of the PyFoam-Library
- Checks whether utility version is consistent the library found
Hooks can be added at the start and the end of a run
Added -end
and -start
-option to select a range that should be
plotted.
Currently not working with the Matplotlib-implementation (only gnuplot)
If a file with values is specified then the utility assumes you're editing a template file and will evaluate it before displaying it
New switch that makes the parser treat files that are declared
binary
in the header as if they were ascii
This makes it easier to catch faulty specifications (or empty timeline-files)
An option --wait
has been added that makes the utility wait
before displaying the next picture
Switch allows forcing it to read a binary File as an ASCII
Previously the option --interactive-debug
only started the
debugger if the error was no syntax error. This is still the
default behavior, but can be overruled
The option --catch-USR1-signal
now installs a signal-handler
that prints a traceback and finishes the run. If the interactive
debugger is enabled then it goes to the debugger-shell.
Option --keyboard-interrupt-trace
triggers the same behaviour
for keyboard interrupts with <Ctrl>-C
For the purpose of developing a switch --i-am-a-developer
has
been added.
With the option xlabel
in the customRegexp
-file the label on
the x-axis of the plot can be changed. Setting ylabel
and
y2label
(for the secondary axis) was already possible
Now the options --min-time
and --max-time
are supported by
--metrics
and --compare
New addition by Marc Immer allows the graphical selection of
blocks and patches and adds them to the blockMeshDict
The file LocalConfigPyFoam
is read by these utilities and if
there is a parameter addItem
in the section Cloning
defined
then these files are cloned/packed automatically (no user
specification required)
Additional option to print the estimated end times. These can be
wrong if the case did not start from the startTime
in the
controlDict
.
Also now allows printing the end and the start-time according to
the controlDict
Plots of type phase
in customRegexp
don't actually plot
anything. The set a phase-name that is used for subsequent values
(for instance to distinguish the different residuals)
Options --region
and --time-directory
added that allow
selecting different boundary
-files
The class RunDatabase
stores the data from runs. Utility
pyFoamAddCaseDataToDatabase.py
is one way to populate the
database. pyFoamDumpRunDatabaseToCSV.py
allows dumping that
data to a file for further processing (in a spreadsheet for
instance)
Database can also be populated using a special post-run hook
Pattern had to start with 1 (now every digit is possible))
No harm done. But fixed
Reason was that rmtree
does not allow wildcards. Fixed
The DictRedirect
would not convert to float. Fixed. Although it
might happen again for other data types
The option was only implemented for the list-form of the
functions
entry in controlDict
Now fixed to also work with the dictionary-form
Seems like the length was interpreted as the name of the list. Fixed
Only worked if no region was specified (= not at all). Fixed
Plots were over the whole data range. This is now fix (also the
issue that --end
alone did not work)
Contents was "only" set as a dictionary which does not preserve
the order in which entries are added. Replaced with a DictProxy
Problem that was introduced by changes in the fields
-mode
For OpenFOAM-versions 1.6 and higher the automatic decomposition
used is now scotch
As regions have their own subdirectories the /
from the
directory name was inserted into the filename and if the
subdirectory did not exist gnuplot
did not create the picture
The base class didn't correctly handle the (
and )
. Fixed
The problem was that during splitting the timeline data an exception was raised. This exception was caught by another part of PyFoam. This left a lock on the data structure locked and the next access to the structure was held indefinitely. Fixed
As there is a tuple of residuals the scanner did not analyze the
output of the output of the block-coupled solver from 1.6-ext
correctly. This is now treated as a special case and each residual
is plotted separately (distinguished by a [x]
with x
being the
number of the component)
Macros $var
were not correctly expanded. Fixed
When being expanded to string form macros were not correctly expanded
If the utility was used in the form
pyFoamPackCase.py .
then an 'invisible' tar ..tgz
was produced. Fixed
Reported in [http://www.cfd-online.com/Forums/openfoam-solving/112278-pyfoam-struggles-adopted-solver-post403990.html] the string is assumed to be part of the iteration number. Fixed
At least for PV 3.14 and 3.98 the way the version number is determined has changed and the PV-utilities failed. This has been fixed but is untested with old versions
For the first rendered view Paraview automatically resets the camera. This has now been switched off (so the snapshot is rendered correctly)
- Problem with nested comments
- Parse code streams
- Preserving of comments can be switched off
- Ignore extra semicolons
- Allows parsing lists of length 3 and 9 as lists and not as vectors and tensors
- "lookup redirection" in OF-dictionaries now works
- pyFoamSamplePlot.py stops if the same directory is compared
- pyFoamSamplePlot.py shows the location of the biggest difference
- pyFoamSamplePlot.py allows only same ranges for comparisons
- Generation of pickled-files can be switched of for runner-utilities
- Frequency with which the pickled file is written is adapted (so that it doesn't use ALL the CPU-time)
- pyFoamVersion.py improved (Version of Python is checked etc)
- pyFoamRedoPlot.py: fixed parameter checking
- pyFoamPotentialRunner.py: temporarily disable libs and functions
- Only write last N loglines from Runner-utility
- pyFoamClearCase.py: allow local specification of additional files that should be cleared
- Runner utilities can report data about the run
- pyFoamConvertToCSV.py now allows selection of columns
- Utilities for quantative analysis now can return data
- Utilities for quantative now correctly return data for multiple places
- pyFoamSamplePlot.py now allows specification of valid variable pre and postfixes to allow correct parsing of variable names with a _
- endTime can be specified by the runner-utilities
- Utilities now allow piping (using pickled data)
- pyFoamSamplePlot.py now allows the specification of a reference time
- Nomenclature of pyFoamSamplePlot.py and pyFoamTimelinePlots.py now similar (both call it fields)
- pyFoamDecompose.py now can use the -region-option ifthe OF-version is right
- Forcing debug-mode fixed for older OF-versions
- pyFoamDecomposer.py now accepts globalFaceZones in Python or OpenFOAM-syntax
- Plot-utilities now don't interpret _ in names not as LaTeX
- pyFoamEchoPickledApplicationData to output pickled data
- pyFoamPrintData2DStatistics.py to output data from comparisons
- pyFoamBuildHelper.py to build project and its prerequisites (work in progress)
- pyFoamCreateModuleFile.py to create files for http://modules.sourceforge.net/ (by Martin Beaudoin)
- pyFoamSTLUtility.py to join STL-files
- stabler comparisons
- Paraview-Utilities work with 1.x and 2.x
- Runner classes return a dictionary with data
- TimelineDirectory ignores dot-files
- Application-objects can now be used like dictionaries to access data
- New class TableData for simple data tables
- New class Data2DStatistics for statistics about tables
- new class CTestRun as basis for automated testing
- FoamOptionParser now resets environment variables so that application-classes can call other application classes
- Improvements to HgInterface
- Additional VCS-subclasses for git, svn and svk (implementation only as needed)
- SolutionDir now uses 0.org as initial directory if no valid initial directory is present (this affects clearing and cloning)
- FoamFileGenerator now more flexible for long lists
- ParsedBlockMeshDict now doesn't introduce prefixes for 'long' lists
- pyFoamAPoMaFoX.py
- pyFoamPlotResiduals.py
- Got rid of Numeric-support in Gnuplot-library
- script to generate man-pages for the utilities
- Paraview3-example probeDisplay.py now renamed to probeAndSetDisplay.py and reads sampledSets from controlDict and sampleDict
The changes for older versions can be found on the Wiki-page