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

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

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 26, 2014, 20:42
Default
  #21
New Member
 
Nguyen Duc Thuyen
Join Date: Jul 2014
Posts: 7
Rep Power: 11
tandem is on a distinguished road
@adi.ptb
Thank you for reply, it worked.
Computer --> Properties --> Avandced system setting --> Evironment Variables --> User variables for... --> New...
1. INCLUDE: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;C:\Program Files\Microsoft SDKs\Windows\v7.1\Include
2. LIB: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64
3. Path: C:\Windows\System32;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
Regards
tandem is offline   Reply With Quote

Old   December 15, 2014, 19:54
Default
  #22
New Member
 
Renato Venturatto Junior
Join Date: May 2014
Posts: 18
Rep Power: 11
renatovj is on a distinguished road
Quote:
Originally Posted by manalis View Post
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..
Did someone try to do something similiar in Windows 8.1, 64 bit with Visual Studio 12 and the Windows Kits 8.1. Did it work?

These are my Environmental variables:

INCLUDE= C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include;C:\Program Files (x86)\Windows Kits\8.1\Include

LIB=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64;C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64

Path=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE;C:\Program Files\ANSYS Inc\v150\fluent\ntbin\win64

Still not working for me.

Error:

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

PLEASE guys, help me!
renatovj is offline   Reply With Quote

Old   December 15, 2014, 20:10
Default
  #23
New Member
 
Renato Venturatto Junior
Join Date: May 2014
Posts: 18
Rep Power: 11
renatovj is on a distinguished road
Also tried to add C:\Windows\System32; to the path variable. Not working yet...
renatovj is offline   Reply With Quote

Old   December 16, 2014, 03:25
Default
  #24
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 22
vasava will become famous soon enough
Quote:
Originally Posted by renatovj View Post
INCLUDE= C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include;C:\Program Files (x86)\Windows Kits\8.1\Include

LIB=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64;C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64

Path=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE;C:\Program Files\ANSYS Inc\v150\fluent\ntbin\win64
Are you sure that these addresses are pointing to right directories?? In other words are you sure that these directories exists?

I have tried windows-8 and installed Ansys-15 without any problem. I dont remember the exact steps now. I used windows-8 for a very short time (only couple of days) and then switched to windows-7 again.
vasava is offline   Reply With Quote

Old   December 16, 2014, 05:47
Default
  #25
New Member
 
Renato Venturatto Junior
Join Date: May 2014
Posts: 18
Rep Power: 11
renatovj is on a distinguished road
vasava,

The directories do exist. I searched for the adresses in the windows explorer and just copied them to the environmental variables.But it is not working!

Did you run Fluent from GUI or from the Windows SDK prompt?
renatovj is offline   Reply With Quote

Old   December 16, 2014, 07:35
Default
  #26
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 22
vasava will become famous soon enough
Well I had a case with UDF (with velocity profile and viscosity model) that I could run without any problem. But I dont remember if I used SDK to start fluent.

Anyways here are steps that I followed (both installation on win-7 and 8) along with links where I downloaded files. Hope they help.

Step-1: Install visual studio 2008 from DVD.
Step-2: Install .NET 4 from Microsoft website.
Step-3: Install SDK. Download from following link.

http://download.microsoft.com/downlo...DKX_EN_DVD.iso
http://www.mydigitallife.info/window...download-link/

If your operating system language is not English then SDK may behave strangely.

Last edited by vasava; December 16, 2014 at 07:36. Reason: Wrong link
vasava is offline   Reply With Quote

Old   December 18, 2014, 02:13
Default
  #27
New Member
 
Nguyen Duc Thuyen
Join Date: Jul 2014
Posts: 7
Rep Power: 11
tandem is on a distinguished road
Hi everybody!
I haven't been work Windows 8 so that I don't know Environmental variables in Windows 8. Now, I don't work UDF in Fluent, i have Fortran in CFX. Please!
tandem is offline   Reply With Quote

