Simcenter STAR-CCM+ User Coding for 2-dimensional T,p-Table interpolation - Linux OS

2022-12-06T16:14:51.000-0500
Simcenter STAR-CCM+ Simcenter STAR-CCM+ Virtual Reality Teamcenter Share Simcenter STAR-CCM+ Viewer Simcenter STAR-CCM+ Application Specific Solutions

Summary

This article tries to show a way how 2-dimensional interpolation of a temperature and pressure table can be done, via user coding on a Linux machine. This is very useful in cases where you cannot directly provide a Table (T,p) for a property item of the STAR-CCM+ simulation tree.


Details

This article tries to show a way how 2-dimensional interpolation of a temperature and pressure table Table (T,p) can be done. This is very useful in cases, where you cannot directly provide a Table (T,p) for a property item of the STAR-CCM+ simulation tree. For example, when you are trying to provide a temperature and pressure dependent net emission coefficient as volumetric heat source, you will see, that here you can only specify the following options:


User-added image


We can see that here the option Table (T,p) is not available. Hence we need to use a workaround and pick in this case from the above list the option Field Function. In case the option Table (T,p) is there, the solver of  STAR-CCM+ would automatically do this table interpolation.

Then you need to compile the provided user code on your LINUX machine by using following command line, which will create the user library libuser.so:
gcc -fPIC -shared d2InterpolationTable_Linux.c -o libuser.so

d2InterpolationTable_Linux.c will interpolate the table data of VolHeatSource_TP.txt and will give them back as result to STAR-CCM+. 

Please pay attention to specify the correct path on your machine, to the data file VolHeatSource_TP.txt in the file d2InterpolationTable_Linux.c:
  /*  Points to the table file */
  char *filename =  "/PATH_to_FILE/VolHeatSource_TP.txt";

After you complied the code please load the library into STAR-CCM+ under Tools > User Code:


User-added image

and apply the User heatSource function to the Volumetric Heat Source of the Region:


User-added image


The Volumetric Heat Source or net emission coefficient provided in this table, is per Steradian ([W/m3/sr]), hence the user code will multiply the interpolated table value of net emission coefficient with 4pi to satisfy the unit [W/m3] of Volumetric Heat Source option in the simulation. In case this is not needed in your case, please remove this multiplication from the user code.

For further informations on user code, compilation to create user library, loading of library and other user coding examples, please see following link:
See User Code chapter of User Guide


 

KB Article ID# KB000054066_EN_US

Contents

SummaryDetails

Associated Components

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