For experienced users it is possible to extend the TCFD workflow by custom scripts (advanced). These scripts are expected to be written in basic Python 2.7 and they are executed at specific moments during the workflow. It is allowed to assign multiple execution points to a single script, see figure . The script can use the predefined variable CaseDirectory, which contain the full absolute path to the directory with the OpenFOAM case. Besides the standard Python functions one can also use the TCFD-specific functions SetEntry and WriteFile. For example the following tiny script
SetEntry("system/fvSolution", "solvers/p/nCellsInCoarsestLevel", "10")WriteFile("system/fvSolution")
will change the coarsest-level cell number in pressure GAMG solver to 10, followed by writing the modified file. The function SetEntry does all modifications in memory and the result is written to disk only when the function WriteFile is used, or during writing requested by the workflow. Apart from the two functions, there is also a predefined string variable CaseDirectory which contains the absolute path to the case and two other access functions
RenameEntry(, , )DeleteEntry(, )
with obvious purpose: The former changes the name of an entry (i.e. the keyword that introduces the entry), whereas the latter erases the whole entry from the file.
Figure: Plugin TCFDSource – addition of custom user scripts to be executed during the workflow.