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

UDf - please help

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 18, 2011, 03:08
Default UDf - please help
  #1
New Member
 
Amir
Join Date: Aug 2010
Posts: 10
Rep Power: 15
amirhabibdoost is on a distinguished road
Dear friends
I face with a problem when I want to reform my UDF. Indeed , I want to add a function ( sin(x)) to my udf , but I don’t know what is necessary corrections.
Please let me any suggestion in order to correct my udf.
Tanks in advance.
Amir

#include "udf.h"

real velocity (real t)
{
real a, b, value;

a = 10.0;
b = 0.34;
value = 0.0;

if ((t >= 0) || (t < 0.2))
{
value = sin (a*t);( here , I want to add sin(x) , but I don’t know what corrections is need.)
}
else
{
value = b;
}

return value;
}

DEFINE_PROFILE(unsteady_velocity, thread, position)
{
face_t f;
real t;

t = CURRENT_TIME;

begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) = velocity(t);
}
end_f_loop(f, thread)
}
amirhabibdoost is offline   Reply With Quote

Old   July 18, 2011, 03:10
Default
  #2
New Member
 
Amir
Join Date: Aug 2010
Posts: 10
Rep Power: 15
amirhabibdoost is on a distinguished road
Quote:
Originally Posted by amirhabibdoost View Post
Dear friends
I face with a problem when I want to reform my UDF. Indeed , I want to add a function ( sin(x)) to my udf , but I don’t know what is necessary corrections.
Please let me any suggestion in order to correct my udf.
Tanks in advance.
Amir

#include "udf.h"

real velocity (real t)
{
real a, b, value;

a = 10.0;
b = 0.34;
value = 0.0;

if ((t >= 0) || (t < 0.2))
{
value = sin (a*t);( here , I want to add sin(x) , but I don’t know what corrections is need.)
}
else
{
value = b;
}

return value;
}

DEFINE_PROFILE(unsteady_velocity, thread, position)
{
face_t f;
real t;

t = CURRENT_TIME;

begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) = velocity(t);
}
end_f_loop(f, thread)
}
urgent help , please
amirhabibdoost is offline   Reply With Quote

Old   July 19, 2011, 07:53
Default
  #3
Member
 
eng_s_sadeghi's Avatar
 
Join Date: Mar 2011
Posts: 64
Rep Power: 15
eng_s_sadeghi is on a distinguished road
Hi Dear Mr. Habibdoust
I know you very well
you should use this:

DEFINE_PROFILE(unsteady_velocity, t, i)
{
real pos[ND_ND], x;
face_t f;
begin_f_loop(f, t)
{
F_CENTROID(pos,f,t);
x=pos[0];
F_PROFILE(f, t, i) = sin(x);
}
end_f_loop(f, thread)
}
__________________
Saeed Sadeghi
Ansys Fluent CFD Consultant
eng_s_sadeghi is offline   Reply With Quote

Old   July 20, 2011, 02:29
Default
  #4
New Member
 
Amir
Join Date: Aug 2010
Posts: 10
Rep Power: 15
amirhabibdoost is on a distinguished road
Dear Saeed,
I know you very well too.
Tank for your attention and reply.
you mean that if i use your suggested code, I will have velocity inlet as bellow function:
sin(x).sin(t)
Tanks in advance
Amir
amirhabibdoost is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 07:37
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 22:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 04:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 04:01


All times are GMT -4. The time now is 11:39.