1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-26 20:18:51 -05:00
catima/reactions.cpp

98 lines
3.0 KiB
C++
Raw Normal View History

2018-04-29 18:16:45 -04:00
#include "catima/reactions.h"
2018-05-02 19:23:47 -04:00
#include "catima/catima.h"
#include "catima/abundance_database.h"
2018-07-30 13:57:51 -04:00
#include "catima/storage.h"
2018-04-29 18:16:45 -04:00
#include <cmath>
2018-05-02 19:23:47 -04:00
#include <iostream>
2018-07-31 11:40:25 -04:00
#ifdef NUREX
#include "nurex/Parametrization.h"
using nurex::SigmaR_Kox;
#else
using catima::SigmaR_Kox;
#endif
2018-04-29 18:16:45 -04:00
namespace catima{
2018-07-31 09:34:41 -04:00
double nonreaction_rate(Projectile &projectile, const Material &target, const Config &c){
2018-07-30 19:41:44 -04:00
if(projectile.T<emin_reaction)return -1.0;
2018-07-31 09:34:41 -04:00
if(target.thickness()<=0.0)return 1.0;
2018-07-30 19:41:44 -04:00
2018-04-29 18:16:45 -04:00
int ap = lround(projectile.A);
int zp = lround(projectile.Z);
2018-07-30 13:57:51 -04:00
2018-10-21 16:08:16 -04:00
auto& data = _storage.Get(projectile,target,c);
spline_type range_spline = get_range_spline(data);
2018-07-30 19:41:44 -04:00
if(energy_out(projectile.T, target.thickness(), range_spline) < emin_reaction)return -1.0;
2018-07-31 12:52:53 -04:00
2018-07-30 13:57:51 -04:00
auto sigma_r = [&](double th){
double stn_sum=0.0, sum=0.0;
double e = energy_out(projectile.T, th, range_spline);
for(unsigned int i = 0;i<target.ncomponents();i++){
2018-07-31 12:52:53 -04:00
int zt = target.get_element(i).Z;
int at = abundance::get_isotope_a(zt,0); // most abundand natural isotope mass
2018-07-30 13:57:51 -04:00
stn_sum += target.molar_fraction(i);
2018-07-31 11:40:25 -04:00
sum += target.molar_fraction(i)*SigmaR_Kox(ap,zp,e,at,zt);
2018-07-30 13:57:51 -04:00
}
return sum/stn_sum;
};
2018-05-02 19:23:47 -04:00
2018-07-30 13:57:51 -04:00
//nurex::Nucleus nurex_projectile = nurex::get_default_nucleus(ap,zp);
//nurex::Nucleus nurex_target = nurex::get_default_nucleus(at,zt);
//nurex::GlauberModelOLA_ZeroRange gm(nurex_projectile, nurex_target);
//double cs = nurex::SigmaR_Kox(ap,zp,projectile.T,);
2018-05-02 19:23:47 -04:00
2018-07-30 19:41:44 -04:00
double cs0 = sigma_r(0);
double cs1 = sigma_r(target.thickness());
double cs;
if(std::abs(cs0-cs1)/cs0 < 0.05){
cs = target.number_density_cm2()*(cs0 + cs1)/2.0;
}
else{
2018-07-31 12:52:53 -04:00
cs = Avogadro*catima::integrator.integrate(sigma_r,0,target.thickness())/target.M();
2018-07-30 19:41:44 -04:00
}
return exp(-cs*0.0001);
2018-04-29 18:16:45 -04:00
}
2018-08-13 12:08:54 -04:00
double production_rate(double cs, double rcs_projectile, double rcs_product, const Material &target, const Config &c){
double t = target.number_density_cm2();
double res = 0.0;
if( std::abs(rcs_product - rcs_projectile)<5.0){
res = 0.0001*cs*t*(exp(-0.0001*rcs_product*t));
}
else{
res = cs*(exp(-0.0001*rcs_projectile*t) - exp(-0.0001*rcs_product*t))/(rcs_product-rcs_projectile);
}
return res;
2018-04-29 18:16:45 -04:00
}
2018-07-31 11:40:25 -04:00
#ifndef NUREX
double SigmaR_Kox(int Ap, int Zp, double E, int At, int Zt){
constexpr double rc = 1.3;
constexpr double r0 = 1.1;
constexpr double a = 1.85;
constexpr double c1 = 2-(10.0/(1.5*1.5*1.5*1.5*1.5));
double Ap13 = pow(Ap,1.0/3.0);
double At13 = pow(At,1.0/3.0);
double D = 5.0*(At-2*Zt)*Zp/(Ap*At);
double Bc = Zp*Zt/(rc*(Ap13+At13));
double logE = std::log10(E);
double c = 0;
if(logE < 1.5){
c = c1*std::pow(logE/1.5,3);
}
else{
c = (-10.0/std::pow(logE,5)) + 2;
}
double Rs = r0 * ((a*Ap13*At13)/(Ap13+At13)-c)+D;
double Rv = r0 * (Ap13 + At13);
double Ri = Rv + Rs;
2019-01-17 12:20:00 -05:00
double Ecm = Ecm_from_T(E,Ap,At);
2018-07-31 11:40:25 -04:00
return 10.0*PI*Ri*Ri*(1-(Bc/Ecm));
}
2018-04-29 18:16:45 -04:00
#endif
2018-07-31 11:40:25 -04:00
2018-08-13 12:08:54 -04:00
} //end of catima namespace