# Blog

Viewing posts for the category Featured on frontpage

## Simulating two-dimensional polycrystals

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.

## Breeding tritium for a fusion reactor

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.

## Diffusion on the surface of a torus

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.

## Non-linear least squares fitting of a two-dimensional data

The scipy.optimize.curve_fit routine can be used to fit two-dimensional data, but the fitted data (the ydata argument) must be repacked as a one-dimensional array first. The independent variable (the xdata argument) must then be an array of shape (2,M) where M is the total number of data points.

## ExB drift for an arbitrary electric potential

As described in the previous blog post charged particle moving in crossed constant magnetic and electric fields exhibits a drift velocity, $(\boldsymbol{E}\times\boldsymbol{B})/B^2$, perpendicular to both $\boldsymbol{E}$ and $\boldsymbol{B}$. The particle's trajectory in this situation can be found analytically. For an arbitrary $\boldsymbol{E}$, some kind of numerical integration of the equation of motion is usually necessary, but the force that the particle experiences at an instant is perpendicular to to the electric field and the particle therefore undergoes its gyromotion along an isocontour of electrostatic potential, $V$ (since $\boldsymbol{E} = -\nabla V$).