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

UDF of shear flows - Just need a little little help

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 6, 2011, 11:58
Exclamation UDF of shear flows - Just need a little little help
  #1
New Member
 
Join Date: Dec 2010
Posts: 11
Rep Power: 6
yannossss is on a distinguished road
Hey guys
I've got a little problem about my UDF program to simulate shear flow in Fluent.
I finally managed to write the UDF program but there is a little mistake somewhere and I can't manage to fix it.

So the geometry of my problem is displayed here -> http://i1129.photobucket.com/albums/...inderinbox.jpg

As you can see I want the shear flow to act on the z-axis direction.

My UDF program is written as follows:

#include "udf.h"

DEFINE_PROFILE(yann_x_velocity, thread, position)
{
real x[ND_ND]; /* this will hold the position vector */
real z;
real u0=1.0;
face_t f;

begin_f_loop(f, thread)
{
F_CENTROID(x,f,thread);
z=x[1];
F_PROFILE(f, thread, position) =1.0+20.0*z;
}
end_f_loop(f, thread)
}


Now the problem in Fluent is:

When I plot the X velocity profile following a line created on the z-axis, the graph given is http://i1129.photobucket.com/albums/...annossss/1.jpg but this is not the solution I want.

On another hand when I plot the X velocity profile following a line created on the y-axis, the graph obtained is http://i1129.photobucket.com/albums/...annossss/2.jpg and this is the graph I'd like to get BUT when I plot the X velocity profile following the line created on the z-axis.

I have tried to modify the UDF file but nothing has worked. I'm pretty sure I am very close to the solution but I didn't mange to find and fix the mistake.

So if anyone could give me a little help I would really much apprecite it.

Thanks for your time guys, I hope you got what my problem is.

Yann
yannossss is offline   Reply With Quote

Old   July 6, 2011, 12:24
Cool
  #2
Member
 
Engr Adeniyi
Join Date: Jan 2011
Posts: 32
Rep Power: 7
Galileo is on a distinguished road
Quote:
Originally Posted by yannossss View Post

real x[ND_ND]; /* this will hold the position vector */
real z;
real u0=1.0;
face_t f;

begin_f_loop(f, thread)
{
F_CENTROID(x,f,thread);
z=x[1];
F_PROFILE(f, thread, position) =1.0+20.0*z;
}
end_f_loop(f, thread)
}


Yann
What I guess is wrong is z=x[1];
I think it should be z=x[3]; to mean z=zaxis because z=x[1]; means z=x axis.
At the interface, x=0 in your 3D rectangular geometry.

Notice that the velocity is constant meaning the face coordinate is x=0.

The plot direction, I think, should be x=1, z=0, y=0 ie in the x-direction in your yannossss/1.jpg not z=1.

I suppose all those by using my left hand as the box. Thumb=z axis, first finger=y axis,second finger= x axis, based on your Squarecylinderinbox.jpg

Hope am not confusing you ...lol

Please confirm am right or wrong.
Galileo is offline   Reply With Quote

Old   July 6, 2011, 13:21
Default
  #3
New Member
 
Join Date: Dec 2010
Posts: 11
Rep Power: 6
yannossss is on a distinguished road
Thank you very much for the reply unfortunately it does not work.

I also think the mistake comes from the line "z=x[1];"

However I made a little mistake on the Squarecylinderinbox.jpg and the right geometry is http://i1129.photobucket.com/albums/...oxmodified.jpg but I don't think it changes the problem.

When I plot the X velocity with the plot direction being as you advised me x=1, y=0 and z=0 following the line created on the z-axis it doen't give anything. I mean nothing is plotted.

When I do the same but following the line created on the y-axis it gives this http://i1129.photobucket.com/albums/...annossss/3.jpg

Hope you're not confused too and still have some ideas in the back of your mind.
yannossss is offline   Reply With Quote

Old   July 6, 2011, 15:48
Default
  #4
Member
 
Engr Adeniyi
Join Date: Jan 2011
Posts: 32
Rep Power: 7
Galileo is on a distinguished road
Quote:
Originally Posted by yannossss View Post
Thank you very much for the reply unfortunately it does not work.

I also think the mistake comes from the line "z=x[1];"

However I made a little mistake on the Squarecylinderinbox.jpg and the right geometry is http://i1129.photobucket.com/albums/...oxmodified.jpg but I don't think it changes the problem.

