|
[Sponsors] |
March 21, 2007, 22:53 |
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
|
#1 |
Guest
Posts: n/a
|
Good Morning Dear All,
I am happy to put forward solution to resolve the difficulty to compile udf. As I myself have gone through it resolving for long time, I like to share the solution with u. I request to put off all your defensive mechanisms from minds and hearts that dealing with udf's is a tough problem, infact they r easy and most helpful shoud we undrstand wat all udf's logic is about and how grid is represented in terms of co-ords and so on. the most basic and fundamental programming knowledge is desired but not essential to write udf. First and foremost, this method is specifically applicable to the problem of getting any of the statements below wen u try to BUILD the udf and subsequently load it. 'CANT FIND NMAKE' , 'CHNG DIRC' (chdir "libudf")() (chdir "ntx86\\2ddp")() 'nmake' is not recognized as an internal or external command, operable program or batch file. 'nmake' is not recognized as an internal or external command, operable program or batch file. I have come accross many proposals by my seniors and on forums and help files etc etc but none worked out to a general logical solution to the problem, for example the most general solution i found on forums is unistall fluent first, then install vc++ then again install fluent then set environment etc... (for people using unix operating system, go to the last lines of the post.). One more Example: First you have read ur case/mesh file before u compile it.....etc etc. there is no need for that. first u can compile then read ur case file and hook ur udf's. there is no need to do all the stuff like the above ones stated above. im putting forward the procedure and possible pit falls we generally do when we try to compile a udf. I am putting forward detailed steps understandable for a novice fluent/udf user too. experienced users may ignore a few of the comments below without getting bored. Step 1. if fluent is already intalled, the default folder is C:\FLUENT.INC if you dint change it when u install it on your computer. there is nothing to disturb fluent. leave it as it is. Step 2a. Install Microsoft Visual Studio (written MSVS from now on) (with all components including MSDN and .net, .bat and not just VC++ I repeat not JUST VC++. the express edition of MSVC++ has only debugger and not compiler and will not serve the purpose of compiling fluent udf's). MSVS will take around 500 to 700 mb space of ur hard disk but its worth. Step 2b. But the default folder will be C:\Program files\Microsoft Visual studio (x.x edition)\...., change this to C:\Microsoft Visual studio (x.x edition)\..... Step 3. While u r installing, a promt is displayed asking to chek an option if you want to have command line comiler etc..., chek the box (MOST IMPORTANT chek the box). Doing this enables command line compiler and Fluent needs and searches only for this. It has to find this command line compiler to compile udfs. Step 4. If the system asks for rebooting/restarting the system for the setup to take effect, do it. Step 5. Now after the system reboots, right click my computer ---> properties ----> advanced tab. on the bottom part u have environment variables and system variables. Step 5a. In the environment vairable add the variable for MSVS along wiht the fluent, and add path (same as that set in step 2b) also along with fluent path separtated by a semicolon. Step 5b. To carry out this step, u need to have administrative rights for the computer u r using. In the system variables panel add the same path (generally on installing this is added for MSVC, chek to make sure that this is added). In the system varaibles path also follwo step 5a. Step 6: Reset environment variables for fluent once again. (Start Menu ---- > Program Files----> Fluent.Inc----->Set environment) That's it and u r done with this.. Remember, If you are using a unix based computer, then a udf compiled on 1 pc may not work with other unix pc as, in case of unix based systems, the system C compiler is invoked and there is no need to install MSVC. Thanks for your patience of reading a lenghthy post and I hope it may be benficial for u. If you dont understand any of the steps, I advice read the steps again and again at the same time practically implementing each step. If you have difficulty still to compile a udf in syntax, u may send it to me directly. All the best Regards Rizwan. |
|
March 27, 2007, 10:18 |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
|
#2 |
Guest
Posts: n/a
|
Dear Sir,
I wrote a udf function by MSVS C++ 2005 to calculate temperature-dependent viscosity as follows; #include "udf.h" DEFINE_PROPERTY(cell_viscosity, c, t) { real mu_lam; real temp = C_T(c, t); real a, b, tempo, muo; a = 0.000178; b = 0.0542; tempo = 323.0; muo = 0.142; mu_lam = muo*exp(a*(temp-tempo)-(b*(temp-tempo))); return mu_lam; } ------------- i go a massage ' the system cannot find the file specified'. (system "copy c:\Fluent.Inc\Fluent6.216\src\makefile_nt.udf libudf\ntx86\2ddp\makefile") 1 file copied. (chdir "libudf")() (chdir "ntx86\2ddp")() 'nmake' is not recognized as an internal or external command, operabe program or batch file. I made a diectory name thin_film, and i put my case file and cell_viscosity.c file in this directory. please help. I need this urgent. Regards, |
|
March 27, 2007, 17:27 |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
|
#3 |
Guest
Posts: n/a
|
is this your entire udf? u need to chek the looping through cells as far as i guess. r u changing viscotiy of a single cell or a group of cells ??? once you complete this part then go to the compile udf part. also if its not necessary, then i suggest that u go for interpreted udfs as both serve the same purpose except tht things are done differntly in either case and flexibility of dealing with problem.
If compiled udf is mandatory, Did you go through all the steps I stated in my above post? chek with your environment variables, ask your adimistrator to copy the enviornment variables and give it to you and u too define ur environment variables same as that of yours/. Regards |
|
March 27, 2007, 17:32 |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
|
#4 |
Guest
Posts: n/a
|
Also Please be adviced that if u r using udf to modify properties of only single cell, i tested ur udf and its working absolutely fine till compiling and loading state. i dont know tha result provided by it but programming aspect is absolutely correct FOR A SINGLE CELL ONLY. I repeat FOR A SINGLE CELL ONLY not for a group of cells. U need to chek with the installation of MSVS, esp i suggest u use MSVS 6 PRO and modify the environment varialbes properly and set path.
Regards |
|
April 3, 2007, 11:16 |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
|
#5 |
Guest
Posts: n/a
|
Dear Razwan,
I have MS Visual Studio C++ 2007 express. I am looking for the full package, then, i will try your steps. I have Fluent in my computer and i am the administrator. I need to calculate the viscosity for each cell as it is temperature-dependet. the udf should take cell-temperture to calculate the viscosity. I am happy that it is working with you. When i use interpreted udf, it is working ok, but very slow. there is massage 'temp definition shadows previous definition' what does this mean? Regards, |
|
April 4, 2007, 12:41 |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
|
#6 |
Guest
Posts: n/a
|
Ya Rizwan, I too am not able to get full package. and i too use interpret and get the same message 4 times. let me know.
Thanks Rizwan |
|
April 9, 2007, 05:25 |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
|
#7 |
Guest
Posts: n/a
|
Thanks Rizwan,
I got Visual C++ full package, and i have gotten good result. Regards, |
|
April 10, 2007, 05:40 |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
|
#8 |
Guest
Posts: n/a
|
I dint get you. Can u please explain a bit more clearly? Also i want to mention is that there installing MSDN documentation library eats up computer memory terribly. Just add to my first post on wednesday 21, March that, even without documentation MSVC works fine and I have tested it.
Regards Rizwan |
|
April 16, 2007, 13:40 |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
|
#9 |
Guest
Posts: n/a
|
The message that i had got while interpreting the UDF was,
temp definition shadows previous definition. that also 4 times and then the file got interpreted. I wanted to know what does this mean? With regards, Sangeeta |
|
May 14, 2009, 01:02 |
Environment Variables
|
#10 |
New Member
Muhammad Nadeem
Join Date: May 2009
Posts: 5
Rep Power: 17 |
Dear Rizwan
Can you provide the deatils (commands and variable name) to set the environment variables for MSVS Nadeem |
|
January 28, 2010, 08:57 |
Re: ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM
|
#11 |
New Member
samt
Join Date: Jan 2010
Posts: 13
Rep Power: 16 |
Dear Rizwan
I have installed Install Microsoft Visual Studio, I followed all your steps but when I want compiled udf, I got the following error : { 1 fichier(s) copi‚(s). 1 fichier(s) copi‚(s). (system "copy C:\Fluent.Inc\fluent6.3.26\src\makefile_nt.udf libudf\ntx86\2ddp\makefile") 1 fichier(s) copi‚(s). (chdir "libudf")() (chdir "ntx86\2ddp")() Done. "c:/documents and settings/administrateur/bureau/mywork" Opening library "libudf"... Error: open_udf_library: Le fichier spécifié est introuvable. Error Object: () } Knowing that I used the same UDF in function interpreted Udfs . It works very well. Just to ensure the smooth operation of the function compiled UDFs. Please help. I need this urgent. Regards, |
|
February 26, 2010, 07:32 |
Errors with C++ compiler using VIsual Studio 2008
|
#12 |
New Member
Michael McMaster
Join Date: May 2009
Posts: 29
Rep Power: 17 |
Hi, i have followed the steps above, but when i try to compile and example UDFfrom the Fluent UDF manual, i get an error that the Microsoft Visual C++ compiler has stopped working. I dont know what to do now, getting Compiled UDFs to work is essential for progress in my PhD, any help would be greatly appreciated. Also when i start the Command line compiler of C++ in visual studio, at the top it says "vcvars32.bat is not recognised as an internal or external command, operable program or batch file" would this have anything to do with it?
|
|
February 26, 2010, 08:40 |
|
#13 |
Member
chétan
Join Date: May 2009
Location: Australia
Posts: 55
Rep Power: 17 |
Hello everyone,
I saw some of our friends are looking for complete Visual Studio. I am using Visual C++ 2008 Express Edition, which is available for free and works perfect to compile UDF's. regards Chetan |
|
February 26, 2010, 08:47 |
|
#14 |
New Member
Michael McMaster
Join Date: May 2009
Posts: 29
Rep Power: 17 |
Great, thanks, just trying that now.
Michael |
|
February 26, 2010, 09:05 |
Still error with Visual C++ express
|
#15 |
New Member
Michael McMaster
Join Date: May 2009
Posts: 29
Rep Power: 17 |
Hi all, i still get the same error that the C++ compiler stops working when i try to build the UDF. I have set the environment variable as suggested, has anyone else had this problems, does anyone know how this can be solved?
Thanks Michael |
|
July 19, 2010, 09:18 |
|
#16 |
New Member
teo wei how
Join Date: Jun 2010
Posts: 5
Rep Power: 16 |
guys....i'm trying to compile my udf n i getting this error....any1 can help ??? ihave set environment variable and everything according to the steps explained...
LINK : fatal error LNK1104: cannot open file 'kernel32.lib' |
|
July 22, 2010, 18:21 |
UDF compilation on Windows and launcher
|
#17 |
New Member
Join Date: Jul 2010
Posts: 5
Rep Power: 16 |
If you are using FLUENT12.0 and newer, compilation of UDF is lot easier.
1. install FLUENT 2. install MS Visual Studio 2005 or 2008 There is no order who is first installed, FLUENT or Compiler 3. launch FLUENT with the FLUENT launcher, with the proper current working directory, where you have the C files. Compiler path should have been setup automatically 4. do your normal compilation |
|
August 14, 2010, 16:45 |
|
#18 |
New Member
Alvin Simer
Join Date: Aug 2010
Posts: 2
Rep Power: 0 |
Followed the step above, but getting this error,
"Error: open_udf_library: %1 is not a valid Win32 application. Error Object: ()" Please, can anyone help me? |
|
September 19, 2010, 20:58 |
|
#19 |
New Member
srr
Join Date: Feb 2010
Posts: 25
Rep Power: 16 |
Thanks a lot, I tried with FLUENT 12 and MS VS 2008 and it worked perfectly
|
|
October 7, 2010, 05:52 |
|
#20 | |
New Member
asal
Join Date: Apr 2010
Posts: 11
Rep Power: 16 |
Quote:
tanx |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help! Compiled UDF problem 4 Wave tank tutorial | Shane | FLUENT | 1 | September 3, 2010 03:32 |
Problem with my udf | july | Fluent UDF and Scheme Programming | 3 | June 20, 2010 07:56 |
Error compile file udf | czfluent | Fluent UDF and Scheme Programming | 24 | September 26, 2009 14:24 |
UDF compile problem | ak6g08 | Fluent UDF and Scheme Programming | 2 | June 25, 2009 07:56 |
dynamic mesh and udf problem | boboroo | FLUENT | 1 | January 20, 2008 22:26 |