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

UDF moving wall

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

Like Tree7Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 23, 2012, 05:02
Default UDF moving wall
  #1
Member
 
anonymous
Join Date: Mar 2012
Posts: 45
Rep Power: 14
libia87 is on a distinguished road
Hi everybody!

i want to simulate a cylinder that one face is moving linearly (axis z) with a constant velocity, ie. the cylinder decreases.

looking some of the posts i found this:

DEFINE_PROFILE(moving_wall, thread, i)
{

face_t f;

begin_f_loop(f, thread)

{

F_PROFILE = ....; /* insert speed of wall here*/

}

end_f_loop(f, thread)

}

I wonder if the problem is well posed

Thaks!!!
zengqiang2006 likes this.
libia87 is offline   Reply With Quote

Old   March 23, 2012, 06:30
Default
  #2
New Member
 
Jessica Simberg
Join Date: Mar 2012
Posts: 18
Rep Power: 14
Jessica.S is on a distinguished road
maybe u could use 6DOF...
Jessica.S is offline   Reply With Quote

Old   March 30, 2012, 14:46
Default
  #3
Member
 
Join Date: Sep 2011
Posts: 43
Rep Power: 14
Komon is on a distinguished road
I don't really know how the geometry of the problem looks as a whole, but when I did simulations with moving walls I used define_cg_motion. and setting under dynamic mesh panel as to determine when the cells split and join (if you have a moving wall the cells will become deformed). so I hope it helps if I post this UDF:

DEFINE_CG_MOTION(oscillate,dt,vel,omega,time,dtime )
{
Thread *t;
face_t f; /* define the variables */

t = DT_THREAD(dt); /* get the thread pointer for which the motion is defined */

/* if (!Data_Valid_P())
/* return; /* check if the values of the variables are accessible before you compute the function */

begin_f_loop(f,t) /* loop over each face in the zone to create an array of data */
{
if (time <= 1)
vel[0] = -2* 3.14159 * 2 * 0.025 * cos (2 * 3.14159 * 2 * time); /* define the velocity of the moving zone---*/
else
vel[0] = 0;
}
end_f_loop(f,t)
}
Komon is offline   Reply With Quote

Old   April 2, 2012, 04:08
Default
  #4
Member
 
anonymous
Join Date: Mar 2012
Posts: 45
Rep Power: 14
libia87 is on a distinguished road
thanks komon, but i have a constant velocity, 1.4e-6 m/s, how can I put this in the UDF?
libia87 is offline   Reply With Quote

Old   April 2, 2012, 04:50
Default
  #5
Member
 
Join Date: Sep 2011
Posts: 43
Rep Power: 14
Komon is on a distinguished road
in the loop you have to just replace if and else sentences with vel[0]=1,4e-06.
Komon is offline   Reply With Quote

Old   April 2, 2012, 04:56
Default
  #6
Member
 
anonymous
Join Date: Mar 2012
Posts: 45
Rep Power: 14
libia87 is on a distinguished road
thanks komon! Fluent interpret my UDF, but when I go to dynamic mesh and I select the face and I create my dynamic mesh zone with the udf fluent gives me an error


Warning: incorrect cg motion UDF oscillate on zone 5 (assuming no motion)

what does it mean?
thanks
libia87 is offline   Reply With Quote

Old   April 2, 2012, 05:05
Default
  #7
Member
 
Join Date: Sep 2011
Posts: 43
Rep Power: 14
Komon is on a distinguished road
under type in the dynamic mesh zones dialog box use rigid body. If i use user defined, it also gives me an error.
Komon is offline   Reply With Quote

Old   April 2, 2012, 05:13
Default
  #8
Member
 
anonymous
Join Date: Mar 2012
Posts: 45
Rep Power: 14
libia87 is on a distinguished road
with rigid body gives me an error too...
libia87 is offline   Reply With Quote

Old   April 2, 2012, 05:20
Default
  #9
Member
 
Join Date: Sep 2011
Posts: 43
Rep Power: 14
Komon is on a distinguished road
did you include in your udf at the beginning, beside command

#include "udf.h"

also

#include "dynamesh_tools.h"
Komon is offline   Reply With Quote

Old   April 2, 2012, 06:03
Default
  #10
Member
 
anonymous
Join Date: Mar 2012
Posts: 45
Rep Power: 14
libia87 is on a distinguished road
Yes I include this... and my geometry is very basic, a cylinder that one face moves in axis z, causing the cylinder decreases its length.
libia87 is offline   Reply With Quote

Old   April 2, 2012, 06:29
Default
  #11
Member
 
Join Date: Sep 2011
Posts: 43
Rep Power: 14
Komon is on a distinguished road
i suppose then the boundary you are trying to move is a wall (bottom of the cilinder). I used the given udf for a similar purpose, for moving a whole cilinder in a pool of liquid/another cilinder. the only problem I faced was the deformation of the interior mesh cells, which I could not get to split/grow together. however, the difference I see in your attempt is that the wall, which you are trying to move, is ''blocked'' by the wall, which resembles cilinder side surface. I didn't have that in my case.
I think you should also include this side wall and interior zone in the dynamic mesh and use ''deforming'' as a type. and then work around conditions you have available (remeshing and so on), which define when your cells grow together or separate.
Komon is offline   Reply With Quote

Old   April 2, 2012, 06:39
Default
  #12
Member
 
anonymous
Join Date: Mar 2012
Posts: 45
Rep Power: 14
libia87 is on a distinguished road
I include the wall and the interior zone as a deforming type, but the wall i want to move continues giving error...

