|
[Sponsors] |
June 18, 2016, 02:46 |
Help me with UDF code
|
#1 |
New Member
ronnie wang
Join Date: Jan 2016
Posts: 10
Rep Power: 10 |
#include "udf.h"
DEFINE_PROFILE(velocity_magnitude, t, i) { real velocity; real the_current_time; face_t f; the_current_time = CURRENT_TIME; if ((the_current_time>=0.0) && (the_current_time<0.25)) { F_PROFILE(f, thread, position) =-39.04*t*t+9.76*t; } if ((the_current_time>=0.25) && (the_current_time<0.3)) { F_PROFILE(f, thread, position) =89.6*t*t-49.28*t+6.72; } if ((the_current_time>=0.3) && (the_current_time<=1)) { F_PROFILE(f, thread, position) =0; } begin_f_loop(f,t) { F_PROFILE(f,t,i) = velocity; } end_f_loop(f, t) } Tha above is the code , however when i try to interpret it, it has err hope experts here can help me best regard Ronnie sdsuronnie@gmail.com thanks |
|
June 18, 2016, 02:47 |
|
#2 |
New Member
ronnie wang
Join Date: Jan 2016
Posts: 10
Rep Power: 10 |
it is an inlet velocity boundary condition
|
|
June 18, 2016, 08:28 |
|
#3 |
Senior Member
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 25 |
DEFINE_PROFILE is called for an entire face thread...the "t" in the DEFINE_PROFILE macro at the top of the UDF. You *must* loop over all of the faces on the thread and set F_PROFILE for each face. That is happening in what appears to be vestigial code at the bottom there, but not in the conditional test.
Inside of your if statements checking the_current_time, you need to have those loops. And your are using the thread pointer t in your piecewise definition of the velocity, which makes no possible sense. I assume that should be the_current_time. Code:
... if ((the_current_time>=0.0) && (the_current_time<0.25)) { begin_f_loop(f,t) { F_PROFILE(f, thread, position) =-39.04*the_current_time*the_current_time+9.76*the_current_time; } end_f_loop(f, t) } ... |
|
June 18, 2016, 10:16 |
Thank you
|
#4 |
New Member
ronnie wang
Join Date: Jan 2016
Posts: 10
Rep Power: 10 |
Thank you for your comments, really help me a lot
best regard Ronnie |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Brownian Motion UDF Code | Confuser | FLUENT | 3 | August 13, 2021 01:14 |
power law udf code | b.p.v | Fluent UDF and Scheme Programming | 1 | April 4, 2019 02:33 |
how to use UDF to obtain the thred of the interface between the liquid and the wall? | hellowqy | Fluent UDF and Scheme Programming | 8 | December 17, 2015 10:03 |
How to transfer a 2D UDF code into 3D? | Jo_vivian_lee | Fluent UDF and Scheme Programming | 0 | August 26, 2012 03:36 |
Sos!!! Udf code | Jo_vivian_lee | Fluent UDF and Scheme Programming | 1 | August 16, 2012 00:09 |