|
[Sponsors] |
January 30, 2014, 06:17 |
Perform several simulations automatically
|
#1 |
New Member
Gustaf T
Join Date: Jan 2014
Posts: 3
Rep Power: 12 |
I am working on a project where I want to be able to loop the simulation process, i.e. set up the simulation properly with some design parameters, and then creating some automatic parameter study. Is there some way of doing this in STAR-CCM+, for example writing a macro?
Would appreciate the help greatly. |
|
January 31, 2014, 07:03 |
|
#2 |
Senior Member
Ping
Join Date: Mar 2009
Posts: 556
Rep Power: 20 |
i suggest you do the help tutorials on macros first then you will understand the code below a little better
a field function can also be used - easier than a macro is some ways you could also use optimate in simple design exploration mode - the easiest way, but you may not have a license for this save the text below to a file called run_batch_inlets.java // STAR-CCM+ macro: run_batch_inlets.java package macro; // Runs the current .sim with a range of inlet values, and saves each result to a different .sim file import java.util.*; import star.common.*; import star.base.neo.*; import star.flow.*; import star.vis.*; public class run_batch_inlets extends StarMacro { public void execute() { double Yin ; int i; String str1, str2; // start of real code Simulation simulation_0 = getActiveSimulation(); StepStoppingCriterion stepStoppingCriterion_0 = ((StepStoppingCriterion) simulation_0.getSolverStoppingCriterionManager().g etSolverStoppingCriterion("Maximum Steps")); stepStoppingCriterion_0.setMaximumNumberSteps(10); i = 0; for ( Yin = -1.0; Yin >= -11.0; Yin = Yin - 2.0) { i = i + 1; Region region_0 = simulation_0.getRegionManager().getRegion("subdoma in-1"); Boundary boundary_0 = region_0.getBoundaryManager().getBoundary("boundar y1"); VelocityProfile velocityProfile_0 = ((VelocityProfile) boundary_0.getValues().get(VelocityProfile.class)) ; ((ConstantVectorProfileMethod) velocityProfile_0.getMethod()).getQuantity().setVe ctor(new DoubleVector(new double[] {0.0, Yin, 0.0})); Solution solution_0 = simulation_0.getSolution(); solution_0.clearSolution(); simulation_0.getSimulationIterator().run(true); str1 = Integer.toString(i); // pad on left with zeros str1 = "0000000".substring(0,4 - str1.length()) + str1; str2 = "part2_run_" + str1 + ".sim" ; simulation_0.saveState(resolvePath(str2)); str2 = "part2_run_" + str1 + ".png" ; Scene scene_0 = simulation_0.getSceneManager().getScene("Scalar Scene 1"); scene_0.printAndWait(resolvePath(str2), 1, 1198, 816); } } } |
|
January 31, 2014, 07:46 |
|
#3 |
New Member
Gustaf T
Join Date: Jan 2014
Posts: 3
Rep Power: 12 |
Thanks for the response. I guess my thought process wasnt entirely clear at the moment of the post. I have been looking in the tutorial guide and can see that it is clearly possible to run several simulations within STAR-CCM+ automatically. However, my goals have changed somewhat since then.
What I actually in the end want to achieve is to perform a CFD parameter study on a geometry that I have created in CATIA v5 R21. So I figured that I can write a VBA macro in Microsoft Visual basic which alters my parameters in CATIA based on an excel sheet, and then exports a geometry file for each set of parameters. I figure that I can then basically run a pre-determined macro file which imports each geometry file, runs the desired simulation and produces the desired outputs. All of this I want to do automatically, so basically looping the following: -Change parameters -Export geometry from CATIA followed by: -Run java macro file in STAR-CCM+ to perform simulations on all geometries created Can I do this using VBA script solely? If so, how? If not, what may be another way of doing it? |
|
January 31, 2014, 07:48 |
|
#4 |
New Member
Gustaf T
Join Date: Jan 2014
Posts: 3
Rep Power: 12 |
BTW, I know how to do the CATIA-related parts of the above post, Im more wondering about running the java macro automatically.
|
|
January 31, 2014, 07:55 |
|
#5 |
Senior Member
Ping
Join Date: Mar 2009
Posts: 556
Rep Power: 20 |
all very possible either in vba or in star-ccm+ using java since java can talk to the os of course.
if you have the cad client for catia it is easier since you can define parameters in catia which are now visible as star-ccm+ design parameters and can be driven by a macro or even easier by optimate - if you have optimate+ then you can do real optimization with the cfd results driving the cad changes in catia. |
|
October 25, 2018, 12:03 |
|
#6 | |
Member
Linyan X
Join Date: Dec 2015
Posts: 43
Rep Power: 11 |
Quote:
Have you finally achieve this? Curious about that I think one of the viable ways is to use a platform that can call either STAR-CCM and CATIA, like Netbean for example. Best, Linyan |
||
Tags |
automatic, optimize, parameters, star ccm+ |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hardware selection for steady/unsteady incompressible, turbulent and cht simulations | maddalena | OpenFOAM | 2 | July 13, 2011 09:55 |
Automatically running simulations | xTamx420 | FLUENT | 2 | May 17, 2011 07:51 |
Timestepping in two - phase Simulations using RSM | challenger85 | CFX | 0 | January 4, 2010 06:00 |
How to perform TIME_AVERAGE automatically | Saim | FLUENT | 0 | January 22, 2007 10:43 |
URANS and Transient Simulations | bob | Main CFD Forum | 0 | October 1, 2003 04:54 |