do you know what does it mean ZONE 5?
libia87 is offline   Reply With Quote

Old   April 2, 2012, 06:49
Default
  #13
Member
 
Join Date: Sep 2011
Posts: 43
Rep Power: 14
Komon is on a distinguished road
hm a bit strange, I would expect it to give no errors this way.

you can see which zone is which if you look at the ID numbers under boundary or cell zone condition dialog box.
Komon is offline   Reply With Quote

Old   April 4, 2012, 04:40
Default
  #14
Member
 
anonymous
Join Date: Mar 2012
Posts: 45
Rep Power: 14
libia87 is on a distinguished road
When I interpret your UDF, Fluent says : line 8: structure reference not implemented, and it's refered to this:
t = DT_THREAD(dt); /* get the thread pointer for which the motion is defined */

what's the problem?
libia87 is offline   Reply With Quote

Old   April 4, 2012, 04:53
Default
  #15
Member
 
Join Date: Sep 2011
Posts: 43
Rep Power: 14
Komon is on a distinguished road
do you interpret or compile? As far as I know, you have to compile UDFs when you work with dynamic meshes. I have never tried to interpret udfs for dynamic meshes, so I don't know if Fluent even accepts them in this way.

otherwise, that line is as it says a pointer for thread which is to be moved. I don't really know what might be the problem here.
Komon is offline   Reply With Quote

Old   April 6, 2012, 10:34
Default
  #16
New Member
 
Down
Join Date: Dec 2011
Posts: 4
Rep Power: 14
xiandjf is on a distinguished road
CG_Motion means the body you want move is a rigid body.do you know what it mean? in your problem, one face of cylinder moves.so your case is not a rigid body.you can try other udf.
Mike Romeo likes this.
xiandjf is offline   Reply With Quote

Old   April 11, 2012, 00:42
Default
  #17
New Member
 
Jessica Simberg
Join Date: Mar 2012
Posts: 18
Rep Power: 14
Jessica.S is on a distinguished road
i think i got a solution to your problem:
try building 2 cylinders, one over the other. one cylinder will be stagnant and the other u can program to move...
Jessica.S is offline   Reply With Quote

Old   November 1, 2012, 10:35
Default
  #18
Member
 
Vidit Sharma
Join Date: Aug 2012
Location: Delhi, India
Posts: 32
Rep Power: 13
Vidit Sharma is on a distinguished road
Quote:
Originally Posted by Komon View Post
I don't really know how the geometry of the problem looks as a whole, but when I did simulations with moving walls I used define_cg_motion. and setting under dynamic mesh panel as to determine when the cells split and join (if you have a moving wall the cells will become deformed). so I hope it helps if I post this UDF:

DEFINE_CG_MOTION(oscillate,dt,vel,omega,time,dtime )
{
Thread *t;
face_t f; /* define the variables */

t = DT_THREAD(dt); /* get the thread pointer for which the motion is defined */

/* if (!Data_Valid_P())
/* return; /* check if the values of the variables are accessible before you compute the function */

begin_f_loop(f,t) /* loop over each face in the zone to create an array of data */
{
if (time <= 1)
vel[0] = -2* 3.14159 * 2 * 0.025 * cos (2 * 3.14159 * 2 * time); /* define the velocity of the moving zone---*/
else
vel[0] = 0;
}
end_f_loop(f,t)
}
Dear Sir,

i am using the UDF you told But I am having a problem while compiling it in Visual Studio Command Prompt. While executing nmake command to compile an error is appearing which is saying NMAKE : fatal error U1077: "sed" :return code '0X1'

Can you tell how to eliminate this error?

Thank You

Regards

Vidit Sharma
Vidit Sharma is offline   Reply With Quote

Old   November 1, 2012, 14:44
Default
  #19
Member
 
Join Date: Sep 2011
Posts: 43
Rep Power: 14
Komon is on a distinguished road
Hi Vidit!

I haven't yet come across that someone would compile an udf for Fluent from Visual Studio command prompt. what I always do when I use UDFs which need to be compiled is that I run Fluent from the mentioned command prompt. and then in the fluent I compile the UDF. So my suggestion would be to try and compile the udf in this way.
Komon is offline   Reply With Quote

Old   November 1, 2012, 17:03
Default
  #20
Member
 
Vidit Sharma
Join Date: Aug 2012
Location: Delhi, India
Posts: 32
Rep Power: 13
Vidit Sharma is on a distinguished road
Quote:
Originally Posted by Komon View Post
Hi Vidit!

I haven't yet come across that someone would compile an udf for Fluent from Visual Studio command prompt. what I always do when I use UDFs which need to be compiled is that I run Fluent from the mentioned command prompt. and then in the fluent I compile the UDF. So my suggestion would be to try and compile the udf in this way.
Dear Sir,

Thank you for the reply. I was not able to compile it in fluent as for that fluent is asking two files one is .c the code and the other one is .h header file. Can u plz explain how to do that in fluent I have wasted a lot of time with Visual Stdio may be that was not the right way. So, plz tell me.

Regards.
Vidit Sharma 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
[Commercial meshers] Fluent3DMeshToFoam simvun OpenFOAM Meshing & Mesh Conversion 50 January 19, 2020 16:33
How to use UDF to define a moving wall lingo FLUENT 9 August 19, 2014 10:14
stationary wall vs. moving wall user0314 FLUENT 0 August 26, 2011 10:42
udf variable for wall temperature Kiran FLUENT 0 July 31, 2008 09:31
Multicomponent fluid Andrea CFX 2 October 11, 2004 06:12


All times are GMT -4. The time now is 08:04.