CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Turek-Hron UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 7, 2019, 05:29
Exclamation Turek-Hron UDF
  #1
New Member
 
omid
Join Date: Jun 2019
Posts: 15
Rep Power: 6
sarbakhshian is on a distinguished road
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)
}
Attached Images
File Type: png Capture11.PNG (40.8 KB, 7 views)
sarbakhshian is offline   Reply With Quote

Old   August 8, 2019, 01:31
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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)
}
best regards
AlexanderZ is offline   Reply With Quote

Reply

Tags
fluent - udf, udf code


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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 02:18
Save output of udf in another udf! JuanJoMex FLUENT 0 February 8, 2018 12:43
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 00:53
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 22:14
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 04:01


All times are GMT -4. The time now is 05:41.