CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   Batch in CFX 12 in Windows XP (

Jade M February 26, 2010 13:19

Batch in CFX 12 in Windows XP
I am fairly new to CFX. Can someone provide step-by-step instructions on submitting several runs serially in CFX 12? I am working in Windows XP.

Jinx February 26, 2010 18:27

This question has been discussed in various posts already. I use a .bat file in my project directory which contains the following commands:

cd .\Case1
"C:\Program Files\Ansys Inc\v110\CFX\bin\cfx5solve.exe" -def .\Case1.def
cd ..
cd .\Case2
"C:\Program Files\Ansys Inc\v110\CFX\bin\cfx5solve.exe" -def .\Case2.def -ini ..\Case1\Case1_001.res
cd ..
cd .\Case3
"C:\Program Files\Ansys Inc\v110\CFX\bin\cfx5solve.exe" -def .\Case2.def -ini ..\Case2\Case2_001.res
cd ..

Obviously you need to check the path of the solver for your system.
In this situation I have already created the various .def files for each case in it's own sub-directory. The batch file commands change the working directory, run the case and then return to the main directory.

Jade M March 3, 2010 16:35

Recognizing results in workbench
I think it worked. However, workbench does not recognize the results. I will compare the directory structure to a case that I ran in workbench. If you have any further suggestions, they are most welcome!

Thanks so much.

rikio March 3, 2010 20:28

Before run the .bat file, add the path of the cfx5solve into the environment variable list will eliminate the directory change command. No matter where you store the .bat file, the command can be simply as,
cfx5solve -def [name.def]

Jinx March 3, 2010 20:56

I'm not sure about the workbench commands so sorry! Obviously the commands I had given were for cfx11, but they should carry over to v12 OK. Can you be more specific on the workbench problem you have or the error message you get?

Regarding the use of the environment variable to define the path - it simplifies the start command but with the command I have given it still doesn't matter where the .bat file is stored. What is important is the working directory and unless this is specified in the .bat file, it will default to the location of the .bat file.
I had used the directory change commands simply to keep each different case in its own sub-folder. I just find this cleaner than having all case files in the one folder.

rikio March 4, 2010 01:27

Do not worry, John.
If the path was set to the environment variable, the .res file and .out file will locate at the same folder as the .bat file are.

Jade M March 8, 2010 17:04

Thanks everyone
12.1 says something about the information having been updated since last time. When I submitted my question to ANSYS tech support, the response was

I should have clarified that you can't really run CFX in batch using Workbench, or get Workbench to recognize the results afterwards. You can copy the results into the project directory and then drag a "Results" component to the project schematic, double click to load CFD-Post, and then manually load one of your RES files into CFD-Post. This Results component will then remember the RES file loaded as well as the state the next time you edit it.

I asked for clarification, as I'm new to CFX and don't really understand the files, the file structure, etc. yet. The response was

First, the only reason I suggest to copy the results into the project directory is so that you can archive the files as one package. There is no other real benefit in WB by keeping the files in there.

The CFX directory that you have shown is probably a good place to keep them. The WB project directory structure is pretty much designed to try to be non-intuitive and keep people out of it. FYI, You can see where your files are located if you go to the project page, View > Files. This will open a pane with a list of all of the files associated with the project. If you right click on one of the entries you can choose to "Open Containing Folder".

So I would just copy your results into this directory, and then you can go to the project page, expand the "Component Systems" section, drag in the "Results" object. Editing this cell will bring up CFD-Post, and from there you can do a File > Load Results to bring in your RES file data.

I'd love to get step-by-step instructions but so far, no go. I do not know what is meant by "copy your results into this directory." I'm not sure what the results are -- the .res file or the folder called "Fluid Flow 001"? And to what directory do I copy this file?

Any ideas? Thanks in advance for any help. Perhaps my question is very dumb but I do not know what to do here.

Jade M May 14, 2010 12:10

For any interested parties, one can get Workbench (WB) to recognize results after running in batch. In WB, in Toolbox under Component Systems, drag Results to the Project Schematic without linking to any project. Double click on Results. In Post, click File > Load Results. Browse to the directory where the batch job ran and select the .res file.

claco May 24, 2010 05:43

Dear All,

I'm currently involved in a shape optimization problem.
My question is: How can I save both residuals and some "User Point" (i.e.: mass flow rate or efficiency, that I have peviously defined) in a file (.txt etc.) that my optimizer engine can subsequently read?
Thank You in advance.

ghorrocks May 24, 2010 06:46

You can do this easily with the solver manager and a monitor point. You can right click on a chart and export the data in the chart. If you want to automate the process you can parse a file in the CFX temp directory, I forget its name but it is easy to find.

claco May 24, 2010 07:22

Thank You very much.
You saved me a huge amount of time.
A last question: in which directory can I find this template file?
Thank You.

ghorrocks May 24, 2010 07:37

It is not a template file, it is the monitor points datafile. I think it has the filename "mon". Note it only exists when a simulation is proceeding and gets deleted when it is finished (the data is stored as part of the results file). Look in the .cfx_tempdir to find it.

claco May 24, 2010 08:05

Ok ok,
I noted the presence of this file.
However, I cannot automate the procedure, yet.
As a matter of fact, this file cannot be opened during the simulation, and there is no possibility to change it in order to "Export Plot data" in batch mode.

ghorrocks May 24, 2010 08:15

That's just the windows file locking. You can get around that if you want.

I think there is also a command line to extract the monitor data, cfx5monitor or something. Check out the documentation about the command line tools to try to find it, or search the forum.

claco May 25, 2010 08:23

Thank You very much.
I was finally able to extract results by means of cfx5mondata.exe application.
Now I have another (final) problem: I launch cfx5solve in batch mode, but I cannot save the result file .res. How can I do it?
Thank You.

ghorrocks May 25, 2010 19:04

It should save the res file if it is working properly. Either you have turned saving of the res file off or the simulation has had a problem and is unable to save a res file.

Jade M August 20, 2010 15:33

Batch processing in CFX 12.1
Please find below step-by-step instructions for batch processing in Workbench 12.1

- Define the problem in Workbench (build geometry in DM, mesh in Mesh and assign BCs in Pre)
- In Workbench, double click on Solution to launch Solver Manager which generates the definition (.def) file; close Solver Manager as the Solution need not be run but needs to be launched to create the file; old .cfx and .def files are deleted and new ones are created
- Backup the project, since the cells in the CFX analysis system can no longer be opened after the proceeding changes
- Search in the files folder for the definition file which will be in the folder for the design point and then subfolder CFX and another subfolder CFX; for example, for design point 0, the directory path will end in \dp0\CFX\CFX
- Create a text batch file with the extension .bat with the following, where Fluid_Flow.def is the definition file generated by Solution and has no spaces
cd C:\your_directory_path
"C:\Program Files\Ansys Inc\V121\CFX\bin\cfx5solve" -batch -def Fluid_Flow.def
- For multiple cases, simply repeat these two lines with the appropriate director path and file name for each case
- To run, double click on the batch file
- In Workbench, under Toolbox and Component Systems, drag Results to the Project Schematic without linking to the CFX analysis system; double click on Results, click File > Load Results, and browse to the directory where the batch job ran and select the .res file; alternatively, view in CFD-Post standalone as done prior to Workbench

rideway February 8, 2012 17:51

I am trying to make different run with different initial conditions. I saved a *.ccl file with all the system parameters, and then created different variations with different temperatures.

I tried to run a batch file with the following line:
"C:\Program Files\Ansys Inc\V121\CFX\bin\cfx5solve" -batch -def Fluid_Flow.def -initial ic.ccl

and i get this error


An error has ocurred in cfx5solve:
Error reported by IO module: iif_open: the file is not in CFX-5.x format.

An error has ocurred in cfx5solve:
Error reported by IO module: iocnt: open the primary file failed

An error has ocurred in cfx5solve:
Error from IO module while opening C:/FEM/ic.cll:
"iocnt: open the primary file failed"

IO_RAD_FILE<20>: Invalid def/res file. File could be corrupted

I found the answer so I edit my mesage.

I was confusing initial files with ccl files...

changed the batch code to
"C:\Program Files\Ansys Inc\V121\CFX\bin\cfx5solve" -batch -def Fluid_Flow.def -ccl ic.ccl

and seems to be working :)

alikhube February 6, 2013 10:29

Where ???
Where we must type this comment for create batch file???
cd C:\your_directory_path
"C:\Program Files\Ansys Inc\V121\CFX\bin\cfx5solve" -batch -def Fluid_Flow.def
And another questin, I have ANSYS 13.0 and it creates Fluid Flow cfx.def not Fluid_Flow.def

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