0% found this document useful (0 votes)
65 views10 pages

Udfs 2019

This document provides instructions for compiling and loading user defined functions using ANSYS Fluent and Microsoft Visual Studio 2019 on single and multiple computers. It details how to install Visual Studio, configure Fluent, compile functions in serial and parallel, and launch Fluent across machines.

Uploaded by

Gera Quiroz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views10 pages

Udfs 2019

This document provides instructions for compiling and loading user defined functions using ANSYS Fluent and Microsoft Visual Studio 2019 on single and multiple computers. It details how to install Visual Studio, configure Fluent, compile functions in serial and parallel, and launch Fluent across machines.

Uploaded by

Gera Quiroz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Compiling and Loading User Defined Functions using

Fluent and Microsoft Visual Studio 2019 Community


Edition running ANSYS Fluent in Serial and Parallel
This document assumes that you have Administrator rights and know how to Share folders and Map
drives. If you do not please consult with your local IT personnel. Microsoft Visual Studio 2019 is not
officially supported for any current ANSYS Fluent release. It will be officially supported with ANSYS
Fluent 2020 but can be used by following the instructions below. Alternatively, Microsoft Visual Studio
2019 will work if you launch Fluent from the Command Line using the Visual Studio 2019 x64 Native
Tools Command Prompt. The Microsoft Visual Studio 2019 compiler will work natively with Windows 10
but if you are running Windows 7 or Windows server please see Microsoft’s installation requirements.

NOTE: The Microsoft Visual Studio compilers are generally NOT free of charge. Please read the Microsoft
agreements for restrictions or licenses needed or contact your IT Department

Table of Contents

Windows 7 note using the 2019 compiler ..................................................................................................... 1


Downloading and Installing Microsoft Visual Studio 2019 Community ........................................................ 2
Download a UDF Batch File Fix for running Fluent without using the SDK Window ..................................... 2
Compiling Fluent UDFs in serial or SMP (Shared Memory) ........................................................................... 3
Compiling Fluent UDFs in DMP (Distributed Memory) on Multiple Computers ........................................... 3
Launching and Configuring ANSYS Fluent to run across Multiple Computers and Compile UDFs ................ 4
Compiling ANSYS Fluent UDFs from the Command Line using the Visual Studio 2019 x64 Native Tools
Command Prompt window ........................................................................................................................... 6
Compiling Fluent UDFs in serial or SMP (Shared Memory) ........................................................................... 7
Compiling Fluent UDFs in DMP (Distributed Memory) on Multiple Computers ........................................... 8
Launching and Configuring ANSYS Fluent to run across Multiple Computers and Compile UDFs ................ 9

Windows 7 note using the 2019 compiler


If your Operating System is Windows 7 you will need the following Microsoft Patch in order to use this
version (2017) of the compiler to compile Fluent UDF's.

Update for Windows 7 (KB2999226)

1
https://www.microsoft.com/en-us/download/details.aspx?id=49077
If you do not have this patch you will get this error when trying to compile Fluent UDFs

fatal error: Cannot open include file 'stdio.h': No such file or directory

Downloading and Installing Microsoft Visual Studio 2019 Community

ANSYS is not responsible for the correct installation of Microsoft Visual Studio. If you have issues
installing the compiler, please contact Microsoft or your IT staff.

NOTE: You will need to choose the selection in RED as well as the optional components on the
right hand side of the screenshot for the SDK, etc.

Download a UDF Batch File Fix for running Fluent without using the SDK
Window

1. In order to use the 2019 compiler with Fluent (until the release of 2020) you will need to
download the attached file, udf-batch-file-2019.
2. Browse to C:\Program Files\ANSYS Inc\v19.x\fluent\ntbin\win64 and rename the existing
udf.bat.

2
3. Rename udf-batch-file-2019 to udf.bat and place it in the C:\Program Files\ANSYS 4.
Inc\v19.x\fluent\ntbin\win64 directory
Note: The v19.x is an example. If you are running any other version of Fluent browse to the
appropriate v##.# directory.

Compiling Fluent UDFs in serial or SMP (Shared Memory)


1. Launch Fluent ensuring that your “Working Directory” is set to the location where your
case, data and UDF is located in.
2. Read in your model
3. Select the Console tab (at the bottom of the Fluent window)
4. Select the User Defined tab
5. Choose Functions > Compiled
6. Select the Add button to add your source file (.c)
7. Select Build
8. Select Load

Compiling Fluent UDFs in DMP (Distributed Memory) on Multiple


Computers
NOTE: If you running the ANSYS Fluent solver on multiple computers and will be compiling and loading
UDFs you need to follow the steps below. If you are running in local parallel you do not need to share
and map drives. Follow the steps above except choose Parallel and the number of cores (processes) you
wish to run on.

1. Share the “ANSYS Inc” folder located at C:\Program Files\ANSYS Inc\v19.x with Full Control

3
2. Create a working directory that contains the ANSYS Fluent case, data files and UDF source
code files. DO NOT COMPILE OR LOAD UDFS FROM FOLDERS WITH SPACES IN THE NAME
AND DO NOT INCLUDE SPACES IN THE NAME OF YOUR CASE AND DATA FILES.
3. Share the Working directory folder with Full Control
4. Map a drive letter to the shared folder, for example, U:\ (When compiling UDFs and
running in parallel (across machines) you must use a mapped drive letter to the shared
folder. Fluent will use this shared folder as its Working Directory in the Fluent Launcher.)

Launching and Configuring ANSYS Fluent to run across Multiple


Computers and Compile UDFs
1. Launch ANSYS Fluent
2. Select Show More Options from the ANSYS Fluent Launcher.
3. Set your Working Directory to the shared, mapped drive letter that you created earlier
4. Change the Fluent Root Path to in UNC format with the Computer_name\and the Shared
ANSYS Inc directory, for example, \\Computer_name\ANSYS Inc\v19.x\fluent
5. Select Parallel under Processing Options and then enter the Number of Processes you will
be using.

6. Select the Parallel Settings tab


7. Choose File Containing Machine Names
8. Choose the Text icon and enter the machine names once.
9. Click OK once you have entered and saved the machines.txt file.

4
10. Click OK to launch ANSYS Fluent

11. Read in your model


12. Select the Console tab (at the bottom of the Fluent window)
13. Select the User Defined tab
14. Choose Functions > Compiled
15. Select the Add button to add your source file (.c)

16. In the Library Name text box type in the \\Computer_name\share_name\libudf. It is


necessary to type in the network path to the compiled UDF in this text box if running across
multiple computers.

5
17. Select Build
18. Select Load
19. After you have compiled the UDF the working folder will include a new subfolder called
libudf.

Compiling ANSYS Fluent UDFs from the Command Line using the Visual
Studio 2019 x64 Native Tools Command Prompt window
1. Open up the Visual Studio 2019 x64 Native Tools Command Prompt window and change to your
working directory where your case and data reside.

2. Create an ANSYS Fluent v1xx.x shortcut on the desktop

3. Drag the ANSYS Fluent shortcut into the x64 Native tools Command Prompt window.

6
4. Press Enter
5. ANSYS Fluent launches.
6. Follow the procedures below for compiling UDFs

NOTE: If you are compiling from the x64 Native Tools Command Prompt then you must uncheck
this box when Fluent launches. Choose the Environment Tab, uncheck “Set up Compilation
Environment for UDF”. If you have replaced the udf.bat file as noted above, do not uncheck
this box.

Compiling Fluent UDFs in serial or SMP


(Shared Memory)
1. Launch Fluent ensuring that your “Working
Directory” is set to the location where your case, data and UDF is located in.

7
2. Read in your model
3. Select the Console tab (at the bottom of the Fluent window)
4. Select the User Defined tab
5. Choose Functions > Compiled
6. Select the Add button to add your source file (.c)
7. Select Build
8. Select Load

Compiling Fluent UDFs in DMP (Distributed Memory) on Multiple


Computers
NOTE: If you running the ANSYS Fluent solver on multiple computers and will be compiling and loading
UDFs you need to follow the steps below. If you are running in local parallel you do not need to
share and map drives. Follow the steps above except choose Parallel and the number of cores
(processes) you wish to run on.

1. Share the “ANSYS Inc” folder located at C:\Program Files\ANSYS Inc\v19.x with Full Control
2. Create a working directory that contains the ANSYS Fluent case, data files and UDF source
code files. DO NOT COMPILE OR LOAD UDFS FROM FOLDERS WITH SPACES IN THE NAME
AND DO NOT INCLUDE SPACES IN THE NAME OF YOUR CASE AND DATA FILES.
3. Share the Working directory folder with Full Control
4. Map a drive letter to the shared folder, for example, U:\ (When compiling UDFs and
running in parallel (across machines) you must use a mapped drive letter to the shared
folder. Fluent will use this shared folder as its Working Directory in the Fluent Launcher.)

8
Launching and Configuring ANSYS Fluent to run across Multiple
Computers and Compile UDFs
1. Launch ANSYS Fluent
2. Select Show More Options from the ANSYS Fluent Launcher.
3. Set your Working Directory to the shared, mapped drive letter that you created earlier
4. Change the Fluent Root Path to in UNC format with the Computer_name\and the Shared
ANSYS Inc directory, for example, \\Computer_name\ANSYS Inc\v19.x\fluent
5. Select Parallel under Processing Options and then enter the Number of Processes you will
be using.

6. Select the Parallel Settings tab


7. Choose File Containing Machine Names
8. Choose the Text icon and enter the machine names once.
9. Click OK once you have entered and saved the machines.txt file.
10. Click OK to launch ANSYS Fluent

9
11. Read in your model
12. Select the Console tab (at the bottom of the Fluent window)
13. Select the User Defined tab
14. Choose Functions > Compiled
15. Select the Add button to add your source file (.c)

16. In the Library Name text box type in the \\Computer_name\share_name\libudf. It is


necessary to type in the network path to the compiled UDF in this text box if running across
multiple computers.
17. Select Build
18. Select Load
19. After you have compiled the UDF the working folder will include a new subfolder called libudf.

10

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy