|
[Sponsors] |
December 19, 2017, 03:48 |
Udf doubt
|
#1 |
New Member
Neethu N
Join Date: Nov 2017
Posts: 8
Rep Power: 8 |
Hello, please help me with this. I am studying UDF coding. I found this code in the ANSYS Manual.
/************************************************** ********************* udfexample.c UDF for specifying steady-state velocity profile boundary condition ************************************************** **********************/ #include "udf.h" DEFINE_PROFILE(inlet_x_velocity, thread, position) { real x[ND_ND]; /* this will hold the position vector */ real y, h; face_t f; h = 0.016; /* inlet height in m */ begin_f_loop(f,thread) { F_CENTROID(x, f, thread); y = 2.*(x[1]-0.5*h)/h; /* non-dimensional y coordinate */ F_PROFILE(f, thread, position) = 0.1*(1.0-y*y); } end_f_loop(f, thread) } Is it necessary to find the centroid? The code works without it too. |
|
December 19, 2017, 03:54 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
3.2.4.1. Face Centroid (F_CENTROID)
The macro listed in Table 3.21: Macro for Face Centroids Defined in metric.h (p. 261) can be used to obtain the real centroid of a face. F_CENTROID finds the coordinate position of the centroid of the face f and stores the coordinates in the x array. Note that the x array is always one-dimensional, but it can be x[2] or x[3] depending on whether you are using the 2D or 3D solver. |
|
December 19, 2017, 04:02 |
|
#3 |
New Member
Neethu N
Join Date: Nov 2017
Posts: 8
Rep Power: 8 |
I got it. Thank you very much
|
|
Tags |
fluent - udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for vapor pressure | anuarun | Fluent UDF and Scheme Programming | 12 | December 24, 2021 10:12 |
Doubt about real x[ND_ND] declaration in FLUENT udf | Abhya | Fluent UDF and Scheme Programming | 5 | March 21, 2013 00:21 |
parse error while interpreting udf | Kristin | Fluent UDF and Scheme Programming | 3 | March 15, 2012 06:43 |
I need UDF help. | S.Whitney | FLUENT | 0 | October 15, 2007 11:29 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 04:01 |