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

dynamic mesh using define grid motion udf

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By masoud6

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 6, 2015, 23:19
Default dynamic mesh using define grid motion udf
  #1
New Member
 
fredrick
Join Date: Apr 2015
Location: China
Posts: 15
Rep Power: 11
fredrick is on a distinguished road
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.
fredrick is offline   Reply With Quote

Old   May 29, 2015, 03:43
Default Dear Fredrick
  #2
New Member
 
MaSoud Rahimi
Join Date: Jan 2015
Posts: 5
Rep Power: 11
masoud6 is on a distinguished road
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.
masoud6 is offline   Reply With Quote

Old   July 14, 2015, 02:56
Default thanks masoud6
  #3
New Member
 
fredrick
Join Date: Apr 2015
Location: China
Posts: 15
Rep Power: 11
fredrick is on a distinguished road
hello. thanks for your reply. do you think the code i have written for the dynamic mesh is okay?
fredrick is offline   Reply With Quote

Old   July 14, 2015, 06:19
Default another strategy for grid motion
  #4
New Member
 
MaSoud Rahimi
Join Date: Jan 2015
Posts: 5
Rep Power: 11
masoud6 is on a distinguished road
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);
}

masoud6 is offline   Reply With Quote

Old   August 28, 2015, 03:32
Default definition
  #5
New Member
 
MaSoud Rahimi
Join Date: Jan 2015
Posts: 5
Rep Power: 11
masoud6 is on a distinguished road
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*/
masoud6 is offline   Reply With Quote

Old   August 28, 2015, 05:16
Default
  #6
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 14
amin.z is on a distinguished road
Quote:
Originally Posted by fredrick View Post
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
amin.z is offline   Reply With Quote

Old   August 28, 2015, 05:17
Default
  #7
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 14
amin.z is on a distinguished road
Quote:
Originally Posted by masoud6 View Post
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?
amin.z is offline   Reply With Quote

Old   August 31, 2015, 00:14
Default bending grid motion
  #8
New Member
 
MaSoud Rahimi
Join Date: Jan 2015
Posts: 5
Rep Power: 11
masoud6 is on a distinguished road
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
File Type: jpg Capture.JPG (80.8 KB, 160 views)
masoud6 is offline   Reply With Quote

Old   October 11, 2015, 22:25
Default masoud6
  #9
New Member
 
fredrick
Join Date: Apr 2015
Location: China
Posts: 15
Rep Power: 11
fredrick is on a distinguished road
Quote:
Originally Posted by masoud6 View Post
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
fredrick is offline   Reply With Quote

Old   October 11, 2015, 22:35
Default
  #10
New Member
 
fredrick
Join Date: Apr 2015
Location: China
Posts: 15
Rep Power: 11
fredrick is on a distinguished road
Quote:
Originally Posted by amin.z View Post
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?
fredrick is offline   Reply With Quote

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

Old   June 26, 2018, 03:11
Default tutorial
  #12
Member
 
Join Date: Nov 2017
Posts: 54
Rep Power: 8
Saman95 is on a distinguished road
hi

can u give me a tutorial for dynamic mesh grid motion dynamic msh?
Saman95 is offline   Reply With Quote

Old   June 30, 2018, 07:18
Default
  #13
Member
 
Join Date: Nov 2017
Posts: 54
Rep Power: 8
Saman95 is on a distinguished road
Quote:
Originally Posted by masoud6 View Post
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
Saman95 is offline   Reply With Quote

Old   June 30, 2018, 07:25
Default
  #14
Member
 
Join Date: Nov 2017
Posts: 54
Rep Power: 8
Saman95 is on a distinguished road
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);
Saman95 is offline   Reply With Quote

Old   July 23, 2018, 04:20
Default
  #15
Member
 
Join Date: Nov 2017
Posts: 54
Rep Power: 8
Saman95 is on a distinguished road
Quote:
Originally Posted by masoud6 View Post
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?
Saman95 is offline   Reply With Quote

Old   December 21, 2020, 17:06
Default Define as UDF
  #16
New Member
 
Haitham Osman
Join Date: Jan 2020
Posts: 6
Rep Power: 6
Haitham Osman CFD is on a distinguished road
Quote:
Originally Posted by Amit soni View Post
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
Haitham Osman CFD is offline   Reply With Quote

Reply


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
2d Dynamic Mesh with udf pvc Fluent UDF and Scheme Programming 44 May 19, 2021 18:10
HELP----Surface Reaction UDF Ashi Fluent UDF and Scheme Programming 1 May 19, 2020 21:13
UDF for Dynamic Mesh vasava Fluent UDF and Scheme Programming 2 September 25, 2013 00:54
dynamic mesh and udf problem boboroo FLUENT 1 January 20, 2008 21:26
Problem related with UDF for dynamic mesh Ryan FLUENT 6 April 29, 2004 09:29


All times are GMT -4. The time now is 21:47.