|
[Sponsors] |
April 18, 2011, 11:40 |
Run Multiple Files in Batch
|
#1 |
New Member
Nicholas
Join Date: May 2009
Location: Seattle, USA
Posts: 18
Rep Power: 17 |
Hi all,
I found this wonderful example java macro in the Star CCM+ help files. They claim it should allow me to run multiple simulations files consecutively without a need to make a batch file. I've added a few extra pieces of changing the simulation settings, but it's essentially the same. Except I can't get it to work. If I try to just invoke Star CCM+ in batch mode without any simulation file, it doesn't work. Code:
%\starccm+ -batch -np 4 runMultiple.java Code:
%\starccm+ -batch -np 4 -new runMultiple.java Code:
%\starccm+ -batch -np 4 runMultiple.java LocksVes_Rev0.5.sim System: Windows XP 64-bit, SP3. 2 Dual core Intel Xeon, 3.33 Ghz RAM: 16.0 gig Code:
// STAR-CCM+ macro: runMultiple.java package macro; import java.io.*; import star.base.neo.*; import star.common.*; public class runMultiple extends StarMacro { public class SimFileFilter implements FilenameFilter { public boolean accept(File dir, String name) { return name.endsWith(".sim"); } } public void execute() { File simDir = new File("E:\\10099 - John Day Locks\\02 Locks with Vessels\\MeshIndependenceStudy_Rev0.5\\Raw Data\\"); for (File f : simDir.listFiles(new SimFileFilter())) { startAndRun(f); } } public void startAndRun(File f) { System.out.println("\n Starting "+f); String fileName = f.getAbsolutePath(); Simulation sim = new Simulation(fileName); runmesh(); initialize_iters(); sim.getSimulationIterator().step(8); String newFileName = fileName.replaceAll("\\.sim","-new.sim"); sim.saveState(newFileName); sim.kill(); } public void initialize_iters() { Simulation simulation_0 = getActiveSimulation(); Solution solution_0 = simulation_0.getSolution(); solution_0.clearSolution(); InnerIterationStoppingCriterion innerIterationStoppingCriterion_0 = ((InnerIterationStoppingCriterion) simulation_0.getSolverStoppingCriterionManager().getSolverStoppingCriterion("Maximum Inner Iterations")); innerIterationStoppingCriterion_0.setMaximumNumberInnerIterations(120); simulation_0.getSimulationIterator().step(1); innerIterationStoppingCriterion_0.setMaximumNumberInnerIterations(45); } public void runmesh() { Simulation simulation_0 = getActiveSimulation(); MeshPipelineController meshPipelineController_0 = simulation_0.get(MeshPipelineController.class); meshPipelineController_0.clearGeneratedMeshes(); meshPipelineController_0.generateVolumeMesh(); } } |
|
April 18, 2011, 13:47 |
|
#2 |
Member
John
Join Date: Aug 2009
Posts: 92
Rep Power: 17 |
You need a parallel license in order to run multiple instances of starccm. Do you have that?
Also, I'm not sure if the batch command actually lets you do that. It will let you run macros, and multiple simulation one after another, but multiple simulations at the same time? I'm not so sure. |
|
April 18, 2011, 16:58 |
|
#3 |
New Member
Nicholas
Join Date: May 2009
Location: Seattle, USA
Posts: 18
Rep Power: 17 |
Yes, we do have the parallel licenses. And I am just trying to run the simulations run after another. From what I understand of the macro, it should run through all commands for an entire simulation before looping back to the next simulation file.
I'm new to Java macros, but if I understand the programming correctly, my goal was to have this macro open a simulation file, generate the volume mesh based on existing settings, and then step through the first few timesteps of the simulation, and save the results. Afterwards, the macro should move on to the next simulation in the file folder. But I don't know why it isn't working. |
|
April 18, 2011, 18:31 |
|
#4 |
Member
John
Join Date: Aug 2009
Posts: 92
Rep Power: 17 |
Syntax issues maybe?
See if you find anything here: http://www.cfd-online.com/Forums/sta...atch-mode.html |
|
April 19, 2011, 05:56 |
|
#5 |
Member
Oliver Lauer
Join Date: Mar 2009
Location: Coburg
Posts: 57
Rep Power: 17 |
Name of your java macro must follow directly after -batch option.
So try %\starccm+ -batch runMultiple.java -np 4 LocksVes_Rev0.5.sim |
|
October 6, 2017, 08:28 |
|
#6 |
New Member
Join Date: Jun 2016
Posts: 17
Rep Power: 10 |
Where do you keep your runMultiple.java file? Maybe it can't find this macro.
|
|
October 12, 2017, 07:17 |
|
#7 |
Member
|
Hi Nicholas,
it's good practice to add: "pause" on a new line at the end of your batch file. That means the output is kept in the CMD shell, and you can read the error messages. Best regards, Guillaume TrampoCFD.com |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM static build on Cray XT5 | asaijo | OpenFOAM Installation | 9 | April 6, 2011 13:21 |
OF 1.6 | Ubuntu 9.10 (64bit) | GLIBCXX_3.4.11 not found | piprus | OpenFOAM Installation | 22 | February 25, 2010 14:43 |
Calculating YPLUS and Compiling Multiple C files | sanjibdsharma | OpenFOAM Programming & Development | 1 | August 11, 2009 07:56 |
Help!! Why I can't run fluent in batch mode? | Cindy Jones | FLUENT | 0 | April 9, 2003 00:39 |
Problems on Batch run | Cindy Jones | FLUENT | 2 | November 24, 2002 01:45 |