In today’s world, engineering simulations are becoming more and more complex. With the increasing complexity, it can become difficult to capture all desired behavior using just one specialized software. This is where co-simulation can come in – an effective solution that enables multi-domain simulation by coupling two or more engineering software. Although Simcenter Amesim is a tool that specializes in capturing system level behavior and interaction between components, there are situations where it becomes necessary to resolve the flow and involve more spatial aspects using a tool like Simcenter STAR-CCM+.
Co-simulation is a technique that enable two or more simulation software to communicate and exchange data with each other throughout a simulation. In this blog article we will go through a typical workflow for enabling co-simulation between the tools Simcenter Amesim and Simcenter STAR-CCM+. In addition to describing the workflow, a method for how to use Simulation Operations inside Simcenter STAR-CCM+ is given to allow for multiple simulation to be run using batch simulation in Simcenter Amesim.
To showcase the workflow a simple geometry of a check valve is simulated by coupling both software together. We start by aquatinting us with the model used inside Simcenter STAR-CCM+. The check valve’s internal flow region is shown in the illustration below. The geometry has one inlet and one outlet. For the inlet a stagnation inlet boundary is used and for the outlet boundary a pressure outlet is selected. To capture the effects of flow pushing on the plate to open the valve, an overset mesh region surrounds the plate and allows the plate to move throughout the transient simulation.
To counteract the force pushing on the plate inside Simcenter STAR-CCM+, a spring and mass system is simulated in Simcenter Amesim. Any scalar field can be exchanged between the two tools, and in this example the scalar value of the force acting on the plate is continuously past from Simcenter STAR-CCM+ to Simcenter Amesim. Using this force and the plate’s mass and spring force, Simcenter Amesim calculates the new position of the plate and outputs this information to Simcenter STAR-CCM+, which in turn updates the plats overset region. The updated plate displacement affects the flow pushing on the plate and new force values are sent back to Simcenter Amesim. In this example this procedure occurs at every timestep, but this can be configured differently depending on the simulation case.
The inlet and outlet pressures assigned to the boundary conditions in Simcenter STAR-CCM+ are controlled from Simcenter Amesim. Initially, both pressures are set to be equal at 1 [bar], and as the simulation is run the inlet pressure will first increase from 1 to 10 [bar] and then remain at 10 [bar] for the duration of the simulation.
To enable co-simulation between the two tools, the physics models Co-Simulation and Simcenter Amesim have to be selected under the physics continua. The Explicit Coupling option is added as an auto-selected recommendation and allows for two-way coupled co-simulation. The settings are outlined in the image below.
Once the models have been selected a new node is provided in simulation tree called External Links. Under this node the connection between Simcenter STAR-CCM+ and Simcenter Amesim is managed. In this example the communication is carried out using TCP/IP where Simcenter Amesim is the server and Simcenter STAR-CCM+ the client. Information concerning port number and hostname is required for Simcenter STAR-CCM+ to be able to connect.
In addition to ensuring that the two softwares communicate, which variables to send and receive are also managed under External Links. These are set as single-value scalar fields, and the exported variables in this study are force and mass flow rate. The image below illustrates how the force acting on the plate is exported using a force report on the plate region’s wall boundary.
Exported fields are added by right clicking Exported field –> Add Auxiliary Field àScalar, and the same procedure is carried out for Imported fields. A numerical value is assigned to each new field to keep track of which variable to connect to which port inside Simcenter Amesim.
Taking a close look at the TCP socket connection inside Simcenter Amesim. The network co-simulation component is found under the Generic Cosimulation library. Once the component has been added to the sketch area the user is prompted with the question of how many input and output ports the connection should have. To ensure that the right information is sent, variables must be connected to the correct port and the number must match the number assigned to the field inside Simcenter STAR-CCM+. For example, in the imagery below the current valve displacement connected to port number 5 in Simcenter Amesim and the imported one-value scalar field in Simcenter STAR-CCM+ is assigned the number 5.
The total simulation time of the co-simulation is 0.05 [s], and the data transfer between the two tools is set to occur every 0.005 [s]. Since Simcenter Amesim runs in server mode, the frequency of the data exchange is managed through the co-simulation component and specified using the parameter named “sample time”.
Below, a video of the co-simulation as it is being run.
Running Simcenter Amesim batch runs with Simulation Operations in Simcenter STAR-CCM+
In the previous example, once the simulation is completed the connection between Simcenter Amesim and Simcenter STAR-CCM+ will end. Now if a user desires to run a new case, with for instance new boundary conditions, one approach would be to manually clear the solution and run a new co-simulation.
A better alternative however is to utilize Simulation Operations inside Simcenter STAR-CCM+. Using a loop operation to cycle through batch cases set up in Simcenter Amesim allows you to create a matrix of simulation cases, run them, and automatically clear the solution between each run.
A simulation operation is created in the simulation tree under Tools–>Simulation Operation–>New, and an example of an operation intended for batch runs is outlined below.
In this process, a loop operation runs through the steps of clearing any previous solution, runs the co-simulation (Solve Physics), and then using Set Parameter updates the loop count by adding the value of 1 to a previously created parameter called LoopCounter. The loop is broken once the loop count becomes larger than the number desired simulation cases, i.e. essentially a while loop.
The operation is then run from the toolbar using Play/Resume Simulation Operation.
We hope you have found this article interesting. If you have any questions or comments, please feel free to reach out to us on email@example.com
Fabian Hasselby, M.sc.