Blog posts Volupe

Templates and ini-files

Have you met Templates? Robin showed you in last week’s blog, how easily you can build you template simulation by using filters and queries. In this weeks post I would like to leverage the use of template with the functionality of parameters and the ini-file. So, let´s first talk about Global Parameters in Simcenter STAR-CCM+. They can be scalars, vectors and files which can be defined once and used in multiple objects.

Global Parameters

The key idea of Global Parameters is to define a physical characteristic or a constant value only once and reuse its value several times in your simulation. For example, in a boat simulation, the hull length could be used (directly or multiplied by a scale factor) in numerous other nodes. Or a value like pi or the density of water. This lets your simulation setup be consistent.

Your parameters can be used to set any physical quality which allows you load the Definition property. For instance, Regions > Air > Air.Inlet 1 > Physics Values > Static Temperature. And since version 2019.1, even coordinates take parametric expressions, e.g. DFBI > 6-DOF Bodies > Initial Values > Center of Mass:

Global Parameters conveniently control your design optimization and in context with a template definition you can use Global Parameters to define your new geometry input to your template. So, literally, parameters belong to a template like HTML to browsers.

The ini-file

But there is one more cool thing about parameters; And that allows you to save time in preparing and running design or physical variants of a simulation or design alternatives. Easily run a simulation with new Global Parameters in batch with -param option in the command line:

If you, however, have many parameters in your simulation the command-line-input of all parameter values can be error prone. For instance, in case you import several geometry files which are to be replaced in your template. In the following example I use a template for the setup of a ship resistance investigation. The hull as well as the domain and volume refinement geometries are generated in a specialized CAD program and are loaded into the template with the Replace Part operation.

Since we have several parameters to adjust, I use the ini-file to define all parameters when starting STAR-CCM+ in batch or just from the command line. Ini-file is simply used as a shortcut for general and client command line options when starting local Simcenter STAR-CCM+ simulations.

To use this feature, add the -ini option to your line command:

% starccm+ -ini myinifile.ini <simfile>

In my case myini.ini file contains the arguments for the values of a global parameters that already exists in the template simulation but you can specify any command line option.

In the following video I would like to demonstrate how you can make use of your template by using the ini-file to load two different hull designs, 1. the Kriso hull and 2. mydesign. I automatically load all required parameters from myini.ini.

More blog posts