|
[Sponsors] |
UDF Compilation Error - Loading Library - COMMON Problem! Help! |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 13, 2014, 16:03 |
UDF Compilation Error - Loading Library - COMMON Problem! Help!
|
#1 | |||
New Member
Rob
Join Date: Apr 2014
Posts: 13
Rep Power: 12 |
Hello,
NOTE: ------------------------------------------------------------ This is a pretty long post... however, I PROMISE that if anyone can provide some insight into this problem, it will help a LOT of people! I see inquiries about this exact error message all over the internet... ...in fact, I considered posting this on one of the many related threads on this issue. However, all of the threads I found were either 1) very similar, but just different enough to warrant a new thread or 2) years old and abandoned before a satisfactory solution was suggested. Hopefully my first post will guide others through the process of triaging their issue. Obviously, none of my steps successfully solved my problem... thus, this thread! ------------------------------------------------------------ ISSUE: ------------------------------------------------------------ After what appears to be a successful compilation (with some odd syntax errors in "math.h," which is very strange) I attempt to load the UDF library and receive this error message: Quote:
ATTEMPT AT RESOLUTION: ------------------------------------------------------------ After this disappointing failure, I performed some Google searches and tried:
With the exception of 1, these steps did not alter the error message displayed in the TUI in any way. ------------------------------------------------------------ IS ANY OF THIS NECESSARY? ------------------------------------------------------------ The entire reason I decided to compile my (relatively simple) UDF over interpreting is because of an error message I kept receiving whenever I attempted to interpret my UDF source code in Fluent: Quote:
Code:
Thread *outlet_thread = Lookup_Thread(domain,ZONE_ID); Assuming there is no issue with that line (and there certainly could be) my assumption was that the error resulted from the need to compile my source code over interpret... although the manual wasn't specific enough about the interpreter limitations for me to be certain that that was the case. (This is probably because it is written for those that know C fairly well, and I'm no more than an amateur.) And as long as we're talking amateurism, it's also possible (likely?) that my code is a mess. As you already know, I'm new to UDFs, and I have yet to get a chance to debug my code and learn about the Fluent macros from experience... once it's compiled, I shall be happy to learn more on my own! My point is this: if you think my code is nonsense, don't hesitate to tell me. Although getting my code to work without compiling would be great for now - if that's even an option - the larger compiler issue is still important to resolve so that I (and anyone else with the same issue) can work on UDFs in the future! ------------------------------------------------------------ REFERENCE: MY UDF SO FAR ------------------------------------------------------------ Code:
/****************************************************************************** DESCRIPTION: UDF for determining real inlet conditions based on pump curve data (hard-coded) and the system demand curve (geometry in ANSYS) AUTHOR: Robert * ***** CREATED: 5/9/2014 LAST CHANGED: 5/13/2014 ******************************************************************************/ #include "udf.h" //Required for all Fluent UDFs #define INLET_AREA 0.0001 //Inlet cross-sectional area in m^2 #define HEIGHT 0.0001 //Height of inlet to be addded to //position vector in m #define ZONE_ID 14 //Zone ID for outlet /*----------------------------------------------------------------------------- *Adjusts BC using ANSYS compiler macro *Uses value of pressure difference to adjust flow velocity *Flow velocity is considered in 1 dimension *t is pointer to thread on which BC is applied *i is index that identifies variable that is set when UDF is hooked -----------------------------------------------------------------------------*/ DEFINE_PROFILE(pump_curve,t,i) { /*------------------------------------------------------------------------- *Global variable initialization -------------------------------------------------------------------------*/ face_t f; //Declare a special variable structure to store face data real outlet_pressure,pressure_drop; //Pressure variables real face_num,pressure = 0; //Storage variables for calculations //face_num sums number of faces in loop //pressure sums pressure in loop /*------------------------------------------------------------------------- *First, the domain must be retrieved *Required because it was not passed in define macro -------------------------------------------------------------------------*/ Domain *domain; //Domain is declared as a variable domain = Get_Domain(1); //Returns fluid domain pointer /*------------------------------------------------------------------------- *Next, we must obtain the outlet thread *The inlet thread is passed vis the define macro, not outlet *We need outlet thread to determine outlet pressure *Outlet pressure is used to determine pressure drop later -------------------------------------------------------------------------*/ Thread *outlet_thread = Lookup_Thread(domain,ZONE_ID); /*------------------------------------------------------------------------- *Outlet pressure must now be obtained *Outlet pressure is used to determine pressure drop later -------------------------------------------------------------------------*/ begin_f_loop(f, outlet_thread) { pressure += F_P(f,outlet_thread); //F_P gets face pressure //The += sums values in loop face_num++; //Inrement number of faces by one for each loop } end_f_loop(f,outlet_thread) outlet_pressure = pressure/face_num; //Average outlet pressure pressure = 0; //Reset pressure face_num = 0; //Reset number of faces Message("The outlet pressure is calculated to be %g/n",outlet_pressure); /*------------------------------------------------------------------------- *This loop will apply the new velocity boundary condition ------------------------------------------------------------------------- begin_f_loop(f,t) { F_CENTROID(x,f,t); //Find and store position vector for face y = x[1] //Second value (y) in position vector array F_PROFILE(f,t,i) = f(pressure_drop) //This sets the new velocity //^^^ FEED PRESSURE DROP INTO PUMP CURVE FUNCTION } end_f_loop(f,t) */ } REFERENCE: "BUILD" OUTPUT BEFORE LOADING LIBRARY ------------------------------------------------------------ Quote:
Thank you all for your help in advance! Rob |
||||
May 14, 2014, 09:38 |
|
#2 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
Hi,
I didn't read closely all your post but I have some advice: - the comments at the end of lines (//blablabla) are probably causing the syntax errors, always use /*blablabla*/ - To get acquainted with udf compiling, you should try to compile a very simple udf (copy pasted from UDF Manual) within a very simple 2D model (e.g. 2D heat conduction problem). Last edited by macfly; May 14, 2014 at 11:37. |
|
May 14, 2014, 11:23 |
|
#3 | ||
Senior Member
Andrew Kokemoor
Join Date: Aug 2013
Posts: 122
Rep Power: 14 |
3ddp means 3d, double precision. When you compile your UDF, it only compiles for the version (2d or 3d, single or double precision, serial or parallel) that it's currently running. If you're going to run your UDF in 3d double precision parallel, it needs to be compiled when Fluent is launched in 3d double precision parallel.
Exactly how you do this depends on how you compile. If you're using the launcher, each of these is an option in the launcher. If you're running from a command prompt, you'll need to use the proper flags. Check out your 'libudf' folder. Inside 'win64' should be another folder. Its name will tell you what you've compiled it in. '3d' would be 3d single precision serial, '3ddp_host' and '3ddp_node' would be the folders for double precision parallel. If 'win32' is there instead of 'win64', then you've compiled in 32 bits and are trying to run on 64 bits. Quote:
Quote:
|
|||
May 14, 2014, 11:35 |
|
#4 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
In my case, //comments didn't cause any problem for interpreted UDF, but it caused syntax errors for compiled ones.
I think it depends if you compile in Windows or Linux: http://msdn.microsoft.com/en-us/library/wfwda74e.aspx It's better to stick with /* comments */ since it's not OS dependent. |
|
May 14, 2014, 14:36 |
|
#5 | ||||
New Member
Rob
Join Date: Apr 2014
Posts: 13
Rep Power: 12 |
Thank you all for the responses!
I've made a service request through ANSYS support and just received a response. I wanted to respond to everyone in this thread quickly and then digest the information they sent me. If the information proves to be useful, I will be sure to report back once I've gotten something out of it. Quote:
Quote:
I've been compiling by virtue of the GUI. I select double precision and parallel via the Fluent launcher. I've done this through the Workbench as well as through stand-alone Fluent, if that matters. I've also launched Fluent through the command prompt, but I didn't include any extra flags. I assumed that - because the Fluent setup window appeared normally with all of the configurable options - I configured setup after launching Fluent, and flags weren't necessary. Feel free to disabuse! Quote:
Still being new to UDFs and this method of compilation, I suppose I can't tell you that I'm certain, beyond a shadow of a doubt, that everything is compiling properly. I did make sure to include a copy of the TUI output of the "Build" function in my first post. Does it look correct? Is that ALL of the information necessary to determine if compilation was successful? Quote:
------------------------------------------------------------ Thanks again, everyone. I will report back soon. Any other ideas are still welcome. |
|||||
May 16, 2014, 11:46 |
|
#6 | |
Senior Member
Andrew Kokemoor
Join Date: Aug 2013
Posts: 122
Rep Power: 14 |
Quote:
I can't say much from the build output, but it does have errors, so I'd venture to guess it isn't compiling. Your UDF looks like it should be able to be interpreted, so I'd suggest focusing on that and using errors there to debug. |
||
June 18, 2014, 04:43 |
|
#7 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Were you able to finish this and get it stable?
I tried to model a pump curve boundary condition, but in the opposite way that you did: I calculated the mass flux through the boundary, looked up the corresponding pressure, and applied that as a pressure outlet. However, during simulation the values (both pressure and mass flux) start oscillating until the simulation diverges. I am considering changing to your approach, but it would be helpful to me to know if you found similar problems. |
|
June 18, 2014, 11:05 |
|
#8 | ||
New Member
Rob
Join Date: Apr 2014
Posts: 13
Rep Power: 12 |
Hello all,
I just returned after nearly five weeks travelling abroad, and I've been away from ANSYS the entire time. I wanted to make a post about how this issue may be resolved. It's quite simple, really. Basically, VS 2013 will not work. There was a change in the libraries with 2013. ANSYS has addressed this in Ansys 15.0.7, which is due out in June with some changes to how Fluent finds these new library locations. If you don't want to wait for the update, you will have to uninstall 2013 and use 2012. This is basically what I did to solve the problem. For your convenience, I would have loved to attach the document that explains all of the minor steps in detail. However, it appears that it exceeds the forum file size limits at ~300kb. Oh well. Here's what you can search to find the article in ANSYS knowledge resources: Quote:
Quote:
That's an interesting approach. As I mentioned earlier, I just got back from five weeks of travel. I haven't touched my UDF since I left. Considering I was brand new to them before I left, I have to relearn a bit before I make headway again. However, I will be posting code regularly to this thread. Feel free to ask any questions there, where the pump BC is the topic of discussion. No, my code wasn't stable when I left; that is, it wasn't exactly doing what I wanted it to, but it did run without issues. I'm having problems that I believe are associated with parallel programming considerations. I have great ANSYS support and will be reaching out to them to get some answers. I will post the short version of what I hear to the pump BC thread when I get more information. |
|||
July 24, 2015, 01:53 |
|
#9 |
New Member
Amit soni
Join Date: Jul 2015
Posts: 10
Rep Power: 11 |
Opening library "E:\case run amit\2d\libudf"...
Error: The UDF library you are trying to load (libudf) is not compiled for 3ddp on the curent platform (win64). The system cannot find the file specified. I tried all the possible ways, do I have to check the boundary condition? #include "udf.h" #include "stdio.h" #include "stdlib.h" #include "math.h" #include "dynamesh_tools.h" #include "storage.h" DEFINE_CG_MOTION(object_mov , dt , vel , omega ,time , dtime) { real v,a,w,pi; pi = 3.1415; a = 0.05; w = 2*pi*2; v = 0; v = -a*w*sin(w*time); vel[0] = 0; vel[1] = v; vel[2] = 0; } I tried this simple example as suggested in CFD online forum |
|
Tags |
compile, parallel, platform, udfs, win64 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 |
A problem about 'printf' and 'Message' in UDF. | LICH | Fluent UDF and Scheme Programming | 2 | May 2, 2013 03:45 |
Help! Compiled UDF problem 4 Wave tank tutorial | Shane | FLUENT | 1 | September 3, 2010 03:32 |
parallel UDF problem | kerem | FLUENT | 2 | June 20, 2006 07:56 |
problem with running UDF in batch mode | James | FLUENT | 0 | June 6, 2006 07:49 |