When I plot the X velocity with the plot direction being as you advised me x=1, y=0 and z=0 following the line created on the z-axis it doen't give anything. I mean nothing is plotted.

When I do the same but following the line created on the y-axis it gives this http://i1129.photobucket.com/albums/...annossss/3.jpg

Hope you're not confused too and still have some ideas in the back of your mind.



I think the system in Fluent is x=x[0],x[1],x[2] and not 1,2,3

so it should be:

real x[ND_ND]; /* this will hold the position vector */
real z;
real u0=1.0;
face_t f;

begin_f_loop(f, thread)
{
F_CENTROID(x,f,thread);
z=x[2];
F_PROFILE(f, thread, position) =1.0+20.0*z;
}
end_f_loop(f, thread)
}



See the file for my understanding of your model. I like to know if it works.
Make sure your axis system is right in Fluent see the x,y,z system and be sure you bind the BC UDF correctly.
Attached Images
File Type: jpg model.jpg (14.8 KB, 13 views)
Galileo is offline   Reply With Quote

Old   July 9, 2011, 07:01
Default Problem solved
  #5
New Member
 
Join Date: Dec 2010
Posts: 11
Rep Power: 6
yannossss is on a distinguished road
Hey lad I solved my problem.

So the problem was the cartesian system. In fact the udf is written for my mind with the catesian system I always learnt, meaning: with the right hand, thumb pointing the right designng the x-axis, first finger pointing up designing the y-axis and second finger pointing myself designing the z-direction. It is how Gambit is set and Fluent is also set that way.

The problem comes from the reading of the udf file by Fluent. I don't know why but I realised that when Fluent reads the udf file the cartesian system used changes and is defined as: still with your right hand, thumb pointing the right designing the x-axis, first finger pointing in front of you designing the y-axis and second finger pointing up designing the z-axis.

Which means that on the udf file, the "z" is read by Fluent as a "y". So in Gambit I just rotated the whole geometry by 90 around the x-axis and modify the equation in the udf file and now when I plot the x-velocity in the y direction (y direction that was the z before of course) it gives me what I'm looking for.

Tell me if you understood and thank you very much to have replied quickly to my post to help me.

I wish you all the best. Bye bye
yannossss is offline   Reply With Quote

Old   July 11, 2011, 07:11
Default
  #6
Member
 
Engr Adeniyi
Join Date: Jan 2011
Posts: 32
Rep Power: 7
Galileo is on a distinguished road
Quote:
Originally Posted by yannossss View Post
Hey lad I solved my problem.

So the problem was the cartesian system. In fact the udf is written for my mind with the catesian system I always learnt, meaning: with the right hand, thumb pointing the right designng the x-axis, first finger pointing up designing the y-axis and second finger pointing myself designing the z-direction. It is how Gambit is set and Fluent is also set that way.

The problem comes from the reading of the udf file by Fluent. I don't know why but I realised that when Fluent reads the udf file the cartesian system used changes and is defined as: still with your right hand, thumb pointing the right designing the x-axis, first finger pointing in front of you designing the y-axis and second finger pointing up designing the z-axis.

Which means that on the udf file, the "z" is read by Fluent as a "y". So in Gambit I just rotated the whole geometry by 90 around the x-axis and modify the equation in the udf file and now when I plot the x-velocity in the y direction (y direction that was the z before of course) it gives me what I'm looking for.

Tell me if you understood and thank you very much to have replied quickly to my post to help me.

I wish you all the best. Bye bye

Its good to know you have solved your problem. I don't use Gambit. From what you noticed, it is therefore important to see the geometry coordinate system as displayed in Fluent (irrespective of the meshing software).
Good luck to you.
Galileo is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF for coal combustion in multiphase flow niisha24 Fluent UDF and Scheme Programming 10 March 9, 2015 02:56
UDF to measure Mass Flow Rate a.lynchy Fluent UDF and Scheme Programming 21 February 15, 2014 03:18
udf for transient mass flow rate inlet mdzubairmanipal@gmail.com Fluent UDF and Scheme Programming 0 February 22, 2011 03:51
Wall shear stress in a UDF Jafri FLUENT 3 December 6, 2002 18:29
UDF for pulsing flow. J. Keays FLUENT 0 February 1, 2001 11:19


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