|
[Sponsors] |
April 11, 2015, 04:16 |
UDF for unsteady velocity inlet
|
#1 |
Member
Lida
Join Date: Apr 2015
Posts: 39
Rep Power: 11 |
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 |
|
April 11, 2015, 04:54 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Here's a start with the structure of the code, add in your velocity profile equation and you're set.
Code:
#include "udf.h" DEFINE_PROFILE(unsteady_velocity_profile, t, i) { real current_time; face_t f; current_time = CURRENT_TIME; begin_f_loop(f, t) { if (current_time < 10.) { // first period of time } else { // second period of time } } end_f_loop(f, t) } |
|
April 12, 2015, 05:17 |
|
#3 | |
Member
Lida
Join Date: Apr 2015
Posts: 39
Rep Power: 11 |
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? |
||
April 12, 2015, 05:20 |
|
#4 |
Member
Lida
Join Date: Apr 2015
Posts: 39
Rep Power: 11 |
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) } |
|
April 12, 2015, 05:53 |
|
#5 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
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.
|
|
April 12, 2015, 07:28 |
|
#6 | |
Member
Lida
Join Date: Apr 2015
Posts: 39
Rep Power: 11 |
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) } |
||
April 12, 2015, 07:34 |
|
#7 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
This code is looking good, have you tried compiling and running this boundary condition profile?
|
|
April 12, 2015, 08:25 |
|
#8 | |
Member
Lida
Join Date: Apr 2015
Posts: 39
Rep Power: 11 |
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. |
||
April 12, 2015, 09:09 |
|
#9 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Yea, you require a compiler such as Microsoft Visual Studio contains for compiling UDFs. Otherwise try interpreting this UDF (it may not require compiling).
|
|
April 12, 2015, 09:55 |
|
#10 | |
Member
Lida
Join Date: Apr 2015
Posts: 39
Rep Power: 11 |
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. |
||
April 12, 2015, 20:25 |
|
#11 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Your error has provided the error type (undeclared variable, you should declare variables before using them) and where it has occurred (line 12 of inlet.c: your UDF?).
|
|
April 13, 2015, 04:37 |
|
#12 |
Member
Join Date: Jul 2013
Posts: 80
Rep Power: 13 |
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)) ; |
|
August 9, 2015, 13:52 |
|
#13 |
New Member
tooraj
Join Date: Aug 2015
Posts: 1
Rep Power: 0 |
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; } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF: Change boundary condition. Velocity inlet to pressure inlet at time "t" | jpina | FLUENT | 10 | April 11, 2015 15:19 |
UDF for 3D rectangular Inlet velocity | Mohammed Attya | Fluent UDF and Scheme Programming | 0 | January 28, 2015 14:18 |
(UDF) Sinusoidal inlet velocity in Fluent | star | Fluent UDF and Scheme Programming | 1 | December 19, 2013 17:23 |
Fluent UDF load and apply inlet velocity b.c. | Knut Lehmann | Main CFD Forum | 2 | June 29, 2007 05:53 |
Urgent! Help on UDF to set inlet velocity | Ray Hong | FLUENT | 4 | December 30, 2005 13:32 |