# dynamic mesh using define grid motion udf

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Search this Thread Display Modes
 April 6, 2015, 23:19 dynamic mesh using define grid motion udf #1 New Member   fredrick Join Date: Apr 2015 Location: China Posts: 15 Rep Power: 10 hello ladies and gentlemen. I am trying to simulate deflecting a beam that is acting like a fan for a heat sink. i am using define grid motion udf but every time i try "smoothing" and "remeshing", i get a problem of negative volume error. Kindly help me to workaround this problem. this is my code based on the simple deflection equation of the fluent udf tutorial. the equation for my deflection is s(z)=amplitude*sin(2*pi*f*time)*(z/0.075)^2 hence the velocity becomes velocity = amp * w * cos(w * time)*(z/0.075)^2; z ranges from zero to 75mm but i want deflection to start at 20mm this is my code #include "udf.h" DEFINE_GRID_MOTION(fan1,main, dt, time, dtime) { Thread *tf = DT_THREAD (dt); face_t f; Node *v; real NV_VEC (velocity), NV_VEC (axis); real NV_VEC (origin), NV_VEC (rvec); real velc; real freq; real amp; real w; int n; /* set deforming flag on adjacent cell zone */ SET_DEFORMING_THREAD_FLAG (THREAD_T0 (tf)); freq=50; amp=0.003; w=2*3.141592654*freq; velc = amp * w * cos(w * time); NV_S (velocity, =, 0.0); NV_D (axis, =, 0.0,0.0, 1.0); NV_D (origin, =, 0.00307, 0.023, 0.075);/*center of gravity for my beam*/ begin_f_loop (f, tf) { f_node_loop (f, tf, n) { v = F_NODE (f, tf, n); /* update node if z position is greater than 0.02 and that the current node has not been previously visited when looping through previous faces */ if (NODE_Z (v) > 0.020 && NODE_POS_NEED_UPDATE (v)) { /* indicate that node position has been update so that it's not updated more than once */ NODE_POS_UPDATED (v); velocity[0] = velc * pow (NODE_Z (v)/0.075, 2); NV_V_VS (rvec, =, NODE_COORD (v), +, velocity, *, dtime); NV_V (NODE_COORD (v), =, rvec); } } } end_f_loop (f, tf); } kindly guys, assist me with any suggestion.

 May 29, 2015, 03:43 Dear Fredrick #2 New Member   MaSoud Rahimi Join Date: Jan 2015 Posts: 5 Rep Power: 10 I am also working on beam and dynamic mesh,i think it is really sensitive to time step and cell size. a minimum time step you could have is :1/8(1/freq). fredrick likes this.

 July 14, 2015, 02:56 thanks masoud6 #3 New Member   fredrick Join Date: Apr 2015 Location: China Posts: 15 Rep Power: 10 hello. thanks for your reply. do you think the code i have written for the dynamic mesh is okay?

 July 14, 2015, 06:19 another strategy for grid motion #4 New Member   MaSoud Rahimi Join Date: Jan 2015 Posts: 5 Rep Power: 10 it's true logically but it depends on your geometry. if it possible put the geometry. however you can carry out another strategy for code implement as following bellow (use your own equation and beam characteristic): #include"udf.h" #include"unsteady.h" #include"dynamesh_tools.h" #include "udf.h" DEFINE_GRID_MOTION(beam,domain,dt,time,dtime) { Thread *tf; face_t f; int n; Node *v; /* get the thread pointer for which this motion is defined */ tf=DT_THREAD(dt); begin_f_loop(f,tf) { f_node_loop(f,tf,n) { v = F_NODE(f,tf,n); NODE_Y(v)=NODE_Y(v)+fabs(NODE_X(v))*dtime; } } end_f_loop(f,tf); }

 August 28, 2015, 03:32 definition #5 New Member   MaSoud Rahimi Join Date: Jan 2015 Posts: 5 Rep Power: 10 Dear Fredrick could you please tell me what does these three lines mean, specially line 3 ? NV_S (velocity, =, 0.0); NV_D (axis, =, 0.0,0.0, 1.0); NV_D (origin, =, 0.00307, 0.023, 0.075);/*center of gravity for my beam*/

August 28, 2015, 05:16
#6
Senior Member

Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 13
Quote:
 Originally Posted by fredrick hello. thanks for your reply. do you think the code i have written for the dynamic mesh is okay?
Hi friends,
I'm working on same projects,
the first question, Fredrick, what's the direction of the beam in your code? Is it in X direction?
I've also prepared a same code based on fluent tutorial but it's not working, actually the domain is completely stationary!
My domain is 2D and I've checked the beam in X and Y direction, bot it's still not working

August 28, 2015, 05:17
#7
Senior Member

Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 13
Quote:
 Originally Posted by masoud6 it's true logically but it depends on your geometry. if it possible put the geometry. however you can carry out another strategy for code implement as following bellow (use your own equation and beam characteristic): #include"udf.h" #include"unsteady.h" #include"dynamesh_tools.h" #include "udf.h" DEFINE_GRID_MOTION(beam,domain,dt,time,dtime) { Thread *tf; face_t f; int n; Node *v; /* get the thread pointer for which this motion is defined */ tf=DT_THREAD(dt); begin_f_loop(f,tf) { f_node_loop(f,tf,n) { v = F_NODE(f,tf,n); NODE_Y(v)=NODE_Y(v)+fabs(NODE_X(v))*dtime; } } end_f_loop(f,tf); }
and dear Masoud,
Based on your code, is the beam bending? or only rotate as a rigid beam?

August 31, 2015, 00:14
bending grid motion
#8
New Member

MaSoud Rahimi
Join Date: Jan 2015
Posts: 5
Rep Power: 10
Dear Amin
the geometry has been attached. as can be seen from fig. this cod is expedient for bending of a beam.
best
Attached Images
 Capture.JPG (80.8 KB, 156 views)

October 11, 2015, 22:25
masoud6
#9
New Member

fredrick
Join Date: Apr 2015
Location: China
Posts: 15
Rep Power: 10
Quote:
 Originally Posted by masoud6 Dear Fredrick could you please tell me what does these three lines mean, specially line 3 ? NV_S (velocity, =, 0.0); NV_D (axis, =, 0.0,0.0, 1.0); NV_D (origin, =, 0.00307, 0.023, 0.075);/*center of gravity for my beam*/
hello buddy. sorry for the delay but i hope i'm not too late. It's been long since I logged in.
my thoughts are, since I'm working with velocity equation, the first line is to reset vel as 0;
the second line means my beam lies in the z axis.
the third line i suspect I'm wrong.. maybe i could have ignored x, y and just indicate z (0.0, 0.0, 0.075) since the starting point for my beam is 75mm in the Z axis...

I'm restarting the project and I am still stuck.
I guess your code looks nice but i don't understand this line "NODE_Y(v)=NODE_Y(v)+fabs(NODE_X(v))*dtime; " what do u mean by fabs?

couldyou also kindly send me your entire code so to my email if you don't mind "irungufred@yahoo.com". thanks

October 11, 2015, 22:35
#10
New Member

fredrick
Join Date: Apr 2015
Location: China
Posts: 15
Rep Power: 10
Quote:
 Originally Posted by amin.z Hi friends, I'm working on same projects, the first question, Fredrick, what's the direction of the beam in your code? Is it in X direction? I've also prepared a same code based on fluent tutorial but it's not working, actually the domain is completely stationary! My domain is 2D and I've checked the beam in X and Y direction, bot it's still not working
Hello sir.
sorry that I could not reply on time.

my domain is 3D. mine works and I can see the bean vibrating but the problem of negative volume is the headache.
My beam lies in the Z axis. It vibrates in X direction.

which equation of vibration did you use?

 October 14, 2016, 02:37 define grid motion #11 New Member   Amit soni Join Date: Jul 2015 Posts: 10 Rep Power: 9 In my case it is showing Warning: incorrect cg motion UDF beam::libudf on zone 14 (assuming no motion), What does it mean

 June 26, 2018, 03:11 tutorial #12 Member   Join Date: Nov 2017 Posts: 54 Rep Power: 7 hi can u give me a tutorial for dynamic mesh grid motion dynamic msh?

June 30, 2018, 07:18
#13
Member

Join Date: Nov 2017
Posts: 54
Rep Power: 7
Quote:
 Originally Posted by masoud6 it's true logically but it depends on your geometry. if it possible put the geometry. however you can carry out another strategy for code implement as following bellow (use your own equation and beam characteristic): #include"udf.h" #include"unsteady.h" #include"dynamesh_tools.h" #include "udf.h" DEFINE_GRID_MOTION(beam,domain,dt,time,dtime) { Thread *tf; face_t f; int n; Node *v; /* get the thread pointer for which this motion is defined */ tf=DT_THREAD(dt); begin_f_loop(f,tf) { f_node_loop(f,tf,n) { v = F_NODE(f,tf,n); NODE_Y(v)=NODE_Y(v)+fabs(NODE_X(v))*dtime; } } end_f_loop(f,tf); }
can you send me your case and data?
I want to learn grid motion

 June 30, 2018, 07:25 #14 Member   Join Date: Nov 2017 Posts: 54 Rep Power: 7 hello Does any one know what the two bettom lines mean real NV_VEC (omega), NV_VEC (axis), NV_VEC (dx); real NV_VEC (origin), NV_VEC (rvec);

July 23, 2018, 04:20
#15
Member

Join Date: Nov 2017
Posts: 54
Rep Power: 7
Quote:
 Originally Posted by masoud6 Dear Amin the geometry has been attached. as can be seen from fig. this cod is expedient for bending of a beam. best
hello
I have a geometry like square with four node and this geometry has a shadow.

I want to move just a node, but I have a problem that the node between shadow and geometry is different and after the motion, the shapes are different

can you explain me how to match the node arrangement?

December 21, 2020, 17:06
Define as UDF
#16
New Member

Haitham Osman
Join Date: Jan 2020
Posts: 5
Rep Power: 5
Quote:
 Originally Posted by Amit soni In my case it is showing Warning: incorrect cg motion UDF beam::libudf on zone 14 (assuming no motion), What does it mean
It is old thread, but it may be helpful for another.

you have to define your udf as a DEFINE UDF from the grid motion options. I think you got this message cause you selected rigid body option

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 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 OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post pvc Fluent UDF and Scheme Programming 44 May 19, 2021 18:10 Ashi Fluent UDF and Scheme Programming 1 May 19, 2020 21:13 vasava Fluent UDF and Scheme Programming 2 September 25, 2013 00:54 boboroo FLUENT 1 January 20, 2008 21:26 Ryan FLUENT 6 April 29, 2004 09:29

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

 Contact Us - CFD Online - Privacy Statement - Top