|
[Sponsors] |
March 23, 2014, 12:40 |
UDF Help
|
#1 |
New Member
anonymous
Join Date: Mar 2014
Posts: 2
Rep Power: 0 |
I am trying write a UDF to be used as an inlet BC. I have read through the tutorial in Fluent and it doesn't provide much help for a 3-d application.
My inlet velocity is composed of velocity magnitudes (x,y,z velocities). The velocity only varies in Y-direction and I have derived an equation for each velocity(u=f(y),v=f(y),w=f(y)). I am just curious how to write the UDF that will be able to define velocity the entire span of the inlet. Thanks |
|
March 24, 2014, 22:55 |
|
#2 |
Super Moderator
Ghazlani M. Ali
Join Date: May 2011
Location: Tokyo, Japan
Posts: 1,385
Blog Entries: 23
Rep Power: 29 |
I am no expert in UDF, I just wrote my UDF last week; the UDF manual and the tutorials will help you understand the functions, but if you wanna learn , look for existing pieces of codes, understand them and modify them so it can suit your need... 2-D should not be that different from 3-D you just add the z component... I guess
|
|
March 28, 2014, 09:40 |
|
#3 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
Hi cfduser,
Here's your udf, I just copied 3 times an example from the udf manual version 15.0: 2.3.19.3. Example 1 - Pressure Profile It doesn't matter 2D or 3D in this case, the DEFINE_PROFILE loops over all faces of the boundary where you apply it. Code:
#include "udf.h" DEFINE_PROFILE(vx,t,i) { real x[ND_ND]; /* this will hold the position vector */ real y; face_t f; begin_f_loop(f,t) { F_CENTROID(x,f,t); y = x[1]; F_PROFILE(f,t,i) = 1.1e5 - y*y/(.0745*.0745)*0.1e5; } end_f_loop(f,t) } DEFINE_PROFILE(vy,t,i) { real x[ND_ND]; /* this will hold the position vector */ real y; face_t f; begin_f_loop(f,t) { F_CENTROID(x,f,t); y = x[1]; F_PROFILE(f,t,i) = 1.1e5 - y*y/(.0745*.0745)*0.1e5; } end_f_loop(f,t) } DEFINE_PROFILE(vz,t,i) { real x[ND_ND]; /* this will hold the position vector */ real y; face_t f; begin_f_loop(f,t) { F_CENTROID(x,f,t); y = x[1]; F_PROFILE(f,t,i) = 1.1e5 - y*y/(.0745*.0745)*0.1e5; } end_f_loop(f,t) } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 07:12 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
How to add a UDF to a compiled UDF library | kim | FLUENT | 3 | October 26, 2011 22:38 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |