Buoyancy Problem

Started by
38 comments, last by Dmytry 19 years, 6 months ago
@Dmytry
Quote:I think, if he'll model water in not so inaccurate way(not as nearly ideal spring), there will be enough damping at impact that will mask all integration problems.

Problems of integrations depend on the sampling frequency and the modulus of the physical variables. High incoming speeds and high damping is rightly where you have the most chances to create diverging anomalies.

Quote:
Yes, it's needed to increase timestep to model spring better but why assume water is a spring ?

Not water as such. But the equations that model this situation are retoractive at first and second order. This creates decreasing exponentials modulated by sinusoids normally. But if time steps or factors are too big, then discretization creates increasing exponentials, that is artificial cinetic energy.

The volume displaced is proportional to z*dt, and this creates the archimedaen force. So this will exaclty the same situation as for fluid damping : retroaction. I remember my trials to model futurist flying engines with strong aerodynamic brakes. It was very difficult to avoid divergences with high speeds and strong deccelerations.

Quote:
Even if it's not a water but helium in superliquid state[grin], there will be damping on impact due to turbulent dissipation. There will be attached mass, greater or equal to mass of vater in volume of underwater part of object.
Jump will not be totally elastic because even superliquid will get some of kinetical energy.


Approximatively, damping here just operates the same way as archimedean forces. Except it's second order (vz*dt), not first (z*dt), and except sign, it always opposes to movement.

So in the end, it's like a spring, or a spring with damping. Springs often break in simulations at low sampling rates.

@Hybrid
Can you tell us your actual average delta of time ? Are you sure your physical constants : mass, damping, water density are all coherent ?

Now for energy assertions. Don't forget to add cinetic AND potential energies. It always has to decrease, diffused in the water.

I'll also try to detect any potential consequence of the approximations you make by computing the displaced volumes and damping forces. But tonite, late, quite sleepy (and drunk ;).
"Coding math tricks in asm is more fun than Java"
Advertisement
Yes, damping forces will make problem worse...

The only way to do something with big timestep is to not use forces there but use approximation to true solution for that timestep.

1: Use (mass_of_object+k*v*p) ,that is,(mass_of_object + k*mass_of_displaced_water) as mass in your calculations. It's very important. It's approximation of effect of "attached" water.
It will have effect on making your final acceleration due to buoyant forces and gravity to be always smaller by absolute value than g, as it should.
It's not quite correct without that:
2: make a variable for mass_of_object+attached_mass_of_water. Let's name it EM(effective mass). At each timestep scale your velocity by min(1.0 , prev_step_EM/current_step_EM) . It's approximation to impulse conservation during timestep. But *that* will make things less stable, so first try 1 alone, then add 2, and maybe it will still work. Also it's possible to scale velocity as in 2 and then re-calculate object position again from prev. timestep pos.(kinda similar to RK integrator) So, timestep error will work in opposite way.

I just imagine you simulate extremely small mass object(bubble). So you'll have extremely high acceleration when it comes underwater. And it's just *wrong*. With water, in reality, you probably can't get g even if object's mass is zero, because there's attached mass of water.

2Charles: That's what i mean by simulate more accurately. With 1, he will always have smaller accelerations, not like there's damping forces added, but like there's more mass, and it will be more physically correct. Maybe with that correct, waay smaller accelerations, his timestep will be small enough. Maybe it even will be able to handle 2. I'm just imagining situation: he have light (think, almost zero mass) object underwater. Say, hydrogen bubble :). So with his model(if i understand his model correctly) it will have extremely big acceleration, for hydrogen, >1000g (edit: for hydrogen, about 10 000 g !). And it's just plain wrong. It can't have >g upwards, because water have to move down with acceleration not bigger than g. If we model it with 10 000g acceleration of bubble, and will add some damping forces as computational afterthought, it will make things worse.


BTW . I posted formules for potential energy of water. As about kinetic energy of water, it's mostly lost forever(will so-on completely dissipate) just like thermal energy...

BTW2, you can also try to use better integration method such as RK4. I was unable to simulate springs for some project with Euler, and was able to do it using RK4 .

[Edited by - Dmytry on October 17, 2004 6:43:57 AM]
I will try and get you my average delta time later today, as at the moment I'm rewriting some of it based on what I've read so far.

I'm keeping my units consistent - masses are in kg, lengths in metres, time in seconds.
Sounds like there are some complex solutions here.

Personally, I'd try decreasing the timestep (as has already been suggested). Also perhaps increase the damping caused by the water.

Failing that, just increase the mass of your cube a tad...

Your original article referred to the surface area affecting buoyancy, which of course, it doesn't - but I think from reading your subsequent posts that that was just a typo and you meant volume.

Mark
Quote:Original post by markr
Failing that, just increase the mass of your cube a tad...

Your original article referred to the surface area affecting buoyancy, which of course, it doesn't - but I think from reading your subsequent posts that that was just a typo and you meant volume.

Thing is, if I tweak the mass of the cube so it works then thats fine... but then I find if I drop it from a different height into the water the problem sometimes returns and the object flies up again.

Yeah I meant volume, but I use surface area to calculate the volume displaced so sometimes I write one instead of the other :)
Quote:Original post by Hybrid
Quote:Original post by markr
Failing that, just increase the mass of your cube a tad...

Your original article referred to the surface area affecting buoyancy, which of course, it doesn't - but I think from reading your subsequent posts that that was just a typo and you meant volume.

Thing is, if I tweak the mass of the cube so it works then thats fine... but then I find if I drop it from a different height into the water the problem sometimes returns and the object flies up again.

Yeah I meant volume, but I use surface area to calculate the volume displaced so sometimes I write one instead of the other :)

my latest suggestion is exactly about mass of object - if you count "attached water", mass must be OK and must be physically-correct even if object's mass is zero.

BTW. To test n tune i'd write special version that does it in 2d and uses axis-aligned rectangle/square as object. It's in fact possible that your displaced volume calculation is not quite correct, and with 2d aligned box, it's simpler and there's less room for mistake......
As I'm working out the forces on a per triangle basis, should I also work out the 'attached mass' per triangle, so only add the mass of water the triangle displaces as opposed to the whole object?

At the moment, it's very close to a 2D situation as the box is upright and the water is a flat plane, so there is no rotation at the moment, so I can easily check the volume displaced to see if the calculations are correct.
@Dmytry (and thus Hybrid too :)
Quote:
The only way to do something with big timestep is to not use forces there but use approximation to true solution for that timestep.

I agree that if a well thought hack works, based on physical observations or on a math study of the differential equations, then it should be prefered to very high integration rates. The volume computations will be time consumming. So risk of global computational 'lags'. Also hydrodynamics are in reality quite complex. Still I don't think it's the approximations of the model that 'cause the jumps'.

I am sure what happense is something like that. At t=0, a volume of 10cm radius is above water, comes with 10m/s. So the next step, t=1/100 sec for intance, it has displaced a height of 10 centimeter. Where it should possibly never have been if the simulation was continuous, this depends on the bal density.And surely never with the velocity it will have at the start of the second frame. I mean in any case energy is artificially created, even with your EM/velocity proposal. I think.

So, until Hybrid tests your solution Dmytry, to see if it works. I would rather go for a event based approach. I suppose it's important to know when the object hits the water/air interface, some kind of collision prediction again or time step refinement. Then integration will surely evolve with sounder initial conditions. Then I'd go for a hugely accelerated sampling rate for the first few seconds. But it's hard to tell on paper the object probably rotates, damping acts...

Quote:Original post by Dmytry
I'm just inagining situation: he have light (think, zero mass) object underwater. Say, hydrogen bubble. So with his model it have extremely big acceleration, >1000g. And it's just plain wrong. It can't have >g upwards, because water have to move down with acceleration not bigger than g. If we model it with 1000g acceleration of bubble, and will add some damping forces as computational afterthought, it will make things worse.

Excuse me if I miss something. It's just that I haven't experienced physic simulations of solids bodies vs liquids. Still I have experienced many other kind of forces. So maybe I miss something crucial in your post.

Still. Zero mass would mean photon to me :). I know that you certainly mean physically infinitesimal (very small but non zero) mass. But your bubble mass is proportional to its volume, which is also proportionnal to a mass of water displaced. So it's all about a ratio of densities (damping left apart), so acceleration is based on it. So your 1000g, OK.

But when you say it's just plain wrong, I think it's because the damping forces lack, not because your EM model lacks. As damping is roughly based on the apparent surface, here the ratio of densities does not count. Thus in results in very high damping, a problem. And there are probably other kinds of forces coming into play for a bubble, all resulting in higher retroaction. Big bubbles do not exist, there is a reason.

So probably the solution is to control artificially and force the evolution towards the limit of the movement that can be studied in theory. Your bubble would quickly reach it's nominal upward velocity. This is roughly what you tried to do with the EM trick, but I am not sure it takes the right params. Where is damping accounted for since it's the main cause of the limit state ? Or I missed something implicit.

Now it would be perfect if this could be done by creating a fake but working force summation. That is force towards the solution at second order. Well near the limit acceleration is null, and you target a speed limit. So more probably, the only stable way is to force control at first order, that is the velocities, with some sort of morphing during the transition between the initial state (for instance a bubble standing still) and the limit state.

Still if you can't change the typical physics interface : user provides forces, only integration modifies velocities and positions, there is a way to do. I remember that to respond to such issues I had a class of tools that helped me to create the forces required to match a given position, orientation, or linear/angular speed. The time to limit was the second argument of the function.. It did so by reversing the physics integrator. This way for instance I could make keyframed animations compatible with the whole physics engine. And keyframed cyclic stuff like elevators, arbitrarilly of infinite mass, interacted perfectly with free physics objects. this worked perfectly.

Quote:
BTW2, you can also try to use better integration method such as RK4. I was unable to simulate springs for some project with Euler, and was able to do it using RK4 .

Yes good advise. I also experienced that.
"Coding math tricks in asm is more fun than Java"
i did some searches...
clickster
Nothing really useful, except that looks like everyone uses concept of "added mass" to model boats, dolphins, submarins, etc.

Yes, added mass it's generally an approximation to part of damping. You'll also need friction damping of course.

It's possible to simulate added mass using damping. But it requirs full liquid simulation.
How simulating may work:
You have a pressure of bubble and pressure of water. At bubble surface, pressure of water is equal to pressure of bubble. For any practical purprose, we can assume air, or hydrogen bubble mass to be zero. So bubble just equates pressure on it's surface, and can accelerate up to equate pressure on surface. Given that, you need to compute flow of water around bubble.
It doesn't go to singularity if mass of bubble is zero....

And, thing is whole lot harder if bubble is "hard" that is, if we will try to work with our 10000g model. It will have 10000g acceleration, it will move a bit, then it will compress water on it's path, and will have opposite direction force due to pressure of water. To simulate this, you need extremely small timestep.

Truing to work out that 10000g accelerations is like attempt to simulate a steel brick with force applied to some small hemisphere : you'll have steel in that hemisphere accelerating, then to move, then to accelerate backward due to springing of steel. Except that for such things, water is harder than steel - if you apply force to some point, steel may break. And water can not.

Also, 10000 g simulation have almost no physical meaning. We simply can't use Archimedes law for accelerating objects, because, this law doesn't take into account acceleration of water.

Imagine bubble/whatever thing is moving in the water. Water around moves in opposite direction. Compute how center of mass of water is moving, and see that it's the same as if you accelerate object upwards and also accelerate water downwards.
Resulting inertia of water is bigger or equal to inertia of mass of water taken in volume of object.

as about size of bubbles, i've found that it's possible to make big bubbles that looks like |) shape. By big i mean with diameter of 10 cm or so.
getting this unconditionally stable, for any mass, isnt easy.

think about it: if you take a very tiny mass, any force generated in the first contact will cause it to blast away, due to a=f/m. no matter how accurate your simulation is, you can always imagine a mass so small it cant handle it.

unless your program is 'aware' it is in a dangerous situation, and can adapt according to that. working with energies is probably a good idea. if a ball hits the water, you can calculate the energy needed for the calculated displacment, and possibliy conclude 1/2mv^2 isnt ever going to be capable of this given the m in question, and based on this condition locally take a smaller timestep for your simulation.

This topic is closed to new replies.

Advertisement