UDF for unsteady velocity inlet
Hello everyone,
I'm new and amateur in the world of CFD and fluent and I should use a udf for a velocity inlet in a cylindrical pipe.the velocity inlet follow a step function as is described: for (t=time) t<10 v=6.5*(1-r/3.5)^(1/7) t>10 v=0 I don't know how to write a step function. does anyone can help me? Thank you in advance |
Here's a start with the structure of the code, add in your velocity profile equation and you're set.
Code:
#include "udf.h" |
1 Attachment(s)
Quote:
should I use this macro in a main steady state program? and do I need to use two loops for time and location? is the macro i have written and attached here correct? |
thank you so much for your answer.
should I use this code in a main steady state code? and do I need to use two loops for time and location? is the code i have written correct? #include "udf.h" DEFINE_PROFILE(unsteady_velocity_profile, t, i) { real current_time; real x[ND_ND]; real y,u; face_t f; current_time = CURRENT_TIME; begin_f_loop(f, t) { begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; if (current_time < 10.) { u=6.5*(1-y/3.5)^(1/7); } else { u=0; } } end_f_loop(f, thread) } end_f_loop(f, t) } |
Don't use two for loops. Set your boundary value with F_PROFILE(f,t,i); setting u=.. has nothing to do with the boundary condition value. Have a read of the UDF Manual for details.
|
Quote:
DEFINE_PROFILE(unsteady_velocity_profile, t, i) { real current_time; real x[ND_ND]; real y; face_t f; current_time = CURRENT_TIME; begin_f_loop(f, t) { F_CENTROID(x,f,t); y = x[1]; if (current_time < 10.) { F_PROFILE(f,t,i)=6.5*(1-y/3.5)^(1/7); } else { F_PROFILE(f,t,i)=0; } } end_f_loop(f, t) } |
This code is looking good, have you tried compiling and running this boundary condition profile?
|
Quote:
1 file(s) copied. The system cannot find the file specified. (system "copy C:\Fluent.Inc\fluent6.3.26\src\makefile_nt.udf libudf\ntx86\2ddp\makefile") 1 file(s) copied. (chdir "libudf")() (chdir "ntx86\2ddp")() 'nmake' is not recognized as an internal or external command, operable program or batch file. 'nmake' is not recognized as an internal or external command, operable program or batch file. Done. "C:/Users/LIDA/Desktop" Opening library "libudf"... Error: open_udf_library: The system cannot find the file specified. Error Object: () as far as I searched and found, I should use Microsoft visual Studio program to compile it.but I haven't install it yet. |
Yea, you require a compiler such as Microsoft Visual Studio contains for compiling UDFs. Otherwise try interpreting this UDF (it may not require compiling).
|
Quote:
cpp -I"C:\Fluent.Inc\fluent6.3.26/src" -I"C:\Fluent.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent.Inc\fluent6.3.26/client/src" -I"C:\Fluent.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="<udfconfig.h>" "C:\Users\LIDA\Desktop\inlet.c" Error: C:\Users\LIDA\Desktop\inlet.c: line 12: thread: undeclared variable I don't know what does it mean and also if it can be solved or not. |
Quote:
|
the line:
F_PROFILE(f,t,i)=6.5*(1-y/3.5)^(1/7); is wrong. Use: F_PROFILE(f,t,i)=6.5*pow((1-y/3.5),(1/7)) ; |
hello every one
i have two formolas and i want to write them in c+ the inlet velocity in the z direction from 0 to the prabolic profile V(r)= 4.5 ( (r+0.1mm)/0.2mm)(1-(r+0.1mm)/0.2mm) during the 2µs. the velocity is then v(r) for 10µs and finally decreases to 0 another 2µs the time dependent velocity profile in the z direction can then be defined as: v(r,t)=(step(t-1.〖10〗^(-6))-step(t-13.〖10〗^(-6))).v(r) where t is given in seconds and step(t) is a smooth step function PLEASE help me i wrote this but fluent cant run it: #include "udf.h" DEFINE_PROFILE( unsteady_velocity_profile, t, i,r,t,v,a,b,total,) { real current_time; real x[ND_ND]; real y; face_t f; current_time = CURRENT_TIME; begin_f_loop(f, t) { F_CENTROID(x,f,t); y = x[1]; if (current_time < 10.) { F_PROFILE(f,t,i)=4.5*pow[(y+(0.1*0.001))/(0.2*0.001)]*[1-((y+(0.1*0.001))/0.2*0.001))]; } "a event folat from 0 through 200*0.001 for(i=0;i<=200*0.001;i+=0.000001) { a+=i; } cout<<"sum in step one is"<<a; "b even float from 0 through 200*0.001 for(i=0;i<=200*0.001;i+=13*0.000001) { b+=i; } cout<<"sum in step two is"<<b; v total=(a-b)*v; cout<<"total is:"<<total<<end l; } |
All times are GMT -4. The time now is 20:32. |