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

problem with real number in udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 1, 2014, 15:38
Default problem with real number in udf
  #1
New Member
 
amr mobarez
Join Date: Jan 2013
Posts: 9
Rep Power: 13
amr mobarez is on a distinguished road
hi guys i'm making udf for unsteady inlet velocity ( step train ) with certain value
with respect to time but i having problem with direction and magnitude as some of the flow goes into the reverse direction here is the code i wrote i hope someone can tell me what is wrong with it


#include "udf.h"

DEFINE_PROFILE(unsteady_x_velocity, thread, position)
{
face_t f;

real t = CURRENT_TIME;
if(t < 0.1)
{
F_PROFILE (f, thread, position)= 8.479;
}
if(0.1 < t > 0.2)
{
F_PROFILE (f,thread,position)= 1.357;
}
if(0.2 < t <0.3)
{
F_PROFILE (f,thread,position)= 8.479;
}
if(0.3 < t > 0.4)
{
F_PROFILE (f,thread,position)= 1.357;
}
if(0.4 < t < 0.5)
{
F_PROFILE (f,thread,position)= 8.479;
}
if(0.5 < t < 0.6)
{
F_PROFILE (f,thread,position)= 1.357;
}
if(t > 0.6)
{
F_PROFILE (f, thread, position)= 0;
}
}
amr mobarez is offline   Reply With Quote

Old   April 2, 2014, 17:57
Default
  #2
Super Moderator
 
diamondx's Avatar
 
Ghazlani M. Ali
Join Date: May 2011
Location: Tokyo, Japan
Posts: 1,385
Blog Entries: 23
Rep Power: 29
diamondx will become famous soon enough
I think you should have a loop !!
__________________
Regards,
New to ICEM CFD, try this document --> https://goo.gl/KAOIwm
Ali
diamondx is offline   Reply With Quote

Old   April 3, 2014, 19:14
Default
  #3
New Member
 
amr mobarez
Join Date: Jan 2013
Posts: 9
Rep Power: 13
amr mobarez is on a distinguished road
you are right diamond x i tried the loop and it corrected the direction , still have problems with values but thanks for helping
amr mobarez is offline   Reply With Quote

Old   April 4, 2014, 07:03
Default
  #4
Member
 
Join Date: Jul 2013
Posts: 80
Rep Power: 13
upeksa is on a distinguished road
You have ambiguous instructions, for example t>0.4 is defined twice:
in (0.3 < t >0.4) and (0.4 < t < 0.5).

And t=0.1, t=0.2... is not defined.

Check that, is an error you made several times.

User diamondx is right, you need a loop.

Cheers
upeksa is offline   Reply With Quote

Old   April 4, 2014, 18:01
Default
  #5
New Member
 
amr mobarez
Join Date: Jan 2013
Posts: 9
Rep Power: 13
amr mobarez is on a distinguished road
i fixed it and it worked and here is the right code in case someone needed it

#include "udf.h"

DEFINE_PROFILE(unsteady_x_velocity12, thread, position)
{
face_t f;
real tm = CURRENT_TIME;
begin_f_loop (f,thread)
{
if(tm < 0.1)
{
F_PROFILE (f,thread,position)= 8.479;
}
if(tm > 0.1)
{
F_PROFILE (f,thread,position)= 1.36;
}
if(tm > 0.2)
{
F_PROFILE (f,thread,position)= 8.479;
}
if(tm > 0.3)
{
F_PROFILE (f,thread,position)= 1.36;
}
if(tm > 0.4)
{
F_PROFILE (f,thread,position)= 8.479;
}
if(tm > 0.5)
{
F_PROFILE (f,thread,position)= 1.36;
}
}
end_f_loop (f,thread)
}
amr mobarez 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
Modified k-e turbulence model UDF Travis Fluent UDF and Scheme Programming 7 November 11, 2018 21:21
decomposePar pointfield flying OpenFOAM Running, Solving & CFD 28 December 30, 2013 16:05
UDF error - FLUENT received fatal signal (ACCESS_VIOLATION) Eliasjal Fluent UDF and Scheme Programming 1 March 7, 2012 12:11
problem to make a UDF parallel pilou Fluent UDF and Scheme Programming 0 March 9, 2011 07:35
Problem to parallelize a UDF pilou FLUENT 0 March 9, 2011 07:32


All times are GMT -4. The time now is 17:43.