|
[Sponsors] |
May 20, 2013, 15:47 |
udf velocity profile
|
#1 |
New Member
hilla tor
Join Date: Nov 2012
Posts: 22
Rep Power: 14 |
hi I am trying to write a udf function that use the index number in order to put a value from array. I wrote the following function that isn't working
Code:
#include"udf.h" DEFINE_PROFILE(unsteady_velocity, thread, position) { real x[ND_ND]; /* this will hold the position vector */ real y;real A[251]={8,7,6,5,4,3,2,1}; real t = CURRENT_TIME; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); c0 = F_C0(f,thread); y = x[1]*2000; F_PROFILE(f, thread, position) =A[c0];} end_f_loop(f, thread)} for example the first y , index=1 so u=A[1]=8; thanks for the help |
|
May 21, 2013, 16:23 |
yes
|
#3 |
New Member
hilla tor
Join Date: Nov 2012
Posts: 22
Rep Power: 14 |
at my grid the velocity inlet border is the line x=0, -0.01<y<0.01 and I have 251 points on the line
|
|
May 21, 2013, 21:46 |
|
#4 |
Senior Member
|
Try this:
#include"udf.h" DEFINE_PROFILE(unsteady_velocity, thread, position) { real x[ND_ND]; /* this will hold the position vector */ real y;real A[251]={8,7,6,5,4,3,2,1}; real t = CURRENT_TIME; face_t f; int ind; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); c0 = F_C0(f,thread); y = 250*(x[1]*50+0.5); ind = (int) (y+0.5); F_PROFILE(f, thread, position) =A[ind]; } end_f_loop(f, thread) } |
|
May 21, 2013, 23:51 |
...
|
#5 |
New Member
hilla tor
Join Date: Nov 2012
Posts: 22
Rep Power: 14 |
my problem is that my grid is note uniform, there is a why to know the index from the grid?
thanks for the help |
|
May 22, 2013, 00:28 |
|
#6 |
Senior Member
|
It is easy to hard-coded your udf file. Print the value of c0. If the value of c0 is contiguous then shift the value so that c0 is in the range [0,250]. Or
#include"udf.h" DEFINE_PROFILE(unsteady_velocity, thread, position) { real x[ND_ND]; /* this will hold the position vector */ real y;real A[251]={8,7,6,5,4,3,2,1}; real t = CURRENT_TIME; face_t f; int ind=0; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); c0 = F_C0(f,thread); F_PROFILE(f, thread, position) =A[ind++]; } end_f_loop(f, thread) } if the values of array A is assigned according to its appearance in the thread loop. |
|
May 23, 2013, 13:10 |
when i wrote the code
|
#7 |
New Member
hilla tor
Join Date: Nov 2012
Posts: 22
Rep Power: 14 |
it was written to me the following message will running :
Divergence detected in AMG solver: x-momentum thanks for the help |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF problems - velocity profile | Oli | Fluent UDF and Scheme Programming | 6 | October 24, 2016 11:38 |
Velocity profile UDF | egge24 | Fluent UDF and Scheme Programming | 2 | May 10, 2012 14:03 |
Logarithmic velocity profile | cfdworker | Fluent UDF and Scheme Programming | 0 | April 23, 2009 20:09 |
How to specify the Velocity profile (eqn) by UDF | Anant | FLUENT | 1 | February 27, 2008 15:54 |
Multi step transient UDF velocity profile problem | William177 | FLUENT | 1 | February 3, 2008 07:47 |