Run macro for Multiple file
Hi, unfortunately at now i am only a beginner of Star CCM +. I want get the WSS tecplot (.plt) solution from 160 simulation files. It's a big work, so I created a macro that can be run by a batch file, with 160 lines.
Code:
// STAR-CCM+ macro: export.java I hope that it's all clear. Thank you in advance |
It's no good idea to run 160 files simultaneously. I assume, we aren't talking about exporting models with 500 cells, so keep the available ressources in mind!
What you want to do would require 160 licenses, 160 CPU-cores, enough memory for all 160 processes, enough memory bandwith to prevent the processes from blocking each other and the hard disk would be excited to read and write 160 files at the same time. When the job is small, it shouldn't harm to do it serial. When the job is big, you have to do it serial. To run it, I would just write a shell script or a few lines in awk which executes this macro on all 160 sim-files. Something like you already did, is this right? When you've got enough computational ressources, you might split it up to 2 or more shell scripts, each handling 80 (or less) sim-files. But don't try to do more jobs at the same time than you've got CPU-cores available on the machine. |
Yes excuse me, my bad English.
I used a wrong word, exactly I wanted to say one by one. ok? I want to avoid a batch with 160 macro request, so I asked if it's possible to modify my macro, in order to automate the export process for all my files, NOT SIMOULTANEOUSLY (excuse me), but ONE BY ONE. |
Okay, in this case sorry for the misunderstanding.
You CAN do it by modifying the macro. But I recommend to do it via batch script. It will finish one run and start the next, exactly like you want it. And it's easier to do it this way, because otherway you would have to open one simulation to executes the macro and opens another one. That can get tricky and is more prone to errors. Do you know how to run a simulation in batch mode? With a command like starccm+ -batch #yourMacro.java #yourSimFile (there might be additional commands like number of CPU's, remote shell etc, depending on your system) Now you don't run it by typing the command by hand, but just put it in a shell script which executes the command line above on several sim-files. On Monday I can post an example how I did this on our cluster, it's essentially only a shell script (on a Linux system). But on a windows system it's pretty much the same. |
Thank you Abdul, I just knew about macro in batch mode,but my problem is that I have hundreds of files that need hundreds of batch rows :(.
Today I will write the batch, only for don't waste the time. I thank you another time Abdul for you availability |
Well, when there's a naming convention like simFile001.sim, simFile002.sim etc it should be easy to write the shell script. Otherwise you might just get every file in a specified directory and pass it to the command line.
On Monday I could maybe provide you with some awk lines. I used it to convert hundreds of pictures, but in principle it's similar to your problem: Get a file and pass it's name as argument to a command line. When you would like to modify the java macro, you also would need some referene to the sim-file. Maybe it can be done with a collection of all files in a directory. Then use a short for-loop iterating over the collection to load the sim-files... The command in the macro to load a simulation from an existing sim-file should be Simulation xxl = new Simulation(PathToSimFile); with xxl as simulation reference. I haven't tried it, so you have to try on your own if it works. |
An example of how to run multiple simulation files consecutively using a macro is given in the help files. Just search for it. However, it will not work as it is if you only got a single license because it will try to start two servers.
You have to add Simulation sim = getActiveSimulation(); sim.kill(); at the beginning of the startAndRun function. |
All times are GMT -4. The time now is 06:25. |