Tutorials
- Discovering examples
- Building compact discrete domains
- Introduction to input file
- Plugins and input files
- Initialize project
- Initialize your first custom plugin
- Implement your first custom plugin
- Run your first project
- granoo-viewer usage
- Inputs/Outputs with GranOO
- Building a very simple tensile test
- Using numerical sensor
This page describes how to run massively simulations for managing a parametric study
It is highly probable that you wonder to manage a parametric study. For instance, you may want to study the impact of one (or more) micro-mechanical parameter on the macroscopic response of your discrete domain. To manage such a study, GranOO embeds interesting tools.
Note that this tutorial step is based on the Example/00004_{tutorial}_{parallel-run}_TENSILE-TEST
. So, you can
copy/paste/edit this example to try this tutorial by yourself.
Building a template inp file
You must build first a template (generic) input file where your parameter of interest appears. For example, imagine that you want to study the impact of the micro Young’s modulus of a beam lattice on the macroscopic response.
To do such thing, the trick here, is to replace the corresponding value in the *.inp
by a unique string ID.
You can note the usage of the __YOUNG-MODULUS__
unique string ID instead of a numeric value for the Young’s modulus.
Now, we will use the magic of command line for substituting on-the-fly this string ID by a given numeric value.
After compiling the corresponding granoo project, you can run granoo with the following command line :
Here, we use the -s
option for giving the substitution pattern and the -b
option for telling the value.
In such a way, these command options are able to substitute the occurrences of the __YOUNG-MODULUS__
in the *.inp
file by another string. Of course, you can specify more than one substitution.
So, now, if you take a look into the backup
folder located in the simulation result directory
named TENSILE-TEST-10e9-Pa
you should see the original *.inp
file where the substitution was done.
Running simulations in parallel
The previous section shows how to use substition patterns into *.inp
file. Now, we will re-use this trick
in combination with python scripts for running massively simulations in parallel.
To do such job we will use the run
python module of granoo. Thanks to this module, we are able
to write very simple python scripts able to manage many simulations. Here, we will run 8 simulations
by varying the microscopic Young’s modulus from 10 GPa to 80 GPa. It can simply done with the following python script named run.py
Here, we re-use the granoo string substitution trick into a python script in comination with run
granoo’s module.
Now, we can simply run our simulations by invoking this script with the -p
option as follows
The -p
option allows to run simulation in parrallel. Here, 4 simulations are running in parralel. When a
simulation ends a, other one is launching automatically until it reaches all the wanted the simulation.
Post-treating a parametric study
Thanks to the plot
module of granoo. It is quite easy to post-treat parametric studies. You can take a
look into the plot.py
script located into the py
directory. Indeed, note that the most important
thing is to build a unique output directory identifier which can be re-used by the python post-treatment
script for retrieving the corresponding results. In this example, it is simply done by substituting the
Young’s modulus into the output directory name that gives the following structure :