Old   December 18, 2014, 02:44
Default
  #28
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 22
vasava will become famous soon enough
Here is a link to some other post which might help.
http://www.cfd-online.com/Forums/flu...tml#post524392
vasava is offline   Reply With Quote

Old   December 19, 2014, 08:50
Default
  #29
New Member
 
Renato Venturatto Junior
Join Date: May 2014
Posts: 18
Rep Power: 11
renatovj is on a distinguished road
Thank you for the answers!

Finally I did it!

Please see below the variables I used in Windows 8.1.

The path to adjust the variables:

Control Panel/System and Security/System;Advanced System Settings/Environment Variables;System Variables

The Variables:

INCLUDE=C:\Program Files (x86)\Windows Kits\8.1\Include;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include

LIB=C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\arm

LIBPATH=C:\Windows\Microsoft.NET\Framework64\v4.0. 30319;C:\Windows\Microsoft.NET\Framework64\v2.0.50 727;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\arm

Path=C:\ProgramData\Oracle\Java\javapath;C:\Progra m Files\ANSYS Inc\v150\fluent\ntbin\win64;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64;C:\Windows\Microsoft.NET\Framewo rk64\v4.0.30319;C:\Windows\Microsoft.NET\Framework 64\v2.0.50727;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcpackages;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools;C:\Program Files (x86)\Windows Kits\8.1\bin\x64;C:\Program Files (x86)\Windows Kits\8.1\bin;C:\Windows\System32

Hope it helps!

Renato.
renatovj is offline   Reply With Quote

Old   March 10, 2015, 03:11
Unhappy
  #30
Senior Member
 
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13
shivakumar is on a distinguished road
I have set the environment variables but getting the error like this.. What is the problem?. I would be thankful to you..


Deleted old libudf\win64\2ddp\libudf.dll
1 file(s) copied.
Copied G:\shivakumar\shiva\RAE2822
ow_on/G:\shivakumar\shiva\RAE2822
ow_on\shock_sensor.c to libudf\src
(system "copy "C:\PROGRA~1\ANSYSI~1\v140\fluent"\fluent14.0.0\sr c\makefile_nt.udf "libudf\win64\2ddp\makefile" ")
1 file(s) copied.
(chdir "libudf")()
(chdir "win64\2ddp")()
# Generating ud_io1.h
shock_sensor.c
..\..\src\shock_sensor.c(11) : error C2143: syntax error : missing ';' before 'type'
..\..\src\shock_sensor.c(12) : error C2143: syntax error : missing ';' before 'type'
..\..\src\shock_sensor.c(18) : error C2065: 'velocity' : undeclared identifier
..\..\src\shock_sensor.c(19) : error C2065: 'f_shock' : undeclared identifier
..\..\src\shock_sensor.c(19) : error C2065: 'velocity' : undeclared identifier
..\..\src\shock_sensor.c(19) : error C2297: '*' : illegal, right operand has type 'real [2]'
..\..\src\shock_sensor.c(19) : warning C4047: 'function' : 'int' differs in levels of indirection from 'real [2]'
..\..\src\shock_sensor.c(19) : warning C4024: 'abs' : different types for formal and actual parameter 1
..\..\src\shock_sensor.c(21) : error C2065: 'f_shock' : undeclared identifier
..\..\src\shock_sensor.c(23) : error C2440: '=' : cannot convert from 'void (*)(void)' to 'real'

Done.



Thanks in advance..
shivakumar is offline   Reply With Quote

Old   March 10, 2015, 04:41
Default
  #31
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 22
vasava will become famous soon enough
I think these errors are due to problems with your UDF and has nothing to do with compilation.
vasava is offline   Reply With Quote

Old   March 10, 2015, 05:56
Question
  #32
Senior Member
 
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13
shivakumar is on a distinguished road
Thanks for the reply. I tried to code the shock sensor algorithm which is attached below but getting errors like that..
Here is the code.

#include "udf.h"
#define A 340.26

DEFINE_ON_DEMAND(shock_sensor)
{
Domain *d;
Thread *t;
cell_t c;
d=Get_Domain(1);

real f_shock, velocity;
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
velocity=(C_U(c,t)+C_V(c,t));
f_shock = (velocity*C_P_G(c,t))/(A*abs(C_P_G(c,t)));

if(f_shock>=1)
{
C_UDMI(c,t,0)=f_shock;
}
}
end_c_loop(c,t)
}
}

Any help would be appreciated

Thanks in advance
Attached Images
File Type: jpg Capture.JPG (61.5 KB, 9 views)
shivakumar is offline   Reply With Quote

Old   March 10, 2015, 06:07
Default
  #33
New Member
 
Renato Venturatto Junior
Join Date: May 2014
Posts: 18
Rep Power: 11
renatovj is on a distinguished road
I agree with vasava,The errors you are getting have nothing to do with compilation or environment variables.Some easy ones to solve are The missing ; (just add it to the end of the command in the line showed between parêntesis).Another one are the variables like 'velocity' that are being used without previous declaration.
Try to look up for threads for each error and go to the line to solve it.

Good luck!
renatovj is offline   Reply With Quote

Old   March 10, 2015, 12:14
Exclamation
  #34
Senior Member
 
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13
shivakumar is on a distinguished road
Thanks for your reply.. you are right, little problem in UDF not in the compilation.
Attached Images
File Type: jpg Capture.JPG (68.1 KB, 8 views)
shivakumar is offline   Reply With Quote

Old   March 21, 2015, 07:44
Default
  #35
New Member
 
reza erfani
Join Date: Dec 2014
Posts: 3
Rep Power: 11
reza.erfani is on a distinguished road
hi friends
I want to compile a udf and followed above steps but when I want to load it it gives this error:
%1 is not a valid win32 application
please help me. what is wrong?
thanks
reza.erfani is offline   Reply With Quote

Old   March 23, 2015, 00:53
Default
  #36
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 22
vasava will become famous soon enough
Post your UDF and we can have a look at it.
vasava is offline   Reply With Quote

Old   March 25, 2015, 17:54
Default
  #37
Member
 
Join Date: Mar 2015
Posts: 30
Rep Power: 11
mimi0201 is on a distinguished road
i've just solved the problem, make sure you type all the path in the right position. If yes, go to "C:\Program Files\ANSYS Inc\v145\fluent\ntbin\win64" find a file named "udf", open it with note pad. In row 10, change the path "set MSVC_DEFAULT=%ProgramFiles(x86)%\Microsoft Visual Studio 11.0" to your current activated VS version. and i think that'll do. If no, please contact me.
mimi0201 is offline   Reply With Quote

Old   March 30, 2015, 05:25
Default
  #38
New Member
 
reza erfani
Join Date: Dec 2014
Posts: 3
Rep Power: 11
reza.erfani is on a distinguished road
Quote:
Originally Posted by vasava View Post
Post your UDF and we can have a look at it.
thanks
it has been solved
just open fluent from mvs command prompt64 no sdk
reza.erfani is offline   Reply With Quote

Old   April 13, 2016, 08:43
Default
  #39
New Member
 
Join Date: Apr 2016
Posts: 1
Rep Power: 0
mbaldwin8 is on a distinguished road
@tandeem
Did you ever find a solution that worked for you on this issue?
(never mind, I now see the response thread)

Last edited by mbaldwin8; April 13, 2016 at 08:50. Reason: new to forums- just saw all responses
mbaldwin8 is offline   Reply With Quote

Old   May 18, 2016, 10:33
Default
  #40
New Member
 
Apiano Morais
Join Date: Apr 2016
Posts: 10
Rep Power: 10
Apiano is on a distinguished road
It worked well, since I added the xcopy.exe path too.
Apiano is offline   Reply With Quote

Reply

Tags
compiling, udf


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 Off
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 15 November 4, 2019 18:05
UDF to record FLUENT Solver variables... mariachi Fluent UDF and Scheme Programming 11 September 24, 2019 00:07
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 1 February 3, 2010 22:18


All times are GMT -4. The time now is 21:07.