#include <stdio.h>
#include <stdlib.h>
#include <math.h>

/* compute radii of overpressure field given the effective yield of a
device.  Uses the power-law from the Nuclear Weapons FAQ.  Does not
include thermal or radiation damage to targets.
*/

int main(int argc, char *argv[])
{
	double Y, R, C[]={2.2, 1.0, 0.71, 0.45, 0.28};
	double psi[]={1, 3, 5, 10, 20};
	int i;

	if(argc < 2) {
		printf("usage: %s <YIELD>\n", argv[0]);
		printf("where YIELD is in kilotons\n");
		exit(0);
		}
	Y = atof(argv[1]);

	printf("Radius (km)    Overpressure\n");
	printf("-----------    ------------\n");
	/* compute various Rs */
	for(i=0; i<5; i++) {
		R = pow(Y, 0.333333333) * C[i];
		printf("%11.3f    %8.1f psi\n", R, psi[i]);
		}
}
