1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-26 20:18:51 -05:00
This commit is contained in:
hrocho 2018-05-03 01:23:47 +02:00
parent 846ad516da
commit f01cb88ddd
5 changed files with 21 additions and 10 deletions

View File

@ -55,6 +55,7 @@ find_package(nurex QUIET)
if(nurex_FOUND) if(nurex_FOUND)
message(STATUS "nurex library found") message(STATUS "nurex library found")
set(NUREX ON) set(NUREX ON)
list(APPEND EXTRA_LIBS nurex::nurex)
endif(nurex_FOUND) endif(nurex_FOUND)

View File

@ -1,21 +1,29 @@
#include "catima/reactions.h" #include "catima/reactions.h"
#ifdef NUREX #ifdef NUREX
#include "catima/catima.h"
#include "catima/abundance_database.h"
#include <cmath> #include <cmath>
#include <iostream>
namespace catima{ namespace catima{
double reaction_rate(Projectile &projectile, const Material &target, const Config &c){ double reaction_rate1(Projectile &projectile, const Material &target, const Config &c){
int num_elements = target.ncomponents(); int num_elements = target.ncomponents();
int ap = lround(projectile.A); int ap = lround(projectile.A);
int zp = lround(projectile.Z); int zp = lround(projectile.Z);
nurex::Nucleus nurex_projectile = get_default_nucleus(ap,zp); nurex::Nucleus nurex_projectile = nurex::get_default_nucleus(ap,zp);
int zt = lround(target.get_element(0).Z; int zt = target.get_element(0).Z;
int at = abundance::get_isotope_a(zt,0); int at = abundance::get_isotope_a(zt,0);
nurex::Nucleus nurex_target = get_default_nucleus(at,zt); nurex::Nucleus nurex_target = nurex::get_default_nucleus(at,zt);
double eout = energy_out(projectile,projectile.T, target,c);
std::cout<<eout<<"\n";
nurex::GlauberModelOLA_ZeroRange gm(nurex_projectile, nurex_target); nurex::GlauberModelOLA_ZeroRange gm(nurex_projectile, nurex_target);
double cs = nurex::SigmaR(gm, projectile.T); double cs = nurex::SigmaR(gm, projectile.T);
double rr = reaction_rate(cs,target.number_density_cm2(0));
std::cout<<rr<<"\n";
return 1.0; return 1.0;
} }

View File

@ -16,9 +16,8 @@
#ifndef REACTIONS_H #ifndef REACTIONS_H
#define REACTIONS_H #define REACTIONS_H
#include "catima/build_config.h"
#ifdef NUREX #ifdef NUREX
#include "nurex/nurex.h" #include "nurex/nurex.h"
#include "catima/structures.h" #include "catima/structures.h"
#include "catima/config.h" #include "catima/config.h"
@ -52,7 +51,7 @@ namespace catima{
return 1.0 - std::exp(-i*0.0001); return 1.0 - std::exp(-i*0.0001);
} }
double reaction_rate(Projectile &projectile, const Material &target, const Config &c=default_config); double reaction_rate1(Projectile &projectile, const Material &target, const Config &c=default_config);
} }

View File

@ -12,7 +12,7 @@ endforeach(entry in ${CATIMA_TESTS})
if(NUREX) if(NUREX)
add_executable(test_reaction test_reaction.cpp) add_executable(test_reaction test_reaction.cpp)
target_link_libraries(test_reaction nurex::nurex catima) target_link_libraries(test_reaction catima)
add_test(test_reaction ${PROJECT_BINARY_DIR}/tests/test_reaction) add_test(test_reaction ${PROJECT_BINARY_DIR}/tests/test_reaction)
endif(NUREX) endif(NUREX)

View File

@ -10,6 +10,7 @@ using catima::nonreaction_rate;
const lest::test specification[] = const lest::test specification[] =
{ {
CASE("reaction"){ CASE("reaction"){
catima::Projectile proj{12,6,6,1000};
auto c = catima::get_material(6); auto c = catima::get_material(6);
c.thickness(4.0); c.thickness(4.0);
double r = reaction_rate(1000,c.number_density_cm2()); double r = reaction_rate(1000,c.number_density_cm2());
@ -24,6 +25,8 @@ const lest::test specification[] =
auto fcc = [](double x){return 1000.0;}; auto fcc = [](double x){return 1000.0;};
r = reaction_rate(fcc, c.number_density_cm2()); r = reaction_rate(fcc, c.number_density_cm2());
std::cout<<r<<"\n"; std::cout<<r<<"\n";
catima::reaction_rate1(proj, c);
} }
}; };