Temperature Gradient UDF file not compiling
Hello,
I have a 2D spiral geometry and I am trying to calculate the temperature gradient along the wall. I have written a UDF code to calculate it but it is not getting compiled. Can anyone help me out here ? I am attaching my udf file here. Code:
#include "udf.h" |
What compiler error do you get?
|
Error: UDF library "libudf" not available at ...
|
That is not the compile error, but the load error. What do you see after you click "build"?
|
|
It's saying there is a problem in line 9. It is saying which word is the problem. Look at that!
|
The error you post, does not correspond to the code you posted.
In the code, you use "domian". The error says "domain". Presumably you fixed that already. But the real problem is that you use a word that Fluent does not know. What is domain/domian? It's the first time you use that word, Fluent does not know what you mean. I, as a human, can guess what you mean: earlier you called it "d". But the compiler can not guess that. Use the same name! |
Actually it was a typing mistake and I have already corrected it after that it is showing me that error.
|
I think you missed the second part of my post.
|
Code:
#include "udf.h" I am still getting following error message : Error: The UDF library you are trying to load (D:\Spiral\Grid Dependency Test-New Geometry\No Of division - 500\2Dv2\2Dv2_files\dp0\FFF\Fluent\libudf) is not compiled for 2ddp on the current platform (win64).\n\nThe system cannot find the file specified. \n\nD:\Spiral\Grid Dependency Test-New Geometry\No Of division - 500\2Dv2\2Dv2_files\dp0\FFF\Fluent\D:\Spiral\Grid Dependency Test-New Geometry\No Of division - 500\2Dv2\2Dv2_files\dp0\FFF\Fluent\libudf\win64\2d dp\libudf.dll Error Object: #f |
You are still looking at the load error. Don't do that. Look at the compile error. It should be just above this.
|
Problem is now probably in your second function : you never initialize domain.
|
Code:
#include "udf.h" |
Maybe you don't know where to look. Your earlier screenshot clearly showed a compile error... Above the load error.
|
I am sorry but I am not understanding your point. Can you elaborate a little bit ? Here is the image after I click on the build : https://imgur.com/vdroI1S
And Here is the image after I click on the load : https://imgur.com/lpa3IEs And also "Problem is now probably in your second function : you never initialize domain." Did I solve this problem ? Also can you recommend some resources to learn all of this ? |
The compile error is that nmake is not found.
This indicates a problem with fluent installation/configuration, and has nothing to do with your code. Weird, because in your earlier screenshot it worked. Is this on the same computer? I don't have a good advice to learn this... The manual, Google, and this forum... |
No, it is the same computer but I was looking through google and found that I need to install microsoft visual studio. I am not understanding the difference between compile error and load error. Which error I am getting ? and what is the solution of this ?
|
You are getting both.
Your file did not compile, because your compiler was not found. And because it was not compiled, Fluent could not load it. How to solve that: install Fluent properly. I'm no expert on that. Search for the nmake message on this forum. |
Post a screenshot of what you get when compiling, not when loading
|
probably the error is here
thread_loop_c(t,domain) make it thread_loop_c(t,d) |
Thanks for your reply but I have already solved that part.
|
Thanks for your reply but I have already corrected that part.
|
Right now I think I have solved that nmake error. Now whenever I build and load the file I am getting following messages :
https://imgur.com/shobqf9 |
Define mass source on boundary cells used UDF
Hi, friends
I am using UDF to define a mass source on the boundary cells, here's my code. My case is this: particles and water flow in a pipe, and I want to define a mass source for the particle phase in the pipe wall cells. When I compile this UDF, it works normally, but the volume fraction of particles at the wall has not changed. According to my UDF, the volume fraction of the particle phase in the pipe wall cells should be reduced. I don't know where the error is, but the UDF can work well after compilation. Can anyone help me? //* You are storing source in User defined memory under DEFINE_ON_DEMAND. Then you are using UDMI(c0,t0,0) in DEFINE_SOURCE *// #include "udf.h" //get the boundary cells DEFINE_ON_DEMAND(selecting_the_cells) { #if !RP_HOST Domain *d; Thread *t, *tc, *t0; face_t f; cell_t c, c0; d = Get_Domain(1); tc = Lookup_Thread(d, 9); //Get boundary thread, wall zone ID is 9 //Loop through all the cell threads in the domain thread_loop_c(t, d) { //Loop through the cells in each cell thread begin_c_loop(c, t) { C_UDMI(c, t, 0) = 0; } end_c_loop(c, t) } begin_f_loop(f, tc) { c0 = F_C0(f, tc); t0 = THREAD_T0(tc); C_UDMI(c0, t0, 0) = 1; } end_f_loop(f, tc) #endif } DEFINE_SOURCE(mass_source, c, t, dS, eqn) { real source; if (C_UDMI(c, t, 0) > 0.) { source = -1000.; dS[eqn] = 0.; } else { source = 0.; dS[eqn] = 0.; } return source; } |
You forgot to tell what kind of variable d is.
Domain *d; (if I remember correctly) |
It is the variable which is used to get the domain in DEFINE_ON_DEMAND macro.
|
Yes I know that, but you did not tell Fluent, so you have to add that code.
|
Look in your photo ... the error is coming from the 4 lines above "Done"
|
I have solved this error and it is working perfectly. Thank you for all of your help. This is the final code.
Code:
#include "udf.h" |
UDF is loading and compiling perfectly but I can't seem to find this variable anywhere. Do you know where to look for ?
|
results -> contours -> contours of: user-defined scalar/user-defined memory -> select surface or zone
|
All times are GMT -4. The time now is 11:51. |