首页 > 技术 > 流体力学 > Fluent / CFX > > FLUENT 6 UDF的编译和连接(英文)

FLUENT 6 UDF的编译和连接(英文)

作者:Simwe    来源:    发布时间:2011-07-21    收藏】 【打印】  复制连接  【 】 我来说两句:(0逛逛论坛

编译:
1.
In your working directory, create a directory that will store your library (e.
g., libudf).

2.
In the library directory you just created, make a source directory for your so
urce code, and name it src.

3.
Copy your source code (e.g., udfexample.c) to your src directory.

4.
Create a directory for the architecture of the machine that you will run FLUEN
T on: use ntx86 for Intel systems running Windows.


5.
Create directories for the versions you want to build for your architecture (e
.g., ntx86\2d). Possible versions are as follows:


single-precision serial 2D or 3D: 2d or 3d

double-precision serial 2D or 3D: 2ddp or 3ddp

single-precision parallel 2D or 3D: 2d_node and 2d_host or 3d_node and 3d_host

double-precision parallel 2D or 3D: 2ddp_node and 2ddp_host or 3ddp_node and 3
ddp_host
!! Note that you must create two build directories for each parallel version o
f the solver (two for the 3D version, two for the 2D double-precision version,
etc.), regardless of the number of compute nodes.


6.
Copy makefile_nt.udf and user_nt.udf to the build directory for the appropriat
e version (e.g., 2d).
!! For a parallel version, be sure to copy both files to the host and node dir
ectories (e.g., 2d_node and 2d_host, as shown in Figure  7.3.2).

The complete path to each of these files is:


path \Fluent.Inc\fluent6.  \src\makefile_nt.udf
path \Fluent.Inc\fluent6.  \src\user_nt.udf

where path is the directory in which you have installed the release directory,
Fluent.Inc, and x is replaced by the appropriate number for the release you h
ave (e.g., 0 for fluent6.0).

!! Be sure that you use the most up-to-date version of these files. If you ins
tall a new version of FLUENT 6, remember to copy the new makefile_nt.udf and u
ser_nt.udf files to the appropriate build directory.


7.
Change the name of makefile_nt.udf to makefile.

After you have set up your directory and put the files in the proper places, y
ou can compile and build your shared library.

1.
Using a text editor, edit the file user_nt.udf to set the following parameters
:


SOURCES = the user-defined function(s) to be compiled. Use the prefix $(SRC) b
efore each filename (e.g., $(SRC)udfexample.c for one function, or $(SRC)udfex
ample.c $(SRC)udfexample2.c for two functions).

VERSION = the version of the solver you are using, which will be the name of t
he build directory in which user_nt.udf is located, as shown in Figure  7.3.2
( 2d, 3d, 2ddp, 3ddp, 2d_host, 2d_node, 3d_host, 3d_node, 2ddp_host, 2ddp_node
, 3ddp_host, or 3ddp_node).

PARALLEL_NODE = the parallel communications library. Specify none for a serial
version of the solver. The possible inputs are as follows:


none: serial

smpi: parallel using shared memory (for multiprocessor machines)

vmpi: parallel using shared memory or network with vendor MPI software

net: parallel using network communicator with RSHD software

!! If you are using a parallel version of the solver, be sure to edit both cop
ies of user_nt.udf (the one in the host directory and the one in the node dire
ctory), and specify the appropriate SOURCE, VERSION, and PARALLEL_NODE for eac
h.

An excerpt from a sample user_nt.udf file is shown below:


# Replace text in " " (and remove quotes)
#  | indicates a choice
#  note: $(SRC) is defined in the makefile

SOURCES = $(SRC)udfexample.c
VERSION = 2d
PARALLEL_NODE = none

To specify multiple user-defined functions, enter them for SOURCES, separated
by spaces.


2.
In an MS-DOS Command Prompt window, go to your build directory (e.g., \libudf\
ntx86\2d\), and type nmake.
Note that if there are problems with the build, you can do a complete rebuild
by typing nmake clean

 
分享到: 收藏