# Errors with sloshing simulation

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

 November 14, 2012, 15:24 Errors with sloshing simulation #1 New Member   Denis Join Date: May 2012 Posts: 4 Rep Power: 12 Hello everyone, sorry for starting another thread on sloshing.. as I have seen many others on this forum. I am trying to get a sloshing simulation for a coffee cup (using water for now) with an opening at the top. I would like to detect the amount of liquid which leaves the cup due to a periodic motion. I have done the flow over a bump tutorial and read over some basics on CFX. If anyone could please assist me with any of these problems I would greatly appreciate it. 1. Since there is no inlet/outlet I am trying to set initial conditions with: LIBRARY: CEL: &replace EXPRESSIONS: Water height = 5 [ m] denh = (denwater - denref) denref = 1.185 [kg m^-3] denwater = 997 [kg m^-3] motion = sin(theta) [m/s] pressure = denh*g*vliquid*((Water height)-y) vair = 1.0 - vfliquid vfliquid = (y-(Water height))/y END END END -but this does not seem to give me a water height of 5m. 2. I have applied symmetry to 2 faces, walls to the bottom and 2 other faces and opening at the top. I am trying to apply "motion" , a periodic sine motion to the walls but it gives me an error unless I apply it in the W direction. Even then, I do not get any motion in CFD-Post. Capture.PNG (using a prism right now for simplicity) Thank you for the help, Denis

 November 14, 2012, 17:31 #2 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 17,323 Rep Power: 138 Use the if-then or step function to give a sharp transition from water to air. This function just linearly adjusts it over a long distance - this is not what you want.

 November 15, 2012, 16:25 #3 New Member   Denis Join Date: May 2012 Posts: 4 Rep Power: 12 Thank you or the tip Glenn! I made this my CEL code: LIBRARY: CEL: &replace EXPRESSIONS: Water height = 20 [ cm] cm = 1 [cm] denh = (denwater - denref) denref = 1.185 [kg m^-3] denwater = 997 [kg m^-3] motion = 5*sin(t*(360[rad/s])) [cm] pressure = denh*g*vfliquid*((Water height)-y) vair = 1.0 - vfliquid vfliquid = step((Water height - y)/cm)*1.0 END END END I am now getting an error of: A negative ELEMENT volume has been detected. This is a fatal error and execution will be terminated. The location of the first negative volume is reported below. Volume : -0.6276E-06 Location : ( -0.75701E-01, 0.33485E+00, 0.70440E-01) I applied "unspecified motion" to the domain, the symmetry walls and the opening. And put in the "motion" expression into X specified displacement for the 3 walls (two sides and the bottom) Thank you, Denis

 November 15, 2012, 17:53 #4 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 17,323 Rep Power: 138 You have not specified your domain motion correctly. If you want the whole thing to oscillate back and forth as a rigid body then you need to apply your motion expression to all boundaries. To debug mesh motion errors, do a simulation where you output a results file every time step including the mesh. You can also turn off the momentum/energy/turbulence solvers using expert parameters to make it go faster. Then run it and you will see the mesh motion you defined. This allows you to quickly debug the mesh motion. Also note this model can be done much more simply by changing the gravity vector. This is an approximation which does not precisely model the motion but it might be close enough and it is much easier and faster to run.

 November 16, 2012, 14:28 #5 New Member   Denis Join Date: May 2012 Posts: 4 Rep Power: 12 Hi Glenn, I fixed the mesh error by reducing mesh element size. I am now trying to run the simulation in CFD -post but am unable to get the right animation. I am trying to get something like: http://www.youtube.com/watch?v=jSs1sFp673o But my water is just moving back and forth, I am not getting any sloshing. I set all of the domains to the specified motion, including the water/air domain inside the box. Sorry for all the questions. I am getting very close and am just missing a few steps! Thanks again, Denis

 November 17, 2012, 20:03 #6 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 17,323 Rep Power: 138 First of all - make sure you get the physics right. Are you simulating a regime where sloshing occurs? If the Reynolds number is too low you will not get sloshing. Also are you correctyl resolving the free surface? If you have excessive diffusion of the surface you will not get sloshing. Is the volume fraction gradient from 0 to 1 resolved over a few elements?

November 20, 2012, 03:55
#7
New Member

Denis
Join Date: May 2012
Posts: 4
Rep Power: 12
Quote:
 Originally Posted by ghorrocks First of all - make sure you get the physics right. Are you simulating a regime where sloshing occurs? If the Reynolds number is too low you will not get sloshing. Also are you correctyl resolving the free surface? If you have excessive diffusion of the surface you will not get sloshing. Is the volume fraction gradient from 0 to 1 resolved over a few elements?

Thank you for all the help Glenn.
Finally got it working.

-Denis