CFD Online Discussion Forums

CFD Online Discussion Forums (
-   STAR-CCM+ (
-   -   Star-CCM+ Macro headache (

PLUH March 24, 2009 05:53

Star-CCM+ Macro headache
Good day.

I want to write/edit an macro that extracts the velocity components (i,j,k) at predeterminde coordinates in my fluid region with the use of a point probe and have these values written to a .csv file. I have a .csv file containing all the coordinates at which i want to extract the data (nearly 400) and am able to read these coordinates into the macro and ajust the point probe acordingly, but I am having trouble extracting the velocity components at these positions. Any help in setting up the code to set a variable (xvel) equal to the i velocity component using the point probe will be greatly appreciated.

I am new user of star-ccm and have no previous experience with java so any help will be greatly appreciated.

An alternative is to insert all the point probes into the simulation and plot the different components using an XY plot, but with this method i'll have to have 3 plots (one for each velocity component and coordinate) that needs to be exported and it will leave me with more postprocessing.

Sorry for the long post and thatks in advance.



ping April 16, 2009 05:21

You are close:
1. create a Max Report, with Vel(i) component as the field, and the probe as the part - call it say Vi .
2. Create similar reports for Vj and Vk - so you now have each component of vel as a report
3. In your macro add something like

//Define some variables
double Vi, Vj, Vk ;

// Start loop over all your required probe locations using SetCoordinate etc

MaxReport maxReport_0 = ((MaxReport) simulation_0.getReportManager().getReport("Vi"));
Vi = maxReport_0.getValue();

MaxReport maxReport_1 = ((MaxReport) simulation_0.getReportManager().getReport("Vj"));
Vj = maxReport_1.getValue();

MaxReport maxReport_2 = ((MaxReport) simulation_0.getReportManager().getReport("Vk"));
Vk = maxReport_2.getValue();

// now you have the components of vel in these three variables - write to file

// repeat loop

A much easier non-java way to do it is to use an Internal XYZ Table which you then export to csv - fine if your probe points are say on a regular grid which a Presentation Grid can create. Or import the probe locations as an STL file - can't see a way to use an imported csv table as an Arbitrary probe location - that would be ideal for you!

Lukas September 1, 2009 08:22

Hi all,

how can I import probe locations from a stl-file?
How can I create a stl-file with my probe locations?

with best regards

All times are GMT -4. The time now is 12:53.