Main Page   Compound List   File List   Compound Members   File Members  

MyHeSource.cpp

Go to the documentation of this file.
00001 
00008 #include <math.h>
00009 #include <iostream.h>
00010 #include <fstream.h>   // file I/O
00011 #include <iomanip.h>   // format manipulation
00012 #include <string>
00013 #include "ReactorConstants.hh"
00014 #include "ReactorFortran.hh"
00015 #include "MyHeSource.hh"
00016 
00017 MyHeSource::MyHeSource(int newIsotope,
00018                        double newRmaxgen){
00019 
00020   Isotope = newIsotope;
00021   Rmaxgen = newRmaxgen;
00022 
00023   //cout << "MyHeSource::MyHeSource(" << Isotope << "," << Rmaxgen 
00024   //     << ")" << endl;
00025 
00026   // 8He
00027   if(Isotope == 8){
00028 
00029     // setup the decay parameters (from Jon Link)
00030     // Nneutron is always 1 and Ngamma always 0
00031     Nneutron = 1;
00032     Ngamma = 0;
00033 
00034     // branching fraction (the 1.0000 bin contains all decays 
00035     // which do nothing: neutron E = 0, beta Q = 0)
00036     float static br[4] = {0.080,0.160,0.169,1.0000};
00037 
00038     // Q-value for beta decay
00039     float static betaQ[4] = {7.442,5.252,1.852,0.000};
00040 
00041     // Q-value for the total decay chain
00042     float static totQ;
00043     totQ = 8.619;
00044 
00045     // neutron energy
00046     float static neuE[4] = {0.697,2.887,6.727,0.000};
00047 
00048     // prepare the beta decay functions
00049     bool static first=1;
00050     float static fspace[3][200];
00051 
00052     if(first){
00053       float xlo = 0.;
00054       funlxp_(BetaHighQ,fspace[0],xlo,betaQ[0]);
00055       funlxp_(BetaMiddleQ,fspace[1],xlo,betaQ[1]);
00056       funlxp_(BetaLowQ,fspace[2],xlo,betaQ[2]);
00057 
00058       first = 0;
00059     }
00060     //
00061     // let the 8He decay
00062     //
00063     int ntrial = 0;
00064     bool passed = false;
00065     while(!passed){
00066       const int len=1;
00067       float rv[len];
00068       ranlux_(rv,len);
00069       //
00070       for(int i=0;i<4; i++){
00071         if(rv[0] < br[i] && !passed){
00072 
00073           // pick an energy for each neutron
00074           neutronE = neuE[i];
00075 
00076           if(neutronE){
00077 
00078             // get the energy of the beta
00079             int len2 = 1;
00080             funlux_(fspace[i],betaE,len2);
00081             passed = true;
00082           }
00083         }
00084       }
00085       ntrial++;
00086     }
00087     Weight = 1./float(ntrial);
00088 
00089     //cout << "   8He neutron energy = " << neutronE << " MeV" << endl;
00090     //cout << "   8He beta energy = " << betaE << " MeV" << endl;
00091     //cout << "   8He weight = " << Weight << endl;
00092 
00093     // pick a decay time in ns
00094     double HalfLife = 1.2e8;
00095 
00096     const int len=1;
00097     float rv[len];
00098     ranlux_(rv,len);
00099     DecayTime = HalfLife*log(1/rv[0]);
00100 
00101   } // done with 8He
00102 }
00103 
00104 MyHeSource::~MyHeSource(){
00105   ;
00106 }
00107 
00108 MyHeSource::MyHeSource(const MyHeSource& HeSource){
00109 
00110   Isotope = HeSource.Isotope;
00111   Rmaxgen = HeSource.Rmaxgen;
00112 
00113   Nneutron = HeSource.Nneutron;
00114   Nbeta    = HeSource.Nbeta;
00115   Ngamma   = HeSource.Ngamma;
00116   neutronE = HeSource.neutronE;
00117   betaE    = HeSource.betaE;
00118   gammaE   = HeSource.gammaE;
00119 
00120   Weight = HeSource.Weight;
00121   DecayTime = HeSource.DecayTime;
00122 }    
00123 
00124 MyHeSource& MyHeSource::operator=(const MyHeSource& rhs){
00125 
00126   if(this == &rhs)return *this;
00127 
00128   Isotope = rhs.Isotope;  
00129   Rmaxgen = rhs.Rmaxgen;
00130 
00131   Nneutron = rhs.Nneutron;
00132   Nbeta    = rhs.Nbeta;
00133   Ngamma   = rhs.Ngamma;
00134   neutronE = rhs.neutronE;
00135   betaE    = rhs.betaE;
00136   gammaE   = rhs.gammaE;
00137 
00138   Weight = rhs.Weight;
00139   DecayTime = rhs.DecayTime;
00140 
00141   return *this;
00142 }    
00143 
00144 float MyHeSource::BetaHighQ(float const& x){
00145 
00146   // beta decay function from Hannah and Jon
00147   static double me = MELECTRON;
00148   float beta = 0.;
00149   int A = 8;
00150   int Z = 2;
00151   double Q = 7.442;
00152 
00153   // x -> 0, beta -> 4.222, but Fermi -> inf so don't call it
00154   if(x == 0.)
00155     return 4.222;
00156   else{
00157     beta = sqrt(x*x+2*x*me)*(Q-x)*(Q-x)*(x+me)*Fermi(Z,A,x);
00158     return beta;
00159   }
00160 }
00161 
00162 float MyHeSource::BetaMiddleQ(float const& x){
00163 
00164   // beta decay function from Hannah and Jon
00165   static double me = MELECTRON;
00166   float beta = 0.;
00167   int A = 8;
00168   int Z = 2;
00169   double Q = 5.252;
00170 
00171   // x -> 0, beta -> 1.1565, but Fermi -> inf so don't call it
00172   if(x == 0.)
00173     return 1.1565;
00174   else{
00175     beta = sqrt(x*x+2*x*me)*(Q-x)*(Q-x)*(x+me)*Fermi(Z,A,x);
00176     return beta;
00177   }
00178 }
00179 
00180 float MyHeSource::BetaLowQ(float const& x){
00181 
00182   // beta decay function from Hannah and Jon
00183   static double me = MELECTRON;
00184   float beta = 0.;
00185   int A = 8;
00186   int Z = 2;
00187   double Q = 1.852;
00188 
00189   // x -> 0, beta -> 0.1944, but Fermi -> inf so don't call it
00190   if(x == 0.)
00191     return 0.1944;
00192   else{
00193     beta = sqrt(x*x+2*x*me)*(Q-x)*(Q-x)*(x+me)*Fermi(Z,A,x);
00194     return beta;
00195   }
00196 }
00197 
00198 double MyHeSource::Fermi(int const& Z, int const& A, float const& x){
00199 
00200   // Fermi function for beta decay from Hannah and Jon
00201   static double me    = MELECTRON;
00202   static double alpha = 1./ALPHAINV;
00203   double fermi = 0.;
00204 
00205   double xx = x/me+1.;
00206   double pe = sqrt(xx*xx-1.);
00207   double g0 = 1.-(alpha*Z)*(alpha*Z);
00208   double rnu = alpha*Z*xx/pe;
00209   double r = pow(A,1./3.);
00210 
00211   complex<double> arg(g0,rnu);
00212   complex<double> cg = wgamma_(arg);
00213   double abscgsq = real(conj(cg)*cg);
00214 
00215   fermi = exp(PI*rnu)*abscgsq*pow((pe*r),(2.*(g0-1.)));
00216   return fermi;
00217 }

Generated on Mon Feb 21 16:11:19 2005 for ReactorFsim by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002