|
[Sponsors] |
January 11, 2021, 03:47 |
Importing probes coordinates
|
#1 |
New Member
Vlad
Join Date: Oct 2020
Posts: 13
Rep Power: 6 |
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? |
|
January 11, 2021, 04:38 |
|
#2 |
Senior Member
Joern Beilke
Join Date: Mar 2009
Location: Dresden
Posts: 528
Rep Power: 20 |
A java macro should do the job.
|
|
January 11, 2021, 05:36 |
|
#3 |
New Member
Vlad
Join Date: Oct 2020
Posts: 13
Rep Power: 6 |
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
|
|
January 11, 2021, 06:09 |
|
#4 |
Senior Member
Joern Beilke
Join Date: Mar 2009
Location: Dresden
Posts: 528
Rep Power: 20 |
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. |
|
January 12, 2021, 05:14 |
|
#5 | |
Senior Member
Chaotic Water
Join Date: Jul 2012
Location: Elgrin Fau
Posts: 437
Rep Power: 18 |
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? |
||
January 13, 2021, 09:05 |
|
#6 |
Senior Member
Ping
Join Date: Mar 2009
Posts: 556
Rep Power: 20 |
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 ; } } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
probes chtMultiRegionFoam (OF v7) | carl_r | OpenFOAM Post-Processing | 1 | May 1, 2020 00:21 |
Trouble importing airfoil coordinates into Pointwise without using iges files | ColourMeRed | Pointwise & Gridgen | 2 | February 6, 2020 19:59 |
[Scripting]: How to get the coordinates of a 2D airfoil @ different angles of attack? | CfdIntro | Main CFD Forum | 2 | December 12, 2017 11:23 |
importing point coordinates for creating probe | zeta | STAR-CCM+ | 1 | March 21, 2013 18:04 |
Problem With Importing Coordinates for an Airfoil | Amerikaneca | ANSYS Meshing & Geometry | 3 | July 8, 2011 08:28 |