Simple examples
Flow in a hydraulic pipe
This model examines the flow in a pipe, which is connected to a pressure source and a valve.
Figure 30: The initial setup
This co-simulation will be carried out with CD-adapco STAR-CD. First, one must construct the model and set up the interface block, as detailed in the Getting started section.
As shown in below, the pressure into the hydraulic line will be computed by Simcenter Amesim, and applied to the CFD model as an inlet boundary condition. The CFD code will then simulate and provide a value of the flow rate, which will be sent back to Simcenter Amesim – which will again calculate the pressure, and so on until the final time is reached.
Figure 31: The sketch in Simcenter Amesim, with interface block configured
Once Simulation mode is activated, the model will be compiled, producing a DLL for the co-simulation. Now that the interface has been set up in Simcenter Amesim, the missing element is the actual link to the CFD model. This involves writing custom code that defines the interface, both in terms of the variables exchanged, as well as how these variables may eventually influence the CFD model’s mesh, or the physical quantities calculated by the CFD code.
For example, in the case of a Diesel injector, one could imagine the case where the needle lift and velocity are calculated and provided by Simcenter Amesim, and the forces experienced by the needle are obtained using the CFD software package. Since needle lift affects the cavity through which the Diesel fuel will flow, the CFD geometry has to reflect these changes as well – as a result, the CFD mesh must be dynamically linked to an Simcenter Amesim output variable. This is the kind of link which can be implemented using custom interface code.
In more concrete terms, third-party CFD software packages are able to read code in order to enable their users to automate some of their simulation tasks, as well as the pre- and post-processing post-processing activities they may want to carry out.
“Piloting the Simcenter Amesim simulation” is a term that can be broken down into multiple explicit actions, which are translated into functions that can be directly used in the code:
Loading the Simcenter Amesim model DLL: dn=loadamesimdll_(filename) ·
Getting the number of variables exchanged with Simcenter Amesim and their type (inputs, outputs, state variables and implicits): amegetsizes_(dn, numinputs, numoutputs, numstates, numimplicits)
Initializing the Simcenter Amesim model: ameinitmodel_(dn, t, printinter, dt, tol, errtype, writelevel, disconpr, runstats, runtype, solvertype, numinputs, numoutputs, inputs, outputs)
Instructing the Simcenter Amesim solver to integrate the model up to the next communication time: amedoastep_(dn, t, numinputs, numoutputs, inputs, outputs)
Closing the Simcenter Amesim DLL: closeamesimdll_(dn)
Note
Most of these functions are self-explanatory – the function calls they involve refer to explicit actions; however, further information is available in Simcenter Amesim "UserCosim" API functions and parameters, with a more complete list of the functions included in the API, as well as examples of arguments that each function takes, and exactly what it does.
In the majority of cases, however, the interface code is not very difficult to set up. As it is written most often in C or Fortran (depending on the CFD software in question), this kind of code is very easy to approach. To illustrate this, below is a snippet of code written for the co-simulation with CD-adapco STAR-CD.
Figure 32: A code snippet used to initialize a “UserCosim” interface between Simcenter Amesim and CD-adapco STAR-CD
Note
This snippet of code only serves as an example, and is not the full code used for this co-simulation.
The language used for interface code varies depending on the CFD software which is used – for Fluent, it is C, and for STAR-CD, it is Fortran.
Simcenter Amesim’s API is compatible with both C and Fortran.
On the CFD side, the hydraulic pipe is meshed. In this case, the pipe is 2D-axisymmetrical, and measures a length of 20m, and a width of 10mm.
Figure 33: The mesh used to represent the pipe
The mesh here is actually 3 dimensional – this is because STAR-CD’s solver requires 3D cells.
For each time step in the CFD solver, the inlet boundary condition is a static pressure (the one provided by Simcenter Amesim). This particular pipe has no outlet; instead, the end of the pipe is a wall.
Concerning the simulation configuration itself, it was set up with a k-ε turbulence mode turbulence model , using a standard wall function wall function for wall treatment. The CFD time step was 10-5s.
This produces the following results:
Figure 34: (a) Pressure at the end of the pipe, and (b) flow at the inlet of the pipe
On the CFD side, we can also visualize the velocity field across the pipe at different instants during the simulation, as can be seen in the figure below.
Figure 35: Velocity distribution in the conduit at t= 0.001s, 0.01s, 0.015s and 0.02s
Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.CFD_Methodology/xid1179062 · retrieved 2026-07-17