|
[Sponsors] |
Simple Java question - close & save simulation |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 16, 2012, 09:58 |
Simple Java question - close & save simulation
|
#1 |
Senior Member
Join Date: Dec 2010
Posts: 135
Rep Power: 16 |
hi guys
with which command can I tell Star-CCM+ to save and close a simulation file after doing some post processing actions? Thanks |
|
May 16, 2012, 12:07 |
|
#2 | |
Senior Member
Ryne Whitehill
Join Date: Aug 2009
Posts: 312
Rep Power: 19 |
Quote:
sim.saveState(resolvePath(simulationname+"_VMesh.s im")); just two snippets from a macro I have |
||
May 16, 2012, 22:17 |
|
#3 |
Senior Member
Join Date: Oct 2009
Location: Germany
Posts: 636
Rep Power: 22 |
When running in batch mode, the simulation will be closed automatically when the end of the macro is reached. Therefore you need only to trigger the save on your own before the macro ends. rwryne already posted the solutution how to do that.
When running in server mode (opened the simulation via GUI or with the -server command line option), it will not be closed. Not sure if it can be done with a macro at all.
__________________
We do three types of jobs here: GOOD, FAST AND CHEAP You may choose any two! |
|
May 17, 2012, 13:25 |
|
#4 | |
Senior Member
Join Date: Dec 2010
Posts: 135
Rep Power: 16 |
Quote:
|
||
May 18, 2012, 09:43 |
|
#5 |
Member
Ryan Coe
Join Date: Jun 2010
Location: Albuquerque, NM
Posts: 98
Rep Power: 16 |
Like abdul mentioned, those lines will not close the simulation. Is there some reason why you need the GUI and do not want to use batch mode? Unless you need the GUI open for some reason, just run the simulation in batch mode and it will close automatically. You can call the java macro directly from the run command (ie <folderpath>/starccm+ -batch <yourjavascript.java> <simulationname.sim>).
__________________
Ryan |
|
May 21, 2012, 05:24 |
|
#6 | |
New Member
Matthias Fitl
Join Date: Mar 2009
Location: Austria
Posts: 21
Rep Power: 17 |
Quote:
Macro RunModel.java // STAR-CCM+ macro: start_ccm.java package macro; import java.util.*; import star.common.*; import star.base.neo.*; public class RunModel extends StarMacro { public void execute() { Simulation simulation_0 = getActiveSimulation(); simulation_0.getSimulationIterator().run(true); simulation_0.saveState(getSimulation().getPresenta tionName()+".sim"); simulation_0.close(ServerConnection.CloseOption.Fo rceClose); } } Runs, saves and forces the simulation to close. Regards, Matthias |
||
May 21, 2012, 06:37 |
|
#7 |
Senior Member
Join Date: Dec 2010
Posts: 135
Rep Power: 16 |
Yes, thatīs what I want, thank u!
|
|
May 30, 2012, 05:03 |
|
#8 | ||
Senior Member
Join Date: Dec 2010
Posts: 135
Rep Power: 16 |
Ok, i am having an issue again, i wanted to create a script which opens alls *.sim files in folders and subfolders, deletes mesh and solution data saves the files in the correct path in batch mode: The script is working and opening all *.sim files, btu jsut the first folder level is saved correctly without mesh and solution data. The *.sim files in the sub folders are not saved without mesh and solution data. Can u help me?
the Linux bash script: Quote:
Quote:
|
|||
September 5, 2013, 10:45 |
|
#9 | ||
Member
Roman
Join Date: Mar 2011
Posts: 46
Rep Power: 15 |
I figure I will resurrect an old topic to post my solution to the problem.
Bash script is made for Linux systems, but feel free to use the java macro on Windows as well. Bash script will recursively search for .sim files, reset the solution, remove the grid and save them. Afterwords, it will search through the folders again and delete .sim~, which are linux backup files. Bash, recursive search Quote:
Quote:
|
|||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Very simple question | Vashishth Patel | CFX | 10 | November 8, 2011 05:26 |
[TGrid] Simple Question (Simple Answers?): Edge Length adjustment for tet mesh | booz | ANSYS Meshing & Geometry | 0 | August 29, 2010 13:39 |
Wall boundary condition (a very simple question) | safa_c | FLUENT | 1 | August 15, 2010 06:05 |
simple question about calculated bc | hyperion | OpenFOAM | 0 | August 14, 2010 15:05 |
A Simple Question | Thomas P. Abraham | Main CFD Forum | 3 | September 6, 1999 19:19 |