|
[Sponsors] |
November 20, 2014, 14:54 |
3D rectangular velocity profile UDF
|
#1 |
New Member
John
Join Date: Nov 2014
Posts: 2
Rep Power: 0 |
Hi guys,
I am quite inexperienced with UDFs and was wondering if anyone could help me, I am trying to create a UDF for a fluent simulation. It is a 3D domain (cuboid) with an inlet face that needs to have a boundary layer conforming to the law: U=((y/d)^(1/7))*Ufree Where U is the inlet velocity at a given point, y is the vertical coordinate, d (delta) is the boundary layer thickness and Ufree is the freestream velocity. When y=d (top of boundary layer) then U=Ufree When I try to interpret the file in fluent I get several errors, but I can't see where the code is wrong. The fluent UDF manual only has one a code for a 2D velocity profile. The code I've been trying is below: #include "udf.h" #define P 1./7. //power law n value 7// #define del 0.005 // boundary layer thickness value// #define ufree 0.05 //freestream velocity value// DEFINE_PROFILE(x_velocity,thread,position) { real x[ND_ND], real y, real z; { face_t f; begin_f_loop(f, thread) } { F_CENTROID(x, f, thread); y=x[1]; z=x[2]; if (y<=del) F_PROFILE(f, thread, position) = ufree*pow(y/del,P); else F_PROFILE(f, thread, position) = ufree; } end_f_loop(f, thread) } Does anyone have a working 3D velocity profile UDF that is similar I could use? Or if anyone could help me I'd really appreciate it. |
|
November 21, 2014, 04:17 |
|
#2 |
Member
Join Date: Jul 2013
Posts: 80
Rep Power: 13 |
#include "udf.h"
#define P 1./7. //power law n value 7// #define del 0.005 // boundary layer thickness value// #define ufree 0.05 //freestream velocity value// DEFINE_PROFILE(x_velocity,thread,position) { real x[ND_ND], y; face_t f; begin_f_loop(f, thread) { F_CENTROID(x, f, thread); y=x[1]; if (y<=del) F_PROFILE(f, thread, position) = ufree*pow(y/del,P); else F_PROFILE(f, thread, position) = ufree; } end_f_loop(f, thread) } //Cheers |
|
November 21, 2014, 08:49 |
|
#3 |
New Member
John
Join Date: Nov 2014
Posts: 2
Rep Power: 0 |
Eureka!! It works perfectly!
Thank you so much, really appreciate it! |
|
August 6, 2016, 14:37 |
|
#4 |
New Member
Join Date: Aug 2016
Posts: 1
Rep Power: 0 |
This is over a year later, but I wanted to add that Upeksa's answer helped me a lot also. I modified it to apply to 2D duct flow (ie, walls at both top and bottom of domain, instead of flow over a flat plate). The modified code reads as follows:
#include "udf.h" #define P 1./7. //power law n value 7// #define del 0.0061 // boundary layer thickness value// #define ufree 17.8778 //freestream velocity value// #define ymin -0.0381 #define ymax 0.0381 DEFINE_PROFILE(x_velocity,thread,position) { real x[ND_ND], y; face_t f; begin_f_loop(f, thread) { F_CENTROID(x, f, thread); y=x[1]; if (y >= ymax-del) F_PROFILE(f, thread, position) = ufree*pow((ymax-y)/del,P); else if (y <= del+ymin) F_PROFILE(f, thread, position) = ufree*pow((y-ymin)/del,P); else F_PROFILE(f, thread, position) = ufree; } end_f_loop(f, thread) } I spent a great deal of time struggling to find another case of a double power law profile in duct flow, so I'm adding this here in case it can help someone else. |
|
Tags |
fluent, power law, udf, velocity profile |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for a 3D inlet velocity profile with wave motion | kailingkk | Fluent UDF and Scheme Programming | 9 | May 26, 2021 08:33 |
UDF of Inlet Velocity Profile help | nabster | Fluent UDF and Scheme Programming | 0 | September 7, 2014 05:01 |
How to make a UDF to have a velocity profile in a square channel | Gigis | Fluent UDF and Scheme Programming | 8 | January 13, 2013 23:20 |
Logarithmic velocity profile | cfdworker | Fluent UDF and Scheme Programming | 0 | April 23, 2009 20:09 |
Multi step transient UDF velocity profile problem | William177 | FLUENT | 1 | February 3, 2008 07:47 |