Creating a UDF for fluid inlet velocity

 Register Blogs Members List Search Today's Posts Mark Forums Read

 February 8, 2017, 09:05 Creating a UDF for fluid inlet velocity #1 New Member   AMEET KUMAR Join Date: Feb 2017 Posts: 14 Rep Power: 2 Sponsored Links Hi, I am new in ansys, I don't know how to write a UDF. Please can someone help me to write a UDF for fluid inlet velocity in recipricating pump which is rotating at 1450 rpm and total displacement of piston is 20 mm. Diameter of piston is 14 mm.

 February 8, 2017, 09:34 #2 Senior Member   Join Date: Nov 2013 Posts: 1,074 Rep Power: 14 If you don't know how to start a udf, I would start by looking in the manual. Try if you can find a udf that does something similar, and think if you can figure out what should be changed. Change that in the code, as good as you guess/understand how that should be done. Your first attempt will probably not work. Then post it here, so we can see how you are thinking, and can really assist you to learn how to make UDFs. ameetks99 likes this.

 February 9, 2017, 00:10 #3 New Member   AMEET KUMAR Join Date: Feb 2017 Posts: 14 Rep Power: 2 thank you for reply But udf for sinusoidal velocity is not there in manual, if you have a udf for sinusoidal velocity please send it to me.

 February 9, 2017, 00:25 #4 New Member   AMEET KUMAR Join Date: Feb 2017 Posts: 14 Rep Power: 2 #include "udf.h" DEFINE_PROFILE(unsteady_velocity, thread, position) { face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_PROFILE(f, thread, position) =2.61*sin(152*t); } end_f_loop(f, thread) } I tried this udf but inlet velocity is showing ZERO,

 February 9, 2017, 03:59 #5 Senior Member   Join Date: Nov 2013 Posts: 1,074 Rep Power: 14 And do you get any warnings when you compile or run? I don't remember now if the sine function works by default, otherwise you have to add Code: #include to your code. But then you should have seen a warning like "undefined reference to sin"...

 February 9, 2017, 06:36 #6 New Member   AMEET KUMAR Join Date: Feb 2017 Posts: 14 Rep Power: 2 cpp -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/multiport/src" -I. -DUDF ONFIG_H="" "C:\Users\Ameet Kumar Singh\Desktop\piston pump h\udf.h.c" C:\\Users\\Ameet Kumar Singh\\Desktop\\piston pump h\\udf.h.c:2: math.h: No such file or directory This message is showing when I added #include "math.h" and I interpret it

February 9, 2017, 07:02
#7
Senior Member

Join Date: Nov 2013
Posts: 1,074
Rep Power: 14
Go back to your original UDF, but now in a foldername that has no spaces.

Quote:
 C:\Users\Ameet Kumar Singh\Desktop\piston pump h\
There are four spaces in the name of this folder, and Fluent is known to have problems with that.

 February 9, 2017, 07:16 #8 New Member   AMEET KUMAR Join Date: Feb 2017 Posts: 14 Rep Power: 2 cpp -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/multiport/src" -I. -DUDF ONFIG_H="" "D:\\udf.c" D:\\\\udf.c:2: math.h: No such file or directory the problem remain same when I copy the udf file to a drive

 February 9, 2017, 07:19 #9 Senior Member   Join Date: Nov 2013 Posts: 1,074 Rep Power: 14 That is impossible, because your original UDF did not have any reference to math.h in it.

 February 9, 2017, 07:21 #10 New Member   AMEET KUMAR Join Date: Feb 2017 Posts: 14 Rep Power: 2 If you can write the udf for inlet velocity of reciprocating pump which is rotating at 1450 rpm and movement of the piston is 20 mm It will be helpful for me

 February 9, 2017, 07:29 #11 Senior Member   Join Date: Nov 2013 Posts: 1,074 Rep Power: 14 Try this: Code: #include "udf.h" DEFINE_PROFILE(unsteady_velocity, thread, position) { face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_PROFILE(f, thread, position) =2.61*sin(152*t); } end_f_loop(f, thread) } If you could read answers that people gave you, it would be helpful for yourself.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post raminostadi Fluent UDF and Scheme Programming 4 July 3, 2017 06:43 Mijin Kim FLUENT 0 September 28, 2009 04:50 Ray Hong FLUENT 4 December 30, 2005 13:32 Jongdae Kim FLUENT 0 June 15, 2004 11:21 Ronak Shah FLUENT 0 June 4, 2003 09:44

All times are GMT -4. The time now is 18:11.