CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Queueing the simulations (https://www.cfd-online.com/Forums/cfx/26201-queueing-simulations.html)

CFDLife August 1, 2008 17:07

Queueing the simulations
 
I am running my simulations on Intel dual core processor (windows based). I have parallel licensing using.

Is there a way I can queue up a few runs, so that the machine can keep working even when i am away?

In other words, how do i create a batch file to run in ANSYS CFX to queue up the simulations.

I read other post where it was mentioned but i guess it was for cfx5 and doesnt work in ANSYS CFX.

Thanks in advance

Rogerio Fernandes Brito August 1, 2008 18:45

Re: Queueing the simulations
 
there is a way u can queue up a few runs, then the machine can keep working even when i am away! I just decrease the priority of run, task bar of windows, using low!


Amit Roghs August 2, 2008 04:16

Re: Queueing the simulations
 
Write the following perl program to have a batch mode run in sequence.

use strict;

system "cfx5solve -def your file name.def";

system "cfx5solve -def your second file name.def";

After writing the above text in a notepad save it as .pl file extension & give the file name what you wish, I am taking sample.pl

Then type the following in the command prompt of CFX in your working directory of above files.

perl sample.pl

The run will start automatically & when first run is over the other will start automatically.

Do let me know if you have any queries.

Regards,

Amit Roghs

Glenn Horrocks August 3, 2008 18:37

Re: Queueing the simulations
 
Hi,

Rogerio's suggestion is a very poor way of doing it. It uses many licenses and also fills up your system memory. Amit's posting shows how to do it using perl but it is much easier to just write a simple batch (Windows) or shell script (unix/linux) and queue them that way.

eg, in windows create a file called "doruns.bat" which contains: cfx5solve -definition run1.def cfx5solve -definition run2.def cfx5solve -definition run3.def cfx5solve -definition run4.def

Run the batch file (using a command line started from the CFX launcher window) and they will be queued up.

Glenn Horrocks

CFDLife August 4, 2008 16:18

Re: Queueing the simulations
 
Thanks to all of you, I did what u suggested.

When I run the perl in the command prompt, it says - 'perl' is not recognized as an internal or external command, operable program or batch file.

Is there any solution to this problem?

Amit Roghs August 5, 2008 01:07

Re: Queueing the simulations
 
You should run the perl from the Ansys CFX command prompt.

CFDLife August 5, 2008 09:13

Re: Queueing the simulations
 
Ok..Here is what i did:

Open a *.cfx file in ANSYS CFX-Pre. Clicked on Tools - > Command Editor Wrote sample.pl and Hit Process (My file name is sample.pl)

I got an error saying

CCL parser failed with message parseCCLineH: syntax error near sample.pl

Glenn Horrocks August 5, 2008 20:13

Re: Queueing the simulations
 
Hi,

Unless you are going to use the functionality of perl (looping, if/then, subroutines etc) then forget perl and use a simple batch script. If all you want to do a sequence of simulations it is much easier.

Glenn Horrocks

Amit Roghs August 6, 2008 00:21

Re: Queueing the simulations
 
Dude you dont have to do that in *.cfx

I will write down the steps below.

1.Open the Ansys CFX Launcher(not ansys CFX Pre)

2.Go to Tools

3.There you have any option of command prompt.

4.Once you click it there will be a DOS window opening.

5.After that you gotta write perl sample.pl

6.The job will start running automatically.

7.You wont be able to see it directly.

8.Now open the CFX Solver.

9.Go to File Menu,click Monitor Run in Progress.

10.Give path to the working directory where it is being run.

11. You will be able to see the run convergence and the run details as usual.

If you still dont get the procedure then do let me know.

Regards,

Amit Roghs

AGP December 1, 2014 16:42

Is there any way to do the same thing in FLUENT?

ghorrocks December 2, 2014 00:54

Fluent can be run from the command line so you can do it there. I suspect it can also be run through workbench so that is another way. You can also use batch scheduling software like PBS of LSF.

Try the fluent form for details.

ZakBristol February 25, 2016 20:42

I have created this batch file , and I got this error.

Unknown command line option year


cfx5solve -definition G:\Final Year Project\Different Pitch\-6.25 -6.25Degree.def
cfx5solve -definition G:\Final Year Project\Different Pitch\-7.5\-7.5Degree.def
cfx5solve -definition G:\Final Year Project\Different Pitch\-8.75\-8.75Degree.def

ghorrocks February 25, 2016 20:45

Your file path has spaces in it. This confuses the command line interpreter. So put your path in quotes:

cfx5solve -definition "G:\Final Year Project\Different Pitch\-6.25 -6.25Degree.def"

Thomasbr June 23, 2016 10:21

Hello,

this topic is pretty old, but as I have a question which relates to it... (I searched the web and the forum but couldn't really find what I was looking for as the Scripting things are not very familiar...)

Let us say I want to queue up 3 simulations using a Batch (or Perl) file as suggested by ghorrocks (in the simulations only one Parameter is modified, for instance the 1st with Viscous Work, the 2nd without, and the third with High Speed Compressible Wall Heat Transfer).

I need to do this for the week-end because I cannot go to work during it, I would like to start Simulation 1 on friday in the afternoon and then when S1 is finished, I'd like that S2 starts automatically right after and then so does S3.

Should I make 3 different projects, which results in:
  • U:\Thomas\Simulation1_files\dp0\CFX\CFX\Fluiddynamik CFX.def
  • U:\Thomas\Simulation2_files\dp0\CFX\CFX\Fluiddynamik CFX.def
  • U:\Thomas\Simulation3_files\dp0\CFX\CFX\Fluiddynamik CFX.def
Should I make 1 project with 3 duplicated jobs in it, which results in:
  • U:\Thomas\Simulations_files\dp0\CFX\CFX\Fluiddynamik CFX.def
  • U:\Thomas\Simulations_files\dp0\CFX-1\CFX\Fluiddynamik CFX.def
  • U:\Thomas\Simulations_files\dp0\CFX-2\CFX\Fluiddynamik CFX.def
Or even something else?
Because with the two things I propose, the *.def files are never in the same directory.

Cheers,
Thomas

ghorrocks June 23, 2016 19:47

This is simple:

cd /path/to/first/directory
cfx5solve -def DefinitionFile1.def
cd /path/to/second/directory
cfx5solve -def DefinitionFile2.def

etc

Thomasbr June 24, 2016 09:18

1. Thanks again for your reply Glenn: I managed to make something work, but only with the command line of the CFX Launcher.

I pasted this into the command prompt (displayed after I launched it via CFX launcher):


cd U:\Thomas\Simulation1_files\dp0\CFX\CFX
cfx5solve -def "Fluiddynamik CFX.def"

cd U:\Thomas\Simulation2_files\dp0\CFX\CFX
cfx5solve -def "Fluiddynamik CFX.def"

and both simulations are launched one after another as wanted :)




2. The Batch file doesn't work and if I try to do it manually with the command prompt launched via cmd.exe (and not via the CFX Launcher) it doesn't work either because it seems that it doesn't understand 'cfx5solve'.
But as the other method works, it's ok to me.

Batch file:
------------------------------------------------------------------
u:
REM I need to change the drive from C:\ to U:\ first

cd U:\Thomas\Simulation1_files\dp0\CFX\CFX
cfx5solve -def "Fluiddynamik CFX.def"

cd U:\Thomas\Simulation2_files\dp0\CFX\CFX
cfx5solve -def "Fluiddynamik CFX.def"

------------------------------------------------------------------

3. Do you know how to tell CFX to use "Double Precision"? I tried this (as I could read it in the documentation):



cfx5solve -def "my file.def" [-double]

But [-double] is not recognized.

-Maxim- June 24, 2016 09:26

You either need to launch it from CFX' command line or add the full path to the cfx5solve.exe:
Code:

"C:\Program Files\ANSYS Inc\v171\CFX\bin\cfx5solve.exe" -batch -double -par-local -partition NUMBER OF CPU CORES -def yourDEF.def -cont-from-file "path/to/old/result.res" -priority 1
If you set the whole path in "", you won't get problems with spaces in the path name.

In windows batch (launching from cmd.exe) you could work with "variables" as well:
Code:

SET ansyspath="C:\Program Files\ANSYS Inc\v171\CFX\bin\cfx5solve.exe"
and then call the variable with
Code:

%ansyspath% -def YOURDEF.def etc
edit: additional, you could launch your files from anywhere without have to "cd" into the right directory by just using the full path to your def file:
Code:

"C:\Program Files\ANSYS Inc\v171\CFX\bin\cfx5solve.exe" -batch -double  -par-local -partition NUMBER OF CPU CORES -def "U:\Thomas\Simulation1_files\dp0\CFX\Fluiddynamik CFX.def"

Thomasbr June 24, 2016 09:58

Thank you very much Maxim :)

