CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Windows Environment variables- to solve problems in compiling UDF in Fluent (https://www.cfd-online.com/Forums/fluent-udf/97960-windows-environment-variables-solve-problems-compiling-udf-fluent.html)

tandem October 26, 2014 20:42

@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

renatovj December 15, 2014 19:54

Quote:

Originally Posted by manalis (Post 500749)
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 December 15, 2014 20:10

Also tried to add C:\Windows\System32; to the path variable. Not working yet...

vasava December 16, 2014 03:25

Quote:

Originally Posted by renatovj (Post 524116)
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.

renatovj December 16, 2014 05:47

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!:confused:

Did you run Fluent from GUI or from the Windows SDK prompt?

vasava December 16, 2014 07:35

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.

tandem December 18, 2014 02:13

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!

vasava December 18, 2014 02:44

Here is a link to some other post which might help.
http://www.cfd-online.com/Forums/flu...tml#post524392

renatovj December 19, 2014 08:50

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.

shivakumar March 10, 2015 03:11

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..

vasava March 10, 2015 04:41

I think these errors are due to problems with your UDF and has nothing to do with compilation.

shivakumar March 10, 2015 05:56

1 Attachment(s)
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

renatovj March 10, 2015 06:07

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!

shivakumar March 10, 2015 12:14

1 Attachment(s)
Thanks for your reply.. you are right, little problem in UDF not in the compilation.

reza.erfani March 21, 2015 07:44

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

vasava March 23, 2015 00:53

Post your UDF and we can have a look at it.

mimi0201 March 25, 2015 17:54

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.

reza.erfani March 30, 2015 05:25

Quote:

Originally Posted by vasava (Post 537755)
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

mbaldwin8 April 13, 2016 08:43

@tandeem
Did you ever find a solution that worked for you on this issue?
(never mind, I now see the response thread)

Apiano May 18, 2016 10:33

It worked well, since I added the xcopy.exe path too.:)


All times are GMT -4. The time now is 06:43.