CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   STAR-CCM+ (http://www.cfd-online.com/Forums/star-ccm/)
-   -   Automatically starting a run (http://www.cfd-online.com/Forums/star-ccm/84313-automatically-starting-run.html)

Dora January 26, 2011 05:07

Automatically starting a run
 
Hi everybody,
let’s say I have a set-up which takes 1hour to run. So in theory, when I leave work at 5pm and come back next morning at 8am,
the system could have ran a dozen of simulations. So is there a possibility to start the next simulation once the previous one is done (something like a “batch-run”)???

Regards,
Dora

olauer January 26, 2011 07:23

You can run Star-CCM+ in batch mode ( -batch file.java).

Imagine a file called run.java containing something like:

// STAR-CCM+ macro: run.java
package macro;

import java.util.*;
import java.io.*;
import javax.swing.*;

import star.common.*;
import star.base.neo.*;
import star.vis.*;
import star.base.report.*;
import star.flow.*;

public class run extends StarMacro {

public void execute() {
execute0();
}

private void execute0() {

try {
Simulation simulation_0 =
getActiveSimulation();

simulation_0.getSimulationIterator().run();

simulation_0.saveState(simulation_0.getSessionPath ());

} catch (Exception e) {
JOptionPane.showMessageDialog(
null, e.toString()
);
}
}

}

then you could run

starccm+ -batch run.java file.sim.

You could add some of these command lines in a batch script.

Have fun
Oliver

Dora January 26, 2011 08:15

Hi Oliver,
thanks for your reply. Somehow Im a bit confused as Im not comfortable with this macro stuff.
Let's say the files I have are:

Version_01.sim
Version_02.sim
Version_03.sim


Do I than to open Version_01.sim, click the marco file button to generate a java file and put the text below??


// STAR-CCM+ macro: run.java
package macro;

import java.util.*;
import java.io.*;
import javax.swing.*;

import star.common.*;
import star.base.neo.*;
import star.vis.*;
import star.base.report.*;
import star.flow.*;

public class run extends StarMacro {

public void execute() {
execute0();
}

private void execute0() {

try {
Simulation simulation_0 =
getActiveSimulation();

simulation_0.getSimulationIterator().run();

simulation_0.saveState(simulation_0.getSessionPath ());

} catch (Exception e) {
JOptionPane.showMessageDialog(
null, e.toString()
);
}
}

}


But were would the connection to the Version_02.sim and Version_03.sim be?
Im confused. Please advise.

Thank you!! again

olauer January 26, 2011 09:00

You create a file run.java containing the posted text with an editor of your choice.
Then you prepare all your simulation cases in a way that they only need to be started and save them.

At last you create a batch file where you write something like
starccm+ -batch run.java Version_01.sim
starccm+ -batch run.java Version_02.sim
starccm+ -batch run.java Version_03.sim

The details for this batch file depend on the OS you use. Usually you can see in the GUI how CCM+ is started on your machine.

run.java automatically finds out path and name of the simulation, runs it and saves the results with the same name.


rwryne January 26, 2011 10:05

Alternatively you can look into a queuing system, which is external to STAR-CCM+.

e.g. : http://www.platform.com/workload-man...ance-computing

I am sure you can find some free/open source project to do the same thing.

WhoAmI January 27, 2011 13:00

Quote:

Originally Posted by Dora (Post 292219)
Hi everybody,
let’s say I have a set-up which takes 1hour to run. So in theory, when I leave work at 5pm and come back next morning at 8am,
the system could have ran a dozen of simulations. So is there a possibility to start the next simulation once the previous one is done (something like a “batch-run”)???

Regards,
Dora

If it is a simple problem i.e. varying velocity at the inlet or temperature on a wall at regular intervals, you can write a field function using floor or ceil functions and autosave option.


All times are GMT -4. The time now is 09:31.