It is quite common to run simulations of models for different values of parameters.
For example, running mesh studies to see what mesh size is necessary to get good solutions,
or testing how the solution varies with physical properties (e.g. sensitivity analysis, emulation, etc.), or modifying the domain geometry to optimize some design.
In this post I describe a very simple way to parametrize an OpenFOAM (version 8) case folder
using python (specifically template string).
This allows to configure the simulation using the power of python.
UPDATE: (10.2023) In OpenFOAM v10 and later the notation for macros in dictionary files has changed.
In the versions posterios to v8 you need to use !
instead of :
(used herein) to refer
to the highest level in the file; and /
instead of .
(used herein) for fields inside a file or dictionary.
For a description of the new macrop expansions visit the official documentation
[Read More]