#!/usr/bin/perl
#
# Compute concentration indices for a few simple cases
#
# MWR 3/13/2011

$debug = 1;

$pi = 3.14159;

$start_radius = 0; 
$end_radius = 10.0;
$d_radius = 0.01;
$sum = 0;
$ring_index = 0;
for ($radius = $start_radius; $radius <= $end_radius; $radius += $d_radius) {
 
  if (0 == 1) {
    # constant intensity
    $intensity = 1.0;
  }
  if (0 == 1) {
    # linearly decreasing intensity
    $intensity = 1.0*(  ($end_radius - $radius)/($end_radius) );
  }
  if (1 == 1) {
    # quadratically decreasing intensity
    $I0 = 1.0;
    $core = 1.0;
    $intensity = $I0*(1.0/($radius*$radius + $core*$core));
  }



  $da = 2.0*$pi*$radius*$d_radius;
  $this = $da*$intensity;

  $sum += $this;
  $radius_array[$ring_index] = $radius;
  $intensity_array[$ring_index] = $intensity;
  $ia_array[$ring_index] = $this;
  $sum_array[$ring_index] = $sum;
  $ring_index++;

}


for ($i = 0; $i < $ring_index; $i++) {
  printf " %8d  %9.4e  %9.4e  %9.4e  %9.4e \n", 
          $i, $radius_array[$i], $intensity_array[$i], 
            $ia_array[$i], $sum_array[$i];
}


exit 0;
