Creating a UDF for fluid inlet velocity
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. |
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. |
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. |
#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, |
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> |
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 |
Go back to your original UDF, but now in a foldername that has no spaces.
Quote:
|
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 |
That is impossible, because your original UDF did not have any reference to math.h in it.
|
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
|
Try this:
Code:
#include "udf.h" |
All times are GMT -4. The time now is 22:56. |