From 4c54ed0dd0c00081a402c2a1ad956017a7aa7455 Mon Sep 17 00:00:00 2001 From: hrocho Date: Tue, 31 Jul 2018 17:40:25 +0200 Subject: [PATCH] reactions v1 --- CMakeLists.txt | 2 ++ build_config.in | 2 +- catima.cpp | 6 +++--- config.h | 2 +- constants.h | 2 +- reactions.cpp | 39 +++++++++++++++++++++++++++++++++++---- reactions.h | 20 ++++++++++++++++++-- structures.h | 2 +- tests/CMakeLists.txt | 5 ++--- tests/test_reaction.cpp | 2 ++ 10 files changed, 66 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d67399..043e80f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,7 @@ option(GENERATE_DATA "make data tables generator" OFF) option(THIN_TARGET_APPROXIMATION "thin target approximation" ON) option(DOCS "build documentation (requires doxygen)" OFF) option(GLOBAL "build with global, sources are required" OFF) +option(REACTIONS "enable/disable nuclear reaction rate" ON) option(APPS "build catima applications" ON) ######## build type ############ @@ -148,6 +149,7 @@ if(EXAMPLES) #add_subdirectory("examples") endif(EXAMPLES) if(TESTS) +enable_testing() add_subdirectory("tests") endif(TESTS) diff --git a/build_config.in b/build_config.in index 2f2a6d0..b770cb4 100644 --- a/build_config.in +++ b/build_config.in @@ -4,7 +4,7 @@ #cmakedefine THIN_TARGET_APPROXIMATION #cmakedefine GSL_INTEGRATION #cmakedefine GLOBAL - +#cmakedefine REACTIONS #cmakedefine NUREX #endif diff --git a/catima.cpp b/catima.cpp index 9ce17bb..73b08a8 100644 --- a/catima.cpp +++ b/catima.cpp @@ -9,7 +9,7 @@ #include "catima/storage.h" #include "catima/nucdata.h" #include "catima/calculations.h" -#ifdef NUREX +#ifdef REACTIONS #include "catima/reactions.h" #endif @@ -254,7 +254,7 @@ Result calculate(Projectile &p, const Material &t, const Config &c){ } res.sigma_r = sqrt(range_straggling_spline(T)); res.Eloss = (res.Ein - res.Eout)*p.A; - #ifdef NUREX + #ifdef REACTIONS res.sp = nonreaction_rate(p,t,c); #endif return res; @@ -274,7 +274,7 @@ MultiResult calculate(Projectile &p, const Layers &layers, const Config &c){ res.total_result.sigma_E += r.sigma_E*r.sigma_E; res.total_result.tof += r.tof; res.total_result.Eout = r.Eout; - #ifdef NUREX + #ifdef REACTIONS res.total_result.sp = (r.sp>=0.0)?res.total_result.sp*r.sp:-1; #endif res.results.push_back(r); diff --git a/config.h b/config.h index b78a5e4..0f584e3 100644 --- a/config.h +++ b/config.h @@ -60,7 +60,7 @@ namespace catima{ //char z_effective=z_eff_type::atima14; unsigned char dedx = 0; unsigned char dedx_straggling = omega::atima; - #ifdef NUREX + #ifdef REACTIONS unsigned char skip=skip_none; #else unsigned char skip=skip_calculation::skip_reactions; diff --git a/constants.h b/constants.h index 1ac2479..fcf712c 100644 --- a/constants.h +++ b/constants.h @@ -20,7 +20,7 @@ constexpr double int_eps_tof = 0.01; */ constexpr double thin_target_limit = 1 - 1e-3; -#ifdef NUREX +#ifdef REACTIONS constexpr double emin_reaction = 30.0; constexpr bool reactions = true; #else diff --git a/reactions.cpp b/reactions.cpp index 906b002..2499f8f 100644 --- a/reactions.cpp +++ b/reactions.cpp @@ -1,12 +1,18 @@ #include "catima/reactions.h" - -#ifdef NUREX -#include "nurex/Parametrization.h" #include "catima/catima.h" #include "catima/abundance_database.h" #include "catima/storage.h" #include #include + +#ifdef NUREX +#include "nurex/Parametrization.h" +using nurex::SigmaR_Kox; +#else +using catima::SigmaR_Kox; +#endif + + namespace catima{ double nonreaction_rate(Projectile &projectile, const Material &target, const Config &c){ @@ -27,7 +33,7 @@ double nonreaction_rate(Projectile &projectile, const Material &target, const Co double e = energy_out(projectile.T, th, range_spline); for(unsigned int i = 0;i