{"id":88,"date":"2020-08-03T18:19:49","date_gmt":"2020-08-03T17:19:49","guid":{"rendered":"http:\/\/ri.itservices.manchester.ac.uk\/csf4\/?page_id=88"},"modified":"2025-10-28T07:33:34","modified_gmt":"2025-10-28T07:33:34","slug":"fluent","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/software\/applications\/fluent\/","title":{"rendered":"Fluent"},"content":{"rendered":"<h2>Overview<\/h2>\n<p>Ansys Fluent is a computational fluid dynamics application. Fluent version v19.3 (i.e. 2019r1) is available.<\/p>\n<div class=\"warning\">\nCSF3 users please note:<\/strong> it is NOT possible to run the <code>fluent<\/code> command on the CSF4 login node to have it automatically submit a batch job. You <strong>must<\/strong> write your own jobscript and submit it using the <code>sbatch<\/code> command. See below for example jobscripts.<\/div>\n<h2>Restrictions on Use<\/h2>\n<p>Only users who have been added to the Fluent group can run the application. Owing to licence restrictions, only users from the School of MACE and one specific CEAS Research Group can be added to this group. Requests to be added to the Fluent group should be submitted please <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/help\/\">via our form<\/a>.<\/p>\n<p>The maximum job size is 16 cores (this is a limitation imposed by the license).<\/p>\n<p>Fluent jobs must not be run on the login node. If you need to run an interactive job please use <a href=\"\/csf4\/batch\/srun\/\">srun<\/a> as detailed below.<\/p>\n<h2>Set Up Procedure<\/h2>\n<p>Once you have been added to the Fluent group, you will be able to access the executables by using <em>one<\/em> of the following module commands:<\/p>\n<pre>\r\nmodule load fluent\/2024R2\r\nmodule load fluent\/2022R1\r\nmodule load fluent\/19.3\r\nmodule load fluent\/19.2<\/pre>\n<h2>Required Input Files<\/h2>\n<p>To run a fluent job you will need a fluent <em>journal<\/em> file, a fluent <em>case<\/em> file and usually a <em>data<\/em> file which the case file will load.<\/p>\n<h3>Journal (.jou) files<\/h3>\n<p>The journal file can be created either by asking fluent to write it while using the fluent GUI (which can be run from the CSF or from a desktop PC installation). Alternatively, the journal file can be written by hand. This is common &#8211; they are often very simple files which load the case and data files, then start the simulation. Here are two examples:<\/p>\n<p>For transient cases:<\/p>\n<pre>rc <em>filename<\/em>.cas\r\nrd <em>filename<\/em>.dat\r\nsolve dual-time-iterate 40000 200\r\n<\/pre>\n<p>where 40000 is the number of time steps and 200 is the max number of iterations per time step.<\/p>\n<p>For steady-state cases. This also demonstrates how to use <code>gzip<\/code> compressed <code>.cas<\/code> and <code>.dat<\/code> files:<\/p>\n<pre>rc <em>filename<\/em>.cas.gz\r\nrd <em>filename<\/em>.dat.gz\r\nit 200\r\n<\/pre>\n<p>where 200 is the number of iterations. The case and data files were first compressed using the following commands to reduce the size of the files. When the job runs, Fluent will be able to uncompress the files to read them:<\/p>\n<pre>gzip <em>filename<\/em>.cas\r\ngzip <em>filename<\/em>.dat\r\n<\/pre>\n<h3>UDF Files<\/h3>\n<p>If you need to compile a <em>User Defined Function<\/em> (UDF) file, this should be done on the CSF. Fluent will usually do this automatically when your job runs provided you have saved the <em>case<\/em> file with the UDF enabled in the GUI (See the <em>Define \/ User-Defined \/ Function Hooks<\/em> menu. You can check your <em>case<\/em> has the correct line in it as follows:<\/p>\n<pre># For an normal (uncompressed) .cas file\r\ngrep libudf <em>filename<\/em>.cas\r\n\r\n# For a compressed .cas.gz file\r\nzgrep libudf <em>filename<\/em>.cas.gz\r\n<\/pre>\n<p>These commands should print something similar to the following if you are using a UDF<\/p>\n<pre>(udf\/compile\/files ((\"libudf\" (source \"\/scratch\/<em>username<\/em>\/<em>my_project<\/em>\/<em>my_udf<\/em>.c\") (header))))\r\n<\/pre>\n<p>Note that the path to the <code>.c<\/code> file will need to be correct for the CSF, otherwise fluent will not be able to find the file. If you saved your <em>case<\/em> file on a Windows PC it could have a path that is only valid on that PC. You DO NOT need to edit your .cas file to add the above line. You can use the Fluent GUI to re-save your <em>case<\/em> file on the CSF with the correct path.<\/p>\n<p>Alternatively, you might be able to add some lines to the <em>journal<\/em> file. However, there are many possible options &#8211; too many to list here &#8211; so we recommend using the Fluent GUI to make the settings. However, here is an example of lines added to the <code>.jou<\/code> file for a specific type of UDF:<\/p>\n<pre># Add the following to the .jou file to enable the UDF\r\n\/define user-defined compiled-functions compile libudf yes <em>my_udf<\/em>.c\r\n\/define user-defined compiled-functions load\r\n\/define user-defined function-hooks <em>DPM_BC<\/em> <em>my_udf<\/em>::libudf\r\n                                      #\r\n                                      # This example uses a Discrete Phase Model\r\n                                      # Boundary Condition UDF\r\n<\/pre>\n<h3>Compiling the UDF code<\/h3>\n<p>You UDF source code (e.g., <code>my_udf.c<\/code>) must be compiled in to a library that Fluent can read. Please note, if you have compiled it on a Windows PC, the library will NOT work on the CSF. You must recompile it on the CSF.<\/p>\n<p>You can either let Fluent compile the UDF code when your job runs, or you can compile it on the CSF before your job runs then fluent won&#8217;t need to do it itself. This is also a good way to check your UDF code actually compiles! If you wait until fluent compiles it (when your job runs), any mistakes in your code will mean you have to fix the code then resubmit the job. It is much easier to try to compile the UDF on the login node before the job runs and make any corrections to the code if you need to do so.<\/p>\n<div class=\"note\">\nIf you have compiled the UDF on Windows before transferring the files to the CSF, please remove any automatically-generated Windows files from the CSF folder (e.g. <code>udf_names.c<\/code>, <code>ud_io1.h<\/code> and any existing <code>libudf\/<\/code> folder.) These files will cause the compilation on the CSF to fail. You should only have the source files you wrote (e.g., <code>my_udf.c<\/code>) in your CSF directory. All of the necessary files will then be generated by fluent when you compile the UDF on the CSF.<\/div>\n<p>If you wish to check your UDF code compiles on the CSF <em>before<\/em> submitting a job to the batch system, you can run a helper script named <code>csf_compile_udf<\/code> on the CSF to do the UDF compilation:<\/p>\n<pre>csf_compile_udf <em>simtype1<\/em> <em>simtype1<\/em>_node <em>simtype1<\/em>_host ...\r\n\r\n# Example 1: Compile for a 3ddp (3D double-precision) simulation:\r\ncsf_compile_udf 3ddp 3ddp_node 3ddp_host\r\n\r\n# Example 2: Compile for a 2d (2D single-precision) simulation:\r\ncsf_compile_udf 2d 2d_node 2d_host\r\n\r\n# For more info:\r\ncsf_compile_udf --help\r\n<\/pre>\n<p>This script will compile your <code>my_udf.c<\/code> file (the script searches for <code>.c<\/code> files in the current directory and checks whether they appear to be Fluent UDF files) in to a <code>libudf.so<\/code> file. It will create a new sub-directory named <code>libudf<\/code> in the current directory (where you run the script). Each simulation type (2d, 3ddp, &#8230;) will have its own <code>libudf.so<\/code> file in directories inside the <code>libudf\/<\/code> sub-dir.<\/p>\n<h2>Running Fluent in Parallel in batch<\/h2>\n<p><strong>Please note:<\/strong> the versions of fluent available do not currently support automatic job-submission to SLURM. Hence you <strong>must<\/strong> write a SLURM jobscript and submit it using the <code>sbatch<\/code> command.<\/p>\n<p>For example, the following jobscript file named <code>fluent-batch.slurm<\/code>:<\/p>\n<pre>#!\/bin\/bash --login\r\n# Job will run in the current directory by default\r\n#SBATCH -n 8            # 8 cores. Can also use --ntasks=8\r\n#SBATCH -p multicore    # Single-node parallel job\r\n\r\n# The default output file will be slurm-JOBID.out. To use a SGE-style filename:\r\n#SBATCH -o %x.o%j       # Output file similar to CSF3: jobscriptname.oJOBID\r\n\r\n# Choose your required version\r\nmodule load fluent\/19.3\r\n\r\nfluent <strong>3d<\/strong> -g -t$SLURM_NTASKS -i <em>input.jou<\/em>\r\n        #                             #\r\n        #                             #\r\n        #                             # Replace input.jou with your input file.\r\n        #\r\n        # If using an UDF this must match the type used for compilation\r\n        # (e.g., 2d or 3d or 3ddp). You should not use the _node or _host\r\n        # type here.\r\n<\/pre>\n<p>Submit the job using:<\/p>\n<pre>sbatch fluent-batch.slurm<\/pre>\n<p>You can then check on the status of the job using<\/p>\n<pre>squeue --me\r\n<\/pre>\n<p>The maximum job size you can request is 16 due to licensing restrictions.<\/p>\n<h2>Running Serial Interactive Jobs via srun<\/h2>\n<p>The running of <strong>serial<\/strong>, interactive jobs is tolerated. This is mainly used to set up a simulation which can then be saved to file and run in batch. You may need to use the GUI to set up a UDF. If you are setting up a parallel UDF please <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/help\/\">contact us via our form<\/a>.<\/p>\n<p>You may run fluent interactively using the <code>srun<\/code> option which has a time limit of 1 hour.<\/p>\n<h3>Starting Fluent interactively<\/h3>\n<pre>srun -n 1 --pty bash\r\n<\/pre>\n<p>Then, once <code>srun<\/code> has returned a commandline on a compute node, load the appropriate environment module and start Fluent:<\/p>\n<pre>module load fluent\/19.3          # Load the modulefile for the version you require\r\nfluent &amp;     ## The &amp; ensures you get your command line and the GUI at the same time.\r\n<\/pre>\n<p>Notes:<\/p>\n<ol>\n<li>Linux: if the render window section of the GUI does not display your model try setting the following before running fluent:\n<pre class=\"in2\">export LIBGL_ALWAYS_INDIRECT=1<\/pre>\n<\/li>\n<li>alternatively run fluent using:\n<pre class=\"in2\">fluent -driver x11<\/pre>\n<\/li>\n<li>Windows: if the render window is slow to redraw or flashes try running fluent using:\n<pre class=\"in2\">fluent -driver x11<\/pre>\n<\/li>\n<\/ol>\n<p><strong>Note:<\/strong> For the GUI to work you must have an X server running on your PC. See the instructions on the <a href=\"\/csf4\/getting-started\/connecting\/gui-apps\/\">using GUI based applications<\/a> page.<\/p>\n<h2>Further Information<\/h2>\n<p>Further information on Fluent and other CFD applications may be found by <a href=\"http:\/\/cfd.mace.manchester.ac.uk\/twiki\/bin\/view\/Forum\/ForumCFD\">visiting the MACE CFD Forum<\/a>.<\/p>\n<p>More information about <a href=\"\/csf4\/batch\/srun\/\">srun<\/a> on the CSF.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview Ansys Fluent is a computational fluid dynamics application. Fluent version v19.3 (i.e. 2019r1) is available. CSF3 users please note: it is NOT possible to run the fluent command on the CSF4 login node to have it automatically submit a batch job. You must write your own jobscript and submit it using the sbatch command. See below for example jobscripts. Restrictions on Use Only users who have been added to the Fluent group can run.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/software\/applications\/fluent\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"parent":49,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-88","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/pages\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/comments?post=88"}],"version-history":[{"count":21,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/pages\/88\/revisions"}],"predecessor-version":[{"id":1462,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/pages\/88\/revisions\/1462"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/pages\/49"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf4\/wp-json\/wp\/v2\/media?parent=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}