algorithmic modeling for Rhino
First of all, thanks for the HOOPSNAKE component!
I am trying to solve hydrostatic stability with Grasshooper (and hoopsnake).
Actually I already did a script wich looks, more or less, the same as the example: http://vimeo.com/25182853
But with my script, I canot align the center of gravity with the center of buoyancy longitudinally.
What I would like to do is to have 3 inputs:
- Heel angle (Degrees)
- Displacement (Tons)
- Center of gravity position of the ship (X, Y, Z)
And the script acts on the hull depth (like now) AND on the trim angle, so the GC and BC can be aliged longitudinally.
Anobody has an idea ?
This is more a discussion for the tuna group I think.
Here's how I did it :
set the dwl right
compute deltaX (horizontal distance betwwen CB and CG)
repeat while deltaX > 1mm
compute le longitudinal metacenter M
compute the angle alpha = CB,M,CG
rotate the hull by alpha times some convergence factor (very close to 1 actually)
set the dwl right again (meaning a nested loop or a "displacement fitter" such as
mine on opensea)
No nested loops. It would work if they were independent. CG depends on both. You can solve with a single loop changing both hull depth and hull angle at every single loop. Be sure to rotate the heel angle around the floating area centroid (not volume centroid). That makes the displacement less dependent of the heel angle change. Make both converge and make the condition to stop when both treshholds are met. One will be more precise than the other (other will meet the treshhold before and continue to converge). To make a very fast convergence use Newton Rapson: solve both at the same time but with a very small diference (small delta similar to the differential), E.g.: . Use one hull angle and another .1 degree larger and a deppth and another 1 mm deeper. Use the diferentials to calculate the next angle and depth.
I solved the keel line curvature to meet the WL and displacement I set using exactly the above described procedure. Instead of angle I use a 2nd degree NURBS curve as the keel curve and change both x and z coordinates of the single NURBS central control point. The hole bottom of the hull is dependent on the keel curve. Making it deeper increase the displacement. bringing the control point backward or forward changes the displacemente center of the hull until it meets the input GC of the boat. It works!