Importing probes coordinates
Hello guys,
I am struggling for a while to import an .csv file to starccm in order to create probes from those coordinates. Does anybody have any clue how i should proceed? |
A java macro should do the job.
|
Could you give me more details how to do it? I know how to import the table, but not to correlate the data with my probes :(
|
There should be 2 ways.
1) Don't read the csv into a table but read it via the macro and create a probe for every line in the file 2) Read the csv into a table and loop over the lines of the table. |
Quote:
UPD The only way I can imagine - is to loop in Simulation Operations with Parameter and interpolateTable() using that parameter. Is there any better way? |
here are two java macros from 2011 that read from and write to a star table - see class table in the api - might need mods for recent versions of star
package macro; import star.base.neo.*; import star.base.report.MaxReport; import star.common.*; /** * This macro takes the first table it finds in the STAR-CCM+ simulation and prints the data in the 1st 4 columns * */ public class JavaReadTable extends StarMacro { Simulation sim; Units meter; public void execute() { int rowStart = 0; int colStart = 0; sim = getActiveSimulation(); Table t = sim.getTableManager().getObjects().iterator().next (); String format = "%0" + (Math.log10(t.getNumColumns()) + 1) + "d"; int nPoints = t.getNumRows(); for (int n = rowStart; n < nPoints; n++) { sim.println( "Table data a, b, c, d : " + t.getTableDataItem(n, 0) + ", " + t.getTableDataItem(n, 1) + ", " + t.getTableDataItem(n, 2) + ", " + t.getTableDataItem(n, 3) ) ; } } } package macro; import star.base.neo.*; import star.base.report.MaxReport; import star.common.*; /** * This macro takes the first table it finds in the STAR-CCM+ simulation and prints the data in the 1st 4 columns * */ public class JavaWriteToTable extends StarMacro { Simulation sim; Units meter; public void execute() { int rowStart = 0; int colStart = 0; sim = getActiveSimulation(); Table t = sim.getTableManager().getObjects().iterator().next (); String format = "%0" + (Math.log10(t.getNumColumns()) + 1) + "d"; int nPoints = t.getNumRows(); t.setTableDataItem(0, 0) = 1234 ; } } |
All times are GMT -4. The time now is 19:38. |