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

UDF compile HELP!!

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 18, 2006, 05:05
Default UDF compile HELP!!
  #1
Leigh
Guest
 
Posts: n/a
Hello all,

I am new to the world of compiling. I have to create a dynamic mesh to model a vibrating wall and need help in compiling the UDF. I have the UDF as follows;

#include "udf.h"

DEFINE_CG_MOTION(wave, dt, vel, omega, time, dtime) { vel[0]=0.001*sin(1099557.429*time); }

This works fine as far as im aware. My problem is that I do not know how to turn this into a compiled function so I can load it in Fluent. My knowledge of c++ is limited at best.

Any help would be much appreciated. Leigh

  Reply With Quote

Old   July 18, 2006, 08:51
Default Re: UDF compile HELP!!
  #2
PAD
Guest
 
Posts: n/a
If you have a C compiler installed it should be fairly easy. In Fluent just goto Define | User-defined | Functions... | Compiled... - select your c-files and compile...

Afterwards click load to load the udf library
  Reply With Quote

Old   July 18, 2006, 09:02
Default Re: UDF compile HELP!!
  #3
Leigh
Guest
 
Posts: n/a
Hello, thanks for your reply.

It is the selection of the c-files that confuses me. I have my UDF defining the motion as shown in my previous post but I dont know what other c files I need.

Leigh
  Reply With Quote

Old   July 18, 2006, 09:38
Default Re: UDF compile HELP!!
  #4
Fabrice
Guest
 
Posts: n/a
Hi,

You don't need any other C files, just write your UDF with a text editor and name it with the extension .c (for example "my_function.c").

Be aware to have your UDF in the same directory than your case and data file otherwise you will get an error message.

PAD's reply is quite correct about how to compile a UDF. For this purpose you need a C compiler such as Microsoft Visual C++.

Fabrice.
  Reply With Quote

Old   July 18, 2006, 09:49
Default Re: UDF compile HELP!!
  #5
Leigh
Guest
 
Posts: n/a
hello,

Your advice is very helpful, I have Microsoft Visual C++, and I have tried to use the compile function in it without luck. It comes up with the error message

"Cannot open include file: 'udf.h': No such file or directory Error executing cl.exe."

I have also tried to load the udf in fluent then clicked build, i then get the error;

'nmake' is not recognized as an internal or external command, operable program or batch file.

Thanks for your help, Leigh
  Reply With Quote

Old   July 18, 2006, 09:58
Default Re: UDF compile HELP!!
  #6
PAD
Guest
 
Posts: n/a
Regarding "Cannot open include file...". Check that you have set the environment variables in Fluent using setenv.exe from folder \ntbin\ntx86.

'nmake' error is most likely also caused by missing environment variables. Fluent does not know where to find the exe-file if the variables are not set properly.

Hope this helps!

Regards, PAD
  Reply With Quote

Old   July 18, 2006, 10:07
Default Re: UDF compile HELP!!
  #7
Leigh
Guest
 
Posts: n/a
I think im getting there with your help!

I tried using setenv.exe and followed the modification successfuly although it has not changed the outcome from both error messages.

Leigh
  Reply With Quote

Old   July 18, 2006, 13:40
Default Re: UDF compile HELP!!
  #8
PAD
Guest
 
Posts: n/a
The error containing cl.exe is related to the C compiler settings. Check your system environment variables for the correct settings with regards to the C compiler.

If the environment is correct setup you should be able to check it by typing nmake in a command prompt. This should run no matter which folder you are located in...

Hope this helps - otherwise I will check my PC tomorrow with regards to the different settings.
  Reply With Quote

Old   July 18, 2006, 13:43
Default Re: UDF compile HELP!!
  #9
PAD
Guest
 
Posts: n/a
Just a note:

As I read you post you have been trying to compile your code from C++ development environment. I don't think you can compile your UDFs from there - this has to be done in Fluent due to the relation with udf.h etc. Fluent knows the location of these files whereas MS C++ does not.

If I'm wrong please correct me anyone.
  Reply With Quote

Old   July 18, 2006, 16:14
Default Re: UDF compile HELP!!
  #10
jasond
Guest
 
Posts: n/a
The nmake error probably comes from command line compiler (and tools) installation. There are some workarounds, but your best bet is to check that the command line stuff was fully set up when VC++ was installed.

Jason
  Reply With Quote

Old   July 19, 2006, 03:08
Default Re: UDF compile HELP!!
  #11
Albert Franco
Guest
 
Posts: n/a
I have the same problem as you, I downloaded dev c++ but it continues like before. I'll try using UNIX, I've heard it has a C complier installed by default.
  Reply With Quote

Old   July 19, 2006, 04:23
Default Re: UDF compile HELP!!
  #12
Leigh
Guest
 
Posts: n/a
Thanks for all of your replies, I will check with the person who deals with the fluent and VC++ software at my uni to see how he/she installed it.

Cheers, Leigh
  Reply With Quote

Old   July 19, 2006, 09:03
Default Re: UDF compile HELP!! *NM*
  #13
Albert Franco
Guest
 
Posts: n/a
  Reply With Quote

Old   July 19, 2006, 09:06
Default Re: UDF compile HELP!!
  #14
Albert Franco
Guest
 
Posts: n/a
Ok, If you get the answer to your problem I would apreciate if you can post it here, I'm in the same situation as you, now I've tried with unix system but it continues without compiling the udf's.

Thanks!!
  Reply With Quote

Old   July 19, 2006, 09:48
Default Re: UDF compile HELP!!
  #15
jasond
Guest
 
Posts: n/a
Has anyone asked Fluent (officially) if the free version of VC++ works with Fluent? I have read in this forum that it does, but I am not sure I have seen "proof". If it did, that would be great.

A prediction: the only way to get it working correctly is a reinstallation of VC++.

Jason

P.S. Even on Unix machines, if the setup is not done properly Fluent will not be able to find the C compiler.
  Reply With Quote

Old   July 19, 2006, 10:01
Default Re: UDF compile HELP!!
  #16
PAD
Guest
 
Posts: n/a
I have asked Fluent support regarding MS C++ Express Edition and it should work flawlessly. I'm using it myself without problems at least

  Reply With Quote

Old   August 2, 2006, 08:40
Default Re: UDF compile HELP!!
  #17
Leigh
Guest
 
Posts: n/a
Hello,

I finally got the UDF in compile. I contacted my local computer servicing guy at the uni, and he was able to globalise a couple of files so that fluent could find them. Firstly the nmake.exe file which was located in Visual basic somewhere (just search) and then we got another error as it could not find another file, I cant remember its exact name but its a .dll file found in Fluent, and anyway when you try to compile it the error will say. Once these two were made globaly available it worked! I guess if you have acsess to your system environment settings you could do this yourself, but I did not have the access. Hope this helps, and thanks for the help everyone.

Leigh

  Reply With Quote

Old   August 22, 2006, 14:17
Default Re: UDF compile HELP!!
  #18
prasad
Guest
 
Posts: n/a
Hi, when i try to compile a udf by calling nmake , fluent says the compiler cant parse. can you help me with this? thanks prasad
  Reply With Quote

Old   August 23, 2006, 03:42
Default Re: UDF compile HELP!!
  #19
Albert F.
Guest
 
Posts: n/a
Look at the post error while compiling udf. I don't know if it is what is happening to you but I explained how I solved the problems compiling the udf and one problem was that nmake mas not recognised.

Hope it helps.

Albert
  Reply With Quote

Old   August 28, 2006, 00:03
Default Re: UDF compile HELP!!
  #20
kk
Guest
 
Posts: n/a
If you are using windows version, check the path under DOS command window by typing 'path'. You have to set the path for FLUENT to locate the nmake.
  Reply With Quote

Reply


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
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 07:05
Error compile file udf czfluent Fluent UDF and Scheme Programming 24 September 26, 2009 14:24
udf compile in parallel system tahereh FLUENT 1 December 9, 2008 10:48
Can someone PLEASE document the development version installation bernd OpenFOAM Installation 76 November 14, 2008 22:51
compile the UDF Li Jingping FLUENT 2 April 14, 2003 22:18


All times are GMT -4. The time now is 20:55.