CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Fluent (ANSYS12) UDF Help, PLEASE! Urgent! (https://www.cfd-online.com/Forums/fluent/81128-fluent-ansys12-udf-help-please-urgent.html)

ANITIX87 October 17, 2010 12:19

Fluent (ANSYS12) UDF Help, PLEASE! Urgent!
 
Hi, all. First-time poster, and very, very frustrated.

I have to analyze the flow around a wind turbine, and have set up my model and mesh in Gambit. I can read the mesh just find in Fluent (I am using ANSYS 12) and can do everything except compile UDFs.

I need to write a UDF that simulated unsteady wind flow (in any way, as long as it's unsteady) and I need a second UDF that analyzes the flow around the windmill and animates its rotation using a dynamic mesh. I have the code written, but it's full of errors, so if someone wants to help me with that, I'd greatly appreciate it.

However, the biggest problem is when I try to compile my UDFs. I get the following error: Opening library "libudf"...
Error: open_udf_library: The system cannot find the file specified.

I have searched online and found several solutions, but none seem to work. I don't know how to fix my environment variables with ANSYS 12, because I can't find anything in START -> ANSYS 12 ...

Can someone PLEASE help me? It's very urgent, and I'm very frustrated. I've been working on this project for months, and have made no progress once I got to the UDF part of it.

I'm desperate!

TIS

lehoang_mai October 17, 2010 16:52

This error occur when U tried compile UDF while libudf do not "Build" correctly. Make sure that, Visual C ++ correctly installed on your computer(later than install Fluent, Register environment variables is checked when installs Visual C++...). I not work in fluent 12.1, but hope this help!:)

ANITIX87 October 17, 2010 16:54

Quote:

Originally Posted by lehoang_mai (Post 279514)
This error occur when U tried compile UDF while libudf do not "Build" correctly. Make sure that, Visual C ++ correctly installed on your computer(later than install Fluent, Register environment variables is checked when installs Visual C++...). I not work in fluent 12.1, but hope this help!:)

Thanks. Visual C++ was already installed on my computer when I got it, so I didn't do anything to it. How can I modify the Environment Variables for C++? UDFs can be interpreted just fine, but I require compiling for my second UDF file.

Can anyone shed some more light? And can anyone take a look at my UDF to see what I'm doing wrong in the code?

TIS

lehoang_mai October 18, 2010 04:09

Environment Variables were automatically installed when you installed Visual C++ if you check box "Register Environment Variables". What was error when you click "Build" UDF? I think you need read more information about this problem here:
http://www.cfd-online.com/Wiki/Fluen...tch_file.22.3F
Best wish for you!

ANITIX87 October 18, 2010 12:51

Quote:

Originally Posted by lehoang_mai (Post 279546)
Environment Variables were automatically installed when you installed Visual C++ if you check box "Register Environment Variables". What was error when you click "Build" UDF? I think you need read more information about this problem here:
http://www.cfd-online.com/Wiki/Fluen...tch_file.22.3F
Best wish for you!

I've checked out this website. Some good information, but I'm still unable to make the error go away, even after re-installing Visual Studio and making sure my environmental variables are set.

Anyone else have some input?

I'm going to post my code here later as well, if someone wants to take a look, because I don't have any idea how to write a good UDF.

TIS

ak6g08 October 20, 2010 10:45

the fact that its saying it cant find a libudf file, means that at the moment you shouldnt be worrying about errors in your source code...because now it is even compiling your source code to begin with...so dont bother posting your source code until you figure out why it isnt compiling.

1. make *SURE* you launch fluent from within the visual studio command prompt...otherwise fluent wont link to the appropriate compiler...

2. make sure you enter the full directory where it asks you what the name of the library file is...or, when you launch from the vis studio command prompt, launch fluent from the appropriate directory...

3. check your environment variables...

have you done all of that?

good luck

ANITIX87 October 20, 2010 10:46

Quote:

Originally Posted by ak6g08 (Post 279990)

3. check your environment variables...

That's the only thing I don't know how to do. My Start menu looks different than the examples I've seen elsewhere, and there's no Environment Variables option in the ANSYS 12 directory, or the Visual Studio directory. How should I check them??

Thanks.

TIS

ak6g08 October 20, 2010 11:19

unfortunately I dont use Fluent 12...so I cant be certain for you, but in fluent 6 you dont have to set anything within fluent...but i remember i had this problem, and re-installed visual directly onto the c: directory...and my environment variable for fluent 6.3.26 is:

Variable: FLUENT_INC
Value: c:\fluent.inc

...incase you dont know where to find all your user variables (system and environment)...go to your start menu, right click on my computer, then click on properties...advanced, and then environment variables. (in xp thats what you do)...

also, something major i forgot, your fluent.inc directory and your visual studio directories must be shared, otherwise fluent wont find the udf.h file which contains everything fluent needs to compile through visual studio...hope that works.

ANITIX87 October 20, 2010 11:21

Quote:

Originally Posted by ak6g08 (Post 279995)
unfortunately I dont use Fluent 12...so I cant be certain for you, but in fluent 6 you dont have to set anything within fluent...but i remember i had this problem, and re-installed visual directly onto the c: directory...and my environment variable for fluent 6.3.26 is:

Variable: FLUENT_INC
Value: c:\fluent.inc

...incase you dont know where to find all your user variables (system and environment)...go to your start menu, right click on my computer, then click on properties...advanced, and then environment variables. (in xp thats what you do)...

also, something major i forgot, your fluent.inc directory and your visual studio directories must be shared, otherwise fluent wont find the udf.h file which contains everything fluent needs to compile through visual studio...hope that works.

Thanks, I'll explore the environmental variables next time I'm using Windows (I dual boot Mac and Windows, and use Mac as my primary).

Fluent definitely finds and copies nmake and udf.h correctly when trying to compile. It builds the libudf directory in my project folder correctly, it just won't load it when I want to.

TIS

lehoang_mai October 20, 2010 14:49

ur problem is set environment Variables, and ak6g08 helped. Best wish for you! Can I see ur code and mesh file?

ANITIX87 October 26, 2010 18:48

Files
 
Here is the link to the relevant files: http://www.yousendit.com/download/ZG...TStsUjgwTVE9PQ

HELP PLEASE! I still have the same "Opening library "libudf"...
Error: open_udf_library: The system cannot find the file specified." error despite everything I have tried.

TIS

lehoang_mai October 27, 2010 06:15

1 Attachment(s)
Quote:

Originally Posted by ANITIX87 (Post 280884)
Here is the link to the relevant files: http://www.yousendit.com/download/ZG...TStsUjgwTVE9PQ

HELP PLEASE! I still have the same "Opening library "libudf"...
Error: open_udf_library: The system cannot find the file specified." error despite everything I have tried.

TIS

Problem is in your source code apmotion.c. It's not correctly. I corrected it. It works on my mechanic. I hope it work on your too. Can you describe me task of problem?
Best wish for you!

ANITIX87 October 27, 2010 08:25

I have designed and meshed an industrial windmill in GAMBIT. I now need to analyze its response to flow through the control volume. I need to determine the Coefficients of Lift, Drag, and Moment, and animate its angular motion based on the wind moving past it.

Does the UDF you wrote have to be compiled, or can it be interpreted?

Thank you so much, I will try running the UDF later today and let you know how it goes.

TIS

lehoang_mai October 27, 2010 10:57

Yes, it compiled well on my mechanic. I haven't iterated mesh file, because i didn't know task of problem:). What did you write in apflow.c? It's angular motion of windmill, isn't it?
Tell me if you have done!
Regards!

ANITIX87 October 27, 2010 16:01

Thank you so much! Both UDF files compiled perfectly (I finally fixed my environment variables).

The UDF "apflow.c" should create a parabolic flow through the control volume, so that the air does not move in a constant velocity. The other one ("apmotion.c") should calculate the windmill's angular momentum based on the lift forces acting on it, and then send that back to Fluent's dynamic mesh to move the windmill and re-calculate everything.

Now, I have a new problem. I don't know how to make the animation show the windmill's motion. I have run the calculation, and my residuals converge to the values I expect. However, I cannot get the animation to show a moving windmill. Anybody have any feedback??

Thanks again.

TIS

lehoang_mai October 27, 2010 17:05

Congratulations!
Your UDF apflow.c describes sinusoidal velocity from INLET, I'm right?
In order to create animation, go to online help
http://my.fit.edu/itresources/manual...g/node1157.htm
I hope this help.
If you want to create motion of windmill, then to do this: Solve>animate>define>....
On this window, increase "animation sequences" to 1, and define it. Set its name, every, when(iteration or time), define>.....
Regards!

arash_7444 October 27, 2010 18:07

Dear Antonis,

I have not work with UDF too but I just saw your mesh and your geometry and i think you want to analyze Horizontal Wind turbine, am i right?
I think you need to pitch your blades 90 degree because your turbine is rotating. if you don't rotate it 90 degree, then the flow will separate and you will not get proper result for your simulation.

Also about UDF, why dont you use Sliding mesh method to give rotation to your blades? so that you do not need to write any UDF file!

feel free to correct me if I am wrong or I misunderstood something. (i meant everyone )
Good luck

ANITIX87 October 27, 2010 18:44

Hi. I have pitched my blades to an angle of attack of 8 degrees, because that is the most commonly used angle for industrial windmills. The windmill is vertical, with flow through its operating diameter wing horizontal. I don't know if you misunderstood that or not. Again, to clarify, I am analyzing axial flow through the turbine's operating circle.

As for the sliding mesh, I don't have any experience with this, so I wouldn't know how to apply it. Will it analyze the forces on the windmill and iterate it for each step to show the acceleration of the windmill, as my UDF is supposed to do?

TIS

arash_7444 October 27, 2010 19:32

1 Attachment(s)
Quote:

Originally Posted by ANITIX87 (Post 281096)
Hi. I have pitched my blades to an angle of attack of 8 degrees, because that is the most commonly used angle for industrial windmills. The windmill is vertical, with flow through its operating diameter wing horizontal. I don't know if you misunderstood that or not. Again, to clarify, I am analyzing axial flow through the turbine's operating circle.

As for the sliding mesh, I don't have any experience with this, so I wouldn't know how to apply it. Will it analyze the forces on the windmill and iterate it for each step to show the acceleration of the windmill, as my UDF is supposed to do?

TIS


Hi again,

I am sorry, again I think i cannot get what you mean by " the windmill is vertical".
I attach a photo of both "Horizontal axis wind turbine" and "vertical axis wind turbine".
I emphasis again if you analyze "HAWT", pitching your bladed 8 degrees is not correct specially for the tip of your blades.

Concerning Sliding meshes, I suggest you to read Tutorial number 12 of Fluent. it's about Sliding meshes.

About Loads, the answer is i dont know. but if you define your "reference value" then you can get your "CL" and "CD" per iteration or per time step.

good luck

ANITIX87 October 27, 2010 22:23

Quote:

Originally Posted by arash_7444 (Post 281099)
I emphasis again if you analyze "HAWT", pitching your bladed 8 degrees is not correct specially for the tip of your blades.

Yes, I am analyzing a HAWT. I read some literature that listed an angle of attack of 8 degrees as being most common, but I just looked up some pictures and realize that your point is correct. Most windmills have a far greater pitch angle. Unfortunately, it's too late to change this now, as GAMBIT is no longer supported by new versions of FLUENT, apparently.

Thanks again to everyone for the help. I will run my simulation again tomorrow with the UDFs active, and let you all know how it goes!

TIS


All times are GMT -4. The time now is 01:58.