This article shows you how to transfer information among n simulations with n >= 2.
The tools that are labelled as "Swiss Simcenter STAR-CCM+ Knife" could be thought as a set of tools with the following properties:
Much in the spirit of the well-known Swiss penknife.
Imagine you have a simulation with some field functions, coordinate systems, and physics continua, that you want to copy or transfer to other simulations. For example, in the following illustration, you want to transfer the physics continuum, your local lab coordinate system, and the field function from the 'source' simulation $intake.sim
...to the simulations bluntBody.sim and fin.sim:
The destination simulations are loaded in the same Simcenter STAR-CCM+ GUI Client.
This transfer of set-up can be performed in one go with the attached Java macro, which illustrates a way to transfer information between a source simulation and any number of destination simulations.
The process can be seen as an automatic copy and paste of a given content. Furthermore, the macro also demonstrates an important feature: how to share information across multiple simulations.
In the given example, it is simply a message going from one simulation to the other, however, you could easily use such information to perform an action, run one iteration, and pass back information. In other words, a crude multiple co-simulation.
Note that the macro can be launched indifferently from one of the opened simulation.
How do you distinguish between source and destination simulations? The macro assumes that the source simulation name contains the character '$'.
After executing the macro, check the output windows of each of the three simulations. Check also that the information has been correctly transferred from the source to destination simulations.
The attached macro:
Shows the name and index of the simulation. (It also output which simulation is the source.)
Each simulation sends a greeting message to the output window of the rest of the simulations. (Think about the possibility to exchange not messages but simulation data for each iteration/time step.)
Runs 1 Iteration/Time Step.
Copies all User-defined field functions from source .sim to destination .sim's.
Copies all Local---to lab---Cartesian Coordinate Systems from the source. sim to the destination .sim's.
For example, the output of the bluntBody.sim looks like:
Could more information be transferred?
Yes, the macro follows the typical structure of a copy and paste operation.
If you want to copy an object from A to B, you first create an object of the same class in B and then copy the properties from the object in A to B.
Do some housekeeping to select the appropriate information: for example, in the case of field functions, you want to copy only the User-Defined Field Functions and this is done by requiring the selected object to be of the UserFieldFunction.class.
Similarly for coordinate systems: you are copying the Cartesian coordinate systems local to your laboratory coordinate system.
Attached you will find the macro and three simulations. There are two versions: One is valid from Simcenter STAR-CCM+ v11.06 onwards (successfully tested till 2020.1), and another valid from Simcenter STAR-CCM+ v11.04 backwards.
and other STAR-CCM+ Knife tools: