# UDF moving wall

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

 March 23, 2012, 05:02 UDF moving wall #1 Member   anonymous Join Date: Mar 2012 Posts: 45 Rep Power: 11 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.

 March 23, 2012, 06:30 #2 New Member   Jessica Simberg Join Date: Mar 2012 Posts: 18 Rep Power: 11 maybe u could use 6DOF...

 March 30, 2012, 14:46 #3 Member   Join Date: Sep 2011 Posts: 43 Rep Power: 12 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) } reza6767, Mike Romeo, pmechz and 2 others like this.

 April 2, 2012, 04:08 #4 Member   anonymous Join Date: Mar 2012 Posts: 45 Rep Power: 11 thanks komon, but i have a constant velocity, 1.4e-6 m/s, how can I put this in the UDF?

 April 2, 2012, 04:50 #5 Member   Join Date: Sep 2011 Posts: 43 Rep Power: 12 in the loop you have to just replace if and else sentences with vel[0]=1,4e-06.

 April 2, 2012, 04:56 #6 Member   anonymous Join Date: Mar 2012 Posts: 45 Rep Power: 11 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

 April 2, 2012, 05:05 #7 Member   Join Date: Sep 2011 Posts: 43 Rep Power: 12 under type in the dynamic mesh zones dialog box use rigid body. If i use user defined, it also gives me an error.

 April 2, 2012, 05:13 #8 Member   anonymous Join Date: Mar 2012 Posts: 45 Rep Power: 11 with rigid body gives me an error too...

 April 2, 2012, 05:20 #9 Member   Join Date: Sep 2011 Posts: 43 Rep Power: 12 did you include in your udf at the beginning, beside command #include "udf.h" also #include "dynamesh_tools.h"

 April 2, 2012, 06:03 #10 Member   anonymous Join Date: Mar 2012 Posts: 45 Rep Power: 11 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.

 April 2, 2012, 06:29 #11 Member   Join Date: Sep 2011 Posts: 43 Rep Power: 12 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.

 April 2, 2012, 06:39 #12 Member   anonymous Join Date: Mar 2012 Posts: 45 Rep Power: 11 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?

 April 2, 2012, 06:49 #13 Member   Join Date: Sep 2011 Posts: 43 Rep Power: 12 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.

 April 4, 2012, 04:40 #14 Member   anonymous Join Date: Mar 2012 Posts: 45 Rep Power: 11 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?

 April 4, 2012, 04:53 #15 Member   Join Date: Sep 2011 Posts: 43 Rep Power: 12 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.

 April 6, 2012, 10:34 #16 New Member   Down Join Date: Dec 2011 Posts: 4 Rep Power: 11 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.

 April 11, 2012, 00:42 #17 New Member   Jessica Simberg Join Date: Mar 2012 Posts: 18 Rep Power: 11 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...

November 1, 2012, 10:35
#18
Member

Vidit Sharma
Join Date: Aug 2012
Location: Delhi, India
Posts: 32
Rep Power: 11
Quote:
 Originally Posted by Komon 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

 November 1, 2012, 14:44 #19 Member   Join Date: Sep 2011 Posts: 43 Rep Power: 12 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.

November 1, 2012, 17:03
#20
Member

Vidit Sharma
Join Date: Aug 2012
Location: Delhi, India
Posts: 32
Rep Power: 11
Quote:
 Originally Posted by Komon 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.