If you peruse through old copies of BYTE Magazine (archive.org), sometimes you can find an oddity. I was looking through some today, and in the December 1986 issue (p.143) there is a very interesting article – “Local Effects of Nuclear Weapons“, by John R. Fanchi. The article talked about how to calculate the effects of a nuclear blast, and provide some programs written in BASIC. Weird you say? Well consider the context, the Cold War was still going on, and people were starting to have home computers, programming in BASIC on them, so it’s not that weird really. Nobody thought that the USSR would basically collapse in five years time, and the early 1980s were full of apocalyptic movies: War Games (1983), The Day After (1983). But it was also the decade that heralded the birth of video games, punk fashion, and dance music, so go figure.
The article provides two programs, one to calculate detonation effects, such as thermal flux, overpressure, EMP range, and radiation dosage, and another to calculate nuclear fallout. These articles were always well written, and researched and included the relevant math. It’s interesting because we don’t see these sort of coding articles anymore.
Anyway, for those interested, I have translated the code to Fortran. many of these programs were fairly basic: lots of input variables, a bunch of calculations, and a loop or two and decisions.
! Falout - A nuclear fallout calc program
! Written by: John R. Fanchi, July 1985 in BASIC
program falout
real :: y, d
real :: vpar, dpar, vtrans, dtrans, rems
real :: alpha, beta, gamma, tfac, facmax
real :: tym, facper, facpar, disper, dispar
real :: factor, coef, effrem, norm, tymhrs
integer :: i
write(*,*) 'Falout - Estimating the Distribution of Nuclear Fallout'
write(*,*) 'Estimating radiation dosage'
write(*,*) 'Enter the yield of the nuclear blast in megatons: '
read(*,*) y
write(*,*) 'Enter your distance from the blast in miles: '
read(*,*) d
rems = 250*(1000*y)/(16*3.1416*d*d)
write(*,*) 'Estimated radiation dosage in rems: ', rems
write(*,*) 'Estimating fallout distribution'
write(*,*) 'The distribution of fallout is treated as a'
write(*,*) 'random walk process similar to Brownian motion.'
write(*,*) 'Enter the line-of-sight wind speed (mph): '
read(*,*) vpar
vpar = vapr * 24.0
write(*,*) 'Enter the line-of-sight dispersion (sq miles/day): '
read(*,*) dpar
write(*,*) 'Enter the tranverse wind speed (mph): '
read(*,*) vtrans
vtrans = vtrans * 24.0
write(*,*) 'Enter the transverse dispersion (sq miles/day): '
read(*,*) dtrans
write(*,*) 'Radiation dosage at your location as a function of time'
write(*,*) ' Days Rems Norm Hrs '
alpha = d*d/(4*dpar)
beta = -2.0*d*vpar/(4.0*dpar)
gamma = vpar*vpar/(4.0*dpar)+vtrans*vtrans/(4.0*dtrans)
tfac = sqrt(1.0+4.0*alpha*gamma)
tymmax = (1.0+tfac)/(2.0*gamma)
facmax = ((d-vpartymmax)**2.0)/(4.0*dpar*tymmax)
facmax = facmax+vtrans*vtrans*tymmax/(4.0*dtrans)
do i = 1,20
tym = tymmax*(1.0-0.02*(10.0-i))
facpar = 0.0
facper = 0.0
dispar = d-vpar*tym
disper = vtrans*tym
facpar = dispar * dispar/(4.0*dpar*tym)
if (dtrans /= 0.0) then
facper = disper*disper/(4.0*dtrans*tym)
end if
factor = facpar+facper
coef = tymmax/tym
effrem = rems*coef*exp(facmax-factor)
norm = effrem/rems
tymhrs = tym*24.0
write(*,10) tym, effrem, norm, tymhrs
end do
10 format(f8.2,f8.2,f8.2,f8.2)
end program