CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF moving wall (http://www.cfd-online.com/Forums/fluent-udf/98991-udf-moving-wall.html)

libia87 March 23, 2012 05:02

UDF moving wall
 
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!!! :)

Jessica.S March 23, 2012 06:30

maybe u could use 6DOF...

Komon March 30, 2012 13:46

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)
}

libia87 April 2, 2012 03:08

thanks komon, but i have a constant velocity, 1.4e-6 m/s, how can I put this in the UDF?

Komon April 2, 2012 03:50

in the loop you have to just replace if and else sentences with vel[0]=1,4e-06.

libia87 April 2, 2012 03:56

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

Komon April 2, 2012 04:05

under type in the dynamic mesh zones dialog box use rigid body. If i use user defined, it also gives me an error.

libia87 April 2, 2012 04:13

with rigid body gives me an error too...

Komon April 2, 2012 04:20

did you include in your udf at the beginning, beside command

#include "udf.h"

also

#include "dynamesh_tools.h"

libia87 April 2, 2012 05:03

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.

Komon April 2, 2012 05:29

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.

libia87 April 2, 2012 05:39

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?

Komon April 2, 2012 05:49

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.

libia87 April 4, 2012 03:40

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?

Komon April 4, 2012 03:53

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.

xiandjf April 6, 2012 09:34

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.

Jessica.S April 10, 2012 23:42

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...

Vidit Sharma November 1, 2012 10:35

Quote:

Originally Posted by Komon (Post 352351)
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

Komon November 1, 2012 14:44

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.

Vidit Sharma November 1, 2012 17:03

Quote:

Originally Posted by Komon (Post 389730)
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.


All times are GMT -4. The time now is 09:12.