CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > Siemens > STAR-CCM+

Run Multiple Files in Batch

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 18, 2011, 10:40
Default Run Multiple Files in Batch
  #1
New Member
 
Nicholas
Join Date: May 2009
Location: Seattle, USA
Posts: 18
Rep Power: 16
nickninevah is on a distinguished road
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
And if I try to run Star CCM+ with a new simulation command, it tells me that it can't run the new simulation since the batch macro doesn't set it up.

Code:
%\starccm+ -batch -np 4 -new runMultiple.java
And finally, I tried to run the macro and just specify the first simulation in the list of files I have. All files are stored in one folder, as required by the macro. That still didn't work. Star CCM+ started off running the simulation. It didn't execute any of the commands in the macro.

Code:
%\starccm+ -batch -np 4 runMultiple.java LocksVes_Rev0.5.sim
Any ideas what I am doing wrong? Thanks for any help.

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();
  }
}
nickninevah is offline   Reply With Quote

Old   April 18, 2011, 12:47
Default
  #2
Member
 
John
Join Date: Aug 2009
Posts: 92
Rep Power: 16
nomad is on a distinguished road
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.
nomad is offline   Reply With Quote

Old   April 18, 2011, 15:58
Default
  #3
New Member
 
Nicholas
Join Date: May 2009
Location: Seattle, USA
Posts: 18
Rep Power: 16
nickninevah is on a distinguished road
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.
nickninevah is offline   Reply With Quote

Old   April 18, 2011, 17:31
Default
  #4
Member
 
John
Join Date: Aug 2009
Posts: 92
Rep Power: 16
nomad is on a distinguished road
Syntax issues maybe?
See if you find anything here:

http://www.cfd-online.com/Forums/sta...atch-mode.html
nomad is offline   Reply With Quote

Old   April 19, 2011, 04:56
Default
  #5
Member
 
Oliver Lauer
Join Date: Mar 2009
Location: Coburg
Posts: 57
Rep Power: 17
olauer is on a distinguished road
Name of your java macro must follow directly after -batch option.
So try

%\starccm+ -batch runMultiple.java -np 4 LocksVes_Rev0.5.sim
olauer is offline   Reply With Quote

Old   October 6, 2017, 07:28
Default
  #6
New Member
 
Join Date: Jun 2016
Posts: 17
Rep Power: 9
karahan is on a distinguished road
Where do you keep your runMultiple.java file? Maybe it can't find this macro.
karahan is offline   Reply With Quote

Old   October 12, 2017, 06:17
Default
  #7
Member
 
Guillaume Jolly
Join Date: Dec 2015
Posts: 64
Rep Power: 10
trampoCFD is on a distinguished road
Send a message via Skype™ to trampoCFD
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
trampoCFD is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM static build on Cray XT5 asaijo OpenFOAM Installation 9 April 6, 2011 12:21
OF 1.6 | Ubuntu 9.10 (64bit) | GLIBCXX_3.4.11 not found piprus OpenFOAM Installation 22 February 25, 2010 13:43
Calculating YPLUS and Compiling Multiple C files sanjibdsharma OpenFOAM Programming & Development 1 August 11, 2009 06:56
Help!! Why I can't run fluent in batch mode? Cindy Jones FLUENT 0 April 8, 2003 23:39
Problems on Batch run Cindy Jones FLUENT 2 November 24, 2002 00:45


All times are GMT -4. The time now is 22:29.