|
[Sponsors] |
July 1, 2016, 19:40 |
Macro for parametric study in STAR CCM+
|
#1 |
New Member
Join Date: Jun 2015
Location: Great Britain
Posts: 16
Rep Power: 11 |
I need to do a parametric study in STAR CCM+. The study will have anything between 50 and 150 runs. In each run, several parameters of the CAD model geometry will change, then the new model is remeshed, simulation run.
Obviously, doing this by hand would be very inefficient. I'd like to use a macro that will read the parameters for each run from an Excel (or .csv) file, then remesh, run simulation and perhaps even save some key numerical results to another spreadsheet. Does anyone have macro that does something similar to this? Thanks in advance! |
|
July 4, 2016, 09:40 |
|
#2 |
Senior Member
kevin alun
Join Date: Sep 2011
Location: Germany
Posts: 106
Rep Power: 15 |
People make a living off of that, but really just record yourself changing the design parameters, once that is changed its just one command to mesh and one command to run, writing out results, below are some basic java commands that are helpful for writing out data from a simulation,
Simulation sim = getActiveSimulation(); String filePath = sim.getSessionDir().toString(); String simName = sim.getPresentationName(); ArrayList<Double> someValue = new ArrayList<Double>(); ArrayList caseNameList = new ArrayList(); (define a list of case names probably related to your design changes or read from csv file) For loop //Changing design parameters, mesh run get a value aValue = avgReport.getValue(); (assuming you created an AvgReport variable) someValue.add(aValue); end the loop FileWriter fstream; BufferedWriter reportfile = null; try{ fstream = new FileWriter(filePath + File.separator+simName+caseName+"SomeValue"+".csv" ); reportfile = new BufferedWriter(fstream); reportfile.write(caseName+","+"ValueType"); reportfile.write("\r\n"); for loop reportfile.write(caseNameList.get(i).toString() + "," + someValue.get(i).toString()); reportfile.write("\r\n"); end loop reportfile.close(); }catch {something here} |
|
July 5, 2016, 14:08 |
|
#3 |
New Member
Join Date: Jun 2015
Location: Great Britain
Posts: 16
Rep Power: 11 |
Thank you, marmot! That is brilliant!
|
|
Tags |
macro, parametric study, star ccm+ |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problem when imported geometry from 3D CAD to star ccm, | TAREK GANAT | STAR-CCM+ | 1 | May 21, 2013 23:15 |
[Commercial meshers] Using starToFoam | clo | OpenFOAM Meshing & Mesh Conversion | 33 | September 26, 2012 05:04 |
[Other] StarToFoam error | Kart | OpenFOAM Meshing & Mesh Conversion | 1 | February 4, 2010 05:38 |
error in star ccm | maurizio | Siemens | 3 | October 16, 2007 06:17 |
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues | michele | OpenFOAM Meshing & Mesh Conversion | 2 | July 15, 2005 05:15 |