Simcenter STAR-CCM+ Swiss Simcenter STAR-CCM+ Knife: [4] Multiple cosimulator: How to transfer information across several simulations.

2023-11-02T07:15:38.000-0400
Simcenter STAR-CCM+ Simcenter STAR-CCM+ Virtual Reality Teamcenter Share Simcenter STAR-CCM+ Viewer Simcenter STAR-CCM+ Application Specific Solutions

Summary

This article shows you how to transfer information among n simulations with n >= 2.


Details

The tools that are labelled as "Swiss Simcenter STAR-CCM+ Knife" could be thought as a set of tools with the following properties:

  1. they are used sparsely, from time to time,
  2. they can reduce work and save you from difficult situations,
  3. they must be used with care,
  4. if they are used improperly they can affect negatively your simulation results. 

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

 

 User-added image

 
...to the simulations bluntBody.sim and fin.sim:

 

User-added image


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. 

User-added image

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.

  • Copies all Physics Continua from the source. sim to the destination .sim's.


For example, the output of the bluntBody.sim looks like:
 

User-added image


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.

See also

and other STAR-CCM+ Knife tools:

KB Article ID# KB000031604_EN_US

Contents

SummaryDetails

Associated Components

Design Manager Electronics Cooling In-Cylinder (STAR-ICE) Job Manager Simcenter STAR-CCM+