//-----------------------------------------------------------------------------
//
//  Peter Richter (prichter@princeton.edu)
//  Princeton Plasma Physics Laboratory
//  August 2000
//
//  testpreact.cpp - Test driver for PREACT module.
//
//-----------------------------------------------------------------------------

#include <iostream>

#include "preact/cxreaction.h"
#include "preact/iireaction.h"
#include "preact/fsreaction.h"

using namespace std ;

int main()
{
  const int n = 1;
  fp_64 f[n], x[] = { 10 }, y[] = { 10 }, z[] = { 0 };

  cout << "Initializing reactions..." << endl;
  CXReaction hcx("H->H(cx)");
  IIReaction hii("H->H(ii)");
  FSReaction ddn("D->D(n)");

  cout << "\n***** Charge exchange: H->H(cx) *************************\n"
       << endl;
  cout << "sigma, at E=10 keV/A:                                        "
       << hcx.sigma(x[0]) << " m^2" << endl;
  cout << "vrel, at E=10 keV/A:                                         "
       << hcx.vrel(x[0]) << " m/s" << endl;
  hcx.coldTarget_sigmaTimesV(x, f, n);
  cout << "sigma*v (cold target), at E=10 keV/A:                        "
       << f[0] << " m^3/s" << endl;
  hcx.warmTarget_sigmaTimesV(x, y, f, n);
  cout << "<sigma*v> (warm target), at E=10 keV/A, T=10 keV/A:          "
       << f[0] << " m^3/s" << endl;
  hcx.energyAvg_perAMU(x, y, f, n);
  cout << "<E/A> of target reagent, at E=10 keV/A, T=10 keV/A:          "
       << f[0] << " keV/A" << endl;
  hcx.average_vDotNorm(x, y, f, n);
  cout << "<Vb dot Vtarg / |Vb|*|Vth|>, at E=10 keV/A, T=10 keV/A:      "
       << f[0] << endl;

  cout << "\n***** Ionization: H->H(ii) ******************************\n"
       << endl;
  cout << "sigma, at E=10 keV/A:                                        "
       << hii.sigma(x[0]) << " m^2" << endl;
  cout << "vrel, at E=10 keV/A:                                         "
       << hii.vrel(x[0]) << " m/s" << endl;
  hii.coldTarget_sigmaTimesV(x, f, n);
  cout << "sigma*v (cold target), at E=10 keV/A:                        "
       << f[0] << " m^3/s" << endl;
  hii.warmTarget_sigmaTimesV(x, y, f, n);
  cout << "<sigma*v> (warm target), at E=10 keV/A, T=10 keV/A:          "
       << f[0] << " m^3/s" << endl;

  cout << "\n***** Fusion: D->D(n) ***********************************\n"
       << endl;
  cout << "sigma, at E=10 keV:                                          "
       << ddn.sigma(x[0]) << " m^2" << endl;
  cout << "vrel, at E=10 keV:                                           "
       << ddn.vrel(x[0]) << " m/s" << endl;
  ddn.coldTarget_sigmaTimesV(x, f, n);
  cout << "sigma*v (cold target), at E=10 keV:                          "
       << f[0] << " m^3/s" << endl;
  ddn.warmTarget_sigmaTimesV(x, y, f, n);
  cout << "<sigma*v> (warm target), at E=10 keV, T=10 keV:              "
       << f[0] << " m^3/s" << endl;
  ddn.thermonuclear_sigmaTimesV(x, f, n);
  cout << "<<sigma*v>> thermonuclear, at T=10 keV:                      "
       << f[0] << " m^3/s" << endl;
  ddn.gyroAvg_sigmaTimesV(x, z, f, n);
  cout << "<sigma*v> gyro average, at E=10 keV, no energy var:          "
       << f[0] << " m^3/s" << endl;

  cout << "\nTest driver terminated successfully." << endl;
}

//-----------------------------------------------------------------------------
