The Big Squish Theory - Part I
Subtitle: Physics of Catastrophic Underwater Implosions
Pressure pushing down on me
Pressing down on you, no man ask for
Under pressure that burns a building down
- Under Pressure, Queen, David Bowie
# Under Pressure
Imagine you’re Captain Nemo and you submerge a bubble of air 20,000 leagues under the sea. How much pressure would the bubble of air be under?
Well, there are a couple of problems with this. First, what’s a league? It’s a unit of length, but depending on where you are it can vary from 1280.16 meters (in Myanmar) to 11,295 meters (in Norway). Using the conversion of 1 league = 4 kilometers that Jules Verne wrote about (in France), you’d be 80,000 km under the surface of the ocean, but the Earth’s diameter is 12,735 km so that puts you 67,265 km out in space on the other side of the world.
Verne meant that Captain Nemo and the Nautilus traveled 20,000 leagues in distance under the sea. Let’s choose a Titanic depth of 3800 meters. Imagine a cubic meter box filled with water. From Fermi Problems Predict the Future the mass of a cubic meter of water is 1000 kg or one metric ton, so 1000 kg would be spread out evenly over the bottom of the cube, meaning there would be . If you stacked a second cube on top of the first, it would double to . At a depth of 3800 meters, the mass is (3.8 million!).
Pressure is the force per unit area, and to get the force we need an acceleration term since . The acceleration here is due to gravity, . Multiplying the mass per unit area times the gravitational acceleration constant gives
where is the pressure, is density and is the height of the column of water above us.
If you prefer pressure in psi (pounds per square inch), at the Titanic the pressure is about 5400 psi, or about the weight of two small cars on every square inch. It’s impossible to imagine that kind of pressure, but without actually experiencing it, suppose your foot got run over by a small car. The contact area of a tire with the ground is about 25 square inches, and if we make the weight of the car 2800 lbs, then the one tire running over your foot would only be supporting 700 lbs. Spread that out over 25 square inches, and you’d feel 28 psi.
Your foot would be painfully squished, but nothing like what you’d feel dipping your toes in at the Titanic.
# Assume a Spherical Cow
In physics, there’s a joke that starts, “Assume a spherical cow”. The idea behind the spherical cow is that you should reduce assumptions to the minimum that allow the problem to still make sense, but also make it easy to solve.
So, let’s assume a spherical bubble of air that we can somehow magically transport 3800 meters under the sea while maintaining standard atmospheric pressure typical at the surface. A spherical bubble is perfect because the pressure at the edge will be the same everywhere and a sphere is the best shape to counter that pressure. Now, let’s say that whatever container you used to get the bubble down to the bottom instantly disappears. What happens to the bubble?
Does the water just rush right in? The pressure of the air in the bubble is the same as at sea level, or 14.7 psi = . The water pressure is 366.3 times the air pressure. If you could measure the pressure instantaneously at the surface of the bubble, it would rise very rapidly to equal the pressure of the water, creating a shock wave inwards.
# The Ideal Gas Law
In 1834 Benoît Paul Émile Clapeyron published the ideal gas law
where and are pressure, volume, and temperature as related to the quantity of gas and the ideal gas constant , which is the product of the Boltzmann constant (see Economics and the Stefan Boltzmann Law) and the Avogadro constant. Since the quantity of the gas is in moles, it can be written as
where is the mass in and is the molar mass. Using the specific gas constant converts the equation to
For air, the specific gas constant is .
Since we know the initial air pressure of the bubble and the pressure of the surrounding water, we can estimate the conditions of the air when the pressure is the same as the water pressure. But, the equation is in terms of the volume, and the temperature, . There are two unknowns and only one equation.
A way around this is to make another spherical cow assumption, which is that the compression process is isentropic, meaning that no heat escapes into the surrounding water and that the compression could be completely reversed to the initial conditions. The compression is also called adiabatic because the process happens so quickly that no heat is transferred. If you could push the boundaries of your bubble back to the original position, the temperature would cool back to where it was.
Under this assumption, the volumes and temperatures before and after compression can be related to the ratio of the pressures.
Let be the initial (atmospheric) pressure and be the pressure of the water. Then the volume and temperature of an ideal gas after compression would be
where is the heat capacity ratio which is 1.4 for air. The ratio of the water pressure to the air pressure is
so the ratio of the volumes is
and the temperature ratio is
Under ideal conditions, if the initial temperature was then the final temperature would be , or . Notice that the final volume is compressed to just under 1.5% of the original volume.
The Ideal Gas Law gives a “before” and “after” picture of conditions in the bubble of air, but we’ll need more powerful tools to see the evolving dynamics of The Big Squish.
# The Wolfram Language
Wolfram Mathematica is a symbolic mathematical computation program used in scientific, engineering, mathematical, and computing fields. It is based on the Wolfram Language, a knowledge-based symbolic language. Mathematica is used in areas that require mathematics, such as science, engineering, and finance.
Mathematica was conceived by Stephen Wolfram and is developed by Wolfram Research of Champaign, Illinois. Mathematica 1.0 was released on June 23, 1988. While the Mathematica interface costs several hundred dollars per year, you can get the computational engine for free!
You’ll need to install Anaconda because the Wolfram Language runs in a JupyterLab notebook. Rather than giving all of the installation details here, I recommend reading Nicolás Guarín-Zapata’s blog, “Using Wolfram Language in Jupyter: A free alternative to Mathematica”.
After installing everything, launch the Anaconda Navigator and click on the “Launch” button under JupyterLab. This will open a new tab in your browser that will look something like this:
Click on the Wolfram Language icon under “Notebook” to start a new Wolfram notebook.
# Partial Differential Equations
Partial Differential Equations (PDEs) are equations that involve partial derivatives of an unknown function with several independent variables. They describe various physical phenomena involving functions of more than one variable.
The PDEs we’ll discuss here (in order of increasing complexity) to model The Big Squish are:
- Wave equation: Describes the propagation of waves, such as sound or light waves. This relates the second partial derivatives of the function with respect to time and space. The parameter determines the wave speed.
- Burgers’ equation: Models fluid dynamics and shock waves. The 1D Burgers’ equation is . The nonlinear term represents convection, while the term represents diffusion.
- Euler equations: Describe the motion of an inviscid fluid. These are a set of quasi-linear PDEs that conserve mass, momentum, and energy. For 3D flows, there are four PDEs with four dependent variables (density, velocity components, pressure).
The Navier-Stokes equations describe the motion of viscous fluid substances. They are derived by applying Newton’s second law to fluid motion, together with the assumption that the stress in the fluid is the sum of a diffusing viscous term and a pressure term. This yields a set of nonlinear partial differential equations that conserve momentum.
For incompressible flow, the equations can be written as:
where is the fluid velocity, is pressure, is density, and is the kinematic viscosity.
The term represents convection, represents pressure forces, and represents diffusion. The equations are coupled with the mass continuity equation for incompressible flow:
Solving the Navier-Stokes equations for turbulent flows and complex geometries is very difficult and remains an active area of research. They are considered one of the most important unsolved problems in classical physics. The Navier-Stokes equations are beyond what we’ll be discussing here, and in fact, we’ll see that the Wolfram Language isn’t capable of handling the conditions of The Big Squish Theory.
So in summary, PDEs are ubiquitous tools for modeling many physical systems across science and engineering disciplines. The particular form of a PDE reveals insight into the underlying physics.
Using the Wolfram Language we’ll examine the wave equation, Burgers’ equation and the Euler equations (follow links to download JupyterLab notebooks). Euler’s gives the best representation of conditions as the bubble of air rapidly compresses.
# The Wave Equation
The wave equation gives the height of the wave as a function of the position along the axis and time . The one-dimensional PDE
says that the acceleration of a particle of fluid is proportional to its displacement relative to neighboring particles. (See The mathematics of PDEs and the wave equation by Michael P. Lamoureaux). This equation can be written as
The general solution to the wave equation is
where and are any functions of a single variable. Think of and as the outline of the wave and these outlines move left () and right () from their starting positions with velocity . This is an example of a wave where :
It looks like the wave is moving from the left to the right, but any point on the wave just moves up and down. Watch the dot on the left side as it moves along the red line. From Newton’s second law, , the term describes the vertical acceleration (using ) because it’s the second derivative of position with respect to time.
The term measures the steepness of the wave at any point and says that the steeper the wave, the faster it’s accelerating. This is derived from Hooke’s Law which says that the force of a spring scales linearly with how far it’s been stretched. It helps to think of the wave as a plucked guitar string. The points where the wave is steepest are also the points where the guitar string has been stretched the most.
# Solving the Wave Equation with the Wolfram Language
One of the nice things about using the Wolfram Language to solve problems like the wave, Burgers’, or Euler equations is that the code looks very similar to the math equations. The syntax isn’t exactly the same, though, so I found it useful to ask ChatGPT and Google Bard for help writing the code. The steps used in solving any of these wave-like equations are:
- Define any necessary parameters
- Input the PDE
- Set initial and boundary conditions, and combine them with the PDE
- Solve the system with the Wolfram Language function
NDSolve
- Plot the result
For the wave equation, the parameters needed are the wave speed the domain, and the time interval of the simulation.
c = 1;
t0 = 0;
tf = 4 Pi;
x0 = 0;
xf = Pi;
The definition of the wave equation requires two partial derivatives which in Mathematica are of the form D[u[x, t], {t, 2}]
for . The complete wave equation is
waveEquation = D[u[x, t], {t, 2}] - c^2*D[u[x, t], {x, 2}] == 0;
The initial and boundary equations are
initialCondition = u[x, 0] == Sin[x];
initialVelocityCondition = Derivative[0, 1][u][x, 0] == 0;
boundaryConditions = {
u[x0, t] == 0,
u[xf, t] == 0
};
For convenience, we can combine the equations into a single variable,
waveEqnWithICs = {waveEquation, initialCondition, initialVelocityCondition, boundaryConditions};
Even though it’s possible to solve the wave equation analytically, we’ll use a numerical solver in Mathematica,
sol = NDSolve[waveEqnWithICs, u, {x, x0, xf}, {t, t0, tf}];
and then plot the wave against and .
You can also show the wave in motion using
frames = Table[
Plot[Evaluate[u[x, t] /. sol], {x, x0, xf}, PlotRange -> {-1, 1},
AxesLabel -> {"x", "u(x, t)"}, PlotLabel -> Row[{"t = ", t}]], {t, t0, tf, 0.1}];
animation = ListAnimate[frames];
animation
This version of the wave equation simulates a plucked string where the ends of the string are fixed. This is done by setting the boundary conditions at the endpoints to for all times. To generate a traveling wave like the one shown above, you’ll need to rewrite the boundary conditions.
# Burgers’ Equation
Shocks are related to waves, and the PDE describing them is called Burgers’ Equation,
Burgers’ is a simplification of the Navier-Stokes equations. Provide a proof of Navier-Stokes and the Clay Mathematics Institute will award you one million dollars!
The term is the vertical velocity of a wave particle since it has just one time derivative. The derivative with respect to , gives the slope, and multiplying it by the height of the function induces the shock:
This is a 2D simulation of Burgers’ Equation in two dimensions where you can see the shock “pile up” as the wave moves.
This form is the simplest version of Burgers’ where the sum of the terms is zero, which is the case for an inviscid fluid which happens when two adjacent layers of the fluid can slip past each other without friction.
In most cases, PDEs can only be solved numerically. To do this, a grid is constructed in the plane, and is solved for each time step over every square of the grid. The simulation improves with finer grids and shorter time steps, but the computational cost can be very high. Machine learning has helped reduce the grid density by discovering properties of the problem that reduce the complexity. Here’s an example of Burgers’ using only 16 points:
For the Mathematica version of Burgers’ equation, I used a hyperbolic tangent function for the initial condition,
because it gave a smooth transition across the boundary at . Mathematica generated a warning message,
NDSolve::eerr: Warning: scaled local spatial error estimate of 6047.74 at t = 1. in the direction of independent variable x is much greater than the prescribed error tolerance. Grid spacing with 2001 points may be too large to achieve the desired accuracy or precision. A singularity may have formed or a smaller grid spacing can be specified using the MaxStepSize or MinPoints method options.
but created a plot anyway.
Numerically, the solution becomes unstable fairly quickly when the shock forms. Better solutions are in the post Solving Burger’s equation with NDSolve at large time on the Mathematica and Wolfram Language Stack Exchange forum.
# Euler Equations
The Euler equations extend Burgers’ by including conservation of mass, momentum, and energy. They describe the conditions at the boundary of the interface between the water and air inside the bubble,
where is density, is velocity, is specific internal energy, and pressure is given by
and are valid for an adiabatic, inviscid fluid. Adiabatic flow means that there is no energy transferred in or out of the volume, and an inviscid fluid has no friction between layers of the fluid that are slipping past each other. Another way to describe this is that no shear forces act on the fluid. The adiabatic assumption is quite reasonable for the very short period the bubble is compressed, and fluids like water and air behave sufficiently like an inviscid fluid that the Euler equations hold.
The top equation is for conservation of mass,
which says that the change in density over time is exactly compensated by the density of a small volume of fluid moving with velocity (along the axis). It is also known as the continuity equation.
Momentum is the product of mass and velocity, and momentum is conserved in a closed fluid system,
For a unit volume of fluid, the mass is the density times the volume, so is momentum and is the rate of change of momentum. As with the conservation of mass equation, is the rate of change of momentum due to the motion of the fluid. These two terms must be balanced by the change in momentum due to the pressure gradient .
A pressure gradient means that the pressure on one side of a small volume of fluid is different from the pressure on the opposite side. The side with higher pressure will cause the small bit of fluid to accelerate away which increases the momentum. The greater the pressure gradient, the greater the momentum gain.
The final equation describes the energy of the fluid,
This form of the energy equation assumes no heat dissipation or transfer which is reasonable for the sudden compression experienced by a bubble of air at 3800 meters below the surface. The first term is the rate of change of energy with time, and the second is the change of energy due to the movement of the fluid.
The total energy of a small volume of fluid is derived from several sources:
- Internal energy: The internal energy of a fluid is the energy that is stored in the fluid due to the motion of its molecules. It is a function of the temperature and pressure of the fluid.
- Kinetic energy: The kinetic energy of a fluid is the energy that is stored in the fluid due to its motion. It is a function of the fluid velocity.
- Work done by pressure forces: The work done by pressure forces is the work that is done by the pressure of the fluid on the walls of the container that it is in. This work is used to increase the internal energy of the fluid.
- Heat transfer: Heat transfer is the transfer of energy from one point to another due to a temperature difference. Heat transfer can occur between the fluid and the walls of the container that it is in, or it can occur between different parts of the fluid.
- Dissipation: Dissipation is the loss of energy due to friction. Friction occurs when two surfaces rub against each other. In a fluid, friction occurs between the fluid molecules and the walls of the container that the fluid is in.
For air at sea level and water at a depth of 3800 meters, the values of the variables are
- NOAA How does the temperature of ocean water vary?
- Mac Instruments What Is the Density of Air at STP?
- Stack Exchange Why use different specific heat capacities in the energy equations for incompressible and compressible fluid flow?
- IAPWS (water) Thermodynamic Properties of Ordinary Water Substance for General and Scientific Use
- Engineering Toolbox (air) Ideal gas properties of air at low pressure - SI units.
- BYJU’s (water) What is R for water?
- Engineering Toolbox (air) The Universal and Individual Gas Constants in fluid mechanics and thermodynamics.
The specific energy of water is derived from the IAPWS Main Thermodynamics Formulations using a density of and a temperature of . At depths of water compresses by about
The equation for pressure, includes the heat capacity ratio , which for water is . This would make the pressure zero, but since we know the pressure, density, and specific energy, we can calculate the heat capacity ratio for water at the initial conditions. The velocity is zero which simplifies the pressure equation to
Since the units give pressure in , we need to divide the pressure by . For the initial conditions of water, this works out to
Using these conditions in Mathematica gave this error message:
-7
NDSolve::ndsz: At t == 6.9232 10 , step size is effectively zero; singularity or stiff system suspected.
The code generated a plot, but it ended at time step .
A stiff system is one where conditions change very rapidly, which is what we might expect with very high-pressure water rushing into a bubble of standard atmospheric pressure air. Even with somewhat better conditions, you have to be careful about handling stiff problems. A question on the Mathematica Stack Exchange asked about accurately solving the 1-D Euler equations using NDSolve, which was answered by adding a viscosity term to the equations. The plots of density, energy, and velocity looked like this:
This didn’t work for our Big Squish problem, but Mathematica wasn’t meant to be used for this kind of problem. Instead, we need specialized code that can handle stiff problems which will be the subject of the next post.
# Test Functions
Test functions are a fundamental concept for solving partial differential equations (PDEs). They play a crucial role in variational formulations of PDEs, helping to transform differential equations into a system of algebraic equations that can be solved numerically.
The basic idea behind test functions is to multiply both sides of a PDE with a smooth function and then integrate over the domain. This leads to the weak or variational formulation of the problem, which is often more suitable for numerical approximation. For Burgers’ equation,
the weak form is found by multiplying through by the test function and integrating,
Using this trick leads to an approximate numerical solution to the original “strong form” of Burgers’ equation.
The same process can be used to find a numerical solution to Euler’s equations. In Mathematica, the code to generate a weak form is
testFunctions = {rho[x, t], v[x, t], e[x, t]};
weightedEulerEqs = MapThread[Equal, {eulerEqs, testFunctions}];
weightedEulersEqnWithICsBCs = {weightedEulerEqs, initConds, boundaryConds};
Test functions sometimes help with stiff problems, and often code designed for solving computational fluid dynamics problems requires that the problem be rewritten using a test function.
Even though Mathematica wasn’t able to solve The Big Squish Theory problem, hopefully, you’ll find many more uses for Mathematica and we’ll get to the bottom of this pressing problem next time.
After playing lead guitar in Queen, Brian May earned a Ph.D. in astrophysics. Here, he contemplates another spherical problem.
# References
- 1D Euler equations (fluid dynamics) with NDSolve
- Korteweg–De Vries equation
- Burgers Equation
- Burgers’ equation (clawpack)
- Note on One Dimensional Burgers Equation
- Numerical solutions of the Burgers’ equation by the least-squares quadratic B-spline finite element method
- Notes on Burgers’ Equation
- Solution of Burgers equation with some initial data
- Discontinuous Galerkin Methods for Computational Fluid Dynamics
- One Dimensional Euler’s Equations of Gas Dynamics
- The Euler Equation of Gas-Dynamics
- Compressible Euler Equations (Theoretical Physics Reference)
- Euler equations (fluid dynamics)
- An Overview of Euler’s Equations in Fluid Dynamics
- 1D Euler equations (fluid dynamics) with NDSolve
- Fluid dynamics collapse 1D Euler equations with NDSolve
- Wolfram Language & System Documentation Center
- Wolfram Language & System Language Overview
- Stiffness Detection (Mathematica)
- “StiffnessSwitching” Method for NDSolve
- Using Wolfram Language in Jupyter: A free alternative to Mathematica
- Codeium in Jupyter Notebooks