|
[Sponsors] | |||||
|
|
|
#1 |
|
New Member
omid
Join Date: Jun 2019
Posts: 15
Rep Power: 8 ![]() |
Hello i'm trying to write a UDF for this two inlet BCs:
(1.5*4/0.1681)*y*(0.41-y)*(0.5*(1-cos(0.5*Pi*t))) if t<2sec (1.5*4/0.1681)*y*(0.41-y) otherwise the UDF i have wrote is like below but it doesn't work correctly because i get the velocity vector like the picture i have attached, and the velocity shouldn't be like that after 2 seconds: /************************************************** ********************* UDF for specifying transient velocity profile boundary condition ************************************************** **********************/ #include "udf.h" #define H 0.41 #define PI 3.14 DEFINE_PROFILE(inlet_velocity, thread, index) { real x[ND_ND]; /* this will hold the position vector */ real y; face_t f; begin_f_loop(f, thread) /* loops over all faces in the thread passed in the DEFINE macro argument */ { F_CENTROID(x, f, thread); y = x[1]; { if(CURRENT_TIME<2) F_PROFILE(f, thread, index) =((1.5*1)*(4/0.1681)*y*(H-y))*((1-cos(PI*CURRENT_TIME/2))/2); } { if(CURRENT_TIME>=2) F_PROFILE(f, thread, index) =((1.5*1)*(4/0.1681)*y*(H-y)); } } end_f_loop(f, thread) } |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 35 ![]() ![]() |
try this code
Code:
/************************************************** *********************
UDF for specifying transient velocity profile boundary condition
************************************************** **********************/
#include "udf.h"
#define H 0.41
#define PI 3.14
DEFINE_PROFILE(inlet_velocity, thread, index)
{
real x[ND_ND]; /* this will hold the position vector */
real y;
real time;
face_t f;
time = CURRENT_TIME;
begin_f_loop(f, thread) /* loops over all faces in the thread passed in the DEFINE macro argument */
{
F_CENTROID(x, f, thread);
y = x[1];
{
if(time<2)
F_PROFILE(f, thread, index) =((1.5*1)*(4/0.1681)*y*(H-y))*((1-cos(PI*time/2))/2);
}
{
if(time>=2)
F_PROFILE(f, thread, index) =((1.5*1)*(4/0.1681)*y*(H-y));
}
}
end_f_loop(f, thread)
}
|
|
|
|
|
|
![]() |
| Tags |
| fluent - udf, udf code |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| udf for one dimensional linear motion based on force | maccheese | Fluent UDF and Scheme Programming | 2 | September 1, 2019 03:18 |
| Save output of udf in another udf! | JuanJoMex | FLUENT | 0 | February 8, 2018 13:43 |
| UDF Compilation Error - Loading Library - COMMON Problem! Help! | robtheslob | Fluent UDF and Scheme Programming | 8 | July 24, 2015 01:53 |
| UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
| UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |