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

Moving wall with velocity profile

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

Like Tree3Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   March 28, 2011, 12:53
Default Moving wall with velocity profile
  #1
New Member
 
Join Date: Mar 2011
Posts: 28
Rep Power: 6
Tobard is on a distinguished road
Hi everyone!

I need to study a transient flow inside a closed cylinder which is starting to rotate. It seems impossible to put a velocity profile instead of a constant value under rotating wall boundary conditions with Fluent. Is there another way to do this? Is there somebody here who already tried such a transient simulation?

Thank you very much for your help!
Tobard is offline   Reply With Quote

Old   March 28, 2011, 13:14
Default
  #2
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Hi,
if you try components option in wall boundary conditions, you can impose any velocity profile by a UDF.
Amir is offline   Reply With Quote

Old   March 28, 2011, 13:44
Default
  #3
New Member
 
Join Date: Mar 2011
Posts: 28
Rep Power: 6
Tobard is on a distinguished road
Quote:
Originally Posted by Amir View Post
Hi,
if you try components option in wall boundary conditions, you can impose any velocity profile by a UDF.
Thank you for your answer. I tried this but I would like to input a rotational speed and the only velocity components that are displayed are X, Y and Z components in m/s... Is it possible to change it in order to work in cylindrical coordinates for example? I haven't found anything satisfactory so far.

Thank you!
Tobard is offline   Reply With Quote

Old   March 28, 2011, 16:01
Default
  #4
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
note that you can implement coordinates of surface elements. so you can use a trigonometric functions in your UDF to obtain Cartesian components from rotational speed.
Amir is offline   Reply With Quote

Old   March 29, 2011, 11:15
Default
  #5
New Member
 
Join Date: Mar 2011
Posts: 28
Rep Power: 6
Tobard is on a distinguished road
Dear Amir,

Ok, I am trying to use these UDF. Since I am not really used to this option, it is difficult for me to understand how to implement coordinates of surface elements, as you said. Would it be possible to have an example of the kind of script you was thinking about? I haven't found anything similar in Fluent UDF Guide.

Thank you very much for your help!

Tobard.
Tobard is offline   Reply With Quote

Old   March 29, 2011, 11:41
Default
  #6
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Hi,
it's something like this (as a part of UDF):
Quote:
real x[ND_ND],xf,yf,zf,theta;
F_CENTROID(x,f,t);
xf=x[0];
yf= x[1];
zf= x[2];
theta=atan(yf/xf);
F_PROFILE(f,t,i) = R*omega*sin(theta);
it can be used for x-component. (check it's sign and ...)
Amir is offline   Reply With Quote

Old   March 30, 2011, 12:20
Default
  #7
New Member
 
Join Date: Mar 2011
Posts: 28
Rep Power: 6
Tobard is on a distinguished road
Hi,

Following your advice and trying to understand UDF philosophy, I have written the following function (I think I will have to do 2 different files in order to fill both X and Y velocity component fields in Fluent boundary conditions later, but it is a global base):
Quote:
#include"udf.h"
DEFINE_ADJUST(try3,d)
{
Thread *tf;
face_t f;
real time;
time = CURRENT_TIME;
real x[ND_ND];
real xf, yf;
real omega;
omega = 2*time;
begin_f_loop(f,tf)
{
if (BOUNDARY_FACE_THREAD_P(tf))
{
F_CENTROID(x,f,time);
xf = x[0];
yf = x[1];
F_U(f,time) = -omega*yf; /* For x-component */
F_V(f,time) = omega*xf; /* For y-component */
}
}
end_f_loop(f,tf)
}
Could you please take a look at this? The purpose is to change wall rotational velocity at each time step, and I am not sure my code is correct.

Besides when I try to interpret this with Fluent, I get these errors:
Quote:
Error: [...] line 8: parse error.
Error: [...] line 9: parse error.
Error: [...] line 10: parse error.
Error: [...] line 11: omega: undeclared variable
and I don't understand why!?

Thank you very much for your help!

Tobard
Tobard is offline   Reply With Quote

Old   March 30, 2011, 16:01
Default
  #8
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Hi,
I proposed you these changes:
Quote:
#include "udf.h"
#include "math.h"
DEFINE_PROFILE(x_velocity,thread,position)
{
face_t f;
real time = CURRENT_TIME;
real x[ND_ND],theta;
real R=1.0;
real omega=2.0*time;
begin_f_loop(f, thread)
{
F_CENTROID(x,f,thread);
theta=atan(x[1]/x[0]);
F_PROFILE(f, thread, position) = R*omega*sin(theta);
}
end_f_loop(f, thread)
}
I've compiled this without any error.
you're right, you need another UDF for y velocity which is similar to above.

regards,
stuart23 likes this.
Amir is offline   Reply With Quote

Old   March 30, 2011, 17:19
Default
  #9
New Member
 
Join Date: Mar 2011
Posts: 28
Rep Power: 6
Tobard is on a distinguished road
Thank you, it helps me much! I just would like to understand some points:

- My study needs to change ONLY wall (boundary) velocity (and then observe inertia and viscosity action into the fluid). Does your function really allow that? Using it under boundary conditions menu would then only apply it on boundary faces?

- Is it better to use F_PROFILE instead of F_U or F_V? I am afraid that F_PROFILE may change both X and Y velocity components although I need to change them one by one. (Furthermore F_U and F_V would allow me to not use trigonometrical functions, writing u= -omega*y and v= omega*x)

- Does Fluent accept using several interpreted UDFs at the same time? Or do I have to compile them? Thank you again, I think it will work now!

Regards,
Tobard
Tobard is offline   Reply With Quote

Old   March 31, 2011, 03:35
Default
  #10
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Hi,

Quote:
- My study needs to change ONLY wall (boundary) velocity (and then observe inertia and viscosity action into the fluid). Does your function really allow that? Using it under boundary conditions menu would then only apply it on boundary faces?
it depends on where you'll hook this UDF, if you hook that over wall boundary, it would change wall velocities.

Quote:
- Is it better to use F_PROFILE instead of F_U or F_V? I am afraid that F_PROFILE may change both X and Y velocity components although I need to change them one by one. (Furthermore F_U and F_V would allow me to not use trigonometrical functions, writing u= -omega*y and v= omega*x)
I don't agree with you, in both cases you need to use trigonometric functions but here, you can simplify your relations. i.e. :
R*omega*sin(theta)=R*omega*sin(atan(y/x))=y*omega
these relations are applicable to both procedures. note that using DEFINE_PROFILE for setting boundary conditions is more conservative and reliable than using other functions.

Quote:
- Does Fluent accept using several interpreted UDFs at the same time? Or do I have to compile them? Thank you again, I think it will work now!
that's one of the restrictions of interpreted UDFs. I proposed you using compiled one.

Regards,
Amir

Last edited by Amir; March 31, 2011 at 04:54.
Amir is offline   Reply With Quote

Old   April 4, 2011, 10:22
Default
  #11
New Member
 
Join Date: Mar 2011
Posts: 28
Rep Power: 6
Tobard is on a distinguished road
Hi,

I post this last message to thank you: my simulation is now working, using DEFINE_PROFILE just as you said.
A little feedback: working with direct coordinates rather than using trigonometrical functions avoids sign problems.

Regards,

Tobard

Last edited by Tobard; April 13, 2011 at 15:16.
Tobard is offline   Reply With Quote

Old   April 13, 2011, 15:10
Default
  #12
New Member
 
Join Date: Mar 2011
Posts: 28
Rep Power: 6
Tobard is on a distinguished road
Hi everybody!

I come here again because I encountered some new difficulties: I succeed in putting a profile law making the wall of my 2D cylinder rotate.

Now I would like to improve my model by dividing my cylinder in several zones (adding a wall along portion of diameter, basically). The whole assembly is not rotating as expected because "you cannot use the moving wall condition to model problems where the wall has a motion normal to itself. FLUENT will neglect any normal component of wall motion that you specify using the methods below." (Fluent User Guide).

A moving reference frame would allow me to make my walls rotate. But is it possible to hook a UDF to a moving reference frame (I see no available field for that)? Is there another way to do it?

Thank you so much for your help!

Tobard
Tobard is offline   Reply With Quote

Old   April 14, 2011, 15:23
Default
  #13
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Hi,
I've done such cases by implementation of dynamic mesh, in FLUENT 6.3 you can't use MRF for arbitrary motions(as you said) but it may be included in latest versions.
Amir is offline   Reply With Quote

Old   April 14, 2011, 15:42
Default
  #14
New Member
 
Join Date: Mar 2011
Posts: 28
Rep Power: 6
Tobard is on a distinguished road
I work on Fluent 12.0.1 or 12.1 and it seems not to be better. Do you think a moving mesh could be a solution? My geometry is similar to a disk split into to parts...

Tobard

Last edited by Tobard; April 15, 2011 at 11:25.
Tobard is offline   Reply With Quote

Old   April 15, 2011, 10:47
Default
  #15
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
certainly, moving mesh can help you to impose normal velocity to walls. I'll appreciate any other ideas ...
Amir is offline   Reply With Quote

Old   May 3, 2011, 14:41
Default
  #16
New Member
 
Join Date: Mar 2011
Posts: 28
Rep Power: 6
Tobard is on a distinguished road
Dear Amir,

Do you know where I could find samples or UDF functions close to my problem? I really don't see how to write (and hook) a UDF making my walls move and it is really difficult to find any help on the Internet.

Any concrete suggestion would be appreciated...

Thank you very much.

Tobard
Tobard is offline   Reply With Quote

Old   May 4, 2011, 15:22
Default
  #17
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Hi,
I wrote a UDF which rotate a wall but you can change that easily; here you are:
Quote:
#include "udf.h"
#include "stdio.h"
#include "math.h"
#define pi 3.1415
#define amp 0.174
#define freq 0.75
real w=2*pi*freq;
DEFINE_GRID_MOTION(motion,domain,dt,time,dtime)
{
Thread *tf = DT_THREAD(dt);
face_t f;
Node *v;
real theta,a,b;
int n;
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));
begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
v=F_NODE(f,tf,n);


if (NODE_POS_NEED_UPDATE (v))
{
NODE_POS_UPDATED(v);
theta=(-1)*amp*w*cos(w*time)*dtime;
a=cos(theta)*NODE_X(v)-sin(theta)*NODE_Y(v);
b=sin(theta)*NODE_X(v)+cos(theta)*NODE_Y(v);
NODE_X(v)=a;
NODE_Y(v)=b;
}
}
}
end_f_loop(f,tf);
}
seucj and cdf_user like this.
Amir is offline   Reply With Quote

Old   May 5, 2011, 19:03
Default
  #18
New Member
 
Join Date: Mar 2011
Posts: 28
Rep Power: 6
Tobard is on a distinguished road
Dear Amir,

What a relief to receive your answer! It greatly helped me and my problem is solved: it rotates!

I sincerely thank you!

Tobard
Tobard is offline   Reply With Quote

Old   May 16, 2011, 11:19
Default
  #19
New Member
 
Join Date: Mar 2011
Posts: 28
Rep Power: 6
Tobard is on a distinguished road
Dear Amir,

Sorry for coming to you again...
My simulations with Dynamic mesh give me strange results. Do you know how Fluent manage the transition between two time steps? The velocity is well defined at the boundary but seems not able to diffuse into the whole fluid zone...!
I tried with a DEFINE_CD_MOTION function instead of the DEFINE_GRID_MOTION one with no improvement. So I really don't know where this problem comes from.

Is there restrictions in the use of Dynamic mesh?
Have you ever encountered such an issue?

Thank you again for your help!

Tobard
Tobard is offline   Reply With Quote

Old   May 16, 2011, 12:14
Default
  #20
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Hi Tobard,
pay attention to locations where you hooked this UDF for. In other words, in dynamic zones, set e.g. walls, define interior and other rotating boundaries except the fluid zones.

regards,

Amir
Amir is offline   Reply With Quote

Reply

Tags
fluent, rotating wall, transient, velocity profile

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 slip and moving wall lichun Dong FLUENT 3 March 26, 2014 05:37
calculated velocity profile as new wall boundary wouter OpenFOAM 0 March 4, 2011 19:55
The velocity of wall boundary condtion Dhb FLUENT 1 January 14, 2010 14:00
Prescribed inflow velocity profile - how to? Alan Main CFD Forum 10 October 28, 2005 12:14
Variables Definition in CFX Solver 5.6 R P CFX 2 October 26, 2004 02:13


All times are GMT -4. The time now is 14:52.