Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Stability of Floating Bodies

Run this notebook in your web browser: Open in marimo

The link opens schwimmstabilitaet.py as an interactive marimo notebook that runs entirely in your web browser, without installing anything. Like the Jupyter notebook, the marimo notebook is the original German version of this page.

  1. Wait a moment until Python has loaded in the browser (this takes longer only at the first start).

  2. Click the yellow run button (▶︎, bottom right) to run all cells.

  3. Edit and re-run any code cell to experiment: marimo automatically updates all cells that depend on it.

  4. Your edits remain in the browser tab only. To keep them, save the notebook through the menu (☰, top right) > Export… > Python.

Freeboard and Draft

Parameter definitions:

rho_k =  870. # kg / m3 - wood density
rho_f = 1000. # kg / m3 - water density
g = 9.81      # N / kg - gravitational acceleration
b_x = 1.5     # m - box width
b_y = 2.0     # m - box length
h = 1.5       # m - box height
w = 0.01      # m - wall thickness

Calculation of the weight force Fg=ρk⋅g⋅Vk=ρk⋅g⋅[bx⋅by⋅h−(h−w)⋅(bx−2w)⋅(by−2w)] F_g = \rho_k \cdot g \cdot V_k = \rho_k \cdot g \cdot \left[b_x \cdot b_y \cdot h - \left(h - w\right) \cdot \left(b_x - 2 w\right) \cdot \left(b_y - 2 w\right)\right] :

V_k = b_x * b_y * h - (b_x - 2 * w) * (b_y - 2 * w) * (h - w)
F_g = V_k * rho_k * g
print(f'Body volume V_k = {V_k:.2f} m3\nWeight force: {F_g:.2f} N')
Body volume V_k = 0.13 m3
Weight force: 1141.12 N

Calculation of the displaced volume Vv=Fg/(ρf⋅g) V_v = F_g / \left(\rho_f \cdot g \right) :

V_v = F_g / (rho_f * g)
print(f'Displaced volume: {V_v:.2f} m3')
Displaced volume: 0.12 m3

Calculation of the draft (immersion depth) d=Vv/(bx⋅by) d = V_v / \left(b_x \cdot b_y\right) and the freeboard f=h−d f = h - d :

d = V_v / b_x * b_y
f = h - d
print(f'Draft d = {d:.2f} m\nFreeboard f = {f:.2f} m')
if f >= 0:
    print("The body floats.")
if f < 0:
    print("The body sinks.")
Draft d = 0.16 m
Freeboard f = 1.34 m
The body floats.

Floating Stability

Second Moment of Area

Calculation of the second moment of area I0=bx3⋅by12I_0 = \frac{b_{\text{x}} ^3 \cdot b_{\text{y}} }{12} with respect to 0:

I_0 = b_x**3 * b_y / 12
print(f'Second moment of area I_0 = {I_0:.2f} m4')
Second moment of area I_0 = 0.56 m4

Elevations

Height hgh_g of the center of gravity:

V_k_side_walls = 2 * (b_y - 2 * w) * (h - w) * w
V_k_front_back = 2 * b_x * (h - w) * w
V_k_bottom = b_x * b_y * w
h_g = ((V_k_side_walls + V_k_front_back) * (w + h / 2) + V_k_bottom * w / 2) / V_k
print(f'h_g = {h_g:.2f} m')
h_g = 0.59 m

Height hvh_v of the center of buoyancy:

h_v = d / 2
print(f'Height of the center of buoyancy h_v = {h_v:.2f} m')
Height of the center of buoyancy h_v = 0.08 m

Height difference hgvh_{gv} between the center of gravity and the center of buoyancy:

h_gv = h_g - h_v
print(f'Height difference h_gv = {h_gv:.2f} m')
Height difference h_gv = 0.51 m

Metacentric height hMh_M and floating stability:

h_M = I_0 / V_v - h_gv
print(f'Metacentric height h_M = {h_M:.2f} m')

if h_M > 0:
    print("Stable equilibrium.")
elif h_M < 0:
    print("Unstable equilibrium.")
else:
    print("Neutral equilibrium.")
Metacentric height h_M = 4.32 m
Stable equilibrium.