00001
00008 #include <math.h>
00009 #include <iostream.h>
00010 #include <fstream.h>
00011 #include <iomanip.h>
00012 #include <complex>
00013 #include <string>
00014 #include "ReactorConstants.hh"
00015 #include "ReactorFortran.hh"
00016 #include "MyLiSource.hh"
00017
00018 MyLiSource::MyLiSource(int newIsotope,
00019 double newRmaxgen){
00020
00021 Isotope = newIsotope;
00022 Rmaxgen = newRmaxgen;
00023
00024
00025
00026
00027
00028 if(Isotope == 9){
00029
00030
00031
00032 Nneutron = 1;
00033 Ngamma = 0;
00034
00035
00036
00037 float static br[8] = {0.0238,0.3400,0.4400,0.4475,
00038 0.4550,0.4894,0.4950,1.0000};
00039
00040
00041 float static betaQ[8] = {11.176,11.176,10.826,5.666,
00042 5.666,2.323,2.323,0.000};
00043
00044
00045 float static totQ = 12.033;
00046
00047
00048 float static neuE[8] = {0.764,0.856,1.115,3.235,
00049 5.473,8.816,6.578,0.000};
00050
00051
00052 bool static first=1;
00053 float static fspace[7][200];
00054
00055 if(first){
00056 float xlo = 0.;
00057 funlxp_(BetaHighestQ,fspace[0],xlo,betaQ[0]);
00058 funlxp_(BetaHighestQ,fspace[1],xlo,betaQ[1]);
00059 funlxp_(BetaHighQ,fspace[2],xlo,betaQ[2]);
00060 funlxp_(BetaMiddleQ,fspace[3],xlo,betaQ[3]);
00061 funlxp_(BetaMiddleQ,fspace[4],xlo,betaQ[4]);
00062 funlxp_(BetaLowQ,fspace[5],xlo,betaQ[5]);
00063 funlxp_(BetaLowQ,fspace[6],xlo,betaQ[6]);
00064
00065 first = 0;
00066 }
00067
00068
00069
00070 int ntrial = 0;
00071 bool passed = false;
00072 while(!passed){
00073 const int len=1;
00074 float rv[len];
00075 ranlux_(rv,len);
00076
00077 for(int i=0;i<8; i++){
00078 if(rv[0] < br[i] && !passed){
00079
00080
00081 neutronE = neuE[i];
00082
00083 if(neutronE){
00084
00085
00086 int len2 = 1;
00087 funlux_(fspace[i],betaE,len2);
00088 passed = true;
00089 }
00090 }
00091 }
00092 ntrial++;
00093 }
00094 Weight = 1./float(ntrial);
00095
00096
00097
00098
00099
00100
00101 double HalfLife = 1.8e8;
00102
00103 const int len=1;
00104 float rv[len];
00105 ranlux_(rv,len);
00106 DecayTime = HalfLife*log(1/rv[0]);
00107
00108 }
00109 }
00110
00111 MyLiSource::~MyLiSource(){
00112 ;
00113 }
00114
00115 MyLiSource::MyLiSource(const MyLiSource& LiSource){
00116
00117 Isotope = LiSource.Isotope;
00118 Rmaxgen = LiSource.Rmaxgen;
00119
00120 Nneutron = LiSource.Nneutron;
00121 Nbeta = LiSource.Nbeta;
00122 Ngamma = LiSource.Ngamma;
00123 neutronE = LiSource.neutronE;
00124 betaE = LiSource.betaE;
00125 gammaE = LiSource.gammaE;
00126
00127 Weight = LiSource.Weight;
00128 DecayTime = LiSource.DecayTime;
00129 }
00130
00131
00132 MyLiSource& MyLiSource::operator=(const MyLiSource& rhs){
00133
00134 if(this == &rhs)return *this;
00135
00136 Isotope = rhs.Isotope;
00137 Rmaxgen = rhs.Rmaxgen;
00138
00139 Nneutron = rhs.Nneutron;
00140 Nbeta = rhs.Nbeta;
00141 Ngamma = rhs.Ngamma;
00142 neutronE = rhs.neutronE;
00143 betaE = rhs.betaE;
00144 gammaE = rhs.gammaE;
00145
00146 Weight = rhs.Weight;
00147 DecayTime = rhs.DecayTime;
00148
00149 return *this;
00150 }
00151
00152 float MyLiSource::BetaHighestQ(float const& x){
00153
00154
00155 static double me = MELECTRON;
00156 float beta = 0.;
00157 int A = 9;
00158 int Z = 3;
00159 double Q = 11.176;
00160
00161
00162 if(x == 0.)
00163 return 4.5;
00164 else{
00165 beta = sqrt(x*x+2*x*me)*(Q-x)*(Q-x)*(x+me)*Fermi(Z,A,x);
00166 return beta;
00167 }
00168 }
00169
00170 float MyLiSource::BetaHighQ(float const& x){
00171
00172
00173 static double me = MELECTRON;
00174 float beta = 0.;
00175 int A = 9;
00176 int Z = 3;
00177 double Q = 10.826;
00178
00179
00180 if(x == 0.)
00181 return 4.222;
00182 else{
00183 beta = sqrt(x*x+2*x*me)*(Q-x)*(Q-x)*(x+me)*Fermi(Z,A,x);
00184 return beta;
00185 }
00186 }
00187
00188 float MyLiSource::BetaMiddleQ(float const& x){
00189
00190
00191 static double me = MELECTRON;
00192 float beta = 0.;
00193 int A = 9;
00194 int Z = 3;
00195 double Q = 5.666;
00196
00197
00198 if(x == 0.)
00199 return 1.1565;
00200 else{
00201 beta = sqrt(x*x+2*x*me)*(Q-x)*(Q-x)*(x+me)*Fermi(Z,A,x);
00202 return beta;
00203 }
00204 }
00205
00206 float MyLiSource::BetaLowQ(float const& x){
00207
00208
00209 static double me = MELECTRON;
00210 float beta = 0.;
00211 int A = 9;
00212 int Z = 3;
00213 double Q = 2.323;
00214
00215
00216 if(x == 0.)
00217 return 0.1944;
00218 else{
00219 beta = sqrt(x*x+2*x*me)*(Q-x)*(Q-x)*(x+me)*Fermi(Z,A,x);
00220 return beta;
00221 }
00222 }
00223
00224 double MyLiSource::Fermi(int const& Z, int const& A, float const& x){
00225
00226
00227 static double me = MELECTRON;
00228 static double alpha = 1./ALPHAINV;
00229 double fermi = 0.;
00230
00231 double xx = x/me+1.;
00232 double pe = sqrt(xx*xx-1.);
00233 double g0 = 1.-(alpha*Z)*(alpha*Z);
00234 double rnu = alpha*Z*xx/pe;
00235 double r = pow(A,1./3.);
00236
00237 complex<double> arg(g0,rnu);
00238 complex<double> cg = wgamma_(arg);
00239 double abscgsq = real(conj(cg)*cg);
00240
00241 fermi = exp(PI*rnu)*abscgsq*pow((pe*r),(2.*(g0-1.)));
00242 return fermi;
00243 }