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

Automatically starting a run

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 26, 2011, 05:07
Default Automatically starting a run
  #1
New Member
 
Join Date: May 2010
Posts: 9
Rep Power: 16
Dora is on a distinguished road
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
Dora is offline   Reply With Quote

Old   January 26, 2011, 07:23
Default
  #2
Member
 
Oliver Lauer
Join Date: Mar 2009
Location: Coburg
Posts: 57
Rep Power: 17
olauer is on a distinguished road
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
olauer is offline   Reply With Quote

Old   January 26, 2011, 08:15
Default
  #3
New Member
 
Join Date: May 2010
Posts: 9
Rep Power: 16
Dora is on a distinguished road
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
Dora is offline   Reply With Quote

Old   January 26, 2011, 09:00
Default
  #4
Member
 
Oliver Lauer
Join Date: Mar 2009
Location: Coburg
Posts: 57
Rep Power: 17
olauer is on a distinguished road
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.

olauer is offline   Reply With Quote

Old   January 26, 2011, 10:05
Default
  #5
Senior Member
 
Ryne Whitehill
Join Date: Aug 2009
Posts: 312
Rep Power: 19
rwryne is on a distinguished road
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.
rwryne is offline   Reply With Quote

Old   January 27, 2011, 13:00
Default
  #6
New Member
 
Join Date: Jun 2010
Posts: 3
Rep Power: 16
WhoAmI is on a distinguished road
Quote:
Originally Posted by Dora View Post
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.
WhoAmI is offline   Reply With Quote

Old   July 13, 2022, 12:09
Default
  #7
Member
 
Marc Ricart
Join Date: Jul 2022
Posts: 65
Rep Power: 4
cramr5 is on a distinguished road
Hello, any update on that? does this still works on 2022.1 or similar versions?

I cannot manage to make it run. I can execute the program but does not open the window and then I cannot manage to make it run the simulation.

I'm on windows 10 if that helps

Thanks
cramr5 is offline   Reply With Quote

Old   July 14, 2022, 01:18
Smile
  #8
Senior Member
 
ashokac7's Avatar
 
Ashok Chaudhari
Join Date: Aug 2016
Location: Pune, India
Posts: 260
Rep Power: 11
ashokac7 is on a distinguished road
Send a message via Skype™ to ashokac7
Previously to do a batch run we have to set up a micro. We can still get batch run macro from Star-CCM+ support. But now Star-CCM+ have added node under "Tools" called "Simulation Operations". With simulation operations you can design your own algorithm from set of commands like meshing, running physics, setting different parameter value, clear solution etc. Try exploring this option.
ashokac7 is offline   Reply With Quote

Old   July 14, 2022, 03:20
Default
  #9
Member
 
Marc Ricart
Join Date: Jul 2022
Posts: 65
Rep Power: 4
cramr5 is on a distinguished road
Quote:
Originally Posted by ashokac7 View Post
Previously to do a batch run we have to set up a micro. We can still get batch run macro from Star-CCM+ support. But now Star-CCM+ have added node under "Tools" called "Simulation Operations". With simulation operations you can design your own algorithm from set of commands like meshing, running physics, setting different parameter value, clear solution etc. Try exploring this option.
Thanks but as far as I can see the "Simulation Operations" is only allowing you to do some automated options within the same simulation (*.sim) file.

What I would like to do is to prepare like 3-4 *.sim files and execute them one after the other automatically. I only have 1 power license and this way would allow me to run various 3-4h simulations overnight
cramr5 is offline   Reply With Quote

Old   July 17, 2022, 23:00
Default
  #10
cwl
Senior Member
 
Chaotic Water
Join Date: Jul 2012
Location: Elgrin Fau
Posts: 437
Rep Power: 18
cwl is on a distinguished road
Quote:
Originally Posted by cramr5 View Post
What I would like to do is to prepare like 3-4 *.sim files and execute them one after the other automatically. I only have 1 power license and this way would allow me to run various 3-4h simulations overnight
The simpliest way I can see - is to use the command line.
cwl is offline   Reply With Quote

Old   July 18, 2022, 04:38
Default
  #11
f-w
Senior Member
 
f-w's Avatar
 
Join Date: Apr 2009
Posts: 159
Rep Power: 17
f-w is on a distinguished road
Quote:
Originally Posted by cramr5 View Post
Thanks but as far as I can see the "Simulation Operations" is only allowing you to do some automated options within the same simulation (*.sim) file.

What I would like to do is to prepare like 3-4 *.sim files and execute them one after the other automatically. I only have 1 power license and this way would allow me to run various 3-4h simulations overnight
As others have suggested, command line is the best approach. Here's how you do it in Windows 10 using 2022.1.1 (17.02.008):

1) Make sure your sims have batch autosave enabled (in File>Autosave).
2) Place all your sims and macros in the same folder.
3) Create a text file that contains the following text, and rename its extension from .txt to .bat

If you have macros you'd like to run for each sim, use:
Quote:
"C:\Program Files\Siemens\17.02.008\STAR-CCM+17.02.008\star\lib\win64\intel20.1vc14.2\lib\s tarccm+.exe" -power -np 2 -batch Sim1.java Sim1.sim
"C:\Program Files\Siemens\17.02.008\STAR-CCM+17.02.008\star\lib\win64\intel20.1vc14.2\lib\s tarccm+.exe" -power -np 2 -batch Sim2.java Sim2.sim
If you don't have macros for each sim and just want to run till stopping criteria, use:
Quote:
"C:\Program Files\Siemens\17.02.008\STAR-CCM+17.02.008\star\lib\win64\intel20.1vc14.2\lib\s tarccm+.exe" -power -np 2 -batch run Sim1.sim
"C:\Program Files\Siemens\17.02.008\STAR-CCM+17.02.008\star\lib\win64\intel20.1vc14.2\lib\s tarccm+.exe" -power -np 2 -batch run Sim2.sim
NOTE: for some reason, a space is introduced in starccm+.exe in the quotes above, remove it.

4) Change 17.02.008 to your version (if different), installation directory (if different), the number after -np for the number of cores you want to use (note: these are all on local host), and obviously the names of macros and sims.
5) Open command prompt and change directory to your folder. This is easiest done by opening the folder, clicking in the address bar, typing cmd, and hitting enter.
6) Run batch file by typing its name and hitting enter.
7) If you want to terminate current sim or whole batch job, press Ctrl+C. If you want to view current sim, open Star-CCM+, right-click on your sim in Servers window and connect (then disconnect when done).
f-w is offline   Reply With Quote

Old   July 18, 2022, 04:52
Smile
  #12
Member
 
Marc Ricart
Join Date: Jul 2022
Posts: 65
Rep Power: 4
cramr5 is on a distinguished road
Quote:
Originally Posted by f-w View Post
As others have suggested, command line is the best approach. Here's how you do it in Windows 10 using 2022.1.1 (17.02.008):

1) Make sure your sims have batch autosave enabled (in File>Autosave).
2) Place all your sims and macros in the same folder.
3) Create a text file that contains the following text, and rename its extension from .txt to .bat

If you have macros you'd like to run for each sim, use:
If you don't have macros for each sim and just want to run till stopping criteria, use:
NOTE: for some reason, a space is introduced in starccm+.exe in the quotes above, remove it.

4) Change 17.02.008 to your version (if different), installation directory (if different), the number after -np for the number of cores you want to use (note: these are all on local host), and obviously the names of macros and sims.
5) Open command prompt and change directory to your folder. This is easiest done by opening the folder, clicking in the address bar, typing cmd, and hitting enter.
6) Run batch file by typing its name and hitting enter.
7) If you want to terminate current sim or whole batch job, press Ctrl+C. If you want to view current sim, open Star-CCM+, right-click on your sim in Servers window and connect (then disconnect when done).
Wow you are amazing! that works perfectly, thanks a lot, you saved me from having to connect from home to save and start new simulation during nights and weekends! got a beer paid if you come to Barcelona

Quote:
Originally Posted by f-w View Post
7) If you want to terminate current sim or whole batch job, press Ctrl+C. If you want to view current sim, open Star-CCM+, right-click on your sim in Servers window and connect (then disconnect when done).
To be fair, I managed to execute it and I saw starccm was running on the task manager but I didn't know what it was doing... the connect to the server I did not know and that all now makes sense.
cramr5 is offline   Reply With Quote

Old   July 18, 2022, 06:10
Default
  #13
cwl
Senior Member
 
Chaotic Water
Join Date: Jul 2012
Location: Elgrin Fau
Posts: 437
Rep Power: 18
cwl is on a distinguished road
Quote:
Originally Posted by f-w View Post
1) Make sure your sims have batch autosave enabled (in File>Autosave).
I'd suggest using Simulation Operations - many (but not all) things can be automated within single simulation via that tool: saving simulation, exporting scenes etc.
cwl is offline   Reply With Quote

Old   July 18, 2022, 10:08
Default
  #14
Member
 
Marc Ricart
Join Date: Jul 2022
Posts: 65
Rep Power: 4
cramr5 is on a distinguished road
Quote:
Originally Posted by cwl View Post
I'd suggest using Simulation Operations - many (but not all) things can be automated within single simulation via that tool: saving simulation, exporting scenes etc.
thanks, you are right, that looks like a powerful tool to automate things
cramr5 is offline   Reply With Quote

Old   October 21, 2022, 18:13
Default
  #15
New Member
 
Join Date: Oct 2022
Posts: 1
Rep Power: 0
Pinx is on a distinguished road
Quote:
If you don't have macros for each sim and just want to run till stopping criteria, use:
Quote:
Code:
"C:\Program Files\Siemens\17.02.008\STAR-CCM+17.02.008\star\lib\win64\intel20.1vc14.2\lib\s tarccm+.exe" -power -np 2 -batch run Sim1.sim
"C:\Program Files\Siemens\17.02.008\STAR-CCM+17.02.008\star\lib\win64\intel20.1vc14.2\lib\s tarccm+.exe" -power -np 2 -batch run Sim2.sim
I'm using Stra-CCM+ 17.02.008-R8 version and I can't get it to work with this batch file.
Code:
"C:\Program Files\Siemens\17.02.008-R8\STAR-CCM+17.02.008-R8\star\lib\win64\intel20.1vc14.2-r8\lib\starccm+.exe" starccm+ -server -power -podkey MYPODKEY -licpath 1999@flex.cd-adapco.com -np 2 -batch run Star.sim
I open command prompt and go to the folder where I have the batch file and simulations and run the batch file.
I always get this error message:
Code:
Unable to start Simcenter STAR-CCM+.  Invalid file type.  Check arguments and their order.

Usage: starccm+ [-server] [<options> ...] [<simfile>]
Can anyone please tell me what am I doing wrong?
Pinx is offline   Reply With Quote

Old   October 22, 2022, 20:12
Default
  #16
f-w
Senior Member
 
f-w's Avatar
 
Join Date: Apr 2009
Posts: 159
Rep Power: 17
f-w is on a distinguished road
Quote:
Originally Posted by Pinx View Post
I'm using Stra-CCM+ 17.02.008-R8 version and I can't get it to work with this batch file.
Code:
"C:\Program Files\Siemens\17.02.008-R8\STAR-CCM+17.02.008-R8\star\lib\win64\intel20.1vc14.2-r8\lib\starccm+.exe" starccm+ -server -power -podkey MYPODKEY -licpath 1999@flex.cd-adapco.com -np 2 -batch run Star.sim
I open command prompt and go to the folder where I have the batch file and simulations and run the batch file.
I always get this error message:
Code:
Unable to start Simcenter STAR-CCM+.  Invalid file type.  Check arguments and their order.

Usage: starccm+ [-server] [<options> ...] [<simfile>]
Can anyone please tell me what am I doing wrong?
Looks like you copied the command from the GUI. If you compare your command to the example I posted, you'll find the difference (starccm+ -server is not needed, and -licpath 1999@flex.cd-adapco.com is not needed unless you're overriding the default with something else). See more info in the help file under Client-Server Setup > Command-Line Reference.

Before:
Quote:
C:\Program Files\Siemens\17.02.008-R8\STAR-CCM+17.02.008-R8\star\lib\win64\intel20.1vc14.2-r8\lib\starccm+.exe" starccm+ -server -power -podkey MYPODKEY -licpath 1999@flex.cd-adapco.com -np 2 -batch run Star.sim
After:
Quote:
C:\Program Files\Siemens\17.02.008-R8\STAR-CCM+17.02.008-R8\star\lib\win64\intel20.1vc14.2-r8\lib\starccm+.exe" -power -podkey MYPODKEY -np 2 -batch run Star.sim
f-w is offline   Reply With Quote

Old   November 17, 2022, 04:54
Default
  #17
Member
 
Marc Ricart
Join Date: Jul 2022
Posts: 65
Rep Power: 4
cramr5 is on a distinguished road
Quote:
Originally Posted by f-w View Post

If you have macros you'd like to run for each sim, use:
"C:\Program Files\Siemens\17.02.008\STAR-CCM+17.02.008\star\lib\win64\intel20.1vc14.2\lib\s tarccm+.exe" -power -np 2 -batch Sim1.java Sim1.sim
One question, If I have a Macro that will be called during the batch operation, when that macro will be called exactly? after all the "simulation operations" actions are finished or when exactly? is there a way to define it?

Also, can I add a "Simulation Operation" that calls a Macro? this way I can control when each macro is executed.

Thanks
cramr5 is offline   Reply With Quote

Old   November 17, 2022, 16:41
Default
  #18
f-w
Senior Member
 
f-w's Avatar
 
Join Date: Apr 2009
Posts: 159
Rep Power: 17
f-w is on a distinguished road
Quote:
Originally Posted by cramr5 View Post
One question, If I have a Macro that will be called during the batch operation, when that macro will be called exactly? after all the "simulation operations" actions are finished or when exactly? is there a way to define it?

Also, can I add a "Simulation Operation" that calls a Macro? this way I can control when each macro is executed.

Thanks

The batch macro is called when launching the simulation. Whatever you do in the macro is what's done to the simulation. The batch process (in this case) does not automatically run, mesh, or save; so, the macro must do this (except saving, you can also do this automatically via a tick mark in File>Autosave).

The macro you pass to the batch process can call other macros & execute sim ops (which themselves can call macros). It's macros all the way down, yo. So, in your case, just have the batch macro execute your sim op.

There's also a "run" batch command; however, it's equivalent to hitting run, and I don't think it executes sim ops (never tried it).
f-w is offline   Reply With Quote

Old   November 18, 2022, 08:05
Default
  #19
Member
 
Marc Ricart
Join Date: Jul 2022
Posts: 65
Rep Power: 4
cramr5 is on a distinguished road
Quote:
Originally Posted by f-w View Post
The batch macro is called when launching the simulation. Whatever you do in the macro is what's done to the simulation. The batch process (in this case) does not automatically run, mesh, or save; so, the macro must do this (except saving, you can also do this automatically via a tick mark in File>Autosave).

The macro you pass to the batch process can call other macros & execute sim ops (which themselves can call macros). It's macros all the way down, yo. So, in your case, just have the batch macro execute your sim op.

There's also a "run" batch command; however, it's equivalent to hitting run, and I don't think it executes sim ops (never tried it).
You mention that you can execute Macros with Simulation Operations? I don't see the option in there.
cramr5 is offline   Reply With Quote

Old   November 18, 2022, 15:21
Default
  #20
f-w
Senior Member
 
f-w's Avatar
 
Join Date: Apr 2009
Posts: 159
Rep Power: 17
f-w is on a distinguished road
Quote:
Originally Posted by cramr5 View Post
You mention that you can execute Macros with Simulation Operations? I don't see the option in there.
That was a misunderstood agreement with your question ("can I add a 'Simulation Operation' that calls a Macro?"). Since I never used sim ops, I thought your question implied that macros could be called by sim ops and you were asking if the batch macro could call such a sim op. Sounds like this is not the case, so my comment on this should be disregarded.

So, you must have been asking whether you can call macros within the batch macro itself? If so, then the answer is yes (as previously stated).
f-w 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
Unable to run OF in parallel on a multiple-node cluster quartzian OpenFOAM 3 November 24, 2009 14:37
serial run fine, but parallel run diverged phsieh2005 OpenFOAM Running, Solving & CFD 2 October 6, 2009 09:33
How to run InterFoam in steay state waynezw0618 OpenFOAM Running, Solving & CFD 0 November 10, 2008 08:08
Windows 64-bit, Distributed Parallel Run Issues... Erich CFX 3 March 28, 2006 17:36
Restatring run Tim CFX 2 March 3, 2006 12:54


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