CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   How to create a batch file (

Liam May 4, 2005 06:28

How to create a batch file
Hi there,

I have a queue of jobs that need to be solved one after the other while I am away from my pc for a period of time. I am trying to set up a batch job. I have all the .def file saved in a working directory. I am aware that I need to create a batch.bat file in which I will enter the .def files that I want to be solved.

My problem is this; I am unsure how I would go about creating a batch.bat file. I have look in the manual and tried the help tool in the command line.

Please help.

Kind Regards

Aziz May 4, 2005 09:31

Re: How to create a batch file
You need to save all your def file in the same directory with gtm file, infact you can have def file in different directory but the res file will the store from where you have started you batch file. Here is a small example i can recommend to you. Save these line into a file name file.bat

C:\Programme\CFX\CFX-5.7\bin\cfx5solve -def cfx1.def C:\Programme\CFX\CFX-5.7\bin\cfx5solve -def cfx2.def C:\Programme\CFX\CFX-5.7\bin\cfx5solve -def cfx3.def

If you have already a initial file you can write it after wards like

C:\Programme\CFX\CFX-5.7\bin\cfx5solve -def cfx1.def -initial out.res



Liam May 4, 2005 10:04

Re: How to create a batch file

Thank you very much for your reply, this was very helpful.

Kind Regards

Glenn Horrocks May 4, 2005 19:12

Re: How to create a batch file

If you generate the command line window using the CFX-Launcher (Tools/Command Line) then it knows the path to the executables and the command can be reduced to "cfx5solve -def cfx1.def -initial out.res".

Regards, Glenn Horrocks

Liam May 5, 2005 11:07

Re: How to create a batch file
Hi there,

This is true provided that you select the correct working directory in the cfx launcher before opening the command line from the tools menu.

Does anyone know what the command is for running a batch job using a parallel set-up (pvm). In serial mode it is:

cfx5solve -batch -def {name of def file}.def

But what does this become in order to run the job in parallel?

Any help would be greatly appreciated.

Kind Regards

Kiddo May 5, 2005 18:44

Re: How to create a batch file
cfx5solve -def Name.def -par-dist HostA,ClientB,ClientC *note :no space between "-par-dist" *But the Clients PCs should have been described in hosts.ccl

Glenn Horrocks May 5, 2005 18:58

Re: How to create a batch file
Hi Liam,

Once you have created the command window from the launcher you can cd to any directory you like and it still finds the executables. You do not have to have the launcher in the correct directory before creating the command window.

Glenn Horrocks

Liam May 9, 2005 06:38

Re: How to create a batch file
The command to run a job in batch that already has an initial results file is:

C:\Programme\CFX\CFX-5.7\bin\cfx5solve -def cfx1.def -initial out.res

Is 'initial out' replaced by the name of the initial results file? I know this might seem obvious but I just want to be sure.

Also, want command do you put in the batch file at the end in order to quit the batch file once all the models have been simulated? Is it:




Thank you very much for your help.

Aziz May 9, 2005 07:43

Re: How to create a batch file
out.res should be replaced by the result file of your last simulation, -initial is the key word and must be written before the name of result file

C:\Programme\CFX\CFX-5.7\bin\cfx5solve -def cfx1.def -initial lastsimulation.res

After the completion of simulation it will automatically exit from the batch mode so you dont need to specify any extra command.

Just an extra tip:

If you have many simulation in your batch mode and you want to stop before completion, start new dos mode, go to the working directory and write C:\Programme\CFX\CFX-5.7\bin\cfx5stop -directory cfx1_001.dir

This will stop your simulation in a proper way

best luck with your work


All times are GMT -4. The time now is 13:01.