Simcenter STAR-CCM+ How to read values from xlsx using Apache POI and update the same in Simcenter STAR-CCM+?

Simcenter STAR-CCM+ Simcenter STAR-CCM+ Virtual Reality Teamcenter Share Simcenter Cloud HPC Simcenter STAR-CCM+ Viewer Simcenter STAR-CCM+ Application Specific Solutions


We may face a scenario where we may have to read certain values from excel sheet xlsx and update those in Simcenter STAR-CCM+. In this article we will be creating a macro where the coordinate values are read from xlsx and updated in Simcenter STAR-CCM+ coordinate system.


Prerequisite: Apache POI libraries must be downloaded before creating this macro.
Download Apache POI libraries here

We will take an example to read three cell values from an excel sheet .xlsx and update the same in Simcenter STAR-CCM+ coordinate system.

Excel sheet values:

Update the additional library option in STAR-CCM+ so that it can read apache poi libraries:
Goto>>options>>Environment>>Expert>>User macro classpath

Copy all the jar files from \\poi-4.1.2\\lib
Copy all the jar files from \\poi-4.1.2\\ooxml-lib
Paste the above jar files into \\poi-4.1.2

The  image below shows the imports for getting file input, adding exceptions, apache libraries for reading excel cells, sheets, and STAR-CCM+ libraries. Users may need to add or remove imports based on their macro requirements.

To run this macro user need to specify the file path to .xlsx in the macro

Get row, and column values using XSSFCell class and convert them to double (so that the read value can be assigned in Simcenter STAR-CCM+)

Set the read values into Simcenter STAR-CCM+

Run the macro

Find attached excel sheet and macro file with this article for your reference.

KB Article ID# KB000045191_EN_US



Associated Components

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