# 2d Dynamic Mesh with udf

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

May 30, 2010, 12:35
hi friend
#21
New Member

euzinho
Join Date: May 2010
Posts: 15
Rep Power: 13
this is exactly what I want to resolve
a udf or any other way to get this movement in a transient study

Quote:
 Originally Posted by O.D.Y. Hey euzinho, how large should the displacement of your body you showed in the picture get? If its only a small one, the smoothing should be sufficient. But then you need to specify smoothing for all cell types via TUI as decribed above... Did you properly assign the rigid body movements to your body in the dynamic mesh option? Can you post your udf? cheers
Attached Images
 butterfly valve move.JPG (40.5 KB, 432 views)

 May 31, 2010, 03:55 #22 Member     Join Date: Mar 2009 Posts: 49 Rep Power: 14 Well sliding mesh could be an option... The idea would be to split the flow domain into two parts. Lets say one circle domain containing the valve and one for the rest of the domain, and the boundary between them could be defined as sliding mesh. But as far as I know you can only specify constant movement, or you have to use an udf... But the thing you want to do is quite easy to do with UDF... Here is a simple version of what I am using: #include #include #include "udf.h" DEFINE_CG_MOTION(move_body, dt, vel, omega, time, dtime) { real ampl,disp,omg,count; /* reset velocities */ NV_S (vel, =, 0.0); NV_S (omega, =, 0.0); /* motion */ ampl = 0.008726646 ; /* amplitude of rotation in radians (0.5deg) */ omg = 116.0219; /* angular frequency (18.465Hz) */ disp = ampl * sin(omg * time); /* resultant displacement */ omega[2] = ampl * omg * cos(omg * time); } So this is for a sinusoidal vibration with 0.5deg amplitude around the z-axis. for your case you could take another functional dependency on time or let it only work in a certain time period using an if condition. Then you need to hook this udf as rigid body motion and as center of gravity you just set the coordinates of the geometrical center point of your valve. let me know if it works. cheers Sittisak likes this.

May 31, 2010, 05:23
#23
New Member

euzinho
Join Date: May 2010
Posts: 15
Rep Power: 13
wow! friend, thanks so much for taking your time and help me out.
finally it works! this is the certain code for sure,
and actually this is what I did earlier but omega[2] coordenate didnīt work that time... I wonder why...

it leads me to another problem, however... so two more question, please
How can I define my CG "set the coordinates of the geometrical center point of your valve."
and how can I resolve negative cell volume problems..? is that because a wrong definition of my mesh?

thans again,

Quote:
 Originally Posted by O.D.Y. Well sliding mesh could be an option... The idea would be to split the flow domain into two parts. Lets say one circle domain containing the valve and one for the rest of the domain, and the boundary between them could be defined as sliding mesh. But as far as I know you can only specify constant movement, or you have to use an udf... But the thing you want to do is quite easy to do with UDF... Here is a simple version of what I am using: #include #include #include "udf.h" DEFINE_CG_MOTION(move_body, dt, vel, omega, time, dtime) { real ampl,disp,omg,count; /* reset velocities */ NV_S (vel, =, 0.0); NV_S (omega, =, 0.0); /* motion */ ampl = 0.008726646 ; /* amplitude of rotation in radians (0.5deg) */ omg = 116.0219; /* angular frequency (18.465Hz) */ disp = ampl * sin(omg * time); /* resultant displacement */ omega[2] = ampl * omg * cos(omg * time); } So this is for a sinusoidal vibration with 0.5deg amplitude around the z-axis. for your case you could take another functional dependency on time or let it only work in a certain time period using an if condition. Then you need to hook this udf as rigid body motion and as center of gravity you just set the coordinates of the geometrical center point of your valve. let me know if it works. cheers

 June 1, 2010, 03:38 #24 Member     Join Date: Mar 2009 Posts: 49 Rep Power: 14 Hi, well you just set the center of gravity in the dynamic mesh module to the coordinates of the geometric center of the body thats supposed to rotate. the negative volumes may have different reasons. As you are using quad-elements you have to set /define/models/dynamic-mesh-controls/smoothing-parameter/spring-on-all-shapes? yes via TUI otherwise the smoothing only works for tri- and tet-elements. If you still have negative volumes you should think about making smaller displacement per time step (e.g. taking a smaller time step size). You can also vary the parameters for smoothing and use the remeshing technique additionally. good luck

June 1, 2010, 07:29
#25
New Member

euzinho
Join Date: May 2010
Posts: 15
Rep Power: 13
thanks so much for your response,
actually I am setting my CG when I design the project in Solidworks, and it works

other question, where can I reset the "current mesh time" in order to start from the beginning?
I mean, after the body moves, How can I put it back at its initial position? what I do is to shut fluent down and start it over.. and itīs suck!

thanks

Quote:
 Originally Posted by O.D.Y. Hi, well you just set the center of gravity in the dynamic mesh module to the coordinates of the geometric center of the body thats supposed to rotate. the negative volumes may have different reasons. As you are using quad-elements you have to set /define/models/dynamic-mesh-controls/smoothing-parameter/spring-on-all-shapes? yes via TUI otherwise the smoothing only works for tri- and tet-elements. If you still have negative volumes you should think about making smaller displacement per time step (e.g. taking a smaller time step size). You can also vary the parameters for smoothing and use the remeshing technique additionally. good luck
Attached Images
 question.jpg (100.1 KB, 276 views)

 June 1, 2010, 07:35 #26 Member     Join Date: Mar 2009 Posts: 49 Rep Power: 14 good question, you could reset the current mesh time in the mesh motion module in former versions, but I guess in 6.3.26 and newer versions this isn't possible anymore... This time is saved in the *.dat file. You could just substract this time from the time variable in the udf and compile again... I don't know about another way..

 June 1, 2010, 09:07 #27 New Member   euzinho Join Date: May 2010 Posts: 15 Rep Power: 13 I did it! it is a simple armonic movement what I cannot get is to set certain movement in a given period of time. I mean, I have to open the valve in 2 seconds. thatīs all after that, the aim is to maintain the valve opened but If I cannot have a control of "time" I cannot control that.. I was thinking about something like: if (time=2) (guessing that Time in seconds) then omega[2] = 0 (because the valve will stop once reached that time) any suggestion? thanks Last edited by euzinho; June 1, 2010 at 09:57.

 June 2, 2010, 04:07 #28 Member     Join Date: Mar 2009 Posts: 49 Rep Power: 14 Why not, that should work....

June 2, 2010, 04:19
#29
New Member

euzinho
Join Date: May 2010
Posts: 15
Rep Power: 13
well, it doesnīt work because "time" is greater than 2 and there is no way to resert its value...

Quote:
 Originally Posted by O.D.Y. Why not, that should work....

August 3, 2010, 02:22
#31
Member

Join Date: Jul 2010
Posts: 57
Rep Power: 13
hi everybody...
first please let me brief you my problem,these two image that i sent you were simulated in gambit, both of them are kind of peristaltic pump,i want to rotate two/one small cylinder about z axis,i should write an udf,for this simple movement i used following udf
# include "udf.h"
# include "dynamesh_tools.h"
DEFINE_CG_MOTION(pump,dt,vel,omega,time,dtime)
{

real freq_t;
NV_S(vel,=,0.0);
NV_S(omega,=,0.0);
if(!Data_Valid_P())
return;
freq_t = 4.0;
vel[0] = 0.0;
vel[1] = 0.0;
vel [2] = 0.0;
omega [0] = 0.0;
omega [1] = 0.0;
omega [2] = freq_t;
}
but it does not work
i will be thankful if you could help me out
looking forward to ur help.
Attached Images
 1.JPG (68.2 KB, 175 views) 2.JPG (79.1 KB, 117 views)

 August 5, 2010, 09:48 update-dynamic-mesh failed. negative cell volume detected. #32 Member   ahmad Join Date: Jul 2010 Posts: 57 Rep Power: 13 hi dear all... I was running fluent and waiting to get results but faced an error: update-dynamic-mesh failed. negative cell volume detected. i changed time step from 0.0001 to 0.00001 but again this error showed up,could you help me out plz? thank u in advanced for any help provided

 August 8, 2010, 08:13 How to activate"spring-all-shapes"? #33 Member   ahmad Join Date: Jul 2010 Posts: 57 Rep Power: 13 hi dear all... i faced an error message,negative cell volume detected,i think if i activate spring-on-all shapes this error does show again,but i do not know hoe to activate it in ansys 12.0, any help will be appreciated...

 September 22, 2010, 10:06 butterfly valve #34 Member   andres Join Date: Sep 2010 Posts: 44 Rep Power: 12 I O.D.Y how it is going? I am in trouble one more time with butterfly valve move... I hope you can manage to help me out. Time ago you gave me the following code to resolve butterfly move and I have been changing some parameter to adapt your code to my requirements without success what I have to do is to stop this valve after 45š displacement. thatīs all. If you have any idea to do it, I would appreciate if you share this thoughs. regards DEFINE_CG_MOTION(rotating_body, dt, vel, omega, time, dtime) { real ampl,disp,omg,count; NV_S (vel, =, 0.0); NV_S (omega, =, 0.0); /* motion */ ampl = 0.785423 ; omg = 516.0219; disp = ampl * sin(omg * time); omega[2] = 0.785423*sin(time);

 June 28, 2011, 09:32 #35 Member   Alberto Pellegrino Join Date: Jan 2011 Posts: 32 Rep Power: 12 Hi O.D.Y., you mentioned that negative volume problems can be solved tuning the smoothing or re-meshing parameters. But I have this problem even if I work with sliding mesh (circle inner quad-mesh oscillating, and outer tri-mesh steady), so without smoothing or re-meshing. Any idea about why I get negative volumes (when I run a preview mesh motion on Fluent) and how to solve it, please? Many thanks. Kind regards, Alberto

 June 27, 2012, 03:11 #36 Member   Satish Gupta Join Date: Jun 2012 Posts: 30 Rep Power: 11 I am using dynamic mesh to simulate a 2d square cylinder.My problem is only the cells adjacent to boundary deforms.Can any1 tell me what I should do to deform more portion of the mesh?

 December 16, 2012, 09:30 #37 Member   Vidit Sharma Join Date: Aug 2012 Location: Delhi, India Posts: 32 Rep Power: 10 Hi All.. Sir, I am trying to rotate a 2D box or a 2D cup structure in Fluent using smoothing and remeshing. I am using tri mesh and as mentioned in Fluent Manual I am using smoothing and remeshing and also set the remeshing parameters from mesh info tab given in the remeshing menu. But the problem is that when i start simulation and it goes to first time step Fluent display "Updating mesh at time level N..." and here it stops and it happened alot of time and even waiting after a whole day it didnt worked. I also tried time step size from 0.01 to 0.000001 but it still show this problem. Can you plz help in this case? Thank u in advance

 February 28, 2013, 23:57 2D airfoil O Grid- negative volume #38 Member   samrat himvanth nanduri Join Date: May 2012 Posts: 30 Rep Power: 11 Hi, I'm carrying out a 2D pitching airfoil simulation using dynamic meshing with a "O" Grid. The dynamic conditions i have given were 1) airfoil - rigid body with UDF with pitching over X=0.25 2)interior - deforming with the min and max length scale from zone scale info 3) fluid -deforming with the min and max length scale from zone scale info. The spring constant i gave was 0.001 and convergence tolerance 0.0001 No of iterations 150. The time step tat i used is 0.001. After running the iterations and after about 500 time steps i'm getting the following error negative volume detected dynamic mesh update failed. i have worked around with the spring constant and also with the time step nothing worked. could someone help me out rectify this issue.. thanks in advance, sam

 February 17, 2016, 07:49 #39 New Member   Pradip Join Date: Jan 2016 Location: Mumbai Posts: 13 Rep Power: 7 Sam cfd can you tell me what options of fluent you choose for doing airfoil pitching analysis, I am doing bird wing flapping analysis. My email id is pradip.c1000@gmail.com Thanks in advance.

May 14, 2016, 03:03
#40
Senior Member

Arun raj.S
Join Date: Jul 2011
Posts: 186
Rep Power: 12
Hi everyone,

I am simulating flapping wing of aerofoil. I have created three zones, zone 1, 2 and 3. Zone 1 has aerofoil with structured mesh around the aerofoil. Zone 2 and 3 has unstructured gird. My problem is I have properly followed all the steps. But I am not able to achieve what I want. Because the shadow of the interface is taking as wall and is not moving along with the domain. Kindly someone help in sorting out this issue. I have attached my UDF alos. Please have a look. Thank you so much

Attached Files
 second.c (1.1 KB, 47 views)