# tutorial for solving oscillating cylinder problem

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

 November 17, 2006, 09:59 tutorial for solving oscillating cylinder problem #1 CH Guest   Posts: n/a hello, i've asked this qn a while ago in this forum and some ppl (thanks zxaar!) were very helpful providing me with some pdf. after playing around, i finally managed to get it to work. hence i decided to post the basic steps to get it working. i assume that the unsteady vortex shedding of the cylinder at for e.g. Re=100 has been done. 1. change the unsteady formulation to 1st order implicit if req 2. turn on dynamic mesh setting 3. go to define -> user defined -> functions -> compiled 4. add the c file defining the oscillating motion 5. build it and load (make sure it's successful) 6 for the solutions control, u can use PISO with 2nd order upwind for momentum 7. in the dynamic grid zones, add the fluid and wall of cylinder to the dynamics zones. the type should be rigid body. motion udf should be the library which u just loaded. 8 iterative. note that the time step is very important. too big a time step can give the wrong ans! i hope i've not missed out any steps.... that's all. btw, here's an eg. of my plung.c udf #include "udf.h" /* this function defines velocity of center of gravity for pure plunging motion*/ /* Plunging motion equation is z(t)=h*sin(2*pi*f*t) */ DEFINE_CG_MOTION(plung, dt, vel, omega, time, dtime) { Thread *t; face_t *f; /*reset velocities */ NV_S(vel,=,0.0); NV_S(omega,=,0.0); if (!Data_Valid_P()) return; /* Get the thread pointer for which this motion is defined */ /* t=DT_THREAD(dt); */ /* vel[1] is the vertical plunging velocity */ vel[1] = 0.1910088333*cos(0.9550441667*time); } btw, i'm now considering deforming motion to be used with piching motion of an airfoil. if someone can enlighten me, that 'll be great. jzc likes this.

 December 5, 2006, 15:43 Re: tutorial for solving oscillating adapt problem #2 masum Guest   Posts: n/a hi, i'm a MS student working on adaptive airfoil.i'm facing problem to write the program or coding(on c/c++)to give circular motion and change the shape of the straight airfoil to a curved one. so can you help me to solve this problem. sincerely Masum

 December 7, 2006, 00:31 Re: tutorial for solving heat transfer problem #3 ranjith Guest   Posts: n/a send me tutorial for heat transfer and fluid flow problems

 August 28, 2011, 13:47 oscillating cylinder #4 New Member   Haroon Join Date: Aug 2011 Posts: 6 Rep Power: 7 Hello sir I have written my code with help of your tutorial #include"udf.h" /* this function defines velocity of center of gravity for pure plunging motion*/ /* Plunging motion equation is z(t)=h*sin(2*pi*f*t) */ DEFINE_CG_MOTION(plung,dt,vel,omega,time,dtime) { Thread*t; face_t*f; /*reset velocities */ NV_S(vel,=,0.0); NV_S(omega,=,0.0); if(!Data_Valid_P()) return; /* Get the thread pointer for which this motion is defined */ t=DT_THREAD(dt); /* vel[1] is the vertical plunging velocity */ vel[1] = 3*cos(1000*time); } The fluent runs it good with good qualitative results. cylinder dimensions are 1 m dia But I am not able to see a any visible oscillation in cylinder.How will i see the visible oscillation please help zhaomu67 likes this.

 October 6, 2013, 06:14 UDF for parabolic oscillation #5 New Member   shashank jagtap Join Date: Mar 2013 Posts: 4 Rep Power: 5 can anyone shed some light on oscillatory motion, like if you want to oscillate the cylinder in parabolic profile what should be the change in the udf ??

April 2, 2014, 10:38
#6
Senior Member

ok
Join Date: Oct 2013
Posts: 339
Rep Power: 6
Dear Haroon and others,

I need your help please to give me hint of how to make cylinder oscillating in the attached case. I spent for that more than 3 weeks and I didn't get the result till today. So, I'm waiting your help my friends.

In that case:
- Mesh was generated by Gmsh.
- U = 1m/s^2, D= 1m, Re = 100.
- Other information in the attached folder.

Attached Files
 circularCylinderNew.tar.gz (4.8 KB, 51 views)

 April 2, 2014, 10:46 #7 New Member   shashank jagtap Join Date: Mar 2013 Posts: 4 Rep Power: 5 I didn't find the mesh file in that, can you attach a separate mesh file.

 April 2, 2014, 10:53 #8 Senior Member   ok Join Date: Oct 2013 Posts: 339 Rep Power: 6 The mesh file is .Gmsh. Anyway, I attached again

 April 2, 2014, 10:56 #9 Senior Member   ok Join Date: Oct 2013 Posts: 339 Rep Power: 6 Sorry, there was problem in attachement. Anyway cylinder-2D.geo shown here D Code: ``` = 1.0; R = 0.5*D; CX = 4.5*D; CY = 0.0; S = 1.0/Sqrt(2); DR1 = R*S; DR2 = (R + 2.0*D)*S; N1 = 35; N2 = 90; Point(1) = {0, -4.5*D, 0}; Point(2) = {0, CY - DR2, 0}; Point(3) = (0, CY + DR2, 0); Point(4) = {0, 4.5*D, 0}; Point(5) = {CX - DR2, -4.5*D, 0}; Point(6) = {CX - DR2, CY - DR2, 0}; Point(7) = {CX - DR2, CY + DR2, 0}; Point(8) = {CX - DR2, 4.5*D, 0}; Point(9) = {CX - DR1, CY - DR1, 0}; Point(10) = {CX - DR1, CY + DR1, 0}; Point(11) = {CX, CY, 0}; Point(12) = {CX + DR1, CY - DR1, 0}; Point(13) = {CX + DR1, CY + DR1, 0}; Point(14) = {CX + DR2, -4.5*D, 0}; Point(15) = {CX + DR2, CY - DR2, 0}; Point(16) = {CX + DR2, CY + DR2, 0}; Point(17) = {CX + DR2, 4.5*D, 0}; Point(18) = {21*D, -4.5*D, 0}; Point(19) = {21*D, CY - DR2, 0}; Point(20) = {21*D, CY + DR2, 0}; Point(21) = {21*D, 4.5*D, 0}; Point(22) = {0, CY, 0}; Point(23) = {CX - 2*D, CY, 0}; Point(24) = {CX + 2*D, CY, 0}; Point(25) = {21*D, CY, 0}; Point(26) = {CX, -4.5*D, 0}; Point(27) = {CX, CY - 2*D, 0}; Point(28) = {CX, CY + 2*D, 0}; Point(29) = {CX, 4.5*D, 0}; Point(30) = {CX, CY - R, 0}; Point(31) = {CX - R, CY, 0}; Point(32) = {CX, CY + R, 0}; Point(33) = {CX + R, CY, 0}; Line(1) = {4, 8}; Line(2) = {8, 29}; Line(3) = {29, 17}; Line(4) = {17, 21}; Line(5) = {21, 20}; Line(6) = {20, 25}; Line(7) = {25, 19}; Line(8) = {19, 18}; Line(9) = {18, 14}; Line(10) = {14, 26}; Line(11) = {26, 5}; Line(12) = {5, 1}; Line(13) = {1, 2}; Line(14) = {2, 22}; Line(15) = {22, 3}; Line(16) = {3, 4}; Line(17) = {3, 7}; Line(18) = {7, 8}; Line(19) = {2, 6}; Line(20) = {6, 5}; Line(21) = {15, 14}; Line(22) = {15, 19}; Line(23) = {16, 17}; Line(24) = {16, 20}; Line(25) = {25, 24}; Line(26) = {23, 22}; Line(27) = {28, 29}; Line(28) = {27, 26}; Line(29) = {27, 15}; Line(30) = {15, 24}; Line(31) = {24, 16}; Line(32) = {16, 28}; Line(33) = {28, 7}; Line(34) = {7, 23}; Line(35) = {23, 6}; Line(36) = {6, 27}; Line(37) = {30, 27}; Line(38) = {31, 23}; Line(39) = {33, 24}; Line(40) = {32, 28}; Line(41) = {10, 7}; Line(42) = {9, 6}; Line(43) = {13, 16}; Line(44) = {12, 15}; Circle(45) = {31, 11, 10}; Circle(46) = {10, 11, 32}; Circle(47) = {32, 11, 13}; Circle(48) = {13, 11, 33}; Circle(49) = {33, 11, 12}; Circle(50) = {12, 11, 30}; Circle(51) = {30, 11, 9}; Circle(52) = {9, 11, 31}; Line Loop(53) = {17, 18, -1, -16}; Ruled Surface(54) = {53}; Line Loop(55) = {33, 18, 2, -27}; Ruled Surface(56) = {55}; Line Loop(57) = {32, 27, 3, -23}; Ruled Surface(58) = {57}; Line Loop(59) = {24, -5, -4, -23}; Ruled Surface(60) = {59}; Line Loop(61) = {25, 31, 24, 6}; Ruled Surface(62) = {61}; Line Loop(63) = {30, -25, 7, -22}; Ruled Surface(64) = {63}; Line Loop(65) = {8, 9, -21, 22}; Ruled Surface(66) = {65}; Line Loop(67) = {21, 10, -28, 29}; Ruled Surface(68) = {67}; Line Loop(69) = {11, -20, 36, 28}; Ruled Surface(70) = {69}; Line Loop(71) = {12, 13, 19, 20}; Ruled Surface(72) = {71}; Line Loop(73) = {19, -35, 26, -14}; Ruled Surface(74) = {73}; Line Loop(75) = {34, 26, 15, 17}; Ruled Surface(76) = {75}; Line Loop(77) = {42, -35, -38, -52}; Ruled Surface(78) = {77}; Line Loop(79) = {36, -37, 51, 42}; Ruled Surface(80) = {79}; Line Loop(81) = {29, -44, 50, 37}; Ruled Surface(82) = {81}; Line Loop(83) = {44, 30, -39, 49}; Ruled Surface(84) = {83}; Line Loop(85) = {39, 31, -43, 48}; Ruled Surface(86) = {85}; Line Loop(87) = {43, 32, -40, 47}; Ruled Surface(88) = {87}; Line Loop(89) = {46, 40, 33, -41}; Ruled Surface(90) = {89}; Line Loop(91) = {38, -34, -41, -45}; Ruled Surface(92) = {91}; RHO1 = 40; // Vertial near-wall parts RHO2 = 30; RHO3 = 30; RHO4 = 200; // Outlet channel RHO5 = 40; RHO6 = 40; // Inlet channel Transfinite Line {13, 20, 28, 21, 8} = RHO1; Transfinite Line {16, 18, 27, 23, 5} = RHO1; Transfinite Line {15, 34, 45, 48, 31, 6} = RHO2; Transfinite Line {14, 35, 52, 49, 30, 7} = RHO2; Transfinite Line {11, 36, 51, 46, 33, 2} = RHO3; Transfinite Line {10, 29, 50, 47, 32, 3} = RHO3; Transfinite Line {9, 22, 25, 24, 4} = RHO4; Transfinite Line {42, 37, 44, 39, 43, 40, 41, 38} = RHO5 Using Progression 1.02; Transfinite Line {1, 17, 26, 19, 12} = RHO6; Transfinite Surface "*"; Recombine Surface "*"; Extrude {0, 0, D} { Surface{54, 76, 74, 72, 70, 80, 78, 92, 90, 56, 58, 88, 86, 84, 82, 68, 66, 64, 62, 60}; Layers{1}; Recombine; } Physical Surface("inlet") = {113, 131, 157, 171}; Physical Surface("outlet") = {453, 483, 509, 523}; Physical Surface("walls") = {167, 189, 435, 457, 527, 329, 307, 109}; Physical Surface("cylinder") = {417, 399, 377, 219, 245, 267, 277, 355}; Physical Surface("top") = {114, 136, 158, 180, 202, 444, 466, 488, 510, 532, 334, 312, 246, 224, 422, 400, 378, 356, 290, 268}; Physical Surface("bottom") = {54, 76, 74, 72, 70, 68, 66, 64, 62, 60, 58, 56, 92, 78, 80, 82, 84, 86, 88, 90}; Physical Volume("channel") = {5, 4, 3, 7, 6, 15, 16, 14, 17, 18, 19, 20, 11, 12, 13, 9, 8, 10, 1, 2}; Mesh 3; Save "channel-with-cylinder.msh";```

 Thread Tools 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 On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Logan Page OpenFOAM Native Meshers: snappyHexMesh and Others 4 May 27, 2013 12:07 vovogoal CFX 1 November 22, 2011 10:54 widedMed OpenFOAM 3 March 29, 2011 04:35 m.maneshi OpenFOAM 1 November 29, 2009 14:44 ganesh Main CFD Forum 2 June 27, 2005 13:57

All times are GMT -4. The time now is 14:24.