I did not know these tricks (sorry for being such a newbie) and it helps me a lot!

Thomasbr June 27, 2016 05:30

Hello,

it worked thanks again :) The 3 results files are available to be analysed which is rather pleasant.
But it seems something went wrong with the Double Precision: below is the beginning of the .out file:

Quote:

This run of the CFX Release 16.0 Solver started at 16:17:34 on 24 Jun
2016 by user thomasb on CAD-103-3 (intel_xeon64.sse2_winnt) using the
command:

"C:\Program Files\ANSYS Inc\v160\CFX\bin\perllib\cfx5solve.pl" -def
"U:\Thomas\triplette-test_files\dp0\CFX\CFX\sans viscous work.def"
-double

Release 16.0

Point Releases and Patches installed:
ANSYS, Inc. Products Release 16.0
ANSYS Mechanical Products Release 16.0
[...]

Setting up CFX Solver run ...

+--------------------------------------------------------------------+
| |
| CFX Command Language Upgrade |
| |
+--------------------------------------------------------------------+
Added /SIMULATION CONTROL/EXECUTION CONTROL/EXECUTABLE SELECTION/Double
Precision = Off
.

+--------------------------------------------------------------------+
| |
| CFX Command Language for Run |
| |
+--------------------------------------------------------------------+
LIBRARY:
MATERIAL: Air Ideal Gas
[...]
What do you think?
Does it really mean that the calculations have been performed using simple numerics precision? :(



EDIT: I definitely think yes, because there is a huge difference in the calculation time (and therefore in the number of time steps and the values of them).

With the same mesh I have:

Double Precision Enabled (old Simulation)
13 hours calculation time, 12500 timesteps, last timestep=6,77e-07s

Double Precision Off (simulations performed in the week end)
9 hours calculation time, 8700 timesteps, last timestep=2,2e-05s

---> Though RMS criterion <1e-4s is in both cases fulfilled, the Courant Number with Single Precision Numerics gets rather high

ghorrocks June 27, 2016 06:56

Yes, you are correct - you have not used the -double argument correctly so it has not been activated. Please post your batch file and we will try to help you.

Thomasbr June 27, 2016 07:11

This is a copy and paste of the .bat file I used:

Code:

SET ansyspath="C:\Program Files\ANSYS Inc\v160\CFX\bin\cfx5solve.exe"
 
%ansyspath% -def "U:\Thomas\triplette-test_files\dp0\CFX\CFX\sans viscous work.def" -double
 
%ansyspath% -def "U:\Thomas\triplette-test_files\dp0\CFX-2\CFX\sans viscous work.def" -double
%ansyspath% -def "U:\Thomas\triplette-test_files\dp0\CFX-1\CFX\sans viscous work.def" -double


ghorrocks June 27, 2016 07:15

I can't see why that would not activate double precision.

You can also set double precision in the def file in CFX-Pre or by using CCL.

If you look at the CCL required to set a run to double precision you will find it is only a few lines. So you can write that the the def file using the -cc flag. This way you don't need to regenerate your def files.

-Maxim- June 27, 2016 07:45

mmmh that's strange. I just checked one of my recent out-files and I found the same note in the beginning
Quote:

Setting up CFX Solver run ...
+--------------------------------------------------------------------+
| |
| CFX Command Language Upgrade |
| |
+--------------------------------------------------------------------+
Added /SIMULATION CONTROL/EXECUTION CONTROL/EXECUTABLE SELECTION/Double
Precision = Off.
But then it follows with
Quote:

+--------------------------------------------------------------------+
| |
| CFX Command Language for Run |
| |
+--------------------------------------------------------------------+
[.....]
SIMULATION CONTROL:
EXECUTION CONTROL:
EXECUTABLE SELECTION:
Double Precision = Yes
and I checked with "edit run in progress" in the solver manager - double is clearly activated here. I wrote an email to my CFX support guy asking him about that. I'll report back as soon as I have a response.

Thomasbr June 27, 2016 08:34

@ Glenn: thanks for this interesting Information, I'm going to try that and check if there is a difference.

@ Maxim: I have the same thing too: further in the .out file states "Double Precision = Yes". Thanks for the Report.


I might have spoken too fast with the remark on the Duration time, because the 3rd Simulation needed 13 hours, 13124 timesteps and the last timestep was 6,9757e-7s. So it could be that all 3 simulations were performed with Double Precision and that the only parameter that I change has a big impact on the duration time. Apparently disabling the "Viscous Work Term" (which I can understand because the equations become simpler) or enabling the "High Speed Wall Heat Transfer Model" (when Thermal Energy is checked) need much smaller timesteps and therefore smaller calculation time. In the 3rd simulation, Viscous Work Term was enabled and High Speed HT Model was disabled.

-Maxim- June 28, 2016 02:04

so my CFX support (not from Ansys directly but certified support) answered that he had the same 'problem' before but since "double precision" shows up in the CCL and gets activated during the run, he just ignored the first message so far.
I know, it's not the answer we wanted hear... Maybe you ask Ansys support directly?

Thomasbr July 7, 2016 03:56

Hello Maxim,

thanks for the feedback. I think I will make do. Contacting the Support seems a little bit laborious when you don't have any information (log in, password, information on the license, etc.), because I'm only a student in an Institut.

But well if I have time in the oncoming weeks, I could try to do something with the IT guy of the institut to contact Ansys directly.

cysanghavi October 20, 2016 10:29

Batch run
 
I want to run two simulations in two different folders.
It works when the folders are same.
I tried the above suggestions and got the error as following:
Backlash found where operator excepted at run.pl line 3, near "user"


My run.pl file reads as follows:
# ! perl -w
cd G:\Softwares\MAGNiTUDE
print "Running the 1st simulation\n";
system "cfx5solve -def Unnamed.def";

cd G:\Fraunhofer\Report
print "Running the 2nd simulation\n";
system "cfx5solve -def Unnamed1.def";

What is that I am doing wrong. ?

ThalesMachado September 26, 2017 10:51

I have a related problem. I’m running a large number of simulations, let’s say 100.
Then I wrote a perl script which I’m able to initialize from CFX prompt. It works fine.

However, now, I’m willing to run these simulations on a bigger cluster which allows me only to initialize the simulation with a shell script. For instance, now I have to specify the number of cores on my shell script.
Does any of you know how to run my perl script through a shell script?
On my perl, I was specifying the number of cores, simulations and so on.

leee January 15, 2018 18:50

Quote:

Originally Posted by ghorrocks (Post 606747)
I can't see why that would not activate double precision.

You can also set double precision in the def file in CFX-Pre or by using CCL.

If you look at the CCL required to set a run to double precision you will find it is only a few lines. So you can write that the the def file using the -cc flag. This way you don't need to regenerate your def files.

Hi. The same problem araised for me. I activated the double precision through CFX-Pre. But the real problem for me is, when I try to run the cfx solver in interactive mode using the .bat file, the solver manager opens up , but the run is not executed .
Please do help me out from this

tchavdarov May 21, 2018 12:17

How to write different *def files? - Within Workbench or out of it. In Workbench if I clone the model I still have only one *.def file prior execution of the cloned models.
Is there any simple way to change a number in the *.def file. For example the mass flow rate?

Please ignore this question. I found the way via CFX Solver Manager/Edit CFX Solver File browse and open the *def file.

Gert-Jan May 21, 2018 13:05

Outside Workbench. Use the CFX-launcher.
Open the case in Pre and write as many definition files as you can.
Then run them manually using the solver manager or automatically using a batch file.

elia_l November 6, 2018 10:32

Hi all,
I just noted that launching .bat file through CFXlauncher (Tools > Command line) cfx5solver runs all .def files one by one, but in background. Could be possible do the same, but opening also the usual solver window showing monitors and logs?! Possibly writing some command line in batch file or cmd window...


Thanks to all in advance

-Maxim- November 6, 2018 10:42

open solver manager and use option "monitor run in progress". Select the .dir directory where your current simulation is running. That should give you all the monitors and the out file

elia_l November 6, 2018 11:20

Thanks a lot MAXIM. It was simpler then I thought


All times are GMT -4. The time now is 05:17.