1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2025-02-28 06:58:52 -05:00

production rate type

This commit is contained in:
hrocho 2018-08-13 18:08:54 +02:00
parent 4e1dd18a49
commit 2be81a4544
5 changed files with 47 additions and 13 deletions

View File

@ -3,7 +3,7 @@ project(catima)
############ options ############# ############ options #############
#option(THREADS "Use multi-threading" ON) #option(THREADS "Use multi-threading" ON)
option(CATIMA_PYTHON "compile the Catima python module(requires numpy and cython installed)" OFF) option(PYTHON_MODULE "compile the Catima python module(requires numpy and cython installed)" OFF)
option(TESTS "build tests" OFF) option(TESTS "build tests" OFF)
option(EXAMPLES "build examples" ON) option(EXAMPLES "build examples" ON)
option(GSL_INTEGRATION "use GSL integration" ON) option(GSL_INTEGRATION "use GSL integration" ON)
@ -110,7 +110,7 @@ MESSAGE( STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER} )
MESSAGE( STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS_RELEASE} ) MESSAGE( STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS_RELEASE} )
######## for python module ######## for python module
if(CATIMA_PYTHON) if(PYTHON_MODULE)
if(NOT PYTHONINTERP_FOUND) if(NOT PYTHONINTERP_FOUND)
MESSAGE(SEND_ERROR "Python is required to build nurex python modules") MESSAGE(SEND_ERROR "Python is required to build nurex python modules")
endif(NOT PYTHONINTERP_FOUND) endif(NOT PYTHONINTERP_FOUND)
@ -139,7 +139,7 @@ if(CATIMA_PYTHON)
add_custom_command(TARGET target_python add_custom_command(TARGET target_python
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/setup.py build_ext ${CYTHON_DEFINES} -i COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/setup.py build_ext ${CYTHON_DEFINES} -i
) )
endif(CATIMA_PYTHON ) endif(PYTHON_MODULE )
########## Sub Directories ########### ########## Sub Directories ###########
if(EXAMPLES) if(EXAMPLES)

View File

@ -26,7 +26,7 @@ compile options, enable or disable with cmake:
> cmake ../ -D[OPTION] > cmake ../ -D[OPTION]
available options: available options:
* CATIMA_PYTHON - enable/disable building of the python bindigs, cython and numpy are required to build the catima python module, default OFF * PYTHON_MODULE - enable/disable building of the python bindigs, cython and numpy are required to build the catima python module, default OFF
* TESTS - build tests * TESTS - build tests
* EXAMPLES - build examples * EXAMPLES - build examples
* DOCS - prepare doxygen documentation (after cmake, __make docs__ needs to be executed) * DOCS - prepare doxygen documentation (after cmake, __make docs__ needs to be executed)

View File

@ -56,6 +56,16 @@ double nonreaction_rate(Projectile &projectile, const Material &target, const Co
return exp(-cs*0.0001); return exp(-cs*0.0001);
} }
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;
} }
#ifndef NUREX #ifndef NUREX
@ -84,3 +94,4 @@ double SigmaR_Kox(int Ap, int Zp, double E, int At, int Zt){
} }
#endif #endif
} //end of catima namespace

View File

@ -22,6 +22,7 @@
#include "catima/config.h" #include "catima/config.h"
#include "catima/integrator.h" #include "catima/integrator.h"
#include <cmath> #include <cmath>
#endif
namespace catima{ namespace catima{
@ -49,17 +50,14 @@ namespace catima{
double i = ii.integrate(f,0,t); double i = ii.integrate(f,0,t);
return 1.0 - std::exp(-i*0.0001); return 1.0 - std::exp(-i*0.0001);
} }
double nonreaction_rate(Projectile &projectile, const Material &target, const Config &c=default_config); double nonreaction_rate(Projectile &projectile, const Material &target, const Config &c=default_config);
} double production_rate(double cs, double rcs_projectile, double rcs_product, const Material &target, const Config &c=default_config);
#else
#ifndef NUREX
double SigmaR_Kox(int Ap, int Zp, double E, int At, int Zt); double SigmaR_Kox(int Ap, int Zp, double E, int At, int Zt);
inline double p_from_T(double T, double M=1.0){ inline double p_from_T(double T, double M=1.0){
return M*sqrt(T*T + 2*T*atomic_mass_unit); return M*sqrt(T*T + 2*T*atomic_mass_unit);
} }
inline double Ecm_from_T_relativistic(double T, double Ap, double At){ inline double Ecm_from_T_relativistic(double T, double Ap, double At){
double mp = Ap*atomic_mass_unit; double mp = Ap*atomic_mass_unit;
double mt = At*atomic_mass_unit; double mt = At*atomic_mass_unit;
@ -72,3 +70,4 @@ inline double Ecm_from_T_relativistic(double T, double Ap, double At){
#endif //NUREX #endif //NUREX
#endif #endif
} // end of catime namespace

View File

@ -48,7 +48,31 @@ const lest::test specification[] =
EXPECT( (r > 0 && r<1.0) ); EXPECT( (r > 0 && r<1.0) );
EXPECT( (r2 > 0 && r2<1.0) ); EXPECT( (r2 > 0 && r2<1.0) );
EXPECT( r2>r ); EXPECT( r2>r );
},
CASE("production"){
catima::Projectile proj{12,6,6,870};
auto c = catima::get_material(6);
c.thickness(0.1);
double r,r2;
double cs = 70;
double rcsi = 870;
double rcso = 850;
r = 0.0001*cs*c.number_density_cm2();
r2 = catima::production_rate(cs,rcsi,rcso, c);
EXPECT(r==approx(r2).R(0.01));
r2 = catima::production_rate(cs,2,1, c);
EXPECT(r==approx(r2).R(0.001));
r = catima::production_rate(cs,870,870, c);
r2 = catima::production_rate(cs,870,860, c);
EXPECT(r==approx(r2).R(0.001));
c.thickness(2.0);
r = catima::production_rate(cs,870,870, c);
r2 = catima::production_rate(cs,870,860, c);
EXPECT(r==approx(r2).R(0.001));
} }
}; };