|
[Sponsors] |
How to solve UDF compilation problems in Fluent. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 2, 2016, 05:37 |
How to solve UDF compilation problems in Fluent.
|
#1 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
There are many threads on this forum about compilation problems. Many of those threads show that users have no idea how to start solving their problems related to compiling, so here a start. In red are the questions that you might ask yourself, and below that are solution methods.
I did not get any error when I compiled, but later I get "Error: The UDF library you are trying to load (libudf) is not compiled for 3d on the current platform (...)". When I compile, I get the error "Error: The UDF library you are trying to load (libudf) is not compiled for 3d on the current platform (...)" This error means that you are trying to load a UDF that was not compiled. Actually, that is even exactly what is written in the error message. Before you load the UDF, you have to compile it. In Fluent, this is done by clicking 'build'. Probably you did that, and think everything went fine. But it probably went wrong. If compiling goes wrong, you don't get an error message in a separate window, but the error message is written in the text user interface (the block with text normally on the bottom right of your screen). Check there which errors are showing when you click 'build'. When I try to compile, I see the message "'nmake' is not recognized as an internal or external command, operable program or batch file." The program "nmake" is the compiler. This message means that Fluent can not find the compiler, so it is unable to compile anything. This has nothing to do with the code you wrote, but with the installation/settings of Fluent. Probably you have never been able to compile anything in Fluent. Follow the steps that Fluent advises to set up a compiler, and test it with one of the simple codes in their manual. (Somebody wrote a nice 'how-to-set-up-Fluent-with-compiler-post' on this forum, but I can not find it now.) I get an error such as: ..\..\src\udfsource.c(102) : error C2065: 'mass' : undeclared identifier Now we are really talking about code problems. There can be many more lines just like this, but generally it is best to start with the first one. Let's go through this step by step. ..\..\src\udfsource.c(102) : error C2065: 'mass' : undeclared identifier
When I run the code, I get "FLUENT received fatal signal (ACCESS_VIOLATION)" This is a nasty one. It means that you made a mistake in your code. But not a grammar mistake, but a logical mistake. You are trying to access (read or write) memory that does not exist. For example: you defined an array with 10 members, and now you are trying to write to the eleventh member. Or you are trying to read a temperature gradient from a face for which Fluent does not store the temperature gradient. It can be many things... One of the annoying things is that you don't know where in the code this access violation happened. If you want to solve the problem, you first have to find out where the problem is. One way to do this: make your program write text. Put somewhere in the middle of your code the following line: Code:
Message("UDF got to here.\n"); You can always come to this forum to ask for help on this. But my experience is that people are better able (and willing) to help you if you already did your own investigation in the way I wrote here, and share your results. If there are additions/changes, I might update this post. Last edited by pakk; May 3, 2016 at 06:10. |
|
May 2, 2016, 22:37 |
|
#2 |
Member
mimi
Join Date: Mar 2016
Posts: 33
Rep Power: 10 |
Thank you for the information. =)
Your description is highly appreciated |
|
May 3, 2016, 06:07 |
|
#3 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Great job, pakk. Hope that does help people in their UDF compilation problems and they come with real UDF related questions.
Once again, great job. |
|
May 6, 2016, 12:27 |
|
#4 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Hi pakk, I've just uploaded this tutorial from Ansys teaching how to compile for paralell and serial. Also covers the compiler, prompt, etc.. Have a look if it is worthy to add in your post.
Last edited by Bruno Machado; May 10, 2016 at 07:01. |
|
May 10, 2016, 06:53 |
|
#5 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Hi Bruno,
I am sure you have the best intents, but since you probably don't have permission from Ansys to distribute this document, it is probably a copyright violation to distribute this. I respect that other persons have no problems with this (and I am not going to inform Ansys about this), but I choose not to get involved myself. |
|
May 10, 2016, 07:01 |
|
#6 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
I'll delete the link before to avoid any issues with Ansys. |
||
December 7, 2017, 04:14 |
.dll file error while compiling code
|
#7 |
New Member
Anony
Join Date: Dec 2017
Posts: 5
Rep Power: 9 |
Hi pakk,
I am new to UDFs. I read fluent manual to get idea about udf. I learned something but i am unable to compile a udf. I have one udf file named a.c. i put that file in a folder with my case file. I opened fluent from SDK and then went to user defined functions and then to compiled and then added my udf a.c. then i clicked build. It said something like generating io1.h. Then i clicked load. Then i am gettingg an error that libudf.dll file is missing. What should i do? Look at the photos i uploaded for exact error shown. |
|
December 7, 2017, 04:46 |
|
#8 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
One problem: your folder name has a space in it. This gives problems to the Fluent compiler. Do everything in a folder name without spaces.
|
|
December 8, 2017, 01:12 |
|
#9 |
New Member
Anony
Join Date: Dec 2017
Posts: 5
Rep Power: 9 |
It seems like that is not the problem. (Have a look at image i attached)
I tried doing it by putting files in a folder without any spaces. It is showing the same error. Not only this i tried many different ways told by different users in this forum. Everytime i am receiving this error. I am unable to find what is causing this error. So i want to start from scratch. Could you tell me step by step what i have to do and i will do the same. I want to learn how to compile any udf. |
|
December 8, 2017, 07:50 |
|
#10 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Check the first item (red text above). You have to look at what comes on your screen after you click "build".
What you show was what comes on your screen after you click "load". That does not help. |
|
January 3, 2018, 09:35 |
|
#11 |
New Member
Anony
Join Date: Dec 2017
Posts: 5
Rep Power: 9 |
Hi Pak,
the error was exactly the same error which came before(the one in my previous reply), except the change in name of folder. As you said, i didnt put any spaces in the folder name and file name. |
|
January 3, 2018, 09:47 |
|
#12 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
OK. Start a new Fluent, and load your model.
Then: Go to "user defined", "functions", "manage", and if there is any udf loaded, unload it. Then: go to "user defined", "functions", "compiled", add the source file that you want. Don't click 'build' yet, but look what is currently on your screen. Now click 'build'. Which text was added to your screen after you clicked 'build'? (Don't describe it, but just copy it letter by letter.) |
|
January 4, 2018, 01:45 |
|
#13 |
New Member
Anony
Join Date: Dec 2017
Posts: 5
Rep Power: 9 |
The following message was added when i clicked BUILD.
Copied D:\UDF\FYP\fyp_files\dp0\FFF\Fluent/D:\UDF\FYP\fyp_files\dp0\FFF\Fluent\1.c to libudf\src Creating user_nt.udf file for 2ddp ... (system "copy "C:\PROGRA~1\ANSYSI~1\v160\fluent"\fluent16.0.0\sr c\udf\makefile_nt.udf "libudf\win64\2ddp\makefile" ") 1 file(s) copied. (chdir "libudf")(chdir "win64\2ddp")# Generating ud_io1.h Done. I am also attaching screenshots to make things easier for you. |
|
January 4, 2018, 03:46 |
|
#14 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Mb I'm wrong
but it seems, that Fluent doesn't compile your source file, he thinks libudf library is up to date. Solutions: 1. You may use other name of library (other than libudf, for instance myudf) 2. Once fluent is opened, open your source file, and imitate change: type space, than delete it and save. Now you can compile with the same library name libudf. Best regards |
|
January 4, 2018, 08:54 |
|
#15 |
New Member
Anony
Join Date: Dec 2017
Posts: 5
Rep Power: 9 |
Hey AlexanderZ,
Thanks for reply. Out if two solutions you suggested, i tried first one and it was unsuccessful. I already tried many times giving it many different library names. And as for the 2nd one, I am not getting what you are saying. Can you elaborate what you want me to do?. |
|
January 4, 2018, 21:01 |
|
#16 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Are you sure that your SDK's version is win64 ?
|
|
September 10, 2018, 03:48 |
|
#17 | |
Senior Member
Join Date: Feb 2010
Posts: 164
Rep Power: 17 |
Use the compiling/debugging tool, UDF will be very easy.
https://vcudfstudio.bitbucket.io/ Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A Problem of Fluent Interpreted UDF: parse error | knight | Fluent UDF and Scheme Programming | 25 | August 16, 2018 11:26 |
UDF Compilation Error for Fluent 12.1 | carteblanche | Fluent UDF and Scheme Programming | 8 | July 16, 2015 02:48 |
Fluent UDF for thermal NOx | larsschwarzer | Fluent UDF and Scheme Programming | 1 | July 18, 2014 09:39 |
is it possible to solve mass transfer problems in FLUENT | travikiran | FLUENT | 2 | August 11, 2010 05:46 |
Fluent 5.5 can't solve Multiphase+Multicomponent? | Thitikorn | FLUENT | 8 | March 27, 2002 23:57 |