CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Help me with UDF code

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 18, 2016, 02:46
Red face Help me with UDF code
  #1
New Member
 
ronnie wang
Join Date: Jan 2016
Posts: 10
Rep Power: 10
sdsuronnie is on a distinguished road
#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
sdsuronnie is offline   Reply With Quote

Old   June 18, 2016, 02:47
Default
  #2
New Member
 
ronnie wang
Join Date: Jan 2016
Posts: 10
Rep Power: 10
sdsuronnie is on a distinguished road
it is an inlet velocity boundary condition
sdsuronnie is offline   Reply With Quote

Old   June 18, 2016, 08:28
Default
  #3
Senior Member
 
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 25
mprinkey will become famous soon enough
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)
}
...
mprinkey is offline   Reply With Quote

Old   June 18, 2016, 10:16
Thumbs up Thank you
  #4
New Member
 
ronnie wang
Join Date: Jan 2016
Posts: 10
Rep Power: 10
sdsuronnie is on a distinguished road
Thank you for your comments, really help me a lot

best regard

Ronnie
sdsuronnie is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 20:09.