Uploaded by glhficcup

2040254-udfs-2015

advertisement
Compiling and Loading User Defined Functions using
Fluent and Microsoft Visual Studio 2015 Express (free)
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 2015 is
supported for ANSYS Fluent release 17.x. If you need to use this compiler version for ANSYS Fluent 16.x
you will need to launch Fluent from the Command Line using the VS2015 x86 x64 Cross Tools
Command Prompt
Table of Contents
Downloading and Installing Microsoft Visual Studio 2015 ........................................................................... 1
Compiling Fluent UDFs in serial or SMP (Shared Memory) .......................................................................... 2
Compiling Fluent UDFs in DMP (Distributed Memory) on Multiple Computers .......................................... 2
Launching and Configuring ANSYS Fluent to run across Multiple Computers and Compile UDFs ............... 3
Compiling ANSYS Fluent UDFs from the Command Line using the VS2015 x86 x64 Cross Tools Command
Prompt (if using an earlier version of Fluent than Release 17) .................................................................... 5
Downloading and Installing Microsoft Visual Studio 2015
Download and Install Microsoft Visual Studio 2015 Express
https://www.visualstudio.com/downloads/
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: In some instances, the 64-bit SDK must be installed
separately. After you install the compiler, open up Control Panel,
Programs and Features. Select your 2015 compiler to modify the
installation. Select Visual C++, Common Tools…, etc.
1
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\v17.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
2
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.
2.
3.
4.
Launch ANSYS Fluent
Select Show More Options from the ANSYS Fluent Launcher.
Set your Working Directory to the shared, mapped drive letter that you created earlier
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\v17.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
3
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.
4
17. Select Build
18. Select Load
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 VS2015
x86 x64 Cross Tools Command Prompt (if using an earlier version of
Fluent than Release 17)
1. Open up VS2015 x86 x64 Cross Tools Command Prompt window and change to your shared,
mapped network drive letter
2. Create an ANSYS Fluent 16.x shortcut on the desktop
5
3. Drag the ANSYS Fluent shortcut into the VS2015 x86 x64 Cross Tools Command Prompt
window.
4. Press Enter
5. ANSYS Fluent launches.
6. Follow the procedures above for compiling UDFs
6
Download