|
[Sponsors] |
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: 9 |
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,965
Rep Power: 27 |
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. |
|
February 9, 2017, 00:10 |
|
#3 |
New Member
AMEET KUMAR
Join Date: Feb 2017
Posts: 14
Rep Power: 9 |
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: 9 |
#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,965
Rep Power: 27 |
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 <math.h> |
|
February 9, 2017, 06:36 |
|
#6 |
New Member
AMEET KUMAR
Join Date: Feb 2017
Posts: 14
Rep Power: 9 |
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="<udfconfig.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,965
Rep Power: 27 |
Go back to your original UDF, but now in a foldername that has no spaces.
Quote:
|
||
February 9, 2017, 07:16 |
|
#8 |
New Member
AMEET KUMAR
Join Date: Feb 2017
Posts: 14
Rep Power: 9 |
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="<udfconfig.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,965
Rep Power: 27 |
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: 9 |
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,965
Rep Power: 27 |
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) } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to put udf inlet velocity and udf outlet pressure in fluent | raminostadi | Fluent UDF and Scheme Programming | 4 | July 3, 2017 07:43 |
UDF for Inlet velocity | Mijin Kim | FLUENT | 0 | September 28, 2009 05:50 |
Urgent! Help on UDF to set inlet velocity | Ray Hong | FLUENT | 4 | December 30, 2005 13:32 |
UDF problem : inlet velocity in cyl. coord. system | Jongdae Kim | FLUENT | 0 | June 15, 2004 12:21 |
UDF paraboloid velocity inlet | Ronak Shah | FLUENT | 0 | June 4, 2003 10:44 |