CEL code for simulating the equation of motion of a vibrating rigid body
Hello everybody
I need a CEL code to develop the the equation which describing the motion of a vibrating rigid body: my"+ cy'+ ky = F(t) with F(t) being the hydrodynamic force acting on the surface of the rigid body, m being the mass, c the damping factor and k the spring stiffness. Thanks so much... 
Hi
what is your problem that you want to solve? where do you want use this CEL? 
Take a look at the ball valve tutorial in version 12.1. In version 13.0 it was switched to a rigid body instead. Of course you can just use a rigid body instead of CEL too.

Quote:
Thanks for replying. There's two coaxial tubes and a fluid flows through the space between them; the inner is fixed and the outer is free to oscillate in transverse direction, I mean y direction in this problem. At first the outer tube is replaced a little from its initial position and then is left to vibrate in y direction. I want the outer tube to follow the ODE equation my"+ cy'+ ky = F(t) during its motion. 
Quote:
I've studied it before. I explained my problem above. I used rigid body and a spring force to simulate the vibrating nature of the outer tube but the questionable part is that in my project I should work with natural frequency not the mass of tube "m" and spring stiffness "k". I tried to determine m and k to have the desired natural frequency but I have several choices and each one will lead to different response. 
Have you considered solving it as a 2way FSI case (see the oscillating plate tutorial for an example)?

Quote:
In my problem the outer tube is a rigid body and wouldn't undergo any deformation during the oscillation; with regarding this fact I think a 2way FSI solver is not necessary. 
Perhaps I'm missing something here... if the tube moves as a rigid body in the ydirection then I guess you are assuming there are frictionless supports at the two ends of the tube. If you use the rigid body solver, providing the mass of the tube, then it would move at whatever frequency it wants to  is that what you mean by the natural frequency? If your tube has a spring or damper attached then go ahead and include that too. If the frequency you see doesn't match the expected frequency then I would say some assumptions or the setup is wrong.

I'm not really sure of how you plan to actually apply it all but from what i see it looks like you want to use a moving mesh for your boundary at the pipe's wall and your looking for the equations of motions of the mesh at the wall.
The one issue you may have is using a CEL function to define the acceleration of the wall when dealing with the momentum term of the force function. The rest should not be that difficult to derive however I may be wrong with this. F(t) = my" + cy' + ky m, c, and k are predefined by you. Force = force_y()@Pipe Y Vel = areaAve(Mesh Velocity X)@Pipe *note: this you could use other functions instead of areaAve, they should all yield the same value if the wall moves rigidly Y Accel = I really dont know how to define this. The issue here is that it is time dependent and i know that is an issue with CEL funtions. I remember a thread a while asking about it so i suggest looking it up to see if it can be done Y New = (Force  m*Y Accel  c*Y Vel) / k Y Mesh New = (Y0  y  Total Mesh Displacement Y) + Y New You would use a moving mesh with specified mesh location\ Hope this helps Good luck DM 
Quote:
Hi Doginal I tried it but finally I made the simulation with the menu of rigid body. thank you guies 
Quote:
Doginal, thanks for your previous reply. As I said before I did the simulation with the menus of CFX, I mean by applying the force directly on the rigid body menu: Rigid BodyDynamicsExternal Force DefinitionLinear Spring ConstantY Component. But now I need to use the corresponding CEL code without rigid body but with the motion of pipe wall instead; Besides my problem has changed alittle and that is the damping part is eliminated. I sow your code and found a solution for the acceleration of the pipe; but the code dosen't make the correct answer! What's the wrong with it, Doginal? This my code and used variables : equations and the variables: my"+ky=FlowForce y"=dv/dt=(vnewvold)/timestep vnew=dy/dt=(ynewyold)/timestep m*((ynewyold)/timestepvold)/timestep+k*ynew=FlowForce code: FlowForce=force_y()@pipe vold=areaAve(Mesh Velocity Y)@pipe yold=areaAve(Total Mesh Displacement Y)@pipe ynew=(FlowForce+m*(vold/timestep+yold/timestep^2))/(k+m/timestep^2) m , k and timestep is determined too. 
hi, how can i get the R of inlet, i used expressions areaAve(total mesh displacement x)@inlet and areaAve(total mesh displacement y)@inlet to get the x and y coordinates of every,then got R by (x^2+y^2)^0.5, but i got no R changed. how can i get a variable R? many thanks

All times are GMT 4. The time now is 15:03. 