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/)
-   -   my udf problem!!! (https://www.cfd-online.com/Forums/fluent-udf/182304-my-udf-problem.html)

mostanad January 6, 2017 05:04

my udf problem!!!
 
Hello everybody
I want to compile my udf in fluent. the udf is is a simple parabolic velocity profile in pipe and inlet. as shown below:
Code:

/***********************************************************************
udfexample.c
UDF for specifying steady-state velocity profile boundary condition
************************************************************************/
#include "udf.h"
DEFINE_PROFILE(inlet_x_velocity, thread, position)
{
real x[ND_ND]; /* this will hold the position vector */
real y, h;
face_t f;
h = 0.186; /* inlet height in m */
begin_f_loop(f,thread)
{
F_CENTROID(x, f, thread);
y = 2.*(x[1]-0.5*h)/h; /* non-dimensional y coordinate */
F_PROFILE(f, thread, position) = 1*(1.0-y*y);
}
end_f_loop(f, thread)
}

at first I am using windows 7, ansys fluent 16.2, Microsoft visual studio 2008. also I have Microsoft windows SDK 7.1. when I want to compile my udf, I use two methods. first: running fluent with Microsoft visual studio command prompt and second:running fluent with Microsoft windows sdk 7.1. also my case, .c and .h files are in same folders. with first method, it seems very good in "build" item. but the problem is with loading that gives me error as shown below:
build:
Code:

Copied E:\project    urbulence\p-2\PROJ_files\dp0\FLU\Fluent/E:\project    urbulence\p-2\PROJ_files\dp0\FLU\Fluent\inlet_x_velocity.c to libudf\src
user_nt.udf file is outdated. So, recreating the file for 2d ...
(chdir "libudf\win64\2d")(system "copy "C:\PROGRA~1\ANSYSI~1\v162\fluent"\fluent16.2.0\src\udf\makefile_nt.udf "libudf\win64\2d\makefile" ")
        1 file(s) copied.
(chdir "libudf")(chdir "win64\2d")# Generating ud_io1.h
inlet_x_velocity.c
# Generating udf_names.c because of makefile inlet_x_velocity.obj
udf_names.c
# Linking libudf.dll because of makefile user_nt.udf udf_names.obj inlet_x_velocity.obj
Microsoft (R) Incremental Linker Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.

  Creating library libudf.lib and object libudf.exp

Done.

and load:
Code:


Opening library "E:\project\turbulence\p-2\PROJ_files\dp0\FLU\Fluent\libudf"...
Error: Error code: 193


Error: Error code: 193

Error Object: #f

but when opening case file with microsoft windows sdk it gives:
in build:
Code:

Copied E:\project    urbulence\p-2\PROJ_files\dp0\FLU\Fluent/E:\project    urbulence\p-2\PROJ_files\dp0\FLU\Fluent\inlet_x_velocity.c to libudf\src
Creating user_nt.udf file for 2d ...
(system "copy "C:\PROGRA~1\ANSYSI~1\v162\fluent"\fluent16.2.0\src\udf\makefile_nt.udf "libudf\win64\2d\makefile" ")
        1 file(s) copied.
(chdir "libudf")(chdir "win64\2d")# Generating ud_io1.h
inlet_x_velocity.c
C:\PROGRA~1\ANSYSI~1\v162\fluent\fluent16.2.0\src\main\global.h(9) : fatal error C1083: Cannot open include file: 'stdio.h': Invalid argument
Done.

but in load:
Code:

Opening library "E:\project\turbulence\p-2\PROJ_files\dp0\FLU\Fluent\libudf"...
Error: The UDF library you are trying to load (libudf) is not compiled for 2d on the current platform (win64).

The system cannot find the file specified.

E:\project\turbulence\p-2\PROJ_files\dp0\FLU\Fluent\libudf\win64\2d\libudf.dll

Error: The UDF library you are trying to load (libudf) is not compiled for 2d on the current platform (win64).

The system cannot find the file specified.

E:\project    urbulence\p-2\PROJ_files\dp0\FLU\Fluent\libudf\win64\2d\libudf.dll
Error Object: #f

i am very confused. is anybody solve these problems???
thanks guys


mostanad January 6, 2017 13:44

and no answer yet???!!!

Boh January 10, 2017 12:20

maybe your microsoft visual studio version is too old...try to download the 2013...(have you add the enviromental variables?)

mostanad January 10, 2017 12:23

Solved
 
Thanks a lot
Finally o have solved my problem. I am using microsoft windows sdk 7 so i link it to my visual studio 2008 in its configuration tools.


All times are GMT -4. The time now is 03:45.