# Exercise 1: how much does a bubble grow as it rises? # Boyle's law at constant temperature: P * V = constant (ignoring extra gas that # exsolves into the bubble, which makes the real growth even bigger). P0 = 100.0 # MPa, pressure where the bubble starts, 1 unit of volume for p in (100, 50, 25, 10, 5, 1, 0.1): v = P0 / p r = v ** (1 / 3) # a sphere's radius grows as the cube root of volume print(f"{p:6} MPa volume x{v:7.0f} radius x{r:5.1f}") # 100 MPa volume x 1 radius x 1.0 # 50 MPa volume x 2 radius x 1.3 # 25 MPa volume x 4 radius x 1.6 # 10 MPa volume x 10 radius x 2.2 # 5 MPa volume x 20 radius x 2.7 # 1 MPa volume x 100 radius x 4.6 # 0.1 MPa volume x 1000 radius x 10.0 # Most of the growth happens in the last few MPa, that is, the last few # hundred metres: that is why an eruption accelerates near the surface.