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

Stop in macro loop ?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 28, 2011, 04:36
Default Stop in macro loop ?
  #1
New Member
 
Dave Binbin
Join Date: Nov 2011
Posts: 4
Rep Power: 5
binbinhfr is on a distinguished road
Hi,

i run my simulation thru a macro that contains a "for" loop
calling the solver.step() at each iteration. But when I press the
STOP button in the STAR interface, the program seems to
exit from the current solver.step() call, but not from the loop
within the macro... So is there a way to test in the macro that
the STOP button or "user cancel" has been called ?

thanks for your help.

Dave.
binbinhfr is offline   Reply With Quote

Old   November 28, 2011, 19:50
Default
  #2
Senior Member
 
Join Date: Oct 2009
Location: Germany
Posts: 637
Rep Power: 12
abdul099 is on a distinguished road
You can abort the macro execution by clicking on this little red button with the white cross. It's not in the menu bar but on the left above the property windows, where the status bar could be found.

Another option would be to check for stopping criterias in your loop. Especially the stop file is nice, you just need to create an empty file with the name "ABORT" and the simulation stops after the next iteration or time step. The advantage is, it also works when you run the simulation in batch mode...
abdul099 is offline   Reply With Quote

Old   November 29, 2011, 05:27
Default
  #3
New Member
 
Dave Binbin
Join Date: Nov 2011
Posts: 4
Rep Power: 5
binbinhfr is on a distinguished road
Thank you for the "red cross button" tip, I did not know that it was different from the classic STOP button in the menu bar...

Concerning the ABORT file, I already tested it, but it just force the code to exit the current Solver.Step() call in the macro, but does not exit the macro itself, and the for-loop continues...

I just wonder if there is a way in this macro to catch the fact that in the previous solver.step() call, the user pressed the stop button...
binbinhfr is offline   Reply With Quote

Old   December 3, 2011, 14:06
Default
  #4
Senior Member
 
Join Date: Oct 2009
Location: Germany
Posts: 637
Rep Power: 12
abdul099 is on a distinguished road
Just check in your loop header (assuming it's a while or do-while loop) for the stopping criteria. When the stop file stopping criteria is satisfied, the loop shouldn't be executed again.
But the macro itself will not check if there are buttons pressed, since the macro is completely independent from the GUI. Otherwise you would get a big problem when running in batch mode.
abdul099 is offline   Reply With Quote

Old   December 6, 2011, 08:27
Default
  #5
New Member
 
Dave Binbin
Join Date: Nov 2011
Posts: 4
Rep Power: 5
binbinhfr is on a distinguished road
that's precisely what I don't know how to do :
I have a for loop in my macro, but what is the way to check by java if the file stopping criteria is satisfied ?
binbinhfr is offline   Reply With Quote

Old   January 2, 2012, 21:09
Default
  #6
Senior Member
 
Join Date: Oct 2009
Location: Germany
Posts: 637
Rep Power: 12
abdul099 is on a distinguished road
I can't access the API right now, therefore I can't guarantee for the syntax. Maybe you need to adjust it, but that's some (really simple) framework how to do that.


the usual stuff your macro needs to do before it hits the loop
......
StopFileStoppingCriterion stopFile = (StopFileStoppingCriterion) simulation_0.getStoppingCritetrionManager().getSto ppingCriterion("Stop File");
while(!stopFile.getIsSatisfied()) {
some stuff your macro should do within the loop
}
....
some stuff your macro might need to do after finishing the loop
abdul099 is offline   Reply With Quote

Old   January 3, 2012, 04:50
Default
  #7
New Member
 
Dave Binbin
Join Date: Nov 2011
Posts: 4
Rep Power: 5
binbinhfr is on a distinguished road
thanks for your help, I'm using a test of file existence on teh ABORT file, but I will try your suggestion that seems cleaner.
binbinhfr is offline   Reply With Quote

Old   February 18, 2013, 16:31
Default
  #8
Member
 
Ryan Coe
Join Date: Jun 2010
Location: Albuquerque, NM
Posts: 98
Rep Power: 7
ryancoe is on a distinguished road
I added this feature to a macro of mine, here's the actual code:

Code:
AbortFileStoppingCriterion stopFile = ((AbortFileStoppingCriterion) sim.getSolverStoppingCriterionManager().getSolverStoppingCriterion("Stop File"));
while (!stopFile.getIsSatisfied()) {
// Do in loop
}
__________________
Ryan
ryancoe is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Gmsh nishant_hull Open Source Meshers: Gmsh, Netgen, CGNS, ... 19 July 31, 2015 05:10
Star-cd Macro Loop Results SMM STAR-CD 6 May 2, 2011 20:27
my stl surface is seen as just a line rcastilla OpenFOAM Meshing & Mesh Conversion 2 January 6, 2010 02:30
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 15:57
CFX TASCflow - while-endwhile loop ina macro Deepak Ganga CFX 0 September 6, 2003 22:21


All times are GMT -4. The time now is 10:38.