A blog of Python-related topics and code.
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.
The most feasible nuclear reaction for a "first-generation" fusion reaction is the one involving deuterium (D) and tritium (T): $$ \mathrm{D} + \mathrm{T} \rightarrow \alpha (3.5\;\mathrm{MeV}) + n (14.1\;\mathrm{MeV}) $$ Tritium is not a primary fuel and does not exist in significant quantities naturally since it decays with a half life of 12.3 years. It therefore has to be "bred" from a separate nuclear reaction. Most fusion reactor design concepts employ a lithium "blanket" surrounding the reaction vessel which absorbs the energetic fusion neutrons to produce tritium in such a reaction.
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.
An example in Chapter 7 of the scipython book describes the numerical solution of the two-dimensional heat equation for a flat plate with edges held at a fixed temperature.
The code below, torus.py
, defines a class Torus
for drawing an SVG image of a torus. The Torus
class itself is a subclass of Shape
, a more general class for depicting 3D objects in an SVG image, defined in shape.py
. A usage example is given in the code of draw_torus.py
, which creates this image: