CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

Windows Environment variables- to solve problems in compiling UDF in Fluent

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree5Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   February 29, 2012, 07:20
Default Windows Environment variables- to solve problems in compiling UDF in Fluent
  #1
New Member
 
Samuel
Join Date: Nov 2011
Posts: 12
Rep Power: 5
Modest Cat is on a distinguished road
Problems in compiling UDF in FLUENT:

1.In 'build' progress:
'nmake' is not recognized as an internal or external command...
or
LINK : fatal error LNK1104 kernel32.lib
2.In 'load' progress:
Error code: 193

These problems are due to incorrect setup of Windows Environment variables.

After several days' working on this issue, I finally solved them. And I think it is necessary to share my method.

Programs: Ansys 13.0, Visual Studio 2008; System:Win 7 (64)
Step 1: Find the console of Environment variables---My Computer->Properties->Advanced-> Environment variables

Step 2: Change or add three variables below:

X:\ means your installation path of VS.

I. INCLUDE= X:\Visual Studio\VC\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include

II. LIB =X:\Visual Studio\VC\lib\amd64;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\x64

III.Path=X:\Visual Studio\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio\Common7\IDE

PLEASE make sure that you can find every folder in the path above. If not, like Program Files (x86), then try to find it in other folders, like 'Program Files'. (In my computer, there are two folders, namely, C:\Program Files (x86) and C:\Program Files. The folder you want must be in one of them. )

By the way, this is for WIN 7(64). For 32 bits system, just ignore the 'amd64' and 'x64' in the Environment variables. (Without test, but valid )

That's all. I hope this can help.
sso and yona like this.
Modest Cat is offline   Reply With Quote

Old   March 9, 2012, 10:28
Smile Windows 7 UDF compilation error
  #2
New Member
 
Saif Ullah
Join Date: Aug 2011
Posts: 5
Rep Power: 5
saifullahkhalid is on a distinguished road
Please look into following weblink. I have solved my issues by tips given on this webpage.

http://www.cfd-online.com/Wiki/Fluent_FAQ

Regards
saifullahkhalid is offline   Reply With Quote

Old   September 20, 2012, 20:46
Default
  #3
Member
 
Join Date: May 2009
Posts: 58
Rep Power: 8
amir2920 is on a distinguished road
I have tried that exactly the same as you have written, it did not work for me. Still I have an error like this, Please help. Appreciate it.

Deleted old libudf\win64\2d\libudf.dll
1 file(s) copied.
(system "copy "C:\PROGRA~1\ANSYSI~1\v130\fluent"\fluent13.0.0\sr c\makefile_nt.udf "libudf\win64\2d\makefile" ")
1 file(s) copied.
(chdir "libudf")()
(chdir "win64\2d")()
# Generating ud_io1.h
time_step.c
# Generating udf_names.c because of makefile time_step.obj
udf_names.c
# Linking libudf.dll because of makefile user_nt.udf udf_names.obj time_step.obj
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

Done.
amir2920 is offline   Reply With Quote

Old   April 30, 2013, 05:08
Default Error compiling UDF
  #4
New Member
 
Carlos
Join Date: Dec 2011
Posts: 13
Rep Power: 5
chmurillor is on a distinguished road
Hi everybody!

I have followed the steps suggested in this forum but I have found a concatenation error when I try to load the UDF that I have built.

It seems that the UDF has an error in the value of a variable because a part of the file adress is called twice. For this reason, the file cannot be found.

Please give me your suggestions

Carlos
Attached Images
File Type: jpg error compilacion UDF.jpg (79.6 KB, 156 views)
chmurillor is offline   Reply With Quote

Old   April 30, 2013, 06:25
Default
  #5
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 544
Rep Power: 12
vasava will become famous soon enough
@chmurillor

Do you get this error when you launch fluent separately (I mean not from workbench)?
vasava is offline   Reply With Quote

Old   April 30, 2013, 08:10
Default
  #6
New Member
 
Carlos
Join Date: Dec 2011
Posts: 13
Rep Power: 5
chmurillor is on a distinguished road
Hi vasava

Thanks for your reply.

This error is evidenced in both cases (with and without workbench)

The first image corresponds to workbench and the next image was taken by opening Fluent directly.

Do you know if an environment variable has a wrong value?

Thanks
Attached Images
File Type: jpg error compilacion UDF-2.jpg (65.4 KB, 43 views)
chmurillor is offline   Reply With Quote

Old   April 30, 2013, 08:41
Default
  #7
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 11
blackmask will become famous soon enough
I have a bad sight and can not see the error message clearly. You could unload the library, compile your source files, reload the library, and save your case file. Do not change the path of the case file or the lib afterwards and your should end up fine.
blackmask is offline   Reply With Quote

Old   April 30, 2013, 10:04
Default
  #8
New Member
 
Carlos
Join Date: Dec 2011
Posts: 13
Rep Power: 5
chmurillor is on a distinguished road
No blackmask, the problem is still evidenced. Please, tell me where is the variable that we must modify.

This is the error that we get when we unload and reload the library.

The UDF library you are trying to load (D:\vizcayamurillo\amidon\libudf) is not compiled for 3d on the curent platform (win64).
The system cannot find the path specified.

C:\Program Files\ANSYS Inc\v130\fluent
tbin\win64
\D:\vizcayamurillo\amidon\libudf\win64\3d\libudf.dl l

The red part corresponds to the location of the .bat file and the blue one corresponds to the location of the libudf.dll file
chmurillor is offline   Reply With Quote

Old   April 30, 2013, 10:25
Default
  #9
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 11
blackmask will become famous soon enough
It seems that the "\n" is interpreted as the newline character in the following string
C:\Program Files\ANSYS Inc\v130\fluent\ntbin\win64\
and a ";" is missing after the final "\".

You could check the file named "log" in the same directory as your case file and possibly find what goes wrong.
blackmask is offline   Reply With Quote

Old   January 19, 2014, 13:35
Default
  #10
New Member
 
aeropaolo
Join Date: Jan 2014
Posts: 2
Rep Power: 0
giovanni.el is on a distinguished road
Dear Samuel,
I get a similar error when I compile my UDF:
"fatal error LNK1104: cannot open file LIBCMT.lib"
Do you have any clue what's wrong?

FYI, i'm using Windows 8.1 x64, Fluent 13 x64, Microsoft Visual Studio 2013 Express, SDK 8.1, .NET Framework 4.5.1. I know the "boundary conditions" are different, but the error is similar, so I thought you might know how to solve it.
Thanx.


Quote:
Originally Posted by Modest Cat View Post
Problems in compiling UDF in FLUENT:

1.In 'build' progress:
'nmake' is not recognized as an internal or external command...
or
LINK : fatal error LNK1104 kernel32.lib
2.In 'load' progress:
Error code: 193

These problems are due to incorrect setup of Windows Environment variables.

After several days' working on this issue, I finally solved them. And I think it is necessary to share my method.

Programs: Ansys 13.0, Visual Studio 2008; System:Win 7 (64)
Step 1: Find the console of Environment variables---My Computer->Properties->Advanced-> Environment variables

Step 2: Change or add three variables below:

X:\ means your installation path of VS.

I. INCLUDE= X:\Visual Studio\VC\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include

II. LIB =X:\Visual Studio\VC\lib\amd64;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\x64

III.Path=X:\Visual Studio\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio\Common7\IDE

PLEASE make sure that you can find every folder in the path above. If not, like Program Files (x86), then try to find it in other folders, like 'Program Files'. (In my computer, there are two folders, namely, C:\Program Files (x86) and C:\Program Files. The folder you want must be in one of them. )

By the way, this is for WIN 7(64). For 32 bits system, just ignore the 'amd64' and 'x64' in the Environment variables. (Without test, but valid )

That's all. I hope this can help.
giovanni.el is offline   Reply With Quote

Old   January 20, 2014, 02:27
Default
  #11
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 544
Rep Power: 12
vasava will become famous soon enough
@giovanni.el: I am not sure about Ansys software working with Windows 8. But I recommend you switch to Visual studio 2010 or 2008 and see if it works.
vasava is offline   Reply With Quote

Old   July 9, 2014, 07:37
Default
  #12
New Member
 
...
Join Date: Jun 2013
Posts: 7
Rep Power: 4
manalis is on a distinguished road
Quote:
Originally Posted by Modest Cat View Post
Problems in compiling UDF in FLUENT:

1.In 'build' progress:
'nmake' is not recognized as an internal or external command...
or
LINK : fatal error LNK1104 kernel32.lib
2.In 'load' progress:
Error code: 193

These problems are due to incorrect setup of Windows Environment variables.

After several days' working on this issue, I finally solved them. And I think it is necessary to share my method.

Programs: Ansys 13.0, Visual Studio 2008; System:Win 7 (64)
Step 1: Find the console of Environment variables---My Computer->Properties->Advanced-> Environment variables

Step 2: Change or add three variables below:

X:\ means your installation path of VS.

I. INCLUDE= X:\Visual Studio\VC\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include

II. LIB =X:\Visual Studio\VC\lib\amd64;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\x64

III.Path=X:\Visual Studio\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio\Common7\IDE

PLEASE make sure that you can find every folder in the path above. If not, like Program Files (x86), then try to find it in other folders, like 'Program Files'. (In my computer, there are two folders, namely, C:\Program Files (x86) and C:\Program Files. The folder you want must be in one of them. )

By the way, this is for WIN 7(64). For 32 bits system, just ignore the 'amd64' and 'x64' in the Environment variables. (Without test, but valid )

That's all. I hope this can help.
Your post was very helpful. I will just quote some small changes that I made to your solution to suit my needs. I think that it may help others with the same problems, more or less.

My system:
Windows 7 (x64) + Fluent 14.5 (x64) + Visual Studio 2010 Professional + SDK 7.0A

Step 1: Find the console of Environment variables---My Computer->Properties->Advanced-> Environment variables

Step 2: Change or add three Environmental variables below:

I. INCLUDE (capital letters)
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include

II. LIB (capital letters)
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\x64

III.Path (small letters)
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE;C:\Program Files\ANSYS Inc\v145\fluent\ntbin\win64

Step 3: Start Fluent from "Visual Studio x64 Cross Tools Command Prompt" by just typing "fluent" in the command prompt.

Step 4: Include the correct working directory while launching Fluent from GUI.

Step 5: Compile the UDF normally: Define --> User defined --> Compiled --> etc..
tjugonghao and icemcfd13 like this.
manalis is offline   Reply With Quote

Old   October 1, 2014, 04:46
Default
  #13
New Member
 
Tanuja
Join Date: Aug 2014
Posts: 7
Rep Power: 2
icemcfd13 is on a distinguished road
Thanks a lot. Very good solutio. But please help me with this:I would be grateful

Creating library libudf.lib and object libudf.exp

Done.

Opening library "F:\Trials\Done 2 upto boundary conditions for trial\libudf"...
Error: Error code: 193


Error: Error code: 193

Error Object: #f
icemcfd13 is offline   Reply With Quote

Old   October 1, 2014, 05:57
Default
  #14
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 544
Rep Power: 12
vasava will become famous soon enough
Quote:
Originally Posted by icemcfd13 View Post
Opening library "F:\Trials\Done 2 upto boundary conditions for trial\libudf"...

Error Object: #f[/I]
Do you have spaces in your file or folder name? If so, rename the file/folder and try again.
icemcfd13 likes this.
vasava is offline   Reply With Quote

Old   October 1, 2014, 06:48
Default
  #15
New Member
 
Tanuja
Join Date: Aug 2014
Posts: 7
Rep Power: 2
icemcfd13 is on a distinguished road
Thank you for reply....
I tried after removing spaces in working directory name but it didn't work.
Would you please suggest any other solution.
The error is seen when I click the load button while compiling the UDF
icemcfd13 is offline   Reply With Quote

Old   October 1, 2014, 11:33
Default
  #16
Member
 
ad
Join Date: Apr 2014
Posts: 42
Rep Power: 3
adi.ptb is on a distinguished road
add "C:\Windows\System32" to your path variables
adi.ptb is offline   Reply With Quote

Old   October 1, 2014, 23:59
Default
  #17
New Member
 
Tanuja
Join Date: Aug 2014
Posts: 7
Rep Power: 2
icemcfd13 is on a distinguished road
Thanks a lot....it worked.
I am using dynamic meshing. When I start calculations, I am getting the following error:
update-dynamic-mesh failed. negative cell volume detected

I am totally clueless about it..Please help me. I am using structured mesh-hexa.
icemcfd13 is offline   Reply With Quote

Old   October 2, 2014, 01:22
Default
  #18
Member
 
ad
Join Date: Apr 2014
Posts: 42
Rep Power: 3
adi.ptb is on a distinguished road
If there is not proper matching between grid size spacing and time increment the mesh won’t move. In this case fluent will show an error message for negative volume. So
before starting the simulation it is necessary to check the motion of the mesh for the selected
grid size. If it shows error then the grid size or time step size is changed and
the process is repeated.
adi.ptb is offline   Reply With Quote

Old   October 26, 2014, 09:36
Default
  #19
New Member
 
Nguyen Duc Thuyen
Join Date: Jul 2014
Posts: 6
Rep Power: 2
tandem is on a distinguished road
Hi everybody!
I have a error:
Code:
 
'xcopy' is not recognized as an internal or external command,
operable program or batch file.
Copied D:\NCS\ANSYS\Fluent\UDF_one\elbow.c to libudf\src
udf_names.c and user_nt.udf files in 3ddp are upto date.
(system "copy "C:\PROGRA~1\ANSYSI~1\v150\fluent"\fluent15.0.0\src\makefile_nt.udf "libudf\win64\3ddp\makefile" ")
        1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp")
Done.
I added the Environment:
INCLUDE: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include
LIB: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\x64
Path: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE;C:\Program Files\ANSYS Inc\v150\fluent\ntbin\win64
My System: Windows 7 (x64) + Fluent 15 (x64) + Visual Studio 2010 Professional + SDK 7.0A
Please give me your suggestions
Thank!
tandem is offline   Reply With Quote

Old   October 26, 2014, 13:21
Default
  #20
Member
 
ad
Join Date: Apr 2014
Posts: 42
Rep Power: 3
adi.ptb is on a distinguished road
This thread might help you
compiling udf on windows7 64-bit
adi.ptb is offline   Reply With Quote

Reply

Tags
compiling, udf

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
About UDF compiling issues: 'nmake' Haoyin Shan Fluent UDF and Scheme Programming 7 January 2, 2013 11:49
CFX11 + Fortran compiler ? Mohan CFX 20 March 30, 2011 18:56
64bit error compiling UDF : divergence detected UtoS_99 FLUENT 7 March 29, 2011 03:19
UDF to record FLUENT Solver variables... mariachi Fluent UDF and Scheme Programming 9 February 19, 2010 13:25
UDF to record FLUENT solver variables... mariachi FLUENT 1 February 3, 2010 23:18


All times are GMT -4. The time now is 23:46.