The free-surface effect
A simulation of the free-surface effect, which can lead to a ship carrying a liquid cargo to capsize where the same ship carrying the same mass of solid cargo will float upright.
18 posts on simulation. All posts · RSS feed
A simulation of the free-surface effect, which can lead to a ship carrying a liquid cargo to capsize where the same ship carrying the same mass of solid cargo will float upright.
The Kawasaki dynamics formalism from statistical physics provides a simple model of a phase change (for example, the condensation of a gas at low enough temperature). Considering a gas of particles on a two-dimensional lattice of cells, a given configuration's energy can be calculated as …
Icebergs in adverts stand tall on a narrow point, but a real one would tip over onto its side. This short Python script models a two-dimensional iceberg under its weight and buoyancy, animates the forces as it rolls into its stable orientation, and explains why …
This previous post introduced a simple molecular dynamics simulation for the equilibration of the speeds of the particles of an ideal gas. The present post extends the code a little to model the effusion of an ideal gas through a small hole into a vacuum.
Langton's ant is a two-dimensional cellular automaton usually implemented on a square grid in which each cell has one of two states (white or black). The ant moves according to the simple rules: (1) on a white square turn 90° clockwise flip the square to …
This script demonstrates the relaxation of an ensemble of colliding particles towards the equilibrium, Maxwell-Boltzmann distribution of their speeds. Unlike this previous post, the collision detection and dynamics are handled using NumPy arrays without explicit python loops (except over collision pairs), which improves the performance …
This code continues the previous blog post on two-dimensional collisions to model Brownian motion. The code is on my GitHub page. The core classes, PeriodicParticle and PeriodicSimulation are derived from the original Particle and Simulation classes to allow periodic boundary conditions: instead of bouncing off …
This small Python project is a physical simulation of two-dimensional physics. The animation is carried out using Matplotlib's FuncAnimation method and is implemented by the class Simulation. Each "particle" of the simulation is represented by an instance of the Particle class and depicted as a …
The following code simulates (very approximately) the growth of a polycrystal from a number of seeds. Atoms are added to the crystal lattice of each of the resulting grains until no more will fit, creating realistic-looking boundaries where two grains meet. Two sorts of lattice …
The population dynamics simulation known as Wa-Tor was described in a previous post. When carried out on a grid with periodic boundary conditions, the Wa-Tor "universe" is topologically equivalent to a torus, as depicted below using the code provided here.