diff --git a/source/branches/CLASSV3/Model/Equivalence/EQM_LIN_PWR_MOX.cxx b/source/branches/CLASSV3/Model/Equivalence/EQM_LIN_PWR_MOX.cxx deleted file mode 100644 index d007107fb755bece52a82b1526d574a989db4704..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/Equivalence/EQM_LIN_PWR_MOX.cxx +++ /dev/null @@ -1,262 +0,0 @@ -#include "EQM_LIN_PWR_MOX.hxx" - -#include "CLASSConstante.hxx" - -#include <vector> - -#include "StringLine.hxx" -#include "CLASSLogger.hxx" -#include "IsotopicVector.hxx" - - - -EQM_LIN_PWR_MOX::EQM_LIN_PWR_MOX(string WeightPath):EquivalenceModel(new CLASSLogger("EQM_LIN_PWR_MOX.log")) -{ - fWeightPath = WeightPath; - - ifstream DataDB(fWeightPath.c_str()); // Open the File - if(!DataDB) - WARNING << "Can't open \"" << fWeightPath << "\"\n" << endl; - - string line; - int start = 0; // First Get Fuel Parameter - getline(DataDB, line); - - if( StringLine::NextWord(line, start, ' ') != "PARAM") - { - ERROR << " Bad Database file : " << fWeightPath << " Can't find the Parameter of the DataBase " << endl; - exit (1); - } - while(start < (int)line.size()) - fFuelParameter.push_back(atof(StringLine::NextWord(line, start, ' ').c_str())); - - INFO << " " << (int)fFuelParameter.size() << " parameters have been read " << endl; - - - - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - // ADD ENrichment of the U reading !!!!!!!!!!!!!!!!!!!!!!!!!!!! // - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - - ZAI U8(92,238,0); - ZAI U5(92,235,0); - double U5_enrich= 0.0025; - fFertileList = U5*U5_enrich + U8*(1-U5_enrich); - - - ZAI Pu8(94,238,0); - ZAI Pu9(94,239,0); - ZAI Pu0(94,240,0); - ZAI Pu1(94,241,0); - ZAI Pu2(94,242,0); - fFissileList = Pu8*1+Pu9*1+Pu0*1+Pu1*1+Pu2*1; - - -} - - -EQM_LIN_PWR_MOX::EQM_LIN_PWR_MOX(CLASSLogger* log, string WeightPath):EquivalenceModel(log) -{ - fWeightPath = WeightPath; - - ifstream DataDB(fWeightPath.c_str()); // Open the File - if(!DataDB) - WARNING << " Can't open \"" << fWeightPath << "\"\n" << endl; - - string line; - int start = 0; // First Get Fuel Parameter - getline(DataDB, line); - - if( StringLine::NextWord(line, start, ' ') != "PARAM") - { - ERROR << " Bad Database file : " << fWeightPath << " Can't find the Parameter of the DataBase"<< endl; - exit (1); - } - while(start < (int)line.size()) - fFuelParameter.push_back(atof(StringLine::NextWord(line, start, ' ').c_str())); - - INFO << fFuelParameter.size() << " have been read"<< endl; - - - - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - // ADD ENrichment of the U reading !!!!!!!!!!!!!!!!!!!!!!!!!!!! // - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - - ZAI U8(92,238,0); - ZAI U5(92,235,0); - double U5_enrich= 0.0025; - fFertileList = U5*U5_enrich + U8*(1-U5_enrich); - - - ZAI Pu8(94,238,0); - ZAI Pu9(94,239,0); - ZAI Pu0(94,240,0); - ZAI Pu1(94,241,0); - ZAI Pu2(94,242,0); - fFissileList = Pu8*1+Pu9*1+Pu0*1+Pu1*1+Pu2*1; - - -} - -EQM_LIN_PWR_MOX::~EQM_LIN_PWR_MOX() -{ - -} - -//________________________________________________________________________ -vector<double> EQM_LIN_PWR_MOX::BuildFuel(double BurnUp, double HMMass,vector<IsotopicVector> FissilArray, vector<IsotopicVector> FertilArray) -{ - - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - // ADD ENrichment of the U check ++ Check Un seul fertile !!!! // - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - //-----------------------------------------------------------------------------// - - - vector<double> lambda; - for(int i = 0; i < (int) (FissilArray.size() + FertilArray.size()); i++) - lambda.push_back(0); - - - double Na = 6.02214129e23; //N Avogadro - - IsotopicVector FullUsedStock; - IsotopicVector stock; - - bool FuelBuild = false; - if(FissilArray.size() == 0) - { - for(int i = 0; i < (int)lambda.size(); i++) - lambda[i] = -1; - - FuelBuild = true; - } - int N_FissilStock_OnCheck = 0; - - while(!FuelBuild) - { - - double nPu_0 = 0; - double MPu_0 = 0; - { - map<ZAI ,double>::iterator it; - - map<ZAI ,double> isotopicquantity = FullUsedStock.GetSpeciesComposition(94).GetIsotopicQuantity(); - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++ ) - nPu_0 += (*it).second; - - isotopicquantity = (FullUsedStock.GetSpeciesComposition(94) + ZAI(94,241,0)*FullUsedStock.GetZAIIsotopicQuantity(95,241,0)).GetIsotopicQuantity(); //Add the 241Am as 241Pu... the Pu is not old in the Eq Model but is in the FissileArray....; - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++ ) - MPu_0 += (*it).second*cZAIMass.fZAIMass.find( (*it).first )->second/Na*1e-6; - } - stock = FissilArray[N_FissilStock_OnCheck]; - double nPu_1 = 0; - double MPu_1 = 0; - double Sum_AlphaI_nPuI = 0; - double Sum_AlphaI_nPuI0 = 0; - { - map<ZAI ,double>::iterator it; - map<ZAI ,double> isotopicquantity = stock.GetSpeciesComposition(94).GetIsotopicQuantity(); - - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++ ) - { - if ((*it).first.A() >= 238 && (*it).first.A() <= 242) - { - nPu_1 += (*it).second; - Sum_AlphaI_nPuI += fFuelParameter[(*it).first.A() -237]*(*it).second; - } - } - - isotopicquantity = (stock.GetSpeciesComposition(94) + ZAI(94,241,0)*stock.GetZAIIsotopicQuantity(95,241,0)).GetIsotopicQuantity(); //Add the 241Am as 241Pu... the Pu is not old in the Eq Model but is in the FissileArray.... - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++ ) - if ((*it).first.A() >= 238 && (*it).first.A() <= 242) - { - MPu_1 += (*it).second * (cZAIMass.fZAIMass.find( (*it).first )->second)/Na*1e-6; - } - - isotopicquantity = FullUsedStock.GetSpeciesComposition(94).GetIsotopicQuantity(); - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++ ) - if ((*it).first.A() >= 238 && (*it).first.A() <= 242) - { - Sum_AlphaI_nPuI0 += fFuelParameter[(*it).first.A() -237]*(*it).second; - } - } - - double StockFactionToUse = 0; - - double NT = HMMass*1e6 * Na / (cZAIMass.GetMass( ZAI(92,238,0) ) * 0.997 - + cZAIMass.GetMass( ZAI(92,235,0) ) * 0.003 ); - - double N1 = (BurnUp - fFuelParameter[6]) * NT; - double N2 = -Sum_AlphaI_nPuI0; - double N3 = -fFuelParameter[0] * Na / (cZAIMass.fZAIMass.find( ZAI(92,238,0) )->second*0.997 - + cZAIMass.fZAIMass.find( ZAI(92,235,0) )->second*0.003 ) - * (HMMass*1e6 - MPu_0*1e6); - - double D1 = Sum_AlphaI_nPuI; - double D2 = -fFuelParameter[0] * MPu_1*1e6 * Na / (cZAIMass.fZAIMass.find( ZAI(92,238,0) )->second*0.997 - + cZAIMass.fZAIMass.find( ZAI(92,235,0) )->second*0.003 ) ; - - StockFactionToUse = (N1 + N2 + N3) / (D1 + D2); - - if(StockFactionToUse < 0) - { - WARNING << "!!!FabricationPlant!!! Oups Bug in calculating stock fraction to use "<< endl; - lambda[N_FissilStock_OnCheck] = 0.; - N_FissilStock_OnCheck++; - FuelBuild = false; - } - else if( StockFactionToUse > 1 ) - { - - FullUsedStock += stock; - lambda[N_FissilStock_OnCheck] = 1; - N_FissilStock_OnCheck++; - FuelBuild = false; - } - else - { - lambda[N_FissilStock_OnCheck] = StockFactionToUse; - - FuelBuild = true; - - double U8_Quantity = (HMMass - (MPu_0+StockFactionToUse*MPu_1 ))/(cZAIMass.fZAIMass.find( ZAI(92,238,0) )->second*0.997 + cZAIMass.fZAIMass.find( ZAI(92,235,0) )->second*0.003 )*Na/1e-6; - - lambda.back() = U8_Quantity / FertilArray[0].GetSumOfAll(); - } - - - if( N_FissilStock_OnCheck == (int) FissilArray.size() ) // Check if the last Fissil stock has been tested... quit if so... - { - for(int i = 0; i < (int)lambda.size(); i++) - lambda[i] = -1; - - FuelBuild = true; - } - } - - - - return lambda; -} diff --git a/source/branches/CLASSV3/Model/Equivalence/EQM_LIN_PWR_MOX.hxx b/source/branches/CLASSV3/Model/Equivalence/EQM_LIN_PWR_MOX.hxx deleted file mode 100644 index e6faa430c3fdbbffd90044b5d7268535ff64fa0c..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/Equivalence/EQM_LIN_PWR_MOX.hxx +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _EQM_LIN_PWR_MOX_HXX -#define _EQM_LIN_PWR_MOX_HXX - -#include "EquivalenceModel.hxx" - -#include <string> - -/*! - \file - \brief Header file for EQM_MLP_MOX class. - - - @author BaM - @version 1.0 - */ - -using namespace std; - -//-----------------------------------------------------------------------------// -/*! - Define a EQM_MLP_MOX. - The aim of these class is to constuct a fuel from an equivalence model - based on a Linear Eq Model BU = SUM (alpha_i*n_i} - - @author BaM - @version 3.0 - */ -//________________________________________________________________________ - -class EQM_LIN_PWR_MOX : public EquivalenceModel -{ - public : - - EQM_LIN_PWR_MOX(string WeightPath); - EQM_LIN_PWR_MOX(CLASSLogger* log, string WeightPath); - ~EQM_LIN_PWR_MOX(); - - vector<double> BuildFuel(double BurnUp, double HMMass, vector<IsotopicVector> FissilArray, vector<IsotopicVector> FertilArray ); - - private : - - string fWeightPath; - vector<double> fFuelParameter; - -}; - -#endif - diff --git a/source/branches/CLASSV3/Model/Equivalence/EQM_MLP_PWR_MOX.cxx b/source/branches/CLASSV3/Model/Equivalence/EQM_MLP_PWR_MOX.cxx deleted file mode 100644 index b316b4bfb76214f896e7f5fee9f3eca96cc4960d..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/Equivalence/EQM_MLP_PWR_MOX.cxx +++ /dev/null @@ -1,182 +0,0 @@ -#include "EquivalenceModel.hxx" -#include "EQM_MLP_PWR_MOX.hxx" -#include "CLASSLogger.hxx" -#include "StringLine.hxx" - -#include <string> -#include <iostream> -#include <fstream> -#include <algorithm> -#include <cmath> -#include <cassert> - -#include "TSystem.h" -#include "TMVA/Reader.h" -#include "TMVA/Tools.h" -#include "TMVA/MethodCuts.h" - - -//________________________________________________________________________ -// -// EQM_MLP_MOX -// -// Equivalenve Model based on multi layer perceptron from TMVA (root cern) -// For REP MOX use -// -//________________________________________________________________________ - -EQM_MLP_MOX::EQM_MLP_MOX(string TMVAWeightPath):EquivalenceModel(new CLASSLogger("EQM_MLP_MOX.log")) -{ - fTMVAWeightPath = TMVAWeightPath; - - ZAI U8(92,238,0); - ZAI U5(92,235,0); - double U5_enrich= 0.0025; - - ZAI Pu8(94,238,0); - ZAI Pu9(94,239,0); - ZAI Pu0(94,240,0); - ZAI Pu1(94,241,0); - ZAI Pu2(94,242,0); - - fFissileList = Pu8*1+Pu9*1+Pu0*1+Pu1*1+Pu2*1; - fFertileList = U5*U5_enrich + U8*(1-U5_enrich); - - INFO<<"__An equivalence model of PWR MOX has been define__"<<endl; - INFO<<"\tThis model is based on a multi layer perceptron"<<endl; - INFO<<"\t\tThe TMVA weight file is :"<<endl; - INFO<<"\t\t\t"<<fTMVAWeightPath<<endl; - -} - -//________________________________________________________________________ -EQM_MLP_MOX::EQM_MLP_MOX(CLASSLogger* log, string TMVAWeightPath):EquivalenceModel(log) -{ - fTMVAWeightPath = TMVAWeightPath; - - ZAI U8(92,238,0); - ZAI U5(92,235,0); - double U5_enrich= 0.0025; - - ZAI Pu8(94,238,0); - ZAI Pu9(94,239,0); - ZAI Pu0(94,240,0); - ZAI Pu1(94,241,0); - ZAI Pu2(94,242,0); - - fFissileList = Pu8*1+Pu9*1+Pu0*1+Pu1*1+Pu2*1; - fFertileList = U5*U5_enrich + U8*(1-U5_enrich); - - INFO<<"__An equivalence model of PWR MOX has been define__"<<endl; - INFO<<"\tThis model is based on a multi layer perceptron"<<endl; - INFO<<"\t\tThe TMVA weight file is :"<<endl; - INFO<<"\t\t\t"<<fTMVAWeightPath<<endl; - -} - -//________________________________________________________________________ -TTree* EQM_MLP_MOX::CreateTMVAInputTree(IsotopicVector Fissil,IsotopicVector Fertil,double BurnUp) -{ - TTree* InputTree = new TTree("EQTMP", "EQTMP"); - float Pu8 = 0; - float Pu9 = 0; - float Pu10 = 0; - float Pu11 = 0; - float Pu12 = 0; - float Am1 = 0; - float U5_enrichment = 0; - float BU = 0; - - InputTree->Branch( "Pu8" ,&Pu8 ,"Pu8/F" ); - InputTree->Branch( "Pu9" ,&Pu9 ,"Pu9/F" ); - InputTree->Branch( "Pu10" ,&Pu10 ,"Pu10/F" ); - InputTree->Branch( "Pu11" ,&Pu11 ,"Pu11/F" ); - InputTree->Branch( "Pu12" ,&Pu12 ,"Pu12/F" ); - InputTree->Branch( "Am1" ,&Am1 ,"Am1/F" ); - InputTree->Branch( "U5_enrichment" ,&U5_enrichment ,"U5_enrichment/F" ); - InputTree->Branch( "BU" ,&BU ,"BU/F" ); - - - float U8 = Fertil.GetZAIIsotopicQuantity(92,238,0); - float U5 = Fertil.GetZAIIsotopicQuantity(92,235,0); - float U4 = Fertil.GetZAIIsotopicQuantity(92,234,0); - - float UTOT = U8 + U5 + U4; - - Pu8 = Fissil.GetZAIIsotopicQuantity(94,238,0); - Pu9 = Fissil.GetZAIIsotopicQuantity(94,239,0); - Pu10 = Fissil.GetZAIIsotopicQuantity(94,240,0); - Pu11 = Fissil.GetZAIIsotopicQuantity(94,241,0); - Pu12 = Fissil.GetZAIIsotopicQuantity(94,242,0); - Am1 = Fissil.GetZAIIsotopicQuantity(95,241,0); - - double TOTPU=(Pu8+Pu9+Pu10+Pu11+Pu12+Am1); - - Pu8 = Pu8 / TOTPU; - Pu9 = Pu9 / TOTPU; - Pu10= Pu10 / TOTPU; - Pu11= Pu11 / TOTPU; - Pu12= Pu12 / TOTPU; - Am1 = Am1 / TOTPU; - - U5_enrichment = U5 / UTOT; - - BU=BurnUp; - //cout<<"Pu8 "<<Pu8 <<" Pu9 "<< Pu9 <<" Pu10 "<< Pu10 << " Pu11 "<< Pu11 <<" Pu12 "<<Pu12 <<" Am1 "<<Am1<<endl; - //cout<<"BU "<<BU<<" U5_enrichment "<<U5_enrichment<<endl; - if(Pu8 + Pu9 + Pu10 + Pu11 + Pu12 + Am1 > 1.00001 )//?????1.00001??? I don't know it! goes in condition if =1 !! may be float/double issue ... - { - ERROR << Pu8 << " " << Pu9 << " " << Pu10 << " " << Pu11 << " " << Pu12 << " " << Am1 << endl; - exit(0); - } - // All value are molar (!weight) - - InputTree->Fill(); - return InputTree; -} -//________________________________________________________________________ -double EQM_MLP_MOX::ExecuteTMVA(TTree* theTree) -{ - // --- Create the Reader object - TMVA::Reader *reader = new TMVA::Reader( "Silent" ); - // Create a set of variables and declare them to the reader - // - the variable names MUST corresponds in name and type to those given in the weight file(s) used - Float_t Pu8,Pu9,Pu10,Pu11,Pu12,Am1,BU,U5_enrichment; - - reader->AddVariable( "BU" ,&BU ); - reader->AddVariable( "U5_enrichment",&U5_enrichment ); - reader->AddVariable( "Pu8" ,&Pu8 ); - reader->AddVariable( "Pu9" ,&Pu9 ); - reader->AddVariable( "Pu10" ,&Pu10); - reader->AddVariable( "Pu11" ,&Pu11); - reader->AddVariable( "Pu12" ,&Pu12); - reader->AddVariable( "Am1" ,&Am1 ); - - // --- Book the MVA methods - - // Book method MLP - TString methodName = "MLP method"; - reader->BookMVA( methodName, fTMVAWeightPath ); - //theTree->SetBranchAddress("teneur",&teneur); - theTree->SetBranchAddress( "BU" ,&BU ); - theTree->SetBranchAddress( "U5_enrichment" ,&U5_enrichment ) ; - theTree->SetBranchAddress( "Pu8" ,&Pu8 ); - theTree->SetBranchAddress( "Pu9" ,&Pu9 ); - theTree->SetBranchAddress( "Pu10" ,&Pu10 ); - theTree->SetBranchAddress( "Pu11" ,&Pu11 ); - theTree->SetBranchAddress( "Pu12" ,&Pu12 ); - theTree->SetBranchAddress( "Am1" ,&Am1 ); - theTree->GetEntry(0); - - Float_t val = (reader->EvaluateRegression( methodName ))[0]; - - delete reader; - delete theTree; - - return (double)val; //retourne teneur -} -//________________________________________________________________________ -double EQM_MLP_MOX::GetFissileMolarFraction(IsotopicVector Fissil,IsotopicVector Fertil,double BurnUp) -{DBGL - return ExecuteTMVA(CreateTMVAInputTree(Fissil,Fertil,BurnUp)); -} diff --git a/source/branches/CLASSV3/Model/Equivalence/EQM_MLP_PWR_MOX.hxx b/source/branches/CLASSV3/Model/Equivalence/EQM_MLP_PWR_MOX.hxx deleted file mode 100644 index e003d704e5b2dad396b6c22debe5eb42b3099142..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/Equivalence/EQM_MLP_PWR_MOX.hxx +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef _EQM_MLP_MOX_HXX -#define _EQM_MLP_MOX_HXX - -#include "EquivalenceModel.hxx" -#include "TTree.h" - -/*! - \file - \brief Header file for EQM_MLP_MOX class. - - - @author BaM - @version 1.0 - */ - - -using namespace std; - -//-----------------------------------------------------------------------------// -/*! - Define a EQM_MLP_MOX. - The aim of these class is to constuct a fuel from an equivalence model - based on a Multi layer perceptron - - @author BaM - @version 3.0 - */ -//________________________________________________________________________ - - -class EQM_MLP_MOX : public EquivalenceModel -{ - public : - - EQM_MLP_MOX(string TMVAWeightPath); //!< Constructor string TMVAWeightPath => PATH/TMVAWeight.xml (path to tmva weight) - EQM_MLP_MOX(CLASSLogger* log, string TMVAWeightPath); //!< Constructor CLASSLogger* log ,string TMVAWeightPath => PATH/TMVAWeight.xml - - double GetFissileMolarFraction(IsotopicVector Fissil,IsotopicVector Fertil,double BurnUp); //!<Return the molar fraction of fissile element thanks to a Multi Layer Perceptron - - private : - TTree* CreateTMVAInputTree(IsotopicVector Fissil,IsotopicVector Fertil,double BurnUp);//!<Create input tmva tree to be read by ExecuteTMVA - double ExecuteTMVA(TTree* theTree);//!<Execute the MLP according to the input tree created by CreateTMVAInputTree - - - string fTMVAWeightPath;;//!<The weight needed by TMVA to construct and execute the multilayer perceptron - -}; - -#endif - diff --git a/source/branches/CLASSV3/Model/Equivalence/EQM_QUAD_PWR_MOX.cxx b/source/branches/CLASSV3/Model/Equivalence/EQM_QUAD_PWR_MOX.cxx deleted file mode 100644 index d242af854f09dcb1672e6733cc3e72cba9a50f19..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/Equivalence/EQM_QUAD_PWR_MOX.cxx +++ /dev/null @@ -1,136 +0,0 @@ -#include "EQM_QUAD_PWR_MOX.hxx" - -#include <vector> - -#include "StringLine.hxx" -#include "CLASSLogger.hxx" - - - - -EQM_QUAD_PWR_MOX::EQM_QUAD_PWR_MOX(string WeightPath):EquivalenceModel(new CLASSLogger("EQM_QUAD_PWR_MOX.log")) -{ - fWeightPath = WeightPath; - - ifstream DataDB(fWeightPath.c_str()); // Open the File - if(!DataDB) - WARNING << " Can't open \"" << fWeightPath << "\"" << endl; - - string line; - int start = 0; // First Get Fuel Parameter - getline(DataDB, line); - - if( StringLine::NextWord(line, start, ' ') != "PARAM") - { - ERROR << "Bad Database file : " << fWeightPath << " Can't find the Parameter of the DataBase " << endl; - exit (1); - } - while(start < (int)line.size()) - fFuelParameter.push_back(atof(StringLine::NextWord(line, start, ' ').c_str())); - - INFO << fFuelParameter.size() << " have been read " << endl; - - - ZAI U8(92,238,0); - ZAI U5(92,235,0); - double U5_enrich= 0.0025; - fFertileList = U5*U5_enrich + U8*(1-U5_enrich); - - - ZAI Pu8(94,238,0); - ZAI Pu9(94,239,0); - ZAI Pu0(94,240,0); - ZAI Pu1(94,241,0); - ZAI Pu2(94,242,0); - fFissileList = Pu8*1+Pu9*1+Pu0*1+Pu1*1+Pu2*1; - - -} - -EQM_QUAD_PWR_MOX::EQM_QUAD_PWR_MOX(CLASSLogger* log, string WeightPath):EquivalenceModel(log) -{ - fWeightPath = WeightPath; - - ifstream DataDB(fWeightPath.c_str()); // Open the File - if(!DataDB) - WARNING << " Can't open \"" << fWeightPath << "\"" << endl; - - string line; - int start = 0; // First Get Fuel Parameter - getline(DataDB, line); - - if( StringLine::NextWord(line, start, ' ') != "PARAM") - { - ERROR << "Bad Database file : " << fWeightPath << " Can't find the Parameter of the DataBase " << endl; - exit (1); - } - while(start < (int)line.size()) - fFuelParameter.push_back(atof(StringLine::NextWord(line, start, ' ').c_str())); - - INFO << fFuelParameter.size() << " have been read " << endl; - - - ZAI U8(92,238,0); - ZAI U5(92,235,0); - double U5_enrich= 0.0025; - fFertileList = U5*U5_enrich + U8*(1-U5_enrich); - - - ZAI Pu8(94,238,0); - ZAI Pu9(94,239,0); - ZAI Pu0(94,240,0); - ZAI Pu1(94,241,0); - ZAI Pu2(94,242,0); - fFissileList = Pu8*1+Pu9*1+Pu0*1+Pu1*1+Pu2*1; - - -} - - - -EQM_QUAD_PWR_MOX::~EQM_QUAD_PWR_MOX() -{ - -} - - - - -double EQM_QUAD_PWR_MOX::GetFissileMolarFraction(IsotopicVector Fissile,IsotopicVector Fertile,double BurnUp) -{ - - - ZAI ZAIList[6] = {ZAI(94,238,0), ZAI(94,239,0), ZAI(94,240,0), ZAI(94,241,0), ZAI(94,242,0), ZAI(95,241,0) }; - - vector<double> PuCompo; - double Sum = Fissile.GetSumOfAll(); - - - for(int i = 0; i< 5; i++) - PuCompo.push_back( Fissile.GetZAIIsotopicQuantity(ZAIList[i])/Sum); - - PuCompo[2] += Fissile.GetZAIIsotopicQuantity(ZAIList[5])/Sum; - double A = 0; - - if(PuCompo[0] <= PuCompo[2] && PuCompo[0] <= PuCompo[4] && PuCompo[1] + PuCompo[3] >= 0.40 && PuCompo[1] >0 ) - { - int par = 0; - for(int j = 0 ; j < 5 ; j++) - { - A += fFuelParameter[par] * PuCompo[j] ; - par++; - for(int i = j ; i < 5 ; i++) - { - A += fFuelParameter[par] *PuCompo[i] *PuCompo[j]; - par++; - } - } - A += fFuelParameter[par]; - } - else - { - cout << "oups dans le cul" << endl; - } - return A; -} - diff --git a/source/branches/CLASSV3/Model/Equivalence/EQM_QUAD_PWR_MOX.hxx b/source/branches/CLASSV3/Model/Equivalence/EQM_QUAD_PWR_MOX.hxx deleted file mode 100644 index 551e7ff831848c48d822b1a7298b76be5df44b55..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/Equivalence/EQM_QUAD_PWR_MOX.hxx +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _EQM_QUAD_PWR_MOX_HXX -#define _EQM_QUAD_PWR_MOX_HXX - -#include "EquivalenceModel.hxx" - -#include <string> - -/*! - \file - \brief Header file for EQM_MLP_MOX class. - - - @author BaM - @version 1.0 - */ - -using namespace std; - -//-----------------------------------------------------------------------------// -/*! - Define a EQM_MLP_MOX. - The aim of these class is to constuct a fuel from an equivalence model - based on a Quadratic Pu equivalent Model - - @author BaM - @version 3.0 - */ -//________________________________________________________________________ - -class EQM_QUAD_PWR_MOX : public EquivalenceModel -{ - public : - - EQM_QUAD_PWR_MOX(string WeightPath); - EQM_QUAD_PWR_MOX(CLASSLogger* log, string WeightPath); - ~EQM_QUAD_PWR_MOX(); - - double GetFissileMolarFraction(IsotopicVector Fissil,IsotopicVector Fertil,double BurnUp); - - private : - - string fWeightPath; - vector<double> fFuelParameter; - -}; - -#endif - diff --git a/source/branches/CLASSV3/Model/Irradiation/IM_Matrix.cxx b/source/branches/CLASSV3/Model/Irradiation/IM_Matrix.cxx deleted file mode 100644 index 09c128c8e08d7689e485d3f15d27e4f12a419b59..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/Irradiation/IM_Matrix.cxx +++ /dev/null @@ -1,315 +0,0 @@ -// -// IM_Matrix.cxx -// CLASSSource -// -// Created by BaM on 04/05/2014. -// Copyright (c) 2014 BaM. All rights reserved. -// - -#include "IM_Matrix.hxx" - -#include "IsotopicVector.hxx" -#include "CLASSConstante.hxx" -#include "CLASSLogger.hxx" -#include "StringLine.hxx" - -#include <TGraph.h> -#include <TString.h> - - -#include <sstream> -#include <string> -#include <iostream> -#include <fstream> -#include <algorithm> -#include <cmath> - - - -using namespace std; - - -//________________________________________________________________________ -IM_Matrix::IM_Matrix():IrradiationModel(new CLASSLogger("IM_Matrix.log")) -{ - fShorstestHalflife = 3600.*24*160.; //cut by default all nuclei with a shorter liftime than the Cm242 -> remain 33 actinides -} - - -IM_Matrix::IM_Matrix(CLASSLogger* log):IrradiationModel(log) -{ - fShorstestHalflife = 3600.*24*160.; //cut by default all nuclei with a shorter liftime than the Cm242 -> remain 33 actinides -} - - - - -//________________________________________________________________________ -/* Evolution Calculation */ -//________________________________________________________________________ -EvolutionData IM_Matrix::GenerateEvolutionData(IsotopicVector isotopicvector, EvolutionData XSSet, double Power, double cycletime) -{ - DBGL - if(fFastDecay.size() == 0) - BuildDecayMatrix(); - - - string ReactorType; - - - vector< TMatrixT<double> > NMatrix ;// TMatrixT<double>(decayindex.size(),1)) - { // Filling the t=0 State; - map<ZAI, double > isotopicquantity = isotopicvector.GetIsotopicQuantity(); - TMatrixT<double> N_0Matrix = TMatrixT<double>( findex.size(),1) ; - for(int i = 0; i < (int)findex.size(); i++) - N_0Matrix[i] = 0; - - map<ZAI, double >::iterator it ; - for(int i = 0; i < (int)findex.size(); i++) - N_0Matrix[i] = 0; - - for(it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - { - /// Need TO change with FP managment - map<ZAI, int >::iterator it2; - - if( (*it).first.Z() < fZAIThreshold ) - it2 = findex_inver.find( ZAI(-2,-2,-2) ); - else it2 = findex_inver.find( (*it).first ); - - if(it2 == findex_inver.end() ) //If not in index should be TMP, can't be fast decay for new Fuel !!! - it2 = findex_inver.find( ZAI(-3,-3,-3) ); - N_0Matrix[ (*it2).second ][0] = (*it).second ; - - - } - - isotopicquantity.clear(); - - NMatrix.push_back(N_0Matrix); - N_0Matrix.Clear(); - - } - - - //-------------------------// - //--- Perform Evolution ---// - //-------------------------// - ReactorType = XSSet.GetReactorType(); - - double M_ref = XSSet.GetHeavyMetalMass(); - double M = 0; - double Power_ref = XSSet.GetPower(); - - // Get the mass of the fuel to irradiate in order to perform the evolution at fixed burnup (the burnup step of the calculation will match the burnup step of the XSSet - { - map<ZAI, double >::iterator it ; - - - IsotopicVector IVtmp = isotopicvector.GetActinidesComposition(); - map<ZAI, double >isotopicquantity = IVtmp.GetIsotopicQuantity(); - - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++ ) - M += isotopicvector.GetActinidesComposition().GetZAIIsotopicQuantity( (*it).first )*cZAIMass.fZAIMass.find( (*it).first )->second/AVOGADRO*1e-6; - isotopicquantity.clear(); - - } - - int NStep = XSSet.GetFissionXS().begin()->second->GetN(); - double* DBTimeStep = XSSet.GetFissionXS().begin()->second->GetX(); - - int InsideStep = 10; - - double timevector[NStep]; - timevector[0] = 0; - - double Flux[NStep]; - - TMatrixT<double> FissionEnergy = TMatrixT<double>(findex.size(),1); - for(int i = 0; i < (int)findex.size(); i++) - FissionEnergy[i] = 0; - - { - map< ZAI, int >::iterator it; - for(it = findex_inver.begin(); it != findex_inver.end(); it++) - { - map< ZAI, double >::iterator it2 = fFissionEnergy.find(it->first); - if(it2 == fFissionEnergy.end()) - { - if(it->first.Z() > fZAIThreshold) - FissionEnergy[it->second][0] = 1.9679e6*it->first.A()-2.601e8; // //simple linear fit to known values ;extrapolation to unknown isotopes - else FissionEnergy[it->second][0] = 0; - } - else - FissionEnergy[it->second][0] = it2->second; - - } - } - - vector< TMatrixT<double> > FissionXSMatrix; // Store The Fisison XS Matrix - vector< TMatrixT<double> > CaptureXSMatrix; // Store The Capture XS Matrix - vector< TMatrixT<double> > n2nXSMatrix; // Store The n2N XS Matrix - DBGL - for(int i = 0; i < NStep-1; i++) - { - double TStepMax = ( (DBTimeStep[i+1]-DBTimeStep[i] ) ) * Power_ref/M_ref / Power*M ; // Get the next Time step - - - TMatrixT<double> BatemanMatrix = TMatrixT<double>(findex.size(),findex.size()); - TMatrixT<double> BatemanReactionMatrix = TMatrixT<double>(findex.size(),findex.size()); - - TMatrixT<double> NEvolutionMatrix = TMatrixT<double>(findex.size(),1); - NEvolutionMatrix = NMatrix.back(); - - - - FissionXSMatrix.push_back(GetFissionXsMatrix(XSSet, DBTimeStep[i])); //Feel the fission reaction Matrix - CaptureXSMatrix.push_back(GetCaptureXsMatrix(XSSet, DBTimeStep[i])); //Feel the capture reaction Matrix - n2nXSMatrix.push_back(Getn2nXsMatrix(XSSet, DBTimeStep[i])); //Feel the (n,2n) reaction Matrix - - // ---------------- Evolution - - BatemanReactionMatrix = FissionXSMatrix[i]; - BatemanReactionMatrix += CaptureXSMatrix[i]; - BatemanReactionMatrix += n2nXSMatrix[i]; - - for(int k=0; k < InsideStep; k++) - { - double ESigmaN = 0; - for (int j = 0; j < (int)findex.size() ; j++) - ESigmaN -= FissionXSMatrix[i][j][j]*NEvolutionMatrix[j][0]*1.6e-19*FissionEnergy[j][0]; - // Update Flux - double Flux_k = Power/ESigmaN; - - if(k==0) - Flux[i]=Flux_k; - - BatemanMatrix = BatemanReactionMatrix; - BatemanMatrix *= Flux_k; - BatemanMatrix += fDecayMatrix ; - BatemanMatrix *= TStepMax/InsideStep ; - - - TMatrixT<double> IdMatrix = TMatrixT<double>(findex.size(),findex.size()); - for(int j = 0; j < (int)findex.size(); j++) - for(int k = 0; k < (int)findex.size(); k++) - { - if(k == j) IdMatrix[j][k] = 1; - else IdMatrix[j][k] = 0; - } - - - TMatrixT<double> BatemanMatrixDL = TMatrixT<double>(findex.size(),findex.size()); // Order 0 Term from the DL : Id - TMatrixT<double> BatemanMatrixDLTermN = TMatrixT<double>(findex.size(),findex.size()); // Addind it; - - { - BatemanMatrix *= TStepMax ; - BatemanMatrixDLTermN = IdMatrix; - BatemanMatrixDL = BatemanMatrixDLTermN; - int j = 1; - double NormN; - - do - { - TMatrixT<double> BatemanMatrixDLTermtmp = TMatrixT<double>(findex.size(),findex.size()); // Adding it; - BatemanMatrixDLTermtmp = BatemanMatrixDLTermN; - - BatemanMatrixDLTermN.Mult(BatemanMatrixDLTermtmp, BatemanMatrix ); - - BatemanMatrixDLTermN *= 1./j; - BatemanMatrixDL += BatemanMatrixDLTermN; - - NormN = 0; - for(int m = 0; m < (int)findex.size(); m++) - for(int n = 0; n < (int)findex.size(); n++) - NormN += BatemanMatrixDLTermN[m][n]*BatemanMatrixDLTermN[m][n]; - j++; - - } while ( NormN != 0 ); - } - NEvolutionMatrix = BatemanMatrixDL * NEvolutionMatrix ; - } - NMatrix.push_back(NEvolutionMatrix); - - - timevector[i+1] = timevector[i] + TStepMax; - - BatemanMatrix.Clear(); - BatemanReactionMatrix.Clear(); - NEvolutionMatrix.Clear(); - - - } - DBGL - FissionXSMatrix.push_back(GetFissionXsMatrix(XSSet, DBTimeStep[NStep-1])); //Feel the reaction Matrix - CaptureXSMatrix.push_back(GetCaptureXsMatrix(XSSet, DBTimeStep[NStep-1])); //Feel the reaction Matrix - n2nXSMatrix.push_back(Getn2nXsMatrix(XSSet, DBTimeStep[NStep-1])); //Feel the reaction Matrix - - - EvolutionData GeneratedDB = EvolutionData(GetLog()); - - double ESigmaN = 0; - for (int j = 0; j < (int)findex.size() ; j++) - ESigmaN -= FissionXSMatrix.back()[j][j]*NMatrix.back()[j][0]*1.6e-19*FissionEnergy[j][0]; - - Flux[NStep-1] = Power/ESigmaN; - - GeneratedDB.SetFlux( new TGraph(NStep, timevector, Flux) ); - - for(int i = 0; i < (int)findex.size(); i++) - { - double ZAIQuantity[NMatrix.size()]; - double FissionXS[NStep]; - double CaptureXS[NStep]; - double n2nXS[NStep]; - for(int j = 0; j < (int)NMatrix.size(); j++) - ZAIQuantity[j] = (NMatrix[j])[i][0]; - - for(int j = 0; j < NStep; j++) - { - FissionXS[j] = FissionXSMatrix[j][i][i]; - CaptureXS[j] = CaptureXSMatrix[j][i][i]; - n2nXS[j] = n2nXSMatrix[j][i][i]; - } - - GeneratedDB.NucleiInsert(pair<ZAI, TGraph*> (findex.find(i)->second, new TGraph(NMatrix.size(), timevector, ZAIQuantity))); - GeneratedDB.FissionXSInsert(pair<ZAI, TGraph*> (findex.find(i)->second, new TGraph(NStep, timevector, FissionXS))); - GeneratedDB.CaptureXSInsert(pair<ZAI, TGraph*> (findex.find(i)->second, new TGraph(NStep, timevector, CaptureXS))); - GeneratedDB.n2nXSInsert(pair<ZAI, TGraph*> (findex.find(i)->second, new TGraph(NStep, timevector, n2nXS))); - } - - GeneratedDB.SetPower(Power ); - GeneratedDB.SetHeavyMetalMass(M); - GeneratedDB.SetReactorType(ReactorType ); - GeneratedDB.SetCycleTime(cycletime); - - for (int i = 0; i < (int) FissionXSMatrix.size(); i++) - { - FissionXSMatrix[i].Clear(); - CaptureXSMatrix[i].Clear(); - n2nXSMatrix[i].Clear(); - } - FissionXSMatrix.clear(); - CaptureXSMatrix.clear(); - n2nXSMatrix.clear(); - DBGL - return GeneratedDB; - -} - - - - - - - - - - - - - - - - - diff --git a/source/branches/CLASSV3/Model/Irradiation/IM_Matrix.hxx b/source/branches/CLASSV3/Model/Irradiation/IM_Matrix.hxx deleted file mode 100644 index 3e7cd65c8fa9d9c43a5926d83a14a92aa7edfdf0..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/Irradiation/IM_Matrix.hxx +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef _IMMATRIX_HXX -#define _IMMATRIX_HXX - - -/*! - \file - \brief Header file for IrradiationModel class. - - - @author BaM - @version 2.0 - */ -#include "IrradiationModel.hxx" - - -using namespace std; - - -class CLASSLogger; - -//-----------------------------------------------------------------------------// -/*! - Define a IM_Matrix. - The aim of these class is perform the calculation of the evolution of a fuel trough irradiation solving numericaly the Bateman using Matrix. - - - @author BaM - @version 3.0 - */ -//________________________________________________________________________ - -class EvolutionData; - -class IM_Matrix : public IrradiationModel -{ - - public : - - IM_Matrix(); - IM_Matrix(CLASSLogger* log); - - - - /// virtueal method called to perform the irradiation calculation using a set of cross section. - /*! - Perform the Irradiation Calcultion using the XSSet data - \param IsotopicVector IV isotopic vector to irradiate - \param EvolutionData XSSet set of corss section to use to perform the evolution calculation - */ - EvolutionData GenerateEvolutionData(IsotopicVector IV, EvolutionData XSSet, double Power, double cycletime); - //} - - - - - private : - - - -}; - -#endif - diff --git a/source/branches/CLASSV3/Model/Irradiation/IM_RK4.cxx b/source/branches/CLASSV3/Model/Irradiation/IM_RK4.cxx deleted file mode 100644 index 20123efd3cb16c6b0767b3542ffd7888ff2f8b0c..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/Irradiation/IM_RK4.cxx +++ /dev/null @@ -1,409 +0,0 @@ -// -// IM_RK4.cxx -// CLASSSource -// -// Created by BaM on 04/05/2014. -// Copyright (c) 2014 BaM. All rights reserved. -// - -#include "IM_RK4.hxx" - -#include "IsotopicVector.hxx" -#include "CLASSConstante.hxx" -#include "CLASSLogger.hxx" - -#include "StringLine.hxx" - -#include <TGraph.h> -#include <TString.h> - - -#include <sstream> -#include <string> -#include <iostream> -#include <fstream> -#include <algorithm> -#include <cmath> - - - -using namespace std; - - -//________________________________________________________________________ -IM_RK4::IM_RK4():IrradiationModel(new CLASSLogger("IM_RK4.log")), DynamicalSystem() -{ - fTheNucleiVector = 0; - fTheMatrix = 0; - - SetForbidNegativeValue(); - -} - - -IM_RK4::IM_RK4(CLASSLogger* log):IrradiationModel(log), DynamicalSystem() -{ - fTheNucleiVector = 0; - fTheMatrix = 0; - - SetForbidNegativeValue(); - -} - - - - - - - - - -//________________________________________________________________________ -/* Evolution Calculation */ -//________________________________________________________________________ -EvolutionData IM_RK4::GenerateEvolutionData(IsotopicVector isotopicvector, EvolutionData XSSet, double Power, double cycletime) -{ - DBGL - if(fFastDecay.size() == 0) - { - BuildDecayMatrix(); - fNVar = findex_inver.size(); - } - - SetTheMatrixToZero(); - SetTheNucleiVectorToZero(); - - string ReactorType; - - - vector< TMatrixT<double> > NMatrix ;// TMatrixT<double>(decayindex.size(),1)) - { // Filling the t=0 State; - map<ZAI, double > isotopicquantity = isotopicvector.GetIsotopicQuantity(); - TMatrixT<double> N_0Matrix = TMatrixT<double>( findex.size(),1) ; - for(int i = 0; i < (int)findex.size(); i++) - N_0Matrix[i] = 0; - - map<ZAI, double >::iterator it ; - for(int i = 0; i < (int)findex.size(); i++) - N_0Matrix[i] = 0; - - for(it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - { - /// Need TO change with FP managment - map<ZAI, int >::iterator it2; - - if( (*it).first.Z() < fZAIThreshold ) - it2 = findex_inver.find( ZAI(-2,-2,-2) ); - else it2 = findex_inver.find( (*it).first ); - - if(it2 == findex_inver.end() ) //If not in index should be TMP, can't be fast decay for new Fuel !!! - it2 = findex_inver.find( ZAI(-3,-3,-3) ); - N_0Matrix[ (*it2).second ][0] = (*it).second ; - - - } - - isotopicquantity.clear(); - - NMatrix.push_back(N_0Matrix); - N_0Matrix.Clear(); - - } - - - //-------------------------// - //--- Perform Evolution ---// - //-------------------------// - ReactorType = XSSet.GetReactorType(); - - double M_ref = XSSet.GetHeavyMetalMass(); - double M = 0; - double Power_ref = XSSet.GetPower(); - - // Get the mass of the fuel to irradiate in order to perform the evolution at fixed burnup (the burnup step of the calculation will match the burnup step of the XSSet - { - map<ZAI, double >::iterator it ; - - - IsotopicVector IVtmp = isotopicvector.GetActinidesComposition(); - map<ZAI, double >isotopicquantity = IVtmp.GetIsotopicQuantity(); - - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++ ) - M += isotopicvector.GetActinidesComposition().GetZAIIsotopicQuantity( (*it).first )*cZAIMass.fZAIMass.find( (*it).first )->second/AVOGADRO*1e-6; - isotopicquantity.clear(); - - } - - int NStep = XSSet.GetFissionXS().begin()->second->GetN(); - double* DBTimeStep = XSSet.GetFissionXS().begin()->second->GetX(); - - int InsideStep = 10; - - double timevector[NStep]; - timevector[0] = 0; - - double Flux[NStep]; - - TMatrixT<double> FissionEnergy = TMatrixT<double>(findex.size(),1); - for(int i = 0; i < (int)findex.size(); i++) - FissionEnergy[i] = 0; - - { - map< ZAI, int >::iterator it; - for(it = findex_inver.begin(); it != findex_inver.end(); it++) - { - map< ZAI, double >::iterator it2 = fFissionEnergy.find(it->first); - if(it2 == fFissionEnergy.end()) - { - if(it->first.Z() > fZAIThreshold) - FissionEnergy[it->second][0] = 1.9679e6*it->first.A()-2.601e8; // //simple linear fit to known values ;extrapolation to unknown isotopes - else FissionEnergy[it->second][0] = 0; - } - else - FissionEnergy[it->second][0] = it2->second; - - } - } - - vector< TMatrixT<double> > FissionXSMatrix; // Store The Fisison XS Matrix - vector< TMatrixT<double> > CaptureXSMatrix; // Store The Capture XS Matrix - vector< TMatrixT<double> > n2nXSMatrix; // Store The n2N XS Matrix - DBGL - for(int i = 0; i < NStep-1; i++) - { - double TStepMax = ( (DBTimeStep[i+1]-DBTimeStep[i] ) ) * Power_ref/M_ref / Power*M ; // Get the next Time step - - - TMatrixT<double> BatemanMatrix = TMatrixT<double>(findex.size(),findex.size()); - TMatrixT<double> BatemanReactionMatrix = TMatrixT<double>(findex.size(),findex.size()); - - TMatrixT<double> NEvolutionMatrix = TMatrixT<double>(findex.size(),1); - NEvolutionMatrix = NMatrix.back(); - - - - FissionXSMatrix.push_back(GetFissionXsMatrix(XSSet, DBTimeStep[i])); //Feel the fission reaction Matrix - CaptureXSMatrix.push_back(GetCaptureXsMatrix(XSSet, DBTimeStep[i])); //Feel the capture reaction Matrix - n2nXSMatrix.push_back(Getn2nXsMatrix(XSSet, DBTimeStep[i])); //Feel the (n,2n) reaction Matrix - - // ---------------- Evolution - - BatemanReactionMatrix = FissionXSMatrix[i]; - BatemanReactionMatrix += CaptureXSMatrix[i]; - BatemanReactionMatrix += n2nXSMatrix[i]; - - for(int k=0; k < InsideStep; k++) - { - double ESigmaN = 0; - for (int j = 0; j < (int)findex.size() ; j++) - ESigmaN -= FissionXSMatrix[i][j][j]*NEvolutionMatrix[j][0]*1.6e-19*FissionEnergy[j][0]; - // Update Flux - double Flux_k = Power/ESigmaN; - - if(k==0) - Flux[i]=Flux_k; - - BatemanMatrix = BatemanReactionMatrix; - BatemanMatrix *= Flux_k; - BatemanMatrix += fDecayMatrix ; - - SetTheMatrixToZero(); - SetTheNucleiVectorToZero(); - - SetTheMatrix(BatemanMatrix); - SetTheNucleiVector(NEvolutionMatrix); - - - RungeKutta(fTheNucleiVector, timevector[i]+TStepMax/InsideStep*k, timevector[i]+TStepMax/InsideStep*(k+1), fNVar); - NEvolutionMatrix = GetTheNucleiVector(); - - } - NEvolutionMatrix = GetTheNucleiVector(); - NMatrix.push_back(NEvolutionMatrix); - - timevector[i+1] = timevector[i] + TStepMax; - - BatemanMatrix.Clear(); - BatemanReactionMatrix.Clear(); - NEvolutionMatrix.Clear(); - - - } - FissionXSMatrix.push_back(GetFissionXsMatrix(XSSet, DBTimeStep[NStep-1])); //Feel the reaction Matrix - CaptureXSMatrix.push_back(GetCaptureXsMatrix(XSSet, DBTimeStep[NStep-1])); //Feel the reaction Matrix - n2nXSMatrix.push_back(Getn2nXsMatrix(XSSet, DBTimeStep[NStep-1])); //Feel the reaction Matrix - - - EvolutionData GeneratedDB = EvolutionData(GetLog()); - - double ESigmaN = 0; - for (int j = 0; j < (int)findex.size() ; j++) - ESigmaN -= FissionXSMatrix.back()[j][j]*NMatrix.back()[j][0]*1.6e-19*FissionEnergy[j][0]; - - Flux[NStep-1] = Power/ESigmaN; - - GeneratedDB.SetFlux( new TGraph(NStep, timevector, Flux) ); - - for(int i = 0; i < (int)findex.size(); i++) - { - double ZAIQuantity[NMatrix.size()]; - double FissionXS[NStep]; - double CaptureXS[NStep]; - double n2nXS[NStep]; - for(int j = 0; j < (int)NMatrix.size(); j++) - ZAIQuantity[j] = (NMatrix[j])[i][0]; - - for(int j = 0; j < NStep; j++) - { - FissionXS[j] = FissionXSMatrix[j][i][i]; - CaptureXS[j] = CaptureXSMatrix[j][i][i]; - n2nXS[j] = n2nXSMatrix[j][i][i]; - } - - GeneratedDB.NucleiInsert(pair<ZAI, TGraph*> (findex.find(i)->second, new TGraph(NMatrix.size(), timevector, ZAIQuantity))); - GeneratedDB.FissionXSInsert(pair<ZAI, TGraph*> (findex.find(i)->second, new TGraph(NStep, timevector, FissionXS))); - GeneratedDB.CaptureXSInsert(pair<ZAI, TGraph*> (findex.find(i)->second, new TGraph(NStep, timevector, CaptureXS))); - GeneratedDB.n2nXSInsert(pair<ZAI, TGraph*> (findex.find(i)->second, new TGraph(NStep, timevector, n2nXS))); - } - DBGL - GeneratedDB.SetPower(Power ); - GeneratedDB.SetHeavyMetalMass(M); - GeneratedDB.SetReactorType(ReactorType ); - GeneratedDB.SetCycleTime(cycletime); - - ResetTheMatrix(); - ResetTheNucleiVector(); - - for (int i = 0; i < (int) FissionXSMatrix.size(); i++) - { - FissionXSMatrix[i].Clear(); - CaptureXSMatrix[i].Clear(); - n2nXSMatrix[i].Clear(); - } - FissionXSMatrix.clear(); - CaptureXSMatrix.clear(); - n2nXSMatrix.clear(); - DBGL - return GeneratedDB; - -} - - -void IM_RK4::ResetTheMatrix() -{ - - if(fTheMatrix) - { - for(int i= 0; i<fNVar; i++) - delete [] fTheMatrix[i]; - delete [] fTheMatrix; - } - fTheMatrix = 0; -} - -void IM_RK4::SetTheMatrixToZero() -{ - ResetTheMatrix(); - - fNVar = findex.size(); - fTheMatrix = new double*[fNVar]; - -#pragma omp parallel for - for(int i= 0; i < fNVar; i++) - fTheMatrix[i] = new double[fNVar]; - - for(int i = 0; i < fNVar; i++) - for(int k = 0; k < fNVar; k++) - { - fTheMatrix[i][k]=0.0; - } - -} - -//________________________________________________________________________ -void IM_RK4::ResetTheNucleiVector() -{ - if(fTheNucleiVector) - delete [] fTheNucleiVector; - fTheNucleiVector = 0; -} - -//________________________________________________________________________ -void IM_RK4::SetTheNucleiVectorToZero() -{ - ResetTheNucleiVector(); - fTheNucleiVector = new double[fNVar]; - -#pragma omp parallel for - for(int i = 0; i < fNVar; i++) - fTheNucleiVector[i]=0.0; - -} - -//________________________________________________________________________ -void IM_RK4::BuildEqns(double t, double *N, double *dNdt) -{ - double sum=0; - // pragma omp parallel for reduction(+:sum) - for(int i = 0; i < fNVar; i++) - { - sum=0; - for(int k = 0; k < fNVar; k++) - { - sum += fTheMatrix[i][k]*N[k]; - } - dNdt[i] = sum; - } -} - -//________________________________________________________________________ -void IM_RK4::SetTheMatrix(TMatrixT<double> BatemanMatrix) -{ - for (int k = 0; k < (int)fNVar; k++) - for (int l = 0; l < (int)findex_inver.size(); l++) - fTheMatrix[l][k] = BatemanMatrix[l][k]; -} - -//________________________________________________________________________ -TMatrixT<double> IM_RK4::GetTheMatrix() -{ - TMatrixT<double> BatemanMatrix = TMatrixT<double>(findex.size(),findex.size()); - for (int k = 0; k < (int)fNVar; k++) - for (int l = 0; l < (int)findex_inver.size(); l++) - BatemanMatrix[l][k] = fTheMatrix[l][k]; - - return BatemanMatrix; -} - -//________________________________________________________________________ -void IM_RK4::SetTheNucleiVector(TMatrixT<double> NEvolutionMatrix) -{ - for (int k = 0; k < (int)fNVar; k++) - fTheNucleiVector[k] = NEvolutionMatrix[k][0]; -} - -//________________________________________________________________________ -TMatrixT<double> IM_RK4::GetTheNucleiVector() -{ - TMatrixT<double> NEvolutionMatrix = TMatrixT<double>(findex.size(),1); - for (int k = 0; k < (int)fNVar; k++) - NEvolutionMatrix[k][0] = fTheNucleiVector[k]; - - return NEvolutionMatrix; -} - - - - - - - - - - - - - - - - diff --git a/source/branches/CLASSV3/Model/Irradiation/IM_RK4.hxx b/source/branches/CLASSV3/Model/Irradiation/IM_RK4.hxx deleted file mode 100644 index 5ab986e28e36bf66070604e70de3442b61acfb4b..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/Irradiation/IM_RK4.hxx +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef _IMRK4_HXX -#define _IMRK4_HXX - - -/*! - \file - \brief Header file for IrradiationModel class. - - - @author BaM - @version 2.0 - */ -#include "DynamicalSystem.hxx" -#include "IrradiationModel.hxx" - - -using namespace std; - - -class CLASSLogger; - -//-----------------------------------------------------------------------------// -/*! - Define a IM_RK4. - The aim of these class is perform the calculation of the evolution of a fuel trough irradiation solving numericaly the Bateman using RK4. - - - @author BaM - @version 3.0 - */ -//________________________________________________________________________ - -class EvolutionData; - -class IM_RK4 : public IrradiationModel, DynamicalSystem -{ - - public : - - IM_RK4(); - IM_RK4(CLASSLogger* Log); - - - - /// virtueal method called to perform the irradiation calculation using a set of cross section. - /*! - Perform the Irradiation Calcultion using the XSSet data - \param IsotopicVector IV isotopic vector to irradiate - \param EvolutionData XSSet set of corss section to use to perform the evolution calculation - */ - EvolutionData GenerateEvolutionData(IsotopicVector IV, EvolutionData XSSet, double Power, double cycletime); - //} - - //********* RK4 Method *********// - - //@} - /*! - \name RK4 Method - */ - //@{ - - - using DynamicalSystem::RungeKutta; - //! Pre-treatment Runge-Kutta method. - /*! - // This method does initialisation and then call DynamicalSystem::RungeKutta - // \param t1: initial time - // \param t2: final time - */ - - - void BuildEqns(double t, double *N, double *dNdt); - void SetTheMatrixToZero(); //!< Initialize the evolution Matrix - void ResetTheMatrix(); - void SetTheMatrix(TMatrixT<double> BatemanMatrix); //!< Set the Evolution Matrix (Bateman equations) - TMatrixT<double> GetTheMatrix(); //!< return the Evolution Matrix (Bateman equations) - - void SetTheNucleiVectorToZero(); //!< Initialize the evolution Matrix - void ResetTheNucleiVector(); - void SetTheNucleiVector(TMatrixT<double> NEvolutionMatrix); //!< Set the Evolution Matrix (Bateman equations) - TMatrixT<double> GetTheNucleiVector(); //!< return the Evolution Matrix (Bateman equations) - //@} - - - - private : - - double *fTheNucleiVector; //!< The evolving atoms copied from Material proportions. - double **fTheMatrix; //!< The evolution Matrix - - double fPrecision; //!< Precision of the RungeKutta - double fHestimate; //!< RK Step estimation. - double fHmin; //!< RK minimum Step. - double fMaxHdid; //!< store the effective RK max step - double fMinHdid; //!< store the effective RK min step - bool fIsNegativeValueAllowed; //!< whether or not negative value are physical. - - -}; - -#endif - diff --git a/source/branches/CLASSV3/Model/XS/XSM_CLOSEST.cxx b/source/branches/CLASSV3/Model/XS/XSM_CLOSEST.cxx deleted file mode 100644 index c8be61c8c8086d38760fc12404e6f82d03802fd3..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/XS/XSM_CLOSEST.cxx +++ /dev/null @@ -1,372 +0,0 @@ -#include "XSModel.hxx" -#include "XSM_CLOSEST.hxx" -#include "CLASSLogger.hxx" -#include "StringLine.hxx" - - -#include <TGraph.h> -#include <TString.h> -#include "TSystem.h" -#include "TROOT.h" - -#include <sstream> -#include <string> -#include <iostream> -#include <fstream> -#include <algorithm> -#include <cmath> - - - - -//________________________________________________________________________ -// -// XSM_CLOSEST -// -// -// -// -//________________________________________________________________________ - -XSM_CLOSEST::XSM_CLOSEST(string DB_index_file, bool oldreadmethod ): XSModel(new CLASSLogger("XSM_CLOSEST.log")) -{ - fOldReadMethod = oldreadmethod; - fDataBaseIndex = DB_index_file; - fDistanceType = 0; - fWeightedDistance = false; - fEvolutionDataInterpolation = false; - ReadDataBase(); - - // Warning - INFO << " A EvolutionData has been define :" << endl; - INFO << "\t His index is : \"" << DB_index_file << "\" " << endl; - INFO << "\t " << fFuelDataBank.size() << " EvolutionData have been read."<< endl << endl; - -} - -//________________________________________________________________________ -XSM_CLOSEST::XSM_CLOSEST(CLASSLogger* Log,string DB_index_file, bool oldreadmethod ): XSModel(Log) -{ - fOldReadMethod = oldreadmethod; - fDataBaseIndex = DB_index_file; - fDistanceType = 0; - fWeightedDistance = false; - fEvolutionDataInterpolation = false; - ReadDataBase(); - - // Warning - INFO << " A EvolutionData has been define :" << endl; - INFO << "\t His index is : \"" << DB_index_file << "\" " << endl; - INFO << "\t " << fFuelDataBank.size() << " EvolutionData have been read."<< endl << endl; - -} - -//________________________________________________________________________ -XSM_CLOSEST::~XSM_CLOSEST() -{ - for( int i = 0; i < (int)fFuelDataBank.size(); i++) - fFuelDataBank[i].DeleteEvolutionData(); - fFuelDataBank.clear(); -} - -//________________________________________________________________________ -void XSM_CLOSEST::ReadDataBase() -{ - - if(fFuelDataBank.size() != 0) - { - for( int i = 0; i < (int)fFuelDataBank.size(); i++) - fFuelDataBank[i].DeleteEvolutionData(); - fFuelDataBank.clear(); - } - - - ifstream DataDB(fDataBaseIndex.c_str()); // Open the File - if(!DataDB) - WARNING << " Can't open \"" << fDataBaseIndex << "\"\n" << endl; - - vector<double> vTime; - vector<double> vTimeErr; - - string line; - int start = 0; - - - // First Get Fuel Type - getline(DataDB, line); - if( StringLine::NextWord(line, start, ' ') != "TYPE") - { - ERROR << " Bad Database file : " << fDataBaseIndex << " Can't find the type of the DataBase"<< endl; - exit (1); - } - fFuelType = StringLine::NextWord(line, start, ' '); - - //Then Get All the Database - - while (!DataDB.eof()) - { - getline(DataDB, line); - if(line != "") - { - EvolutionData evolutionproduct(GetLog(), line, fOldReadMethod); - fFuelDataBank.push_back(evolutionproduct); - } - } - -} -//________________________________________________________________________ -//________________________________________________________________________ -//________________________________________________________________________ -/* Distance Calculation */ -//________________________________________________________________________ -//________________________________________________________________________ -//________________________________________________________________________ -map<double, int> XSM_CLOSEST::GetDistancesTo(IsotopicVector isotopicvector, double t) -{ - - map<double, int> distances; - - for( int i = 0; i < (int)fFuelDataBank.size(); i++) - { - pair<map<double, int>::iterator, bool> IResult; - - IsotopicVector ActinidesCompositionAtT = fFuelDataBank[i].GetIsotopicVectorAt(t).GetActinidesComposition(); - IsotopicVector IV_ActinidesComposition = isotopicvector.GetActinidesComposition(); - - double NormalisationFactor = Norme(IV_ActinidesComposition) / Norme( ActinidesCompositionAtT ); - - - double distance = Distance( IV_ActinidesComposition, - ActinidesCompositionAtT / NormalisationFactor, - fDistanceType, - fDistanceParameter); - - IResult = distances.insert( pair< double, int >(distance, i) ); - } - - return distances; - -} -//________________________________________________________________________ -EvolutionData XSM_CLOSEST::GetCrossSections(IsotopicVector isotopicvector, double t) -{ - DBGL - double distance = 0; - int N_BestEvolutionData = 0; - - - if(fWeightedDistance) - { - DBGL - IsotopicVector ActinidesCompositionAtT = fFuelDataBank[0].GetIsotopicVectorAt(t).GetActinidesComposition(); - IsotopicVector IV_ActinidesComposition = isotopicvector.GetActinidesComposition(); - - double NormalisationFactor = Norme( ActinidesCompositionAtT ) / Norme(IV_ActinidesComposition); - - - distance = Distance( IV_ActinidesComposition / NormalisationFactor, - fFuelDataBank[0]); - - - for( int i = 1; i < (int)fFuelDataBank.size(); i++) - { - double D = 0; - ActinidesCompositionAtT = fFuelDataBank[i].GetIsotopicVectorAt(t).GetActinidesComposition(); - IV_ActinidesComposition = isotopicvector.GetActinidesComposition(); - NormalisationFactor = Norme( ActinidesCompositionAtT ) / Norme(IV_ActinidesComposition); - - D = Distance( IV_ActinidesComposition / NormalisationFactor, - fFuelDataBank[i]); - - - if (D< distance) - { - distance = D; - N_BestEvolutionData = i; - } - } - DBGL - return fFuelDataBank[N_BestEvolutionData]; - } - else if (fEvolutionDataInterpolation) - { - DBGL - map<double, int> distance_map = GetDistancesTo(isotopicvector, t); - map<double, int>::iterator it_distance; - int NClose = 64; - int Nstep = 0; - EvolutionData EvolInterpolate; - double SumOfDistance = 0; - for( it_distance = distance_map.begin(); it_distance != distance_map.end(); it_distance++) - { - - double distance = (*it_distance).first; - int ED_Indice = (*it_distance).second; - - if(distance == 0 ) - { - EvolInterpolate = Multiply(1,fFuelDataBank[ED_Indice]); - return EvolInterpolate; - } - - if(Nstep == 0) - EvolInterpolate = Multiply(1./distance, fFuelDataBank[ED_Indice]); - else - { - - EvolutionData Evoltmp = EvolInterpolate; - EvolutionData Evoltmp2 = Multiply(1./distance, fFuelDataBank[ED_Indice]); - - EvolInterpolate = Sum(Evoltmp, Evoltmp2); - Evoltmp.DeleteEvolutionData(); - Evoltmp2.DeleteEvolutionData(); - - - } - - SumOfDistance += 1./distance; - Nstep++; - if(Nstep == NClose) break; - - } - - EvolutionData Evoltmp = EvolInterpolate; - EvolInterpolate.Clear(); - - EvolInterpolate = Multiply(1/SumOfDistance, Evoltmp); - - Evoltmp.DeleteEvolutionData(); - DBGL - return EvolInterpolate; - - } - else - { - DBGL - IsotopicVector ActinidesCompositionAtT = fFuelDataBank[0].GetIsotopicVectorAt(t).GetActinidesComposition(); - IsotopicVector IV_ActinidesComposition = isotopicvector.GetActinidesComposition(); - - - double NormalisationFactor = Norme(IV_ActinidesComposition) / Norme( ActinidesCompositionAtT ); - - - distance = Distance( IV_ActinidesComposition, - ActinidesCompositionAtT / NormalisationFactor, - fDistanceType, - fDistanceParameter); - - for( int i = 1; i < (int)fFuelDataBank.size(); i++) - { - double D = 0; - ActinidesCompositionAtT = fFuelDataBank[i].GetIsotopicVectorAt(t).GetActinidesComposition(); - IV_ActinidesComposition = isotopicvector.GetActinidesComposition(); - - NormalisationFactor = Norme(IV_ActinidesComposition) / Norme( ActinidesCompositionAtT ); - D = Distance( IV_ActinidesComposition, - ActinidesCompositionAtT / NormalisationFactor, - fDistanceType, - fDistanceParameter); - - if (D< distance) - { - distance = D; - N_BestEvolutionData = i; - } - } - - - INFO << distance << endl; - DBGL - - return fFuelDataBank[N_BestEvolutionData]; - } - -} -//________________________________________________________________________ -void XSM_CLOSEST::CalculateDistanceParameter() -{ - DBGL - if(fDistanceType!=1){ - WARNING << " Distance Parameter will be calculate even if the distance type is not the good one. Any Distance Parameters given by the user will be overwriten" << endl; - } - - fDistanceParameter.Clear(); - - //We calculate the weight for the distance calculation. - int NevolutionDatainFuelDataBank = 0; - - for( int i = 0; i < (int)fFuelDataBank.size(); i++) - { - NevolutionDatainFuelDataBank++; - map<ZAI ,double>::iterator itit; - map<ZAI ,double> isovector = fFuelDataBank[i].GetIsotopicVectorAt(0).GetIsotopicQuantity(); - for(itit=isovector.begin(); itit != isovector.end(); itit++) //Boucle sur ZAI - { - double TmpXS=0; - - for( int i=1; i<4; i++ ) //Loop on Reactions 1==fission, 2==capture, 3==n2n - TmpXS+= fFuelDataBank[i].GetXSForAt(0, (*itit).first, i); - - fDistanceParameter.Add((*itit).first,TmpXS); - } - - - } - fDistanceParameter.Multiply( (double)1.0/NevolutionDatainFuelDataBank ); - - if(GetLog()) - { - INFO <<"!!INFO!! Distance Parameters "<<endl; - map<ZAI ,double >::iterator it2; - for(it2 = fDistanceParameter.GetIsotopicQuantity().begin();it2 != fDistanceParameter.GetIsotopicQuantity().end(); it2++) - { - INFO << (*it2).first.Z() << " "; - INFO << (*it2).first.A() << " "; - INFO << (*it2).first.I() << " "; - INFO << ": " << (*it2).second; - INFO << endl; - } - INFO << endl; - } - - DBGL -} -//________________________________________________________________________ -void XSM_CLOSEST::SetDistanceParameter(IsotopicVector DistanceParameter) -{ - - fDistanceParameter = DistanceParameter; - - INFO <<"!!INFO!! Distance Parameters "<<endl; - map<ZAI ,double >::iterator it2; - for(it2 = fDistanceParameter.GetIsotopicQuantity().begin();it2 != fDistanceParameter.GetIsotopicQuantity().end(); it2++) - { - INFO << (*it2).first.Z() << " "; - INFO << (*it2).first.A() << " "; - INFO << (*it2).first.I() << " "; - INFO << ": " << (*it2).second; - INFO << endl; - } - INFO << endl; - -} - -//________________________________________________________________________ -void XSM_CLOSEST::SetDistanceType(int DistanceType) -{ - - fDistanceType=DistanceType; - if(fDistanceType==1){ - CalculateDistanceParameter(); - } - else if(fDistanceType == 2 && Norme(fDistanceParameter)==0){ - // This is so bad!! You will probably unsynchronize all the reactor.... - WARNING << " Distance use weight defined by user for each isotope, but no weight have been given" << endl<<"Use SetDistanceParameter()"<<endl; - exit(1); - } - else if (fDistanceType != 0 && fDistanceType != 1 && fDistanceType != 2 ){ - ERROR << " Distancetype defined by the user isn't recognized by the code"<<endl; - exit(1); - } - -} \ No newline at end of file diff --git a/source/branches/CLASSV3/Model/XS/XSM_CLOSEST.hxx b/source/branches/CLASSV3/Model/XS/XSM_CLOSEST.hxx deleted file mode 100644 index 1bb835deda8f10cb1843bb6fed7eb20b8d9be2e7..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/XS/XSM_CLOSEST.hxx +++ /dev/null @@ -1,134 +0,0 @@ - -#ifndef _XSM_CLOSEST_HXX -#define _XSM_CLOSEST_HXX - - -/*! - \file - \brief Header file for XSM_MLP_PWR_MOX class. - - - @authors BaM,BLG - @version 1.0 - */ -#include "XSModel.hxx" -#include <string> -#include <fstream> -#include <iostream> -#include <map> -#include <vector> -typedef long long int cSecond; -using namespace std; - -//-----------------------------------------------------------------------------// -/*! - Define a XSM_CLOSEST. - CLASS to get cross sections from a set of pre-calculation - (with MURE,or other depletion code) - get cross sections of the closest (in composition) calculation - - @authors BaM,BLG - @version 1.0 - */ -//________________________________________________________________________ - - -class XSM_CLOSEST : public XSModel -{ - - public : - - /*! - \name Constructor/Desctructor - */ - //@{ - XSM_CLOSEST(string DB_index_file, bool oldreadmethod = false ); - XSM_CLOSEST(CLASSLogger* Log, string DB_index_file, bool oldreadmethod = false ); - ~XSM_CLOSEST(); - //{ - - - //********* Get Method *********// - /*! - \name Get Method - */ - //@{ - EvolutionData GetCrossSections(IsotopicVector isotopicvector,double t=0) ; //!< Reason to live of this CLASS Return the closest Evolutiondata - vector< EvolutionData > GetFuelDataBank() const { return fFuelDataBank; } //!< Return the FuelDataBank - string GetDataBaseIndex() const { return fDataBaseIndex; } //!< Return the index Name - string GetFuelType() const { return fFuelType; } //!< Return the fuel type of the DB - vector<double> GetFuelParameter() const { return fFuelParameter; } //!< Return the Fuel parameter of the DB - pair<double,double> GetBurnUpRange() const { return fBurnUpRange;} //!< Return the BurnUp range of the DB - bool IsDefine(IsotopicVector IV) const; //!< True the key is define, false unstead - - map<double, int> GetDistancesTo(IsotopicVector isotopicvector, double t = 0); //! Return a map containing the distance of each EvolutionData in the DataBase to the set IV at the t time - //@} - - //********* Set Method *********// - - /*! - \name Set Method - */ - //@{ - - void SetFuelDataBank(vector< EvolutionData > mymap) { fFuelDataBank = mymap; } //!< Set the FuelDataBank map - - void SetDataBaseIndex(string database) { fDataBaseIndex = database;; ReadDataBase(); } //!< Set the Name of the database index - void SetOldReadMethod(bool val) { fOldReadMethod = val; ReadDataBase();} ///< use the old reading method - - - - void SetWeightedDistanceCalculation(bool val = true) { fWeightedDistance = val;} ///< Set weighted Distance calculation - void SetInventoryEvolutionInterpolation(bool val = true) { fEvolutionDataInterpolation = val;} ///< Set weighted Distance calculation - void SetDistanceParameter(IsotopicVector DistanceParameter); ///< Define mannually the weight for each ZAI in the distance calculation - - - //{ - /// Define the way to decide if two isotopic vectors are close. - /*! - // The different algorythm are: - // \li 0 is for the standard norme, - // \li 1 for each ZAI weighted with its XS, - // \li 2 for each ZAI weighted with coefficient given by the user. - */ - void SetDistanceType(int DistanceType); - //} - - //********* Other Method *********// - /*! - \name Other Method - */ - //@{ - void ReadDataBase(); ///< read the index file and fill the evolutionData map - void CalculateDistanceParameter(); ///< Calcul of the weight for each ZAI in the distance calculation from the mean XS of the FuelDataBank - - //@} - - private : - - vector< EvolutionData > fFuelDataBank; ///< DataBanck map - - string fDataBaseIndex; ///< Name of the index - - bool fOldReadMethod; ///< use old DB format - bool fWeightedDistance; ///< USe XS weighted distance calculation - bool fEvolutionDataInterpolation; ///< USe XS weighted distance calculation - - - string fFuelType; ///< Type of fuel of the FuelDataBank - pair<double,double> fBurnUpRange; ///< Range of the Burn-up range of the FuelDataBank - vector<double> fFuelParameter; ///< Parameter needed by the equivalence model - - - - int fDistanceType; ///< Set the distance calculation algorytm - /// \li 0 is for the standard norm (Default = 0), - /// \li 1 for each ZAI weighted with its XS, - /// \li 2 for each ZAI weighted with coefficient given by the user. - - IsotopicVector fDistanceParameter; ///< weight for each ZAI in the distance calculation - -}; - -#endif - diff --git a/source/branches/CLASSV3/Model/XS/XSM_MLP.cxx b/source/branches/CLASSV3/Model/XS/XSM_MLP.cxx deleted file mode 100644 index e8a6a1f363b209120304317ac99164175f5249e5..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/XS/XSM_MLP.cxx +++ /dev/null @@ -1,510 +0,0 @@ - -#include "XSModel.hxx" -#include "XSM_MLP.hxx" -#include "CLASSLogger.hxx" -#include "StringLine.hxx" - -#include "TMVA/Reader.h" -#include "TMVA/Tools.h" -#include "TMVA/MethodCuts.h" - -#include <TGraph.h> -#include <TString.h> -#include "TFile.h" -#include "TSystem.h" -#include "TROOT.h" -#include "TStopwatch.h" - -#include <dirent.h> -#include <errno.h> -#include <sstream> -#include <string> -#include <iostream> -#include <fstream> -#include <algorithm> -#include <cmath> - -//________________________________________________________________________ -// -// XSM_MLP -// -// -// -// -//________________________________________________________________________ -XSM_MLP::XSM_MLP(string TMVA_Weight_Directory,string InformationFile, bool IsTimeStep):XSModel(new CLASSLogger("XSM_MLP.log")) -{ - - fIsStepTime=IsTimeStep; - fTMVAWeightFolder = TMVA_Weight_Directory; - if(InformationFile=="") - fMLPInformationFile = TMVA_Weight_Directory+"/Data_Base_Info.nfo"; - else - fMLPInformationFile=fTMVAWeightFolder+InformationFile; - - GetMLPWeightFiles(); - GetDataBaseInformation(); - - INFO<<"__A cross section interpolator using" <<endl; - INFO<<"Multi Layer Perceptron has been define__"<<endl; - INFO << " \t His TMVA folder is : \" " << fTMVAWeightFolder << "\"" << endl; - -} -//________________________________________________________________________ -XSM_MLP::XSM_MLP(CLASSLogger* Log,string TMVA_Weight_Directory,string InformationFile, bool IsTimeStep):XSModel(Log) -{ - - fIsStepTime=IsTimeStep; - fTMVAWeightFolder = TMVA_Weight_Directory; - if(InformationFile=="") - fMLPInformationFile = TMVA_Weight_Directory+"/Data_Base_Info.nfo"; - else - fMLPInformationFile=fTMVAWeightFolder+InformationFile; - - GetMLPWeightFiles(); - GetDataBaseInformation(); - - INFO<<"__A cross section interpolator using" <<endl; - INFO<<"Multi Layer Perceptron has been define__"<<endl; - INFO << " \t His TMVA folder is : \" " << fTMVAWeightFolder << "\"" << endl; - -} -//________________________________________________________________________ -XSM_MLP::~XSM_MLP() -{ - fMapOfTMVAVariableNames.clear(); -} -//________________________________________________________________________ -void XSM_MLP::GetDataBaseInformation() -{ - ifstream FILE(fMLPInformationFile.c_str()); - - if(FILE.good()) - { - while(!FILE.eof()) - { - string line; - getline(FILE, line); - size_t foundRType = line.find("ReactorType :"); - size_t foundFType = line.find("FuelType :"); - size_t foundHM = line.find("Heavy Metal (t) :"); - size_t foundPower = line.find("Thermal Power (W) :"); - size_t foundTime = line.find("Time (s) :"); - size_t foundZAI = line.find("Z A I Name (input MLP) :"); - int pos=0; - if(foundRType != std::string::npos) - { StringLine::NextWord(line,pos,':'); - fDataBaseRType = atof( (StringLine::NextWord(line,pos,':')).c_str() ); - } - if(foundFType != std::string::npos) - { StringLine::NextWord(line,pos,':'); - fDataBaseFType = atof( (StringLine::NextWord(line,pos,':')).c_str() ); - } - if(foundHM != std::string::npos) - { StringLine::NextWord(line,pos,':'); - fDataBaseHMMass = atof( (StringLine::NextWord(line,pos,':')).c_str() ); - } - if(foundPower !=std::string::npos) - { StringLine::NextWord(line,pos,':'); - fDataBasePower = atof( (StringLine::NextWord(line,pos,':') ).c_str() ); - } - pos=0; - if(foundTime!=std::string::npos) - { - StringLine::NextWord(line,pos,':'); - while( pos< (int)line.size() ) - fMLP_Time.push_back( atof( (StringLine::NextWord(line,pos,' ')).c_str() )); - } - - if(foundZAI != std::string::npos) - { - while(!FILE.eof()) - { - int Z=-4; - int A=-4; - int I=-4; - string Name; - getline(FILE, line); - stringstream ssline; - ssline<<line; - ssline>>Z>>A>>I>>Name; - //cout<<Z<<" "<<A<<" "<<I<<" "<<Name<<endl; - fMapOfTMVAVariableNames.insert( pair<ZAI,string>(ZAI(Z,A,I),Name) ); - - } - } - - } - } - else - { - ERROR << "Can't find/open file " << fMLPInformationFile << endl; - exit(0); - } - - /********DEBUG*************************************/ - INFO<<"\tMLP XS Data Base Information : "<<endl; - INFO<<"\t\tHeavy Metal (t) :"<<fDataBaseHMMass<<endl; - INFO<<"\t\tThermal Power (W) :"<<fDataBasePower<<endl; - INFO<<"\t\tTime (s) :"<<endl; - for (int i = 0; i < (int)fMLP_Time.size(); ++i) - INFO<<"\t\t\t"<<fMLP_Time[i]<<endl; - INFO<<"\t\tZ A I Name (input MLP) :"<<endl; - - map<ZAI ,string >::iterator it; - - for (it= fMapOfTMVAVariableNames.begin();it!=fMapOfTMVAVariableNames.end();it++) - INFO<<"\t\t\t"<< it->first.Z()<<" "<<it->first.A()<<" "<<it->second<<endl; - - -} -//________________________________________________________________________ -void XSM_MLP::GetMLPWeightFiles() -{DBGL - /**********Get All TMVA weight files*******************/ - //check if the folder containing weights exists - DIR* rep = NULL; - struct dirent* fichierLu = NULL; - rep = opendir(fTMVAWeightFolder.c_str()); - if (rep == NULL) - { - perror(""); - exit(1); - } - - /**Save file names of TMVA weights*/ - fWeightFiles.resize(0); - while ((fichierLu = readdir(rep)) != NULL) - { - string FileName= fichierLu->d_name ; - if(FileName != "." && FileName != ".." ) - { - if(FileName[FileName.size()-3]=='x' && FileName[FileName.size()-2]=='m' && FileName[FileName.size()-1]=='l' ) - fWeightFiles.push_back(FileName); - - } - } - DBGL -} -//________________________________________________________________________ -//________________________________________________________________________ -// -// Time (MLP take time as parameter) -//________________________________________________________________________ -//________________________________________________________________________ -void XSM_MLP::ReadWeightFile(string Filename, int &Z, int &A, int &I, int &Reaction) -{ - Z=-1; - A=-1; - I=-1; - Reaction=-1; - - size_t found = Filename.find("XS"); - - string NameJOB; - NameJOB=Filename.substr(found); - int pos=0; - - StringLine::NextWord(NameJOB, pos, '_'); - - Z = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); - - A = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); - - I = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); - - string sReaction = (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ; - size_t foundext = sReaction.find(".weights.xml"); - sReaction = sReaction.substr(0,foundext); - - if(sReaction=="fis") - Reaction=0; - if(sReaction=="cap") - Reaction=1; - if(sReaction=="n2n") - Reaction=2; - - if(Z<=0 || A<=0 || I<0 || Reaction==-1) - { - ERROR << " wrong TMVA weight format " << endl; - exit(0); - } - -} -//________________________________________________________________________ -TTree* XSM_MLP::CreateTMVAInputTree(IsotopicVector isotopicvector,int TimeStep) -{ - /******Create Input data tree to be interpreted by TMVA::Reader***/ - TTree* InputTree = new TTree("InTMP", "InTMP"); - - vector<float> InputTMVA; - for(int i = 0 ; i< (int)fMapOfTMVAVariableNames.size() ; i++) - InputTMVA.push_back(0); - - float Time=0; - - IsotopicVector IVInputTMVA; - map<ZAI ,string >::iterator it; - int j=0; - - for( it = fMapOfTMVAVariableNames.begin() ; it!=fMapOfTMVAVariableNames.end() ; it++) - { - InputTree->Branch( ((*it).second).c_str() ,&InputTMVA[j], ((*it).second + "/F").c_str()); - IVInputTMVA+= ((*it).first)*1; - j++; - } - - if( !fIsStepTime) - InputTree->Branch( "Time" ,&Time ,"Time/F" ); - - IsotopicVector IVAccordingToUserInfoFile = isotopicvector.GetThisComposition(IVInputTMVA); - - double Ntot = IVAccordingToUserInfoFile.GetSumOfAll(); - - IVAccordingToUserInfoFile = IVAccordingToUserInfoFile/Ntot; - - j=0; - map<ZAI ,string >::iterator it2; - DBGV("INPUT TMVA"); - for( it2 = fMapOfTMVAVariableNames.begin() ; it2!=fMapOfTMVAVariableNames.end() ; it2++) - { - InputTMVA[j] = IVAccordingToUserInfoFile.GetZAIIsotopicQuantity( (*it2).first ) ; - DBGV((*it2).first.Z()<<" "<<(*it2).first.A()<<" "<<InputTMVA[j]); - j++; - } - - Time=fMLP_Time[TimeStep]; - - InputTree->Fill(); - - return InputTree; -} -//________________________________________________________________________ -double XSM_MLP::ExecuteTMVA(string WeightFile,TTree* InputTree) -{ - // --- Create the Reader object - TMVA::Reader *reader = new TMVA::Reader( "Silent" ); - - // Create a set of variables and declare them to the reader - // - the variable names MUST corresponds in name and type to those given in the weight file(s) used - vector<float> InputTMVA; - for(int i = 0 ; i< (int)fMapOfTMVAVariableNames.size() ; i++) - InputTMVA.push_back(0); - Float_t Time; - - map<ZAI ,string >::iterator it; - int j=0; - for( it = fMapOfTMVAVariableNames.begin() ; it!=fMapOfTMVAVariableNames.end() ; it++) - { reader->AddVariable( ( (*it).second ).c_str(),&InputTMVA[j]); - j++; - } - if(!fIsStepTime) - reader->AddVariable( "Time" ,&Time); - - // --- Book the MVA methods - - string dir = fTMVAWeightFolder; - if(dir[dir.size()-1]!='/') - dir+="/"; - - // Book method MLP - TString methodName = "MLP method"; - TString weightpath = dir + WeightFile ; - reader->BookMVA( methodName, weightpath ); - - map<ZAI ,string >::iterator it2; - j=0; - for( it2 = fMapOfTMVAVariableNames.begin() ; it2!=fMapOfTMVAVariableNames.end() ; it2++) - { - InputTree->SetBranchAddress(( (*it2).second ).c_str(),&InputTMVA[j]); - j++; - } - - if(!fIsStepTime) - InputTree->SetBranchAddress( "Time" ,&Time ); - - InputTree->GetEntry(0); - Float_t val = (reader->EvaluateRegression( methodName ))[0]; - - delete reader; - - return (double)val; -} -//________________________________________________________________________ -EvolutionData XSM_MLP::GetCrossSectionsTime(IsotopicVector IV) -{DBGL - - EvolutionData EvolutionDataFromMLP = EvolutionData(); - - map<ZAI,TGraph*> ExtrapolatedXS[3]; - /*************DATA BASE INFO****************/ - EvolutionDataFromMLP.SetReactorType(fDataBaseRType); - EvolutionDataFromMLP.SetFuelType(fDataBaseFType); - EvolutionDataFromMLP.SetPower(fDataBasePower); - EvolutionDataFromMLP.SetHeavyMetalMass(fDataBaseHMMass); - /************* The Cross sections***********/ - for(int i=0;i<int(fWeightFiles.size());i++) - { - int Z=-2; - int A=-2; - int I=-2; - int Reaction=-2; - ReadWeightFile( fWeightFiles[i], Z, A, I, Reaction); - - for(int TimeStep=0;TimeStep<int(fMLP_Time.size());TimeStep++) - { - TTree* InputTree = CreateTMVAInputTree(IV,TimeStep); - - pair< map<ZAI, TGraph*>::iterator, bool> IResult; - - IResult = ExtrapolatedXS[Reaction].insert(pair<ZAI ,TGraph* >(ZAI(Z,A,I), new TGraph() ) ); - - double XSValue = ExecuteTMVA(fWeightFiles[i],InputTree ); - if(IResult.second ) - { - (IResult.first)->second->SetPoint(0, (double)GetMLPTime()[TimeStep], XSValue ); - - } - else - { - (IResult.first)->second->SetPoint( (IResult.first)->second->GetN(), (double)GetMLPTime()[TimeStep], XSValue ); - } - - delete InputTree; - } - - } - - /**********Sorting TGraph*********/ - for(int x=0;x<3;x++) - { map<ZAI,TGraph*>::iterator it; - for(it = ExtrapolatedXS[x].begin(); it != ExtrapolatedXS[x].end(); it++) - it->second->Sort(); - - } - /**********Filling Matrices*/ - EvolutionDataFromMLP.SetFissionXS(ExtrapolatedXS[0]); - EvolutionDataFromMLP.SetCaptureXS(ExtrapolatedXS[1]); - EvolutionDataFromMLP.Setn2nXS(ExtrapolatedXS[2]); - - - DBGL - return EvolutionDataFromMLP; -} -//________________________________________________________________________ -//________________________________________________________________________ -// -// Time step (1 MLP per time step) -//________________________________________________________________________ -//________________________________________________________________________ -void XSM_MLP::ReadWeightFileStep(string Filename, int &Z, int &A, int &I, int &Reaction, int &TimeStep) -{ - Z=-1; - A=-1; - I=-1; - Reaction=-1; - - size_t found = Filename.find("XS"); - - string NameJOB; - NameJOB=Filename.substr(found); - int pos=0; - - StringLine::NextWord(NameJOB, pos, '_'); - - Z = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); - A = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); - I = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); - - string sReaction = (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ; - if(sReaction=="fis") - Reaction=0; - if(sReaction=="cap") - Reaction=1; - if(sReaction=="n2n") - Reaction=2; - - TimeStep = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); - - if(Z==-1 || A==-1 || I==-1 || Reaction==-1 || TimeStep==-1) - { - ERROR << " wrong TMVA weight format " << endl; - exit(0); - } -} - -//________________________________________________________________________ -EvolutionData XSM_MLP::GetCrossSectionsStep(IsotopicVector IV) -{DBGL - TTree* InputTree=CreateTMVAInputTree(IV); - //cout<<"=====Building Evolution Data From TMVA MLP====="<<endl; - - EvolutionData EvolutionDataFromMLP = EvolutionData(); - - map<ZAI,TGraph*> ExtrapolatedXS[3]; - /*************DATA BASE INFO****************/ - EvolutionDataFromMLP.SetReactorType("PWR"); - EvolutionDataFromMLP.SetFuelType("MOX"); - EvolutionDataFromMLP.SetPower(fDataBasePower); - EvolutionDataFromMLP.SetHeavyMetalMass(fDataBaseHMMass); - - /************* The Cross sections***********/ - - for(int i=0;i<int(fWeightFiles.size());i++) - { - int Z=-2; - int A=-2; - int I=-2; - int Reaction=-2; - int TimeStep=-2; - ReadWeightFileStep( fWeightFiles[i], Z, A, I, Reaction, TimeStep); - - ZAI zaitmp = ZAI(Z,A,I); - - pair< map<ZAI, TGraph*>::iterator, bool> IResult; - - IResult = ExtrapolatedXS[Reaction].insert(pair<ZAI ,TGraph* >(ZAI(Z,A,I), new TGraph() ) ); - - if( IResult.second ) - { - (IResult.first)->second->SetPoint(0, (double)GetMLPTime()[TimeStep], ExecuteTMVA(fWeightFiles[i],InputTree) ); - } - else - { - (IResult.first)->second->SetPoint( (IResult.first)->second->GetN(), (double)GetMLPTime()[TimeStep], ExecuteTMVA(fWeightFiles[i],InputTree) ); - } - - } - - /**********Sorting TGraph*********/ - for(int x=0;x<3;x++) - { map<ZAI,TGraph*>::iterator it; - for(it = ExtrapolatedXS[x].begin(); it != ExtrapolatedXS[x].end(); it++) - it->second->Sort(); - } - /**********Filling Matrices*/ - EvolutionDataFromMLP.SetFissionXS(ExtrapolatedXS[0]); - EvolutionDataFromMLP.SetCaptureXS(ExtrapolatedXS[1]); - EvolutionDataFromMLP.Setn2nXS(ExtrapolatedXS[2]); - - delete InputTree; - DBGL - return EvolutionDataFromMLP; -} -//________________________________________________________________________ -EvolutionData XSM_MLP::GetCrossSections(IsotopicVector IV ,double t) -{DBGL - if(t!=0) - WARNING << " Argument t has non effect here " << endl; - - EvolutionData EV; - if(fIsStepTime) - EV=GetCrossSectionsStep(IV); - - else - EV=GetCrossSectionsTime(IV); - - DBGL - return EV; -} -//________________________________________________________________________ diff --git a/source/branches/CLASSV3/Model/XS/XSM_MLP.hxx b/source/branches/CLASSV3/Model/XS/XSM_MLP.hxx deleted file mode 100644 index 536ed50892800a6d210fc75dbb372b31637bf3e7..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/Model/XS/XSM_MLP.hxx +++ /dev/null @@ -1,91 +0,0 @@ - -#ifndef _XSM_MLP_HXX -#define _XSM_MLP_HXX - - -/*! - \file - \brief Header file for XSM_MLP class. - - - @authors BLG - @version 1.0 - */ -#include "XSModel.hxx" -#include "TTree.h" -#include <string> -#include <fstream> -#include <iostream> -#include <map> -#include <vector> -typedef long long int cSecond; -using namespace std; - -//-----------------------------------------------------------------------------// -/*! - Define a XSM_MLP. - This is the class to predict cross sections with a set of MultiLayerPerceptrons - - @authors BLG - @version 1.0 - */ -//________________________________________________________________________ - - -class XSM_MLP : public XSModel -{ - public : - - /*! - \name Constructor/Desctructor - */ - //@{ - - /// CONSTRUCTOR - /*! - \param string TMVA_Weight_Directory The directory where all the TMVA weight are located - \param string InformationFile, Name of the information file located in TMVA_Weight_Directory (defeult: Data_Base_Info.nfo) - \param bool IsTimeStep, if true , one TMVA weihgt per step time is requiered otherwise it assumes time is part of the MLP inputs - - */ - XSM_MLP(string TMVA_Weight_Directory,string InformationFile="",bool IsTimeStep=true); - XSM_MLP(CLASSLogger* Log,string TMVA_Weight_Directory,string InformationFile="",bool IsTimeStep=false); - ~XSM_MLP(); - //{ - - - EvolutionData GetCrossSections(IsotopicVector IV,double t=0) ;//!< Return calculated cross section by the MLP regression - - - private : - void GetDataBaseInformation(); //<! Read information file and fill Reactor Type, Fuel type, HM mass, Power, time vector, and TMVA input variables names (looks at Data Bases example for format details) - vector<double> GetMLPTime() {return fMLP_Time; }//<! Return time vector (seconds) defined in the DataBaseInformation file - - void GetMLPWeightFiles();//<! Find all .xml file in TMVA_Weight_Directory - void ReadWeightFile(string Filename, int &Z, int &A, int &I, int &Reaction) ;//<! Select the reaction according to the weight file name (file name is formated !!) read the manual to know it (formated for fIsTimeStep==false) - double ExecuteTMVA(string WeightFile, TTree* InputTree);//!<Execute the MLP according to the input tree created by CreateTMVAInputTree - TTree* CreateTMVAInputTree(IsotopicVector isotopicvector,int TimeStep=0);//!<Create input tmva tree to be read by ExecuteTMVA - EvolutionData GetCrossSectionsTime(IsotopicVector IV) ;//!< Return calculated cross section by the MLP regression when fIsTimeStep==false - - void ReadWeightFileStep(string Filename, int &Z, int &A, int &I, int &Reaction, int &TimeStep) ;//<! Select the reaction according to the weight file name (file name is formated !!) read the manual to know it (formated for fIsTimeStep==true) - EvolutionData GetCrossSectionsStep(IsotopicVector IV) ;//!< Return calculated cross section by the MLP regression when fIsTimeStep==true - - - - vector<double> fMLP_Time;//<! Time vector of the data base - vector<string> fWeightFiles;//<! All the weight file contains in fTMVAWeightFolder - string fTMVAWeightFolder;//<! folder containing all the weight file - string fMLPInformationFile;//<! file containing Reactor Type, Fuel type, HM mass, Power, time vector, and TMVA input variables names (looks the manual for format details) - double fDataBasePower;//<!Power of the data base (read from fMLPInformationFile ) - double fDataBaseHMMass;//<!Heavy metal mass of the data base (read from fMLPInformationFile ) - string fDataBaseFType; //<! Reactor Type (e.g PWR, RNR, ADS..) - string fDataBaseRType; //<! Fuel Type (e.g MOX, UOX, ThU, ThPu ...) - bool fIsStepTime;//<!true if one TMVA weihgt per step time is requiered otherwise it assumes time is part of the MLP inputs - - map<ZAI,string> fMapOfTMVAVariableNames;//<! List of TMVA input variable names (read from fMLPInformationFile ) , name depends on the training step - - -}; - -#endif - diff --git a/source/branches/CLASSV3/include/CLASSBackEnd.hxx b/source/branches/CLASSV3/include/CLASSBackEnd.hxx deleted file mode 100644 index c16166b27c3718a30a7b565f1f66b0f5d77e55ca..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/CLASSBackEnd.hxx +++ /dev/null @@ -1,122 +0,0 @@ - -#ifndef _CLASSBACKEND_HXX -#define _CLASSBACKEND_HXX - - -/*! - \file - \brief Header file for CLASSFacility class. - - */ - -#include <string> -#include <fstream> -#include <map> - - -#include "CLASSFacility.hxx" -#include "IsotopicVector.hxx" -#include "DecayDataBank.hxx" - -#include "TNamed.h" - -using namespace std; - -typedef long long int cSecond; - -//-----------------------------------------------------------------------------// -/*! - Define a CLASS Facility. - The aim of these class is synthetyse all the commum properties of the nuclear facilities which are involve in the BackEnd Fuel cycle. - - - @author BaM - @version 2.0 - */ -//________________________________________________________________________ - - -class CLASSBackEnd : public CLASSFacility -{ - public : - ///< Normal Constructor. - CLASSBackEnd(int type = 0); - CLASSBackEnd(CLASSLogger* log,int type = 0); - CLASSBackEnd(CLASSLogger* log, cSecond cycletime, int type = 0); - - //********* Get Method *********// - /*! - \name Get Function - */ - //@{ - - - vector<IsotopicVector> GetIVArray() const { return fIVArray; } //!< Return the IsotopicVector Array - vector<cSecond> GetIVArrayArrivalTime() const { return fIVArrayArrivalTime;} //!<Return the pointer to the OUtBackEndFacility - - int GetIVNumber() const { return fIVArray.size();} - bool GetStorageType() const { return fIsStorageType;} //!< Return the storageType - IsotopicVector GetIV(int i) const { if(i < (int)fIVArray.size()) return fIVArray[i]; - else return IsotopicVector(); } -#ifndef __CINT__ - DecayDataBank* GetDecayDataBank() { return fDecayDataBase;} //!< Return the pointer to the decay DataBank - CLASSBackEnd* GetOutBackEndFacility() const { return fOutBackEndFacility;} //!<Return the pointer to the OUtBackEndFacility - virtual map<cSecond,int> GetTheBackEndTimePath(); - -#endif - - //@} - - //********* Set Method *********// - /*! - \name Set Function - */ - //@{ - void SetIsStorageType(bool val = true) { fIsStorageType = val;} //! Set the fIsStorage bool - virtual void SetIVArray(vector<IsotopicVector> ivarray) { fIVArray = ivarray; } //!< Set The isotopicVector Array -#ifndef __CINT__ - void SetDecayDataBank(DecayDataBank* decayDB) { fDecayDataBase = decayDB;} //! Set the Decay DataBank - virtual void SetOutBackEndFacility(CLASSBackEnd* befacility) { fOutBackEndFacility = befacility; - fIsStorageType = false; } //! Set a Out Facility for the fuel - -#endif - - using CLASSFacility::SetName; - - //@} - - - /*! - \name BackEndFacility specific Method - */ - //@{ - virtual void AddIV(IsotopicVector isotopicvector); //!< Add an Isotopicvector to the IVArray - void ClearIVArray(); //!< Empty the IVArray removing all fuel stored - - //@} - virtual void Evolution(cSecond t) {} //!< Performe the Evolution to the Time t - void UpdateInsideIV(); - - - protected : - IsotopicVector GetDecay(IsotopicVector isotopicvector, cSecond t); //!< Get IsotopicVector Decay at the t time - vector<IsotopicVector> fIVArray; ///< Vector containning all the fuel stored. - vector<cSecond> fIVArrayArrivalTime; ///< Vector containning all the fuel stored. - -#ifndef __CINT__ - CLASSBackEnd* fOutBackEndFacility; //!< Facility getting the fuel at the end of the cycle -#endif - - //********* Internal Parameter *********// - private : - bool fIsStorageType; //!< True if there is not OutBAckEndFacility (like a storage...) - -#ifndef __CINT__ - DecayDataBank* fDecayDataBase; //!< Pointer to the Decay DataBase -#endif - - ClassDef(CLASSBackEnd,2); -}; - -#endif - diff --git a/source/branches/CLASSV3/include/CLASSConstante.hxx b/source/branches/CLASSV3/include/CLASSConstante.hxx deleted file mode 100644 index 92a9a374d8b142df777a2559c71caa244e420b44..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/CLASSConstante.hxx +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _CLASSConstante_HXX_ -#define _CLASSConstante_HXX_ - -//CLASS library -#include "ZAIMass.hxx" - -const double AVOGADRO = 6.02214129e23; -const ZAIMass cZAIMass; - - -#endif diff --git a/source/branches/CLASSV3/include/CLASSFacility.hxx b/source/branches/CLASSV3/include/CLASSFacility.hxx deleted file mode 100644 index 35a3a1d734d1266aec64bf95de51022303285e2a..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/CLASSFacility.hxx +++ /dev/null @@ -1,141 +0,0 @@ - -#ifndef _CLASSFACILITY_HXX -#define _CLASSFACILITY_HXX - - -/*! - \file - \brief Header file for CLASSFacility class. - - */ - -#include <string> -#include <fstream> - -#include "CLASSObject.hxx" -#include "IsotopicVector.hxx" -#include "DecayDataBank.hxx" - -#include "TNamed.h" - -using namespace std; -typedef long long int cSecond; - -class Scenario; -//-----------------------------------------------------------------------------// -/*! - Define a CLASS Facility. - The aim of these class is to regroup all the commum properties of the nuclear facilities. - - - @author BaM - @version 2.0 - */ -//________________________________________________________________________ - - - - -class CLASSFacility : public CLASSObject -{ -public : - ///< Normal Constructor. - CLASSFacility(int type = 0); - CLASSFacility(CLASSLogger* log, int type = 0); - CLASSFacility(CLASSLogger* log, cSecond cycletime, int type = 0); - CLASSFacility(CLASSLogger* log, cSecond creationtime, cSecond lifetime, int type = 0); - CLASSFacility(CLASSLogger* log, cSecond startingtime, cSecond lifetime, cSecond cycletime, int type = 0); - - //********* Get Method *********// - /*! - \name Get Function - */ - //@{ - - int GetId() const { return fId; } //!< Return the Facility Parc'Is - IsotopicVector GetInsideIV() const { return fInsideIV; } //!< Return the IV contain in the Facility - - int GetFacilityType() const { return fFacilityType; } - - cSecond GetInternalTime() const { return fInternalTime; } //!< Return Creation Time - - cSecond GetCycleTime() const { return fCycleTime; } //!< Return the cycle time of the Facility - cSecond GetCreationTime() const { return fCreationTime; } //!< Return the creation time of the Facility - cSecond GetLifeTime() const { return fLifeTime; } //!< Return the life time of the Facility - Scenario* GetParc() { return fParc; } //!< return the pointer to the Park - - - IsotopicVector GetCumulativeIVIn() { return fCumulativeIVIn;} //!< return the culative sum of all incoming IV - IsotopicVector GetCumulativeIVOut() { return fCumulativeIVOut;} //!< return the culative sum of all outcoming IV - //@} - - //********* Set Method *********// - /*! - \name Set Function - */ - //@{ - void SetId(int id) { fId = id; } //!< Set The Facility Parc'Id - void SetParc(Scenario* parc) { fParc = parc; } //!< Set the Pointer to the Parc - void SetFacilityType(int type) { fFacilityType = type; } //!< Set the facility type : - /// \li 2 reactor Studown - /// \li 4 start/End of reactor cycle, - /// \li 8 end of Cooling, - /// \li 16 fuel Fabrication - using CLASSObject::SetName; - using CLASSObject::GetName; - - - void SetInsideIV(IsotopicVector isotopicvector) { fInsideIV = isotopicvector; } //!< Set the IV inside the Facility Core - void SetCreationTime(double creationtime) { fCreationTime = (cSecond)creationtime;} //!< Set the creation Time - void SetLifeTime(double lifetime) { fLifeTime = (cSecond)lifetime; } //!< Set the life time of the facility - virtual void SetCycleTime(double cycletime) { fCycleTime = (cSecond)cycletime; } //!< Set the cycle time (Cycle of the loading Plan) - void SetInCycleTime(double incycletime) { fInCycleTime = (cSecond)incycletime; fIsStarted = true; } //!< Set the cycle time (Cycle of the loading Plan) - void SetInternalTime(double internaltime) { fInternalTime = (cSecond)internaltime; } //!< Set the cycle time (Cycle of the loading Plan) - - //@} - - - /*! - \name Evolution Method - */ - //@{ - - void AddCumulativeIVIn(IsotopicVector IV) { fCumulativeIVIn += IV;} //!< Add the Input IsotopicVector the The cumulative IV IN - void AddCumulativeIVOut(IsotopicVector IV) { fCumulativeIVOut += IV;} //!< Add the Input IsotopicVector the The cumulative IV OUT - virtual void Evolution(cSecond t) = 0; //!< Performe the Evolution to the Time t - virtual void Dump() { } //!< Write Modification (IV In/Out, filling the TF...) - - //@} -protected : - bool fIsStarted; ///< True if Running, False Otherwise - bool fIsShutDown; ///< True if the facility is stoped, False Otherwise - bool fIsAtEndOfCycle; ///< True if Reaching the End of a Facility Cycle - - - cSecond fInternalTime; ///< Internal Clock - cSecond fInCycleTime; ///< Time spend since the beginning of the last Cycle - cSecond fCycleTime; ///< Cycle duration Time - - IsotopicVector fInsideIV; ///< All IV in the Facility (fuel for reactor, total for all others...) - IsotopicVector fCumulativeIVIn; ///< All IV in the Facility (fuel for reactor, total for all others...) - IsotopicVector fCumulativeIVOut; ///< All IV in the Facility (fuel for reactor, total for all others...) - - //********* Internal Parameter *********// -private : - int fId; //!< Identity of the Facility inside the Parc - int fFacilityType; ///< Type of facility : - /// \li 4 reactor, - /// \li 8 Pool, - /// \li 16 FabricationPlant. - - - Scenario* fParc; //!< Pointer to the main Parc - - cSecond fCreationTime; ///< CLASS Universal Time of Creation - cSecond fLifeTime; ///< Time of life Of the Reactor (Operating's Duration) - - ClassDef(CLASSFacility,1); -}; - -#endif - diff --git a/source/branches/CLASSV3/include/CLASSFuel.hxx b/source/branches/CLASSV3/include/CLASSFuel.hxx deleted file mode 100644 index 98d320fa6e13c3e40c4ea5e76678437ab5054906..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/CLASSFuel.hxx +++ /dev/null @@ -1,62 +0,0 @@ - -#ifndef _CLASSFUEL_HXX -#define _CLASSFUEL_HXX - - -/*! - \file - \brief Header file for CLASSFuel class. - - - @author BaM - @version 2.0 - */ - -#include <string> -#include <fstream> - -#include "CLASSObject.hxx" -#include "PhysicsModels.hxx" -#include "EvolutionData.hxx" - -using namespace std; - -//-----------------------------------------------------------------------------// -/*! - Define a CLASS Object. - The aim of these class is synthetyse all the commum properties to all CLASS Fuel Element. - - - @author BaM - @version 2.0 - */ -//________________________________________________________________________ - - - -class CLASSFuel : public CLASSObject -{ - public : - ///< Normal Constructor. - CLASSFuel(EvolutionData* evo); - CLASSFuel(PhysicsModels* evo); - - - virtual CLASSFuel* Clone() { return new CLASSFuel(*this); } //!< Correct way to copy a CLASSFuel in case of derivation - - - EvolutionData* GetEvolutionData() {return fEvolutionData;} - PhysicsModels* GetPhysicsModels() {return fPhysicsModels;} - using CLASSObject::SetName; - using CLASSObject::GetName; - protected : - - - private : - - EvolutionData* fEvolutionData; - PhysicsModels* fPhysicsModels; -}; - -#endif - diff --git a/source/branches/CLASSV3/include/CLASSFuelPlan.hxx b/source/branches/CLASSV3/include/CLASSFuelPlan.hxx deleted file mode 100644 index 81b8d721b0afd72d15c091dd514592a7b6efcdfa..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/CLASSFuelPlan.hxx +++ /dev/null @@ -1,64 +0,0 @@ - -#ifndef _CLASSFUELPLAN_HXX -#define _CLASSFUELPLAN_HXX - - -/*! - \file - \brief Header file for CLASSFuelPlan class. - - - @author BaM - @version 2.0 - */ - -#include <string> -#include <fstream> -#include <map> - -#include "CLASSObject.hxx" -#include "CLASSFuel.hxx" - -using namespace std; -typedef long long int cSecond; - - -//-----------------------------------------------------------------------------// -/*! - Define a CLASS Object. - The aim of these class is synthetyse all the commum properties to all CLASS Fuel Element. - - - @author BaM - @version 2.0 - */ -//________________________________________________________________________ - - - -class CLASSFuelPlan : public CLASSObject -{ - public : - ///< Normal Constructor. - CLASSFuelPlan(); - CLASSFuelPlan(CLASSLogger* log); - - void AddFuel(cSecond time, CLASSFuel fuel, double BurnUp); - void AddFuel(cSecond time, EvolutionData* fuel, double BurnUp) {AddFuel( time, CLASSFuel(fuel), BurnUp);} - void AddFuel(cSecond time, PhysicsModels* fuel, double BurnUp) {AddFuel( time, CLASSFuel(fuel), BurnUp);} - - pair< CLASSFuel, double> GetFuelAt(cSecond t); - - using CLASSObject::SetName; - using CLASSObject::GetName; - protected : - - - private : - - map< cSecond, pair< CLASSFuel, double > > fLoadingPlan; ///< Loading PLan to change the EvolutionData (and the associetedBurnup) according to the Plan - -}; - -#endif - diff --git a/source/branches/CLASSV3/include/CLASSHeaders.hxx b/source/branches/CLASSV3/include/CLASSHeaders.hxx deleted file mode 100755 index dbd173fd7b449f83e29dd7e7011f93000f351cfa..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/CLASSHeaders.hxx +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _CLASSHEADERS_HXX_ -#define _CLASSHEADERS_HXX_ - - - - -//CLASS library -#include "CLASSConstante.hxx" -#include "Scenario.hxx" -#include "Reactor.hxx" -#include "Pool.hxx" -#include "FabricationPlant.hxx" -#include "SeparationPlant.hxx" -#include "Storage.hxx" -#include "IsotopicVector.hxx" -#include "ZAI.hxx" -#include "CLASSLogger.hxx" - -#include "EvolutionData.hxx" -#include "PhysicsModels.hxx" -#include "DecayDataBank.hxx" - -#include "ZAIMass.hxx" - -#endif diff --git a/source/branches/CLASSV3/include/CLASSLogger.hxx b/source/branches/CLASSV3/include/CLASSLogger.hxx deleted file mode 100755 index 621402068ab9b1c907080327b2601e9e65eb8d39..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/CLASSLogger.hxx +++ /dev/null @@ -1,182 +0,0 @@ -#ifndef _LOG_CLASS_ -#define _LOG_CLASS_ - - -/*! - \file - \brief Header file for CLASSLogger class. - - - @author BaM - @version 2.0 - */ - -#include <string> -#include <fstream> - -#include <iostream> -#include <cstring> -#include <sstream> -#include "stdlib.h" -using namespace std; - - -#ifndef __CINT__ - -#define ERROR if(fLog)if(fLog->GetMaxOutPutLVL() >= 0) fLog->E() << "!!!ERROR!!! " << "[" << __FILE__ << ":" << __FUNCTION__ << "] " -#define WARNING if(fLog)if(fLog->GetMaxOutPutLVL() >= 1) fLog->W() << "!!WARNING!! " << "[" << __FILE__ << ":" << __FUNCTION__ << "] " -#define INFO if(fLog)if(fLog->GetMaxOutPutLVL() >= 2) fLog->I() << "!!!!INFO!!! " << "[" << __FILE__ << "] " - -#define DBGL if(fLog)if(fLog->GetMaxOutPutLVL() >= 3) fLog->D() << __FILE__ << " : " << __LINE__ << " [" << __FUNCTION__ << "]" << endl; -#define DBGV(x) {if(fLog)if(fLog->GetMaxOutPutLVL() >= 3) fLog->D() << __FILE__ << " : " << __LINE__ << " [" << __FUNCTION__ << "]" << x << endl;} - -#else - -#define ERROR cout -#define INFO cout -#define WARNING cout -#define DBGL -#define DBGV(x) - - -#endif - - - -//-----------------------------------------------------------------------------// -/*! - Define a CLASSLogger. - The aim of this class is to centralize the all CLASS software message inside a file. - - - @author BaM - @version 2.0 - */ -//________________________________________________________________________ -#ifndef _LOGTYPE_CLASS -#define _LOGTYPE_CLASS - - - -class LogType -{ -public: - //********* Constructor/Destructor Method *********// - - /*! - \name Constructor/Desctructor - */ - //@{ - - - LogType(ostream &Log) { fLog = &Log; fLog2 = 0; } //!< Normal Constructor - - ~LogType() {} //!< Normal Destructor - - //@} - - //********* In/Out Method *********// - - /*! - \name In/Out - */ - //@{ - string GetCLASSLoggerName() const { return fCLASSLoggerName; } //!w return the CLASSLogger name - - LogType &operator<<(std::ostream& (*manip)(std::ostream &)) - { - manip( *(this->fLog) ); - if(fLog2) - manip( *(this->fLog2) ); - return *this; - } - - - template<typename T> - inline LogType& operator<<(T something) - { - *(this->fLog) << something; - if(fLog2) - *(this->fLog2) << something; - return *this; - } - - - void SetSecondOutput(ostream &log) {fLog2 = &log;} - - private : - - ostream *fLog; - ostream *fLog2; - - string fCLASSLoggerName; //!< Log File name -}; - - -#endif - - -#ifndef _CLASSLogger_CLASS_ -#define _CLASSLogger_CLASS_ - - - -class CLASSLogger -{ -public: - - //********* Constructor/Destructor Method *********// - - /*! - \name Constructor/Desctructor - */ - //@{ - CLASSLogger(); - - CLASSLogger(string CLASSLoggerName, int VerboseLvl = 0, int OutputLvl = 1 ); //!< Normal Constructor - - ~CLASSLogger(); //!< Normal Destructor - - //@} - - //********* In/Out Method *********// - - /*! - \name In/Out - */ - //@{ - string GetCLASSLoggerName() const { return fCLASSLoggerName; } //!w return the CLASSLogger name - int GetMaxOutPutLVL() const { return fMaxOutPutLVL; } - int GetVerboseLVL() const { return fVerboseLVL; } - - LogType E() {return *fError;} - LogType W() {return *fWarning;} - LogType D() {return *fDebug;} - LogType I() {return *fInfo;} - -//@} - - - - - private : - int fMaxOutPutLVL; - int fVerboseLVL; - - LogType* fError; - LogType* fInfo; - LogType* fWarning; - LogType* fDebug; - - ofstream fOutPutFile; - string fCLASSLoggerName; //!< Log File name -}; - -#endif - - - -#endif - - - diff --git a/source/branches/CLASSV3/include/CLASSObject.hxx b/source/branches/CLASSV3/include/CLASSObject.hxx deleted file mode 100644 index 4a71188615e453be116aa0e0da1b68bfc34ab1e6..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/CLASSObject.hxx +++ /dev/null @@ -1,67 +0,0 @@ - -#ifndef _CLASSOBJECT_HXX -#define _CLASSOBJECT_HXX - - -/*! - \file - \brief Header file for CLASSObject class. - - - @author BaM - @version 2.0 - */ - -#include <string> -#include <fstream> - -#include "CLASSLogger.hxx" - -#include "TNamed.h" - -using namespace std; - -//-----------------------------------------------------------------------------// -/*! - Define a CLASS Object. - The aim of these class is synthetyse all the commum properties to all CLASS Element. - - - @author BaM - @version 2.0 - */ -//________________________________________________________________________ - - - -class CLASSObject : public TNamed -{ -public : - ///< Normal Constructor. - CLASSObject(); - CLASSObject(CLASSLogger* log); - - - virtual CLASSObject* Clone() { return new CLASSObject(*this); } //!< Correct way to copy a CLASSObject in case of derivation - -#ifndef __CINT__ - void SetLog(CLASSLogger* log) { fLog = log;} //!< Set the CLASSLogger - CLASSLogger* GetLog() { return fLog; } //!< Return the Pointer to the Log -#endif - - - using TNamed::SetName; - using TNamed::GetName; -protected : -#ifndef __CINT__ - CLASSLogger* fLog; //!< Pointer to the Log -#endif - - -private : - - ClassDef(CLASSObject,0); -}; - -#endif - diff --git a/source/branches/CLASSV3/include/DecayDataBank.hxx b/source/branches/CLASSV3/include/DecayDataBank.hxx deleted file mode 100644 index 0a36905f62569ed6b5810bf0dd0c782d4253fd5e..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/DecayDataBank.hxx +++ /dev/null @@ -1,180 +0,0 @@ -#ifndef __DecayDataBank_HXX__ -#define __DecayDataBank_HXX__ - -/*! - \file - \brief Header file for DecayDataBank class. - @version 2.0 - */ - -#include "CLASSObject.hxx" -#include "TMatrix.h" -#include "EvolutionData.hxx" -#include "IsotopicVector.hxx" -#include "DynamicalSystem.hxx" - -#include <map> -#include <vector> - - -using namespace std; -typedef long long int cSecond; - -class ZAI; -class CLASSLogger; - -double ReactionRateWeightedDistance(IsotopicVector IV1, EvolutionData DB ); -double ReactionRateWeightedDistance(EvolutionData DB, IsotopicVector IV1 ); - -//-----------------------------------------------------------------------------// -/*! - Define a DecayDataBank. - The aim of these class is describe the evolution of "all" evoluting system in CLASS. - - For the Decay Matrix the DecayDataBank iq mainly contain a map of <ZAI,EvolutionData>.This map do the correspondance between a ZAI and its decay evolution (containing all the daughter nuclei comming from the decay a the original ZAI). - - @author BaM - @author Marc - @author PTO for a part the Decay management -- steal from MURE (Even if he does not kown it!! :)) - @version 2.0 - */ -//________________________________________________________________________ - - - -class DecayDataBank : public CLASSObject -{ - - public : - - - //********* Constructor/Desctructor *********// - - /*! - \name Constructor/Desctructor - */ - //@{ - /// Normal Constructor. - DecayDataBank(); - - //{ - /// Special Constructor. - /*! - Use to load a CLASSLogger - \param CLASSLogger CLASSLogger used for the log... - \param DB_index_file path to the index file - \param setlog if the log are stored in the CLASSLogger - \param olfreadmethod true if the old format of EvolutionData are used (ie without the key word such as Inv, XSFiss...) - */ - DecayDataBank(CLASSLogger* Log, string DB_index_file, bool olfreadmethod = false ); - //} - - //{ - /// Normal Destructor. - /*! - Delete de DecayDataBank and all associated EvolutionData... - */ - ~DecayDataBank(); - //} - - //{ - /// Reset the DecayDataBank. - /*! - Use to reset the DecayDataBank to its default values whihout deleting the EvolutionData (which contain pointer... ). - it does just clear the different maps - */ - void Clear(); - //} - //@} - - - - - //********* Get Method *********// - /*! - \name Get Method - */ - //@{ - map<ZAI ,EvolutionData > GetDecayDataBank() const { return fDecayDataBank; } //!< Return the DecayDataBank - string GetDataBaseIndex() const { return fDataBaseIndex; } //!< Return the index Name - bool IsDefine(const ZAI& zai) const; //!< True the key is define, false unstead - - string GetDataFileName() const { return fDataFileName; } - string GetDataDirectoryName() const { return fDataDirectoryName; } - - double GetShorstestHalflife() const { return fShorstestHalflife; } - IsotopicVector GetDecay(IsotopicVector isotopicvector, cSecond t); //!< Get IsotopicVector Decay at the t time - - //@} - - - - - //********* Set Method *********// - - /*! - \name Set Method - */ - //@{ - - void SetDecayDataBank(map<ZAI ,EvolutionData > mymap) { fDecayDataBank = mymap; } //!< Set the DecayDataBank map - - void SetDataBaseIndex(string database) { fDataBaseIndex = database;; ReadDataBase(); } //!< Set the Name of the database index - - void SetOldReadMethod(bool val) { fOldReadMethod = val; ReadDataBase();} ///< use the old reading method - - //} - - - - - //********* Evolution Method *********// - - //@} - /*! - \name Evolution Method - */ - //@{ - - - IsotopicVector Evolution(const ZAI& zai, double dt); ///< Return the Product IsotopicVector evolution from zai during a dt time - - //@} - - - - - //********* Other Method *********// - /*! - \name Other Method - */ - //@{ - void ReadDataBase(); ///< read the index file and fill the evolutionData map - - void Print() const; - - //@} - - - - - - protected : - - double fShorstestHalflife; - int fZAIThreshold; //!< Highest Mass deal bye the evolution (default 90) - - string fDataFileName; ///< Name of the decay list - string fDataDirectoryName; ///< Path to the decay list file - - map<ZAI, EvolutionData> fDecayDataBank; ///< DataBanck map - - string fDataBaseIndex; ///< Name of the index - - bool fOldReadMethod; ///< use old DB format - -}; - - - -#endif diff --git a/source/branches/CLASSV3/include/DynamicalSystem.hxx b/source/branches/CLASSV3/include/DynamicalSystem.hxx deleted file mode 100755 index 66880571e476dabbda3442999e8f7c3a18d307e1..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/DynamicalSystem.hxx +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef _DynamicalSystem_ -#define _DynamicalSystem_ -/*! - \file - \brief Header file for DynamicalSystem class. -*/ - -#include <math.h> -#include <vector> - - -using namespace std; - -//-----------------------------------------------------------------------------// - - - -//! DynamicalSystem class solves system of differential equations. -/*! -// A DynamicalSystem is a base class thatsolves system of 1st order of differential equations. -// \f[ \frac{d\vec{Y}}{dt}=A\vec{Y}\f] -// The differential equations are built in DynamicalSystem::BuildEqns ; the method MUST be -// defined in the derived classes. -// In this first version only Runge-Kutta method is implemented, but the aim of this class -// is to provide also other methods such as CRAM (Chebyshev rational approximation method). -// -// -// @author PTO. -// @version 1.0 -*/ -//________________________________________________________________________ - -class DynamicalSystem -{ - public : - - DynamicalSystem(); //!< Normal Constructor - DynamicalSystem(const DynamicalSystem & DS); //!< Copy Constructor - virtual ~DynamicalSystem(); //!< Destructor - - /*! - \name Mains attributes of the DynamicalSystem - */ - //@{ - int GetNumberOfEquationSize(){return fNVar;} //!< return the number of equations. - void SetNumberOfEquationSize(int n){fNVar=n;} //!< set the number of equations. - //@} - - /*! - \name Runge-Kutta related methods - Algorithms are taken from Numerical Receipes. - */ - //@{ - - void SetPrecision(double eps=1e-5){fPrecision=eps;} //!< set RK precision to change the integration step - - //! Forbid negative value during integration. - /*! - For some quantities (such as nuclei composition), negative values are forbidden. - But, due to integration step and very fast variation of the integrated variables - Runge-Kutta wil produce very small negative value. This method is used to force - negative value to be zero. - */ - void SetForbidNegativeValue(){fIsNegativeValueAllowed=false;} - - //! Runge Kutta calling method. - /*! - // \param YStart: input : the initial condition Y(t1) ; output the final value Y(t2) - // \param t1: initial time - // \param t2: final time - */ - void RungeKutta(double *YStart, double t1, double t2, int EquationNumber); - - //! Builds the equations for integration. - /*! - This method is an abstract method ; it MUST be overwritten by derived classes. - // \param t: time at which the equations are built - // \param Y: array of variable at time t - // \param dYdt: ode's variable. - */ - virtual void BuildEqns(double t, double *Y, double *dYdt){} - - //@} - - /*! - \name Miscellaneous methods - */ - //@{ - - //@} - - protected : - //! Runge Kutta main method. - /*! - // Call by RungeKutta - // \param y: initial values to integrate - // \param dydx: ode's equations (variable is x) - // \param x: variable of integration - // \param h: step size for integration - // \param yout: result after integration - */ - void RK4(double *y, double *dydx, double x, double h, double *yout); - //! Adaptative Step Size method for RK. - /*! - // Call by RK4 - // \param y: initial values to integrate - // \param dydx: ode's equations (variable is x) - // \param x: new value of the variable after the adaptative step - // \param htry: try step size for integration - // \param eps: precision - // \param yscal: result after hdid step integration - // \param hdid: did step size for integration - // \param hnext: next step size for integration - */ - void AdaptStepSize(double *y, double *dydx, double *x, double htry, double eps, double *yscal, double *hdid, double *hnext); - - int fNVar; //!< The size of the composition vector and /or number of ZAIs involved. - double fPrecision; //!< Precision of the RungeKutta - double fHestimate; //!< RK Step estimation. - double fHmin; //!< RK minimum Step. - double fMaxHdid; //!< store the effective RK max step - double fMinHdid; //!< store the effective RK min step - bool fIsNegativeValueAllowed; //!< whether or not negative value are physical. -}; - -#endif - diff --git a/source/branches/CLASSV3/include/EquivalenceModel.hxx b/source/branches/CLASSV3/include/EquivalenceModel.hxx deleted file mode 100644 index 1a5086dd78d969e7f3adab380749a3a6ecfe2b56..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/EquivalenceModel.hxx +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef _EQUIVALENCEMODEL_HXX -#define _EQUIVALENCEMODEL_HXX - - -/*! - \file - \brief Header file for EquivalenceModel class. - - - @author BaM - @version 2.0 - */ - -#include "IsotopicVector.hxx" -#include <math.h> -#include "CLASSObject.hxx" - - -using namespace std; - -//-----------------------------------------------------------------------------// -/*! - Define a EquivalenceModel. - The aim of these class is synthetyse all the commum properties to all Equivalence Model. - - - @author BaM - @version 3.0 - */ -//________________________________________________________________________ - - -class EquivalenceModel : public CLASSObject -{ - public : - - EquivalenceModel(); - EquivalenceModel(CLASSLogger* log); - - virtual ~EquivalenceModel(); - - /// virtual method called to build a reprocessed fuel as a function of the burnup requierement the stock, mass.... - /*! - Build the fuel following the equivalance model with the proper requierment in term of mass, burnup.... - \param double BurnUp desireted burnup reached by the fuel at the end of irradiation - \param double HMMass, needed Heavy metal mass needed - \param vector<double> &lambda, fraction of the stock to take (initialy should be 0) - \param vector<IsotopicVector> FissilArray, isotopicvectors to use to get the fissil part of the fuel - \param vector<IsotopicVector> FertilArray, isotopicvectors to use to get the fertil part of the fuel (if empty take it from the OutIncome) - */ - - virtual vector<double> BuildFuel(double BurnUp, double HMMass, vector<IsotopicVector> FissilArray, vector<IsotopicVector> FertilArray ); - //} - virtual void GuessLambda(vector<double>& lambda,int FirstStockID, int LastStockID, double DeltaM, vector<IsotopicVector> Stocks, double HMMass); - virtual double GetFissileMolarFraction(IsotopicVector Fissil,IsotopicVector Fertil,double BurnUp) {return 0;} //!< Return the molar fraction of fissile element in the fuel accodring to the Burnup, and a given fuel composition (this is the heart of the equivalence model) - - - - IsotopicVector GetFertileList() {return fFertileList;} //!<return the fertile list - IsotopicVector GetFissileList() {return fFissileList;} //!<return the fissile list - - void SetFertileList(IsotopicVector IV) {fFertileList = IV;}//!<set the fertile list - void SetFissileList(IsotopicVector IV) {fFissileList = IV;}//!<set the fissile list - - - protected : - - IsotopicVector fFertileList; //!< contain the list of zai, needed as fertile, taken in a stock before fabrication - //!< if no stock are provided, will take the isotopic vector in the Park income - - IsotopicVector fFissileList; //!< contain the list of zai, needed as fissile, taken in a stock before fabrication - //!< if no stock are provided the fuel will not be made - - - private : - - void SetLambda(vector<double>& lambda ,int FirstStockID, int LastStockID, double LAMBDA_TOT); //!< Set individual lambda according to the LAMBDA_TOT (lambda of all stocks) - double FindLambdaMax( vector<IsotopicVector> Stocks, double HMMass); //!< Find the maximum LAMBDA_TOT of Stocks (ie lambda to reach HMass) - double fOld_Lambda_Tot;//!<The old (old iteration) guessed lambda_tot (guessed from GuessLambda) - double fLambda_max;//!<Value calculated by FindLambdaMax - -}; - -#endif - diff --git a/source/branches/CLASSV3/include/EvolutionData.hxx b/source/branches/CLASSV3/include/EvolutionData.hxx deleted file mode 100755 index 2cb296e50cde5aeec0491d3dae6849f0e95c627f..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/EvolutionData.hxx +++ /dev/null @@ -1,251 +0,0 @@ -#ifndef __EvolutionData_HXX__ -#define __EvolutionData_HXX__ - -/*! - \file - \brief Header file for EvolutionData class. - @version 2.0 - */ - -#include <string> -#include <map> - -#include "IsotopicVector.hxx" -#include "CLASSObject.hxx" -#include "ZAI.hxx" - -#include "TMatrix.h" - -class TGraph; -class EvolutionData; -class CLASSLogger; - -using namespace std; -typedef long long int cSecond; - - -EvolutionData operator*(EvolutionData const& evol, double F); -EvolutionData operator*(double F, EvolutionData const& evol); -EvolutionData operator/(EvolutionData const& evol, double F); -EvolutionData Sum(EvolutionData const& evol1, EvolutionData const& evol2); -EvolutionData Multiply(EvolutionData const& evol, double F); -EvolutionData Multiply(double F, EvolutionData const& evol); - -double Distance(IsotopicVector IV1, EvolutionData Evd1 ); -double Distance(EvolutionData Evd1, IsotopicVector IV1 ); - -//-----------------------------------------------------------------------------// -/*! - Define a EvolutionData. - The aim of these class is describe the evolution of a single evoluting system in CLASS. - The system can either be a fuel evolution trough irradiation or a nuclei which produce, trough his decay, a large nuclei tree. - - The nuclei tree resulting of the evolution are stored in a map of ZAI and TGraph, each TGraph correspond to the evolution of the quantity of the associeted ZAI. - - @author BaM - @version 2.0 - */ -//________________________________________________________________________ - - - -class EvolutionData : public CLASSObject -{ - -public : - -//********* Constructor/Destructor Method *********// - - /*! - \name Constructor/Desctructor - */ - //@{ - - EvolutionData(); ///< Normal DB Constructor. - - - //{ - /// CLASSLogger Constructor. - /*! - Use create an empty EvolutionData loading a CLASSLogger - \param CLASSLogger CLASSLogger used for the log... - */ - EvolutionData(CLASSLogger* log); ///< Make a new Evolutive Product evolution - //} - - //{ - /// Special Constructor. - /*! - Make a new EvolutionData - \param Log CLASSLogger used for the log... - \param DB_file path to the DataBase file - \param oldread true if the oldmethod should be use to read the DatBase File - \param zai set the ZAI if you want to add a stable nuclei. - */ - EvolutionData(CLASSLogger* log, string DB_file, bool oldread = false, ZAI zai = ZAI(0,0,0) ); - //} - - - //{ - /// Normal Destructor. - /*! - Only remove the map without deleting the pointer to TGraph... - One need to call the DeleteEvolutionData() method to fully delete the EvolutionData, and then avoiding memory leak... - */ - ~EvolutionData(); - //} - - //{ - /// Delete the EvolutionData. - /*! - Use to fully delete the EvolutionData and all associeted TGraph. - In some case needed to be called to avoid memory leak. - */ - void DeleteEvolutionData(); - //} - - //@} - - - - -//********* Set Method *********// - - /*! - \name Set Method - */ - //@{ - void SetHeavyMetalMass(double Mass) {fHeavyMetalMass = Mass;} //!< Set the HeavyMetal Mass - - void SetReactorType(string reactortype) { fReactorType = reactortype; } ///< Set the reactor Type (string) - void SetFuelType(string fueltype) { fFuelType = fueltype; } ///< Set the fuel Type (string) - void SetPower(double power) { fPower = power; } ///< Set the power of the EvolutionData (double) - void SetFlux(TGraph* flux ) { fFlux = flux; } ///< Set the neutron flux of the EvolutionData (double) - void SetCycleTime(cSecond cycletime) { fCycleTime = cycletime; } ///< Set cycletime of the EvolutionData (double) - - - void SetInventoryEvolution(map<ZAI, TGraph*> maptoinsert) { fInventoryEvolution = maptoinsert;}///< Set EvolutionData map - void SetFissionXS(map<ZAI, TGraph*> maptoinsert) { fFissionXS = maptoinsert;} ///< Set fission cross section map - void SetCaptureXS(map<ZAI, TGraph*> maptoinsert) { fCaptureXS = maptoinsert;} ///< Set capture cross section map - void Setn2nXS(map<ZAI, TGraph*> maptoinsert) { fn2nXS = maptoinsert;} ///< Set (n,2n) cross section map - - //@} - - - - -//********* Get Method *********// - - /*! - \name Get Method - */ - //@{ - -#ifndef __CINT__ - map<ZAI ,TGraph* > GetInventoryEvolution() const { return fInventoryEvolution; } //!< return the EvolutionData map - map<ZAI ,TGraph* > GetFissionXS() const { return fFissionXS; } //!< return the fission cross section map - map<ZAI ,TGraph* > GetCaptureXS() const { return fCaptureXS; } //!< return the capture cross section map - map<ZAI ,TGraph* > Getn2nXS() const { return fn2nXS; } //!< return the (n,2n) cross section map - TGraph* GetKeff() const { return fKeff; } //!< return the evolution of the keff (TGraph*) - TGraph* GetFlux() const { return fFlux; } //!< return the evolution of the neutron flux (TGraph*) -#endif - - double GetFinalTime() const { return fFinalTime; } //!< return the final time - last point (double) - double GetCycleTime() const { return fCycleTime; } //!< return the cycletime (double) - double GetPower() const { return fPower; } //!< return the power (double) - string GetDB_file() const { return fDB_file; } //!< return the name of the Database file (string) - string GetReactorType() const { return fReactorType; } //!< return the type of reactor (string) - TGraph* GetEvolutionTGraph(const ZAI& zai); //!< return the evolution of the ZAI quantity (TGraph*) - - IsotopicVector GetIsotopicVectorAt(double t); ///< Return the Product IsotopicVector at t time - - double GetHeavyMetalMass() const { return fHeavyMetalMass; } //!< Return the HeavyMetal Mass in the Core at the begining of the cycle - - - //{ - /// Return the XS for a reactionId on zai at t time - /*! - // This method cross section of a reaction for a ZAI at a time - // \param t time - // \param ZAI ZAI for which the cross section if asked - // \param ReactionId ID of the reaction asked - - // The different reaction ID are : - \li 1 fission, - \li 2 capture, - \li 3 (n,2n). - */ - double GetXSForAt(double t, ZAI zai, int ReactionId); - //} - - //@} - - - - -//********* Insertion Method *********// - - //@} - /*! - \name Insertion Method - */ - //@{ - - bool NucleiInsert(pair<ZAI, TGraph*> zaitoinsert); //!< Add a nuclei evolution to the evolution map - bool FissionXSInsert(pair<ZAI, TGraph*> zaitoinsert); //!< Add a nuclei to the fission cross section map - bool CaptureXSInsert(pair<ZAI, TGraph*> zaitoinsert); //!< Add a nuclei to the capture cross section map - bool n2nXSInsert(pair<ZAI, TGraph*> zaitoinsert); //!< Add a nuclei to the (n,2n) cross section map - - - //@} - - - -protected : - - string fDB_file; ///!< path to the DataBase file - - -#ifndef __CINT__ - map<ZAI ,TGraph* > fInventoryEvolution; //!< evolution map - map<ZAI ,TGraph* > fFissionXS; //!< fission cross section map - map<ZAI ,TGraph* > fCaptureXS; //!< capture cross section map - map<ZAI ,TGraph* > fn2nXS; //!< (n,2n) cross section map - TGraph* fKeff; //!< Keff evolution - TGraph* fFlux; //!< Flux evolution -#endif - - cSecond fFinalTime; ///< time of the last point - bool fIsCrossSection; ///< true if some cross section are present in the database - - - - string fReactorType; ///< Type of reactor - string fFuelType; ///< Type of fuel - double fPower; ///< Power in W - double fCycleTime; ///< Cycle time of the DataBase - double fHeavyMetalMass; ///< Cycle time of the DataBase - - - void OldReadDB(string DBfile); //!< Read old format database - void ReadDB(string DBfile, bool oldread = false); //!< Main function to read database - void ReadKeff(string line, double* time, int NTimeStep); //!< Read the Keff in the database - void ReadFlux(string line, double* time, int NTimeStep); //!< Read the Flux in the database - void ReadInv(string line, double* time, int NTimeStep); //!< Read the Inventory evolution in the database - void ReadXSFis(string line, double* time, int NTimeStep); //!< Read the fission cross section evolution in the database - void ReadXSCap(string line, double* time, int NTimeStep); //!< Read the capture cross evolution in the database - void ReadXSn2n(string line, double* time, int NTimeStep); //!< Read the (n,2n) cross evolution in the database - void ReadInfo(); //!< Read the info file of the database - - - double Interpolate(double t, TGraph& EvolutionGraph); ///< Interpolating the value of EvolutionGraph at the t time - - void AddAsStable(ZAI zai); ///< USe when adding a EvolutionData of a stable nuclei (for "non" decay) - - ClassDef(EvolutionData,0); -}; - - - - -#endif diff --git a/source/branches/CLASSV3/include/FabricationPlant.hxx b/source/branches/CLASSV3/include/FabricationPlant.hxx deleted file mode 100644 index fd829804dab6dfbad2f98ffdc337dce598a2a05d..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/FabricationPlant.hxx +++ /dev/null @@ -1,228 +0,0 @@ -#ifndef __FabricationPlant_HXX__ -#define __FabricationPlant_HXX__ - -/*! - \file - \brief Header file for FabricationPlant class. - @version 2.0 - */ - - - -#include <vector> -#include <map> - -#include "CLASSFacility.hxx" -#include "IsotopicVector.hxx" -#include "EvolutionData.hxx" -#include "Scenario.hxx" -#include "Storage.hxx" -#include "Reactor.hxx" -#include "CLASSLogger.hxx" -#include "ZAI.hxx" - -using namespace std; -typedef long long int cSecond; - -//-----------------------------------------------------------------------------// -/*! - Define a FabricationPLant. - The aim of these class is describe the deal all the reprocessed fuel. - It includes the fabrication of the fuel from a stock of used fuel, using the aproprieted algrorythm, and the storage of this fuel before putting it into a reactor. - The parameter used for the fuel fabrication are recover from the DataBank. - The Databank MUST include an equivalence model to build the fuel. This model is not necessary provided, each user need to put his own. By default a equivalence model is provided for PWR MOX fuel. - - The FabricationPlant once the fuel is builded, also store the corresponding EvolutionData generated using the DataBank. - - @author BaM - @version 2.0 - */ -//________________________________________________________________________ - -class DecayDataBank; -class FuelDataBank; - - -class FabricationPlant : public CLASSFacility -{ - -public : - -//********* Constructor/Destructor Method *********// - - /*! - \name Constructor/Desctructor - */ - //@{ - - FabricationPlant(); ///< Normal constructor - - - - //{ - /// Special Constructor. - /*! - Make a new FabricationPlant evolution - \param CLASSLogger CLASSLogger used for the log... - \param storage storage used to build the reprocessed fuel - \param reusable storage used to store all separated material not used in the fabrication process - \param fabricationtime duration of the fabrication process (2 years by default). - */ - FabricationPlant(CLASSLogger* log, double fabricationtime = 365.25*24*3600*2); - //} - - ~FabricationPlant(); ///< Normal Destructor. - - //@} - - - - -//********* Set Method *********// - - /*! - \name Set Method - */ - //@{ - - void SetDecayDataBank(DecayDataBank* decayDB) {fDecayDataBase = decayDB;} //! Set the Decay DataBank - - void SetFiFo(bool bval = true) { fFiFo = bval;} //!< Set the chronological priority (true for chronological, false unstead) - - void SetSubstitutionFuel(EvolutionData fuel); //!< To use a subtition fuel if the fabrication fail (not enough material in stock) - - void AddReactor(int reactorid, double creationtime) - { fReactorNextStep.insert( pair<int,cSecond> (reactorid, (cSecond)creationtime-GetCycleTime() ) ); } //!< Add a new reactor - -#ifndef __CINT__ - void SetReUsableStorage(Storage* store) { fReUsable = store; fIsReusable = true;} -#endif - - using CLASSFacility::SetName; - - //@} - - - - -//********* Get Method *********// - - /*! - \name Get Method - */ - //@{ - -#ifndef __CINT__ - vector<Storage*> GetFissileStorage() { return fFissileStorage; } //!< Return the Pointer to the Storage - vector<Storage*> GetFertileStorage() { return fFertileStorage; } //!< Return the Pointer to the Storage - - EvolutionData GetReactorEvolutionDB(int ReactorId); //!< Return the EvolutionData of Reactor ReactorId -#endif - IsotopicVector GetDecay(IsotopicVector isotopicvector, cSecond t); //!< Get IsotopicVector Decay at the t time - - map<int, IsotopicVector > GetReactorFuturIncome() const - { return fReactorFuturIV;} //!< Return the List of the Futur Fuel IV - - - //@} - - - -#ifndef __CINT__ - void AddFissileStorage(Storage* stock) { fFissileStorage.push_back(stock); } //!< Add a new Storage to the list of Fissile material provider... - void AddFertileStorage(Storage* stock) { fFertileStorage.push_back(stock); } //!< Add a new Storage to the list of Fertile material provider... -#endif - -//********* Fabrication & Evolution Method *********// - - /*! - \name Fabrication & Evolution Method - */ - //@{ - - void SetSeparartionEfficiencyIV(ZAI zai, double factor); ///< Add Valorisable Element - void Evolution(cSecond t); //!< Perform the Evolution - - void DumpStock(vector<double> lambdaArray); //!< Update the Stock status after building process - - void TakeReactorFuel(int ReactorId) ; //!< Remove the Fuel of reactor ReactorId - void UpdateInsideIV(); - - IsotopicVector BuildFuelFromEqModel(vector<double> LambdaArray); - void BuildFissileArray(); - void BuildFertileArray(); - -#ifndef __CINT__ - void BuildFuelForReactor(int ReactorId, cSecond t); //!< Build a Fuel for the reactor ReactorId -#endif - - void SortArray(int i); - - //@} - - - - -protected : - - - -//********* Internal Parameter *********// - IsotopicVector fSeparationLostFraction; ///< The lost fraction Table during separation (1- efficiency) - map<int, cSecond > fReactorNextStep; ///< Next Time Step to Build a New Fuel - -#ifndef __CINT__ - map< int,EvolutionData > fReactorFuturDB; ///< List of the Futur EvolutionData use in the reactor -#endif - map< int,IsotopicVector > fReactorFuturIV; ///< List of the Futur Fuel Isotopic Vector used in the reactor - - - - - bool fFiFo; //!< Set the First In First Out - - bool fSubstitutionFuel; //!< true if a subtitution fuel as been set - - void FabricationPlantEvolution(cSecond t); //!< Deal the FabricationPlant Evolution - - -#ifndef __CINT__ - - vector<Storage*> fFissileStorage; //!< Pointer to the Storage to recycle used to get the fissile part of the fuel - vector<IsotopicVector> fFissileArray; - vector<cSecond> fFissileArrayTime; - vector< pair<int,int> > fFissileArrayAdress; - IsotopicVector fFissileList; - - vector<Storage*> fFertileStorage; //!< Pointer to the Storage to recycle used to get the fertile part of the fuel - vector<IsotopicVector> fFertileArray; - vector<cSecond> fFertileArrayTime; - vector< pair<int,int> > fFertileArrayAdress; - IsotopicVector fFertileList; - - Storage* fReUsable; //!< Pointer to the Storage using for recycling unused Product - bool fIsReusable; - - EvolutionData fSubstitutionEvolutionData; //!< EvolutionData of the subtitution fuel - - DecayDataBank* fDecayDataBase; //!< Pointer to the Decay DataBase - - - //{ - /// Separation Method - /*! - Make the Separation - \li IV[0] -> To Keep - \li IV[1] -> To Waste - */ - pair<IsotopicVector, IsotopicVector> Separation(IsotopicVector isotopicvector, IsotopicVector ExtractedList); - //} - -#endif - - - ClassDef(FabricationPlant,3); - -}; - -#endif diff --git a/source/branches/CLASSV3/include/IrradiationModel.hxx b/source/branches/CLASSV3/include/IrradiationModel.hxx deleted file mode 100644 index a3f726cec2252ab9bfde4abd5821b45d14f0594f..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/IrradiationModel.hxx +++ /dev/null @@ -1,222 +0,0 @@ -#ifndef _IRRADIATIONMODEL_HXX -#define _IRRADIATIONMODEL_HXX - - -/*! - \file - \brief Header file for IrradiationModel class. - - - @author BaM - @version 2.0 - */ - - -#include "CLASSObject.hxx" -#include "TMatrix.h" -#include "IsotopicVector.hxx" -#include "EvolutionData.hxx" - -#include <map> -#include <vector> - - -using namespace std; -typedef long long int cSecond; - -class ZAI; -class CLASSLogger; -//-----------------------------------------------------------------------------// -/*! - Define a IrradiationModel. - The aim of these class is synthetyse all the commum properties to all Irradiation Model. - - - @author BaM - @version 3.0 - */ -//________________________________________________________________________ - -class EvolutionData; - -class IrradiationModel : public CLASSObject -{ - - public : - - IrradiationModel(); - - IrradiationModel(CLASSLogger* log); - - /// virtueal method called to perform the irradiation calculation using a set of cross section. - /*! - Perform the Irradiation Calcultion using the XSSet data - \param IsotopicVector IV isotopic vector to irradiate - \param EvolutionData XSSet set of corss section to use to perform the evolution calculation - \param double Power, constant power to use for irradation - \param double irradiationtime, time of the irradiation - */ - virtual EvolutionData GenerateEvolutionData(IsotopicVector IV, EvolutionData XSSet, double Power, double cycletime) { return EvolutionData();} - //} - - - - - //********* Get Method *********// - /*! - \name Get Method - */ - //@{ - string GetDataFileName() const { return fDataFileName; } - string GetDataDirectoryName() const { return fDataDirectoryName; } - - double GetShorstestHalflife() const { return fShorstestHalflife; } - - //@} - - - - - //********* Set Method *********// - - /*! - \name Set Method - */ - //@{ - - - //{ - /// set Fission Energy using a file - /*! - // This method fill the Fission Energy map using a file - // \param FissionEnergyFile: filename containing the Fission Energy of some nuclei (form : Z A I Energy) - */ - void SetFissionEnergy(string FissionEnergyFile); - //} - - //{ - /// set Fission Energy for a ZAI using ZAI(Z,A,I) - /*! - // This method fill the Fission Energy map of a set ZAI - // \param zai ZAI - // \param E Fission energy of the ZAI - */ - void SetFissionEnergy(ZAI zai, double E); - //} - - //{ - /// set Fission Energy for a ZAI using the Z, A, I - /*! - // This method fill the Fission Energy map of a set ZAI - // \param Z Z of the ZAI - // \param A A of the ZAI - // \param I I of the ZAI - // \param E Fission energy of the ZAI - */ - void SetFissionEnergy(int Z, int A, int I, double E ) { SetFissionEnergy(ZAI(Z,A,I), E);} - //} - - void SetShortestHalfLife(double halflife) { fShorstestHalflife = halflife;} ///< Set the Half Life cut - void LoadFPYield(string SponfaneusYield, string ReactionYield); ///< Build Fision Yields maps; - - - - - - - //********* Evolution Method *********// - - //@} - /*! - \name Evolution Method - */ - //@{ - - - void BuildDecayMatrix(); ///w Build the Decay Matrix for the futur evolution... - - //@} - - - //********* Other Method *********// - /*! - \name Other Method - */ - //@{ - void Print() const; - - //@} - - - - - - protected : - - double fShorstestHalflife; - int fZAIThreshold; //!< Lowest Mass deal by the evolution (default 90) - string fDataFileName; ///< Name of the decay list - string fDataDirectoryName; ///< Path to the decay list file - - - TMatrixT<double> fDecayMatrix; ///< Matrix with half life of each nuclei - map<ZAI, double > fFissionEnergy; ///< Store the Energy per fission use for the flux normalisation. - map<ZAI, map<ZAI, double> > fFastDecay; ///< Store the cut decay - map<ZAI, IsotopicVector> fSpontaneusYield; ///< Store the Spontaneus fission yield - map<ZAI, IsotopicVector> fReactionYield; ///< Store the reaction fission yield - - - - map<ZAI, int> findex_inver; ///< correspondance matrix from ZAI to the column (or line) of the different Reaction/Decay matrix - map<int, ZAI> findex; ///< correspondance matrix from the column (or line) of the different Reaction/Decay matrix to the ZAI - - //{ - /// Return the Fission XS Matrix at the time TStep - /*! - // This Method extract the Fission Cross section of an EvolutionData at the set time - // \param EvolutionDataStep: EvolutionData - // \param TStep: time - */ - TMatrixT<double> GetFissionXsMatrix(EvolutionData EvolutionDataStep,double TStep); - //} - - //{ - /// Return the Capture XS Matrix at the time TStep - /*! - // This Method extract the capture Cross section of an EvolutionData at the set time - // \param EvolutionDataStep: EvolutionData - // \param TStep: time - */ - TMatrixT<double> GetCaptureXsMatrix(EvolutionData EvolutionDataStep,double TStep); - //} - - //{ - /// Return the n2n XS Matrix at the time TStep - /*! - // This Method extract the (n,2n) Cross section of an EvolutionData at the set time - // \param EvolutionDataStep: EvolutionData - // \param TStep: time - */ - TMatrixT<double> Getn2nXsMatrix(EvolutionData EvolutionDataStep,double TStep); - //} - - - //{ - //! Returns a particular decay mode. - /*! - \param DecayModes : a list of decay modes with their branching ratios and isomeric state of the Daughters. - \param BR : branching ratio of the current decay mode - \param Iso : isomeric state of the Daughter of the current decay mode. - \param StartPos : the current decay mode to extract. - */ - string GetDecay(string DecayModes, double &BR,int &Iso, int &StartPos); - //} - - map< ZAI,IsotopicVector > ReadFPYield(string Yield); ///< Read a CLASSYield file and return the correpsponding map - - private : - -}; - -#endif - diff --git a/source/branches/CLASSV3/include/IsotopicVector.hxx b/source/branches/CLASSV3/include/IsotopicVector.hxx deleted file mode 100755 index c59b9ca5cd64973ccd0e99d05e0b78c20e4a0260..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/IsotopicVector.hxx +++ /dev/null @@ -1,164 +0,0 @@ -#ifndef __ISOTOPICVECTOR_HXX__ -#define __ISOTOPICVECTOR_HXX__ - - -/*! - \file - \brief Header file for IsotopicVector class. - @version 2.0 - */ -#include "ZAI.hxx" - -#include "TObject.h" -#include <string> -#include <map> - -using namespace std; -typedef long long int cSecond; - -//-----------------------------------------------------------------------------// -/*! - Define a Isotopicvector. - The aim of this Class is to manage any kind of IsotopicVector, and any operation between them : sum, substraction.... - - @author BaM, MArc - @version 2.0 - */ -//________________________________________________________________________ - - - -class IsotopicVector : public TObject -{ -public : - -//********* Constructor/Destructor Method *********// - - /*! - \name Constructor/Desctructor - */ - //@{ - - IsotopicVector(); ///< Normal Constructor. - - - ~IsotopicVector(); ///< Normal Destructor. - - //@} - - -//********* Get Method *********// - - /*! - \name Get Method - */ - //@{ - - map<ZAI ,double> GetIsotopicQuantity() const - { return fIsotopicQuantity; } //!< Return the IVQuantity map - map<ZAI ,double> GetIsotopicQuantityNeeded() const - { return fIsotopicQuantityNeeded; } //!< Return the IVQuantityNeeded map - IsotopicVector GetSpeciesComposition(int z) const; //!< Return the Species composition of the "z" atom - IsotopicVector GetThisComposition(IsotopicVector IV) const; //!< Return the composition according the IV list... - vector<ZAI> GetZAIList() const; //!< Return the list of ZAI present in the IV - IsotopicVector GetActinidesComposition() const; //!< Return the Actinides composition of the "z" atom - double GetZAIIsotopicQuantity(const ZAI& zai) const; ///< Return the quantity of the ZAI - double GetZAIIsotopicQuantity(const int z, const int a, const int i) const; ///< Return the quantity of the ZAI - double GetTotalMass() const; //!< Return the mass (in tons) of the isotopic vector - double MeanMolar() const; //<! Return the mean molar mass of the isotopic vector - - vector<int> GetChemicalSpecies() const; //!< Return the Species Species contained - int GetZAIQuantity() const - {return fIsotopicQuantity.size(); } //!< Return the number of different ZAI in the IsotopicVector - - double GetSumOfAll() const; //!< Return the Sum of nuclei in the IsotopicVector - - //@} - - - - -//********* Internal Operation Method *********// - - /*! - \name Internal Operation Method - */ - //@{ - - - void Clear(); //!< Empty all the IV - void ClearNeed(); //!< Empty Need componant of the IV - - void Add(const ZAI& zai, double quantity); //!< Add Quantity gramme of the ZAI Element - void Add(const IsotopicVector& isotopicvector); //!< Add IsotopicVector to the existing IsotopicVector - void Add(const map<ZAI ,double>& quantity); //!< Add IsotopicVector to the existing IsotopicVector - void Add(int Z, int A, int I, double quantity) - { (*this).Add(ZAI(Z,A,I), quantity); } //!< Add Quantity gramme of the ZAI Element - - - void Need(const ZAI& zai, double quantity); //!< Fill the fIsotopicQuantityNeeded - void Need(const IsotopicVector& isotopicvector); //!< Fill the fIsotopicQuantityNeeded - void Need(const map<ZAI ,double>& quantityneeded) { fIsotopicQuantityNeeded = quantityneeded; } - //!< Fill the fIsotopicQuantityNeeded - - void Remove(const ZAI& zai, double quantity); //!< Remove Quantity gramme of the ZAI Element - void Remove(const IsotopicVector& isotopicvector); //!< Remove IsotopicVector to the existing IsotopicVector - - void Multiply(double factor); //!< Multiply the IV by a Factor - - - IsotopicVector& operator+=(IsotopicVector const& IVb); //!<.... - IsotopicVector& operator-=(IsotopicVector const& IVb); //!<.... - IsotopicVector& operator*=(IsotopicVector const& IVb); //!<.... - bool operator <(const IsotopicVector& isotopicvector) const; //!< IsotopicVector Comparator - - //@} - - - -//********* In/Out related Method *********// - - /*! - \name In/Out Method - */ - //@{ - - void Write(string filename, cSecond time = -1 ) const; ///< Write the Content of the IV in the filename file - - void Print(string o =" ") const ; ///< Print the composition of the IV - void PrintList(string o =" ") const ; ///< Print the composition of the IV - - //@} - - -//***************************************************///< - - - protected : - - map<ZAI ,double> fIsotopicQuantity; ///< Isotopic vector composition in Atome Number - map<ZAI ,double> fIsotopicQuantityNeeded; ///< Isotopic vector request and not present - - ClassDef(IsotopicVector,1); -}; - -IsotopicVector operator/(IsotopicVector const& IVA, double F); -IsotopicVector operator/(ZAI const& zai, double F); -IsotopicVector operator*(IsotopicVector const& IVA, double F); -IsotopicVector operator*(ZAI const& zai, double F); -IsotopicVector operator*(double F, IsotopicVector const& IVA); -IsotopicVector operator*(double F, ZAI const& zai); -IsotopicVector operator+(IsotopicVector const& IVa, IsotopicVector const& IVb); -IsotopicVector operator-(IsotopicVector const& IVa, IsotopicVector const& IVb); - -IsotopicVector operator*(IsotopicVector const& IVa, IsotopicVector const& IVb); - - -double RelativDistance(IsotopicVector IV1, IsotopicVector IV2 ); -double Distance(IsotopicVector IV1, IsotopicVector IV2 ,int DistanceType=0, IsotopicVector DistanceParameter=IsotopicVector()); -double DistanceStandard(IsotopicVector IV1, IsotopicVector IV2); -double DistanceAdjusted(IsotopicVector IV1, IsotopicVector IV2, IsotopicVector DistanceParameter); -double Norme(IsotopicVector IV1,int DistanceType=0, IsotopicVector DistanceParameter=IsotopicVector()); - - -#endif diff --git a/source/branches/CLASSV3/include/PhysicsModels.hxx b/source/branches/CLASSV3/include/PhysicsModels.hxx deleted file mode 100644 index d5a4e5a0063eadd5c2d21bf795c9fd56b7632bfb..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/PhysicsModels.hxx +++ /dev/null @@ -1,85 +0,0 @@ - -#ifndef _PhysicsModels_HXX -#define _PhysicsModels_HXX - - -/*! - \file - \brief Header file for XS_INTERPOLATOR class. - - - @authors BLG,BaM - @version 1.0 - */ -#include "EquivalenceModel.hxx" -#include "XSModel.hxx" -#include "IrradiationModel.hxx" -#include "EvolutionData.hxx" - - -using namespace std; -typedef long long int cSecond; - -//-----------------------------------------------------------------------------// -/*! - Define all the physic models used for a specific database - - The 2 following are data base related (for one Reactor and one fuel type and one ...) : - User can either define his own (see manual) or uses the provided ones ) : - - XS_Interpolator = Closest , MLP .... - Equivalence_Model = Linear,Quadratique, MLP ... - - this one is bateman solvers related : - (or it may be link to a evolution code (like MURE), not yet implemented but envisaged) - IrradiationModel = RK4 or Matrix - - - @authors BLG,BaM - @version 1.0 - */ -//________________________________________________________________________ - - -class PhysicsModels : public CLASSObject -{ - - public : - - /*! - \name Constructor/Desctructor - */ - //@{ - - PhysicsModels(); - PhysicsModels(XSModel* XS, EquivalenceModel* EM, IrradiationModel* IM ); - PhysicsModels(CLASSLogger* log, XSModel* XS, EquivalenceModel* EM, IrradiationModel* IM ); - - ~PhysicsModels() {;} - //{ - - EvolutionData GenerateEvolutionData(IsotopicVector IV, double cycletime, double Power); - - XSModel* GetXSModel() {return fXSModel;} - EquivalenceModel* GetEquivalenceModel() {return fEquivalenceModel;} - IrradiationModel* GetIrradiationModel() {return fIrradiationModel;} - - PhysicsModels* GetPhysicsModels() {return this;} - - - - - - - private : - - XSModel* fXSModel; - EquivalenceModel* fEquivalenceModel; - IrradiationModel* fIrradiationModel; - - - -}; - -#endif - diff --git a/source/branches/CLASSV3/include/Pool.hxx b/source/branches/CLASSV3/include/Pool.hxx deleted file mode 100755 index 20379177afced835a8108379e4245c83725e9270..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/Pool.hxx +++ /dev/null @@ -1,173 +0,0 @@ -#ifndef __Pool_HXX__ -#define __Pool_HXX__ -/*! - \file - \brief Header file for Pool class. - */ - -#include <string> -#include <map> - -#include "CLASSBackEnd.hxx" -#include "IsotopicVector.hxx" - -using namespace std; -typedef long long int cSecond; - -class CLASSBackEnd; -class CLASSLogger; -class DecayDataBank; - -//-----------------------------------------------------------------------------// -/*! - Define a Pool. - The aim of the Class is to manage evolution of all out reactor fuel. from Cooling to Waste or storage - - - @author BaM - @version 2.0 - */ -//________________________________________________________________________ - - - -class Pool : public CLASSBackEnd -{ -public : - - -//********* Constructor/Destructor Method *********// - - /*! - \name Constructor/Desctructor - */ - //@{ - - Pool(); ///< Normal Constructor. - - //{ - /// Special Constructor. - /*! - Make a new EvolutionData - \param Log CLASSLogger used for the log... - \param abstime time to start the Pool - \param coolingtime duration of the cooling. - */ - Pool(CLASSLogger* Log, cSecond coolingtime = 5*3600.*24.*365.25); //!< - //} - - - //{ - /// Special Special Constructor. - /*! - Make a new EvolutionData - \param Log CLASSLogger used for the log... - \param Storage storage which get the fuel after the cooling - \param abstime time to start the Pool - \param coolingtime duration of the cooling. - */ - Pool(CLASSLogger* log, CLASSBackEnd* Storage, - cSecond coolingtime = 5*3600.*24.*365.25); //!< - //} - - - ~Pool(); ///< Normal Destructor. - //@} - - - - -//********* Set Method *********// - - /*! - \name Set Method - */ - //@{ - - void SetOutBackEndFacility(CLASSBackEnd* befacility) - { fOutBackEndFacility = befacility; - SetIsStorageType(); - fPutToWaste = true; } //!< Set the Pointer to the Storage - - void SetPutToWaste(bool val) { fPutToWaste = val; } //!< Set True if IV goes to waste after cooling false instead - - void SetIVArray(vector<IsotopicVector> ivarray); //! not use there (Does nothing!!!) - void SetIVArray(vector<IsotopicVector> ivarray, vector<cSecond> timearray); //!< Set The isotopicVector Array at the corresponding time - - - using CLASSBackEnd::SetName; - - //@} - - - - -//********* Get Method *********// - - /*! - \name Get Method - */ - //@{ - - bool GetPutToWaste() const { return fPutToWaste; } //!< Return True if IV goes to waste after cooling false instead - - //@} - - - - -//********* IsotopicVector Managment Method *********// - - /*! - \name IsotopicVector Managment Method - */ - //@{ - - vector<cSecond> GetCoolingStartingTime() const - { return GetIVArrayArrivalTime(); } //!< Return the vector of Cooling Sstarting Time - void RemoveIVCooling(int i); //!< Remove a Cooling IsotopicVector - - void AddIV(IsotopicVector isotopicvector); //!< Add an Isotopicvector to the IVArray - //@} - - - - -//********* Other Method *********// - - //@} - /*! - \name Other Method - */ - //@{ - - void Evolution(cSecond t); //!< Performe the evolution until the Time t - void Dump(); //!< Write Modification (exchange between Cooling, Separation and Storage) - - //@} - -protected : - - - -//********* Internal Parameter *********// - bool fPutToWaste; //!< True if IV goes to waste after cooling false instead - - -//********* Isotopic Quantity *********// -//--------- Cooling ---------// - vector<int> fCoolingIndex; ///< Vector of the Cooling Index - int fCoolingLastIndex; //!< Number of Cooling IV Treated - vector<int> fCoolingEndOfCycle; //!< Index of the Cooling IV reaching the End of a Cooling Cycle - - -//********* Private Method *********// - void CoolingEvolution(cSecond t); //!< Deal the cooling and then send it to Separation - - - - - ClassDef(Pool,3); -}; - -#endif diff --git a/source/branches/CLASSV3/include/Reactor.hxx b/source/branches/CLASSV3/include/Reactor.hxx deleted file mode 100755 index 3212d8097e280572dd8ad5e210c7020a6303fb47..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/Reactor.hxx +++ /dev/null @@ -1,315 +0,0 @@ -#ifndef __Reactor_HXX__ -#define __Reactor_HXX__ - -/*! - \file - \brief Header file for reactor classes. - */ - -#include <string> -#include <map> - -#include "CLASSFacility.hxx" -#include "IsotopicVector.hxx" -#include "EvolutionData.hxx" -#include "PhysicsModels.hxx" -#include "CLASSFuelPlan.hxx" - -using namespace std; -typedef long long int cSecond; - - -class CLASSBackEnd; -class EvolutionData; -class FabricationPlant; -class Storage; -class CLASSLogger; - -//-----------------------------------------------------------------------------// -/*! - Define a reactor. - The aim of this class is to deal the evolution of the fuel inside a reactor. - The fuel state of the reactor is describe in the IsotopicVector. Its evolution is contain in the EvolutionData - - @author BaM - @version 2.0 - */ -//________________________________________________________________________ - - - -class Reactor : public CLASSFacility -{ -public : - - -//********* Constructor/Destructor Method *********// - - /*! - \name Constructor/Desctructor - */ - //@{ - - Reactor(); ///< Normal Constructor. - - //{ - /// CLASSLogger Constructor. - /*! - Use create an empty Reactor loading a CLASSLogger - \param CLASSLogger CLASSLogger used for the log... - */ - Reactor(CLASSLogger* log); - //} - - //{ - /// Special Constructor for reprocessed fuel using cycletime and Burn-Up. - /*! - Make a new reactor - \param CLASSLogger CLASSLogger used for the log... - \param CLASSBAckEnd Pool used facility wich get the fuel after iradiation - \param creationtime creation time - \param lifetime working time duration. - \param cycletime duration of a cycle - \param HMMass Mass of Heavy Metal in the Reactor - \param BurnUp Burnup reach by the fuel at the end of the cycle - */ - Reactor(CLASSLogger* log, CLASSBackEnd* Pool, - cSecond creationtime , cSecond lifetime, double Power, - double HMMass, double CapacityFactor = 1); - //} - - //{ - /// Special Constructor for reprocessed fuel using cycletime and Burn-Up. - /*! - Make a new reactor - \param CLASSLogger CLASSLogger used for the log... - \param CLASSBAckEnd Pool used facility wich get the fuel after iradiation - \param creationtime creation time - \param lifetime working time duration. - \param cycletime duration of a cycle - \param HMMass Mass of Heavy Metal in the Reactor - \param BurnUp Burnup reach by the fuel at the end of the cycle - */ - Reactor(CLASSLogger* log, - FabricationPlant* fabricationplant, CLASSBackEnd* Pool, - cSecond creationtime , cSecond lifetime, double Power, - double HMMass, double CapacityFactor = 1); - //} - - //{ - /// Special Constructor for reprocessed fuel using cycletime and Burn-Up. - /*! - Make a new reactor - \param CLASSLogger CLASSLogger used for the log... - \param fueltypeDB Databank describing the evolution of the fuel - \param CLASSBAckEnd Pool used facility wich get the fuel after iradiation - \param creationtime creation time - \param lifetime working time duration. - \param cycletime duration of a cycle - \param HMMass Mass of Heavy Metal in the Reactor - \param BurnUp Burnup reach by the fuel at the end of the cycle - */ - Reactor(CLASSLogger* log, PhysicsModels* fueltypeDB, - FabricationPlant* fabricationplant, CLASSBackEnd* Pool, - cSecond creationtime , cSecond lifetime, cSecond cycletime, - double HMMass, double BurnUp); - //} - - //{ - /// Special Constructor for reprocessed fuel using Power and Burn-Up. - /*! - Make a new reactor - \param CLASSLogger CLASSLogger used for the log... - \param fueltypeDB Databank describing the evolution of the fuel - \param CLASSBAckEnd Pool used facility wich get the fuel after iradiation - \param creationtime creation time - \param lifetime working time duration. - \param Power Thermal power of the reactor - \param HMMass Mass of Heavy Metal in the Reactor - \param BurnUp Burnup reach by the fuel at the end of the cycle - \param CapacityFactor effective charge of the reactor. - */ - Reactor(CLASSLogger* log, PhysicsModels* fueltypeDB, - FabricationPlant* fabricationplant, CLASSBackEnd* Pool, - cSecond creationtime , cSecond lifetime, - double Power, double HMMass, double BurnUp, double CapacityFactor); - //} - - //{ - /// Special Constructor for fixed fuel using Power and Burn-Up. - /*! - Make a new reactor - \param CLASSLogger CLASSLogger used for the log... - \param evolutivedb EvolutionData describing the evolution of the fuel - \param CLASSBAckEnd Pool used facility wich get the fuel after iradiation - \param creationtime creation time - \param lifetime working time duration. - \param Power Thermal power of the reactor - \param HMMass Mass of Heavy Metal in the Reactor - \param BurnUp Burnup reach by the fuel at the end of the cycle - \param CapacityFactor effective charge of the reactor. - */ - Reactor(CLASSLogger* log, EvolutionData* evolutivedb, CLASSBackEnd* Pool, - cSecond creationtime, cSecond lifetime, - double power, double HMMass, double BurnUp, double CapacityFactor); - //} - - //{ - /// Special Constructor for fixed fuel using Power and Burn-Up. - /*! - Make a new reactor - \param CLASSLogger CLASSLogger used for the log... - \param evolutivedb EvolutionData describing the evolution of the fuel - \param CLASSBAckEnd Pool used facility wich get the fuel after iradiation - \param creationtime creation time - \param lifetime working time duration. - \param Power Thermal power of the reactor - \param HMMass Mass of Heavy Metal in the Reactor - \param BurnUp Burnup reach by the fuel at the end of the cycle - \param CapacityFactor effective charge of the reactor. - */ - Reactor(CLASSLogger* log, EvolutionData* evolutivedb, CLASSBackEnd* Pool, - cSecond creationtime, cSecond lifetime, - cSecond cycletime, double HMMass, double BurnUp); - //} - - ~Reactor(); ///< Normal Destructor - - //@} - - - - -//********* Get Method *********// - - /*! - \name Get Method - */ - //@{ - - IsotopicVector GetIVReactor() const { return GetInsideIV(); } //!< Return the IV contain in the Reactor - IsotopicVector GetIVBeginCycle() const { return fIVBeginCycle; } //!< Return the Starting Cycle IV - //!< (Note : IVBegin != IVIn, only if using charging plan) - - IsotopicVector GetIVOutCycle() const { return fIVOutCycle; } //!< Return the Out Cycle IV - IsotopicVector GetIVInCycle() const { return fIVInCycle; } //!< Return the In Cycle IV - //!< (Note : IVIn != IVBegin, only if using charging plan) - - - - bool IsFuelFixed() const { return fFixedFuel; } //!< True if using fixed Fuel, False otherwise - double GetHeavyMetalMass() const { return fHeavyMetalMass; } //!< Return the HeavyMetal Mass in the Core at the begining of the cycle - double GetBurnUp() const { return fBurnUp; } //!< Return the Burn Up of the Fuel at the end of the cycle - double GetPower() const { return fPower; } //!< Return the cycle time of the Reactor - -#ifndef __CINT__ - - EvolutionData GetEvolutionDB() const { return fEvolutionDB; } //!< Return the Evolution database of the Fuel - - CLASSBackEnd* GetOutBackEndFacility() const { return fOutBackEndFacility; } //!< Return the pointer to Associeted BackEnd Facility - FabricationPlant* GetFabricationPlant() const { return fFabricationPlant; } //!< Return the Pointer to the FabricationPlant - - - CLASSFuelPlan* GetFuelPlan() const { return fFuelPlan; } //!< return the LoadingPlan - -#endif - //@} - - - - -//********* Set Method *********// - - /*! - \name Set Method - */ - //@{ - void SetFuelPlan(CLASSFuelPlan* fuelplan) { fFuelPlan = fuelplan; } //!< return the LoadingPlan - - - void SetHMMass(double Mass) {fHeavyMetalMass = Mass;} //!< Set the HeavyMetal Mass in the Core at the begining of the cycle - - void SetIVReactor(IsotopicVector isotopicvector) - { fInsideIV = isotopicvector; } //!< Set the IV inside the Reactor Core - void SetIVBeginCycle(IsotopicVector isotopicvector) - { fIVBeginCycle = isotopicvector; } //!< Set the IV at the Beginging of the Reactor Cycle - void SetIVOutCycle(IsotopicVector isotopicvector) - { fIVOutCycle = isotopicvector; } //!< Set the IV Going Out at the End of the Cycle - void SetIVInCycle(IsotopicVector isotopicvector) - { fIVInCycle = isotopicvector; } //!< Set the IV Coming In at the Beginning of the Cycle - - - void SetCycleTime(double cycletime); //!< Set the Cycle time (Power fixed) - void SetPower(double Power); //!< Set the Power (BurnUp cte) - void SetBurnUp(double BU); //!< Set the BurnUp reach at end of cycle (Power cte) - - -#ifndef __CINT__ - - void SetOutBackEndFacility(CLASSBackEnd* pool) { fOutBackEndFacility = pool; } //!< Return the pointer to OutBackEnd Facility - void SetStorage(Storage* storage) { fStorage = storage; fIsStorage = true;} //!< Set the Pointer to the Storage - void SetFabricationPlant(FabricationPlant* FP) { fFabricationPlant = FP;} //!< Set the Pointer to the FabricationPlant - void SetEvolutionDB(EvolutionData evolutionDB); //!< Set the Pointer to the DB Evolution of the Reactor -#endif - - using CLASSFacility::SetName; - using CLASSFacility::GetName; - - //@} - - - - -//********* Evolution & Modification Method *********// - - /*! - \name Evolution & Modification Method - */ - //@{ - - void Evolution(cSecond t); //!< Performe the Evolution until the Time t - void Dump(); //!< Write Modification (IV In/Out, filling the TF...) - void SetNewFuel(EvolutionData ivdb); //!< Change the Evolutive DB of the Reactor - - //@} - - - -protected : - - bool fFixedFuel; //!< true if the fuel is fixed (not reprocessed) - bool fIsStorage; //!< true if a storage has been define (to approximate the reprocessing using fixed fuel) - -//********* Internal Parameter *********// - - double fPower; ///< Power (in Watt) - - IsotopicVector fIVBeginCycle; ///< Fuel IV at the Beginning of a Cycle - IsotopicVector fIVInCycle; ///< IVBegin add at the Beginning of the Cycle - IsotopicVector fIVOutCycle; ///< IV wich get out at the End of a Cycle - -#ifndef __CINT__ - EvolutionData fEvolutionDB; //!< Pointer to the Actual Evolution DataBase - - CLASSBackEnd* fOutBackEndFacility; //!< Pointer to the BackEnd Facility which collect the spend fuel - - - CLASSFuelPlan* fFuelPlan; - - FabricationPlant* fFabricationPlant; //!< Poitner to the FabricationPlant - - Storage* fStorage; //!< Pointer to the Stock (only for reprocessing fuel in fixed base...) - - -#endif -//********* Unfixed Fuel Parameter *********// - - - double fHeavyMetalMass; ///< In tons - double fBurnUp; ///< In GWd/tHM - - ClassDef(Reactor,3); - }; - - -#endif diff --git a/source/branches/CLASSV3/include/Scenario.hxx b/source/branches/CLASSV3/include/Scenario.hxx deleted file mode 100755 index 3f889dedc1696e5341073859bb90783461788aaa..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/Scenario.hxx +++ /dev/null @@ -1,285 +0,0 @@ -#ifndef _SCENARIO_HXX_ -#define _SCENARIO_HXX_ -/*! - \file - \brief Header file for CLASS classes. - */ - -#include "CLASSObject.hxx" -#include "IsotopicVector.hxx" - -#include <TFile.h> -#include <TTree.h> -#include <vector> -#include <string> -#include <map> -#include <iostream> - - - -using namespace std; -typedef long long int cSecond; - -class DecayDataBank; -class FabricationPlant; -class SeparationPlant; -class Reactor; -class Pool; -class Storage; - -//-----------------------------------------------------------------------------// -/*! -Define a Scenario . -The aim of these Scenario is to manage the park and its evolution and to lead all Storage, FabricationPlant, Reactor, Pool. - - - @author BaM - @author Marc - @version 2.0 - */ -//________________________________________________________________________ - - -class Scenario : public CLASSObject -{ -public : - -//********* Constructor/Destructor Method *********// - - /*! - \name Constructor/Desctructor - */ - //@{ - - Scenario(); ///< Normal Constructor. - - Scenario(CLASSLogger* Log, cSecond abstime = 0); ///< Log Constructor. - /*! - Use to load a CLASSLogger - \param CLASSLogger: CLASSLogger used for the log... - */ - Scenario(cSecond abstime); ///< Time Constructor. - - - Scenario(cSecond abstime, CLASSLogger* log); ///< Time Constructor. - /*! - Use to set the starting time of the Parc - \param abstime: Starting time of the Parc in second - */ - - ~Scenario(); ///< Normal Destructor. - //@} - - -//********* Get Method *********// - /*! - \name Get Function - */ - //@{ - cSecond GetAbsoluteTime() { return fAbsoluteTime; } ///< Return the Absolute Clock - map<cSecond, int> GetTimeStep() { return fTimeStep; } ///< Return the Time Step Vector - vector<Reactor*> GetReactor() { return fReactor; } ///< Return the Reactor Vector - vector<Storage*> GetStorage() { return fStorage; } ///< Return the Storage Vector - vector<Pool*> GetPool() { return fPool; } ///< Return the Pool Vector - vector<FabricationPlant*> GetFabricationPlant() { return fFabricationPlant; } ///< Return the FabricationPlant Vector - DecayDataBank* GetDecayDataBase() { return fDecayDataBase; } //!< Return the Pointer to the Decay DataBase - - cSecond GetPrintSet() { return fPrintStep; } ///< Return the Print Step Periodicity - bool GetStockManagement() { return fStockManagement; } ///< Return the StockManagement method (True or False) - string GetOutputFileName() { return fOutputFileName; } ///< Return the Output File name - string GetOutputTreeName() { return fOutputTreeName; } ///< Return the Output ROOT TTree name - - IsotopicVector GetWaste() { return fWaste;} ///< Return the waste IsotopicVcetor - - //@} - - - - -//********* Set Method *********// - /*! - \name Set Function - */ - //@{ - - //{ - /// Set the Printing Step periodicity - /*! - Use to set the periodicity of the output - \param timestep: periodicity of outpout in second - */ - void SetTimeStep(cSecond timestep) { fPrintStep = timestep; } - //} - - //{ - /// Set the StockManagement method - /*! - Use to define the stock managment method : true all fuel are stored individualy and false all fuel are mixed in a stock, and one can separate each isotope as needed - \param val: true or false depending on the stock management method used - */ - void SetStockManagement(bool val) { fStockManagement = val; } - //} - - //{ - /// Set the Decay DataBank - /*! - Use to define Decay DataBank to be used - \param decaydatabase: a DecayDataBank which should contain the evolution of each nuclei of the chart - */ - void SetDecayDataBase(DecayDataBank* decaydatabase) { fDecayDataBase = decaydatabase; } - //} - - //{ - /// Set the Output File Name - /*! - Use to define name of the output file - \param name: a string which correspond to the output file name - */ - void SetOutputFileName(string name) { fOutputFileName = name; } - //} - - - //{ - /// Set the Output TTree Name - /*! - Use to define name of the output ROOT TTree - \param name: a string which correspond to the output ROOT TTree name - */ - void SetOutputTreeName(string name) { fOutputTreeName = name; } - //} - //@} - - void SetLogTimeStep(bool val = true) {fLogTimeStep = true;} - -//********* Add Method *********// - /*! - \name Adding Facilities - */ - //@{ - - void AddPool(Pool* Pool); ///< Add a Pool to the Park - void AddReactor(Reactor* reactor); ///< Add a Reactor to the Park - void AddStorage(Storage* storage); ///< Add a Storage to the Park - void AddFabricationPlant(FabricationPlant* fabricationplant); ///< Add a Storage to the Park - void AddSeparationPlant(SeparationPlant* separationplant); - - void Add(Pool* Pool) {AddPool(Pool);} ///< Add a Pool to the Park - void Add(Reactor* reactor) {AddReactor(reactor);} ///< Add a Reactor to the Park - void Add(Storage* storage) {AddStorage(storage);} ///< Add a Storage to the Park - void Add(FabricationPlant* fabricationplant) {AddFabricationPlant(fabricationplant);}///< Add a Storage to the Park - void Add(SeparationPlant* separationplant) {AddSeparationPlant(separationplant);}///< Add a Storage to the Park - - //@} - - - -//********* Evolution Method *********// - /*! - \name Evolution Method - */ - //@{ - - void BuildTimeVector(cSecond t); ///< Build the Time Evolution Vector where : - /// \li 1 printing, - /// \li 2 reactor Studown - /// \li 4 start/End of reactor cycle, - /// \li 8 end of Cooling, - /// \li 16 fuel Fabrication - - void Evolution(cSecond t); ///< Perform the Evolution - void PoolEvolution(); ///< Perform TF Evolution - void ReactorEvolution(); ///< Perform the Reactor Evolution - void FabricationPlantEvolution(); ///< Perform the FabricationPlant Evolution - void StorageEvolution(); ///< Perform the Storage Evolution - - //@} - - - -//-------- IsotopicVector --------// - - /*! - \name IsotopicVector Sum - */ - //@{ - - - IsotopicVector GetOutIncome() const { return fOutIncome; } //!< Return the OutIncome Providings IsotopicVector - void AddOutIncome(ZAI zai, double quantity) { AddOutIncome(zai*quantity); } //!< Add a ZAI*quantity to OutIncomeIncome - void AddOutIncome(IsotopicVector isotopicvector) { fOutIncome.Add(isotopicvector); } //!< Add a isotopicVector to OutIncomeIncome - void AddWaste(ZAI zai, double quantity) { AddWaste(zai*quantity); } //!< Add a ZAI*quantity to Waste - void AddWaste(IsotopicVector isotopicvector) { fWaste.Add(isotopicvector); } //!< Add a isotopicVector to Waste - void AddToPower(double power) { fParcPower += power;} //!< Add power to the installed power in the Parc - - //@} - - - -//********* In/Out related Method *********// - - /*! - \name In/Out Method - */ - //@{ - - - void ProgressPrintout(cSecond t); //!< Update the prompt output to the time t - - void Print(); //!< Print some information about the Parc - void Write(); //!< Write information in a file - void UpdateParc(); //!< Update the Global IsotopicVector - void OpenOutputTree(); //!< Open and define the Ouput ROOT TTree - void CloseOutputTree(); //!< Close and delete the Ouput ROOT TTree - void OutAttach(); //!< Attach the Branch to the Ouput ROOT TTree - void ResetQuantity(); //!< Reset the values of the GLobal IsotopicVector - - //@} - - - -protected : - bool fNewTtree; //!< Tru if we want to define a new TTree in the output File - bool fStockManagement; ///< True if real StockManagement false unstead (Default = true) - bool fLogTimeStep; - - cSecond fPrintStep; ///< Time interval between two output update - cSecond fAbsoluteTime; ///< Absolute Clock - cSecond fStartingTime; ///< Starting Time - map<cSecond, int> fTimeStep; ///< Time Step Vector for the evolution : - /// \li 1 printing, - /// \li 2 reactor Studown - /// \li 4 start/End of reactor cycle, - /// \li 8 end of Cooling, - /// \li 16 fuel Fabrication - - - vector<Storage*> fStorage; ///< Vector of Storages - vector<Pool*> fPool; ///< Vector of Pool - vector<Reactor*> fReactor; ///< Vector of Reactor - vector<FabricationPlant*> fFabricationPlant; ///< Vector of FabricationPlant - vector<SeparationPlant*> fSeparationPlant; ///< Vector of FabricationPlant - DecayDataBank* fDecayDataBase; //!< Pointer to the Decay DataBase - - - TFile* fOutFile; ///< Pointer to the Root Output File - string fOutputFileName; //! Name of the Output File - TTree* fOutT; ///< Pointer to the Root Output TTr3ee - string fOutputTreeName; //! Name of the Output TTree - string fOutputLogName; ///< Name of the Ouput log File - - IsotopicVector fWaste; ///< Waste IV - IsotopicVector fTotalStorage; ///< Sum of all IV in Storage IV - IsotopicVector fOutIncome; ///< OutIncomeIncome IV - IsotopicVector fTotalCooling; ///< Sum of all IV in Cooling IV - IsotopicVector fFuelFabrication; ///< Sum of all IV in Fabrication IV - IsotopicVector fTotalInReactor; ///< Sum of all IV in Reactor IV - - - IsotopicVector fIVInCycleTotal; ///< Sum of all IV in the cycle (without Waste) IV - IsotopicVector fIVTotal; ///< Sum of all IV in the parc (including Waste) IV - double fParcPower; ///< Sum of the Power of all reactor in the parc - -}; - - -#endif diff --git a/source/branches/CLASSV3/include/SeparationPlant.hxx b/source/branches/CLASSV3/include/SeparationPlant.hxx deleted file mode 100644 index 69a5dbc7eca32ecc1ab8656660e15c1eba805c33..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/SeparationPlant.hxx +++ /dev/null @@ -1,153 +0,0 @@ -#ifndef __SeparationPlant_HXX__ -#define __SeparationPlant_HXX__ -/*! - \file - \brief Header file for SeparationPlant class. - */ - -#include <string> -#include <map> - -#include "CLASSBackEnd.hxx" -#include "Storage.hxx" -#include "IsotopicVector.hxx" - -using namespace std; -typedef long long int cSecond; - -class CLASSBackEnd; -class CLASSLogger; -class DecayDataBank; - -//-----------------------------------------------------------------------------// -/*! - Define a SeparationPlant. - The aim of the Class is to separate an IV into several IV (MA, Pu, PF, etc...) and to send it to corresponding storage - - @author NT - @version 1.0 - */ -//________________________________________________________________________ - - - -class SeparationPlant : public CLASSBackEnd -{ -public : - - -//********* Constructor/Destructor Method *********// - - /*! - \name Constructor/Desctructor - */ - //@{ - - SeparationPlant(); ///< Normal Constructor. - - //{ - /// Special Constructor. - /*! - Make a new SeparationPlant - \param Log CLASSLogger used for the log... - \param separationtime duration of the SeparationPlant - */ - SeparationPlant(CLASSLogger* Log); //!< - //} - - - - ~SeparationPlant(); ///< Normal Destructor. - //@} - - - - -//********* Set Method *********// - - /*! - \name Set Method - */ - //@{ - - - void SetBackEndDestination(CLASSBackEnd* storagedestination, IsotopicVector isotopicvector, cSecond destinationstartingtime); - - void AddIV(IsotopicVector IV); - - void SetPutToWaste(bool val) { fPutToWaste = val; } //!< Set True if IV goes to waste after cooling false instead - - - using CLASSBackEnd::SetName; - - //@} - - - - -//********* Get Method *********// - - /*! - \name Get Method - */ - //@{ - - bool GetPutToWaste() const { return fPutToWaste; } //!< Return True if IV goes to waste after cooling false instead - - //@} - - - map<cSecond,int> GetTheBackEndTimePath(); - - -//********* IsotopicVector Managment Method *********// - - /*! - \name IsotopicVector Managment Method - */ - //@{ - - vector<cSecond> GetCoolingStartingTime() const - { return GetIVArrayArrivalTime(); } //!< Return the vector of Cooling Sstarting Time - //@} - - - - -//********* Other Method *********// - - //@} - /*! - \name Other Method - */ - //@{ - - - //@} - -protected : - - - -//********* Internal Parameter *********// - bool fPutToWaste; //!< True if IV goes to waste after cooling false instead - vector<CLASSBackEnd* > fDestinationStorage; //!< Vector containing destination storage of the IV in the Separation Plant - vector<IsotopicVector > fDestinationStorageIV; //!< Vector containing destination storage of the IV in the Separation Plant - vector<cSecond> fDestinationStorageStartingTime; //!< Vector containing destination storage starting time of the IV in the Separation Plant - -//********* Isotopic Quantity *********// -//--------- Cooling ---------// - vector<int> fCoolingIndex; ///< Vector of the Cooling Index - int fCoolingLastIndex; //!< Number of Cooling IV Treated - vector<int> fCoolingEndOfCycle; //!< Index of the Cooling IV reaching the End of a Cooling Cycle - - -//********* Private Method *********// - - - - - ClassDef(SeparationPlant,3); -}; - -#endif diff --git a/source/branches/CLASSV3/include/Storage.hxx b/source/branches/CLASSV3/include/Storage.hxx deleted file mode 100644 index a2d33b9d3201d7846bfff7fa84e0f37019767753..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/Storage.hxx +++ /dev/null @@ -1,167 +0,0 @@ -#ifndef __Storage_HXX__ -#define __Storage_HXX__ - -/*! - \file - \brief Header file for Storage class. - */ - - -#include <vector> - -#include "CLASSBackEnd.hxx" -#include "IsotopicVector.hxx" - - -using namespace std; -typedef long long int cSecond; - -class CLASSLogger; -class DecayDataBank; - -//-----------------------------------------------------------------------------// -/*! - Define a Storage. - The aim of this class is to deal the store used fuel after the cooling dealing the evolution of all radiaoactive nuclei. - - @author BaM - @version 2.0 - */ -//________________________________________________________________________ - - - -class Storage : public CLASSBackEnd -{ -public : - - -//********* Constructor/Destructor Method *********// - - /*! - \name Constructor/Desctructor - */ - //@{ - - Storage(); ///< Normal Constructor. - - //{ - /// CLASSLogger Constructor. - /*! - Use create an empty Stotarage loading a CLASSLogger - \param CLASSLogger CLASSLogger used for the log... - */ - Storage(CLASSLogger* log); - //} - - - //{ - /// Special Constructor. - /*! - Make a new reactor - \param CLASSLogger CLASSLogger used for the log... - \param evolutivedb DataBank for decay management - */ - Storage(CLASSLogger* log, DecayDataBank* evolutivedb); - //} - - - ~Storage(); ///< Normal Destructor. - - //@} - - - - -//********* Set Method *********// - - /*! - \name Set Method - */ - //@{ - - using CLASSBackEnd::SetName; - using CLASSBackEnd::SetIsStorageType; - - //@} - - -//********* Get Method *********// - - /*! - \name Get Method - */ - //@{ - //@} - - - - -//********* Storage specific Method *********// - - /*! - \name Storage specific Method - */ - //@{ - - void AddToFullStock(IsotopicVector isotopicvector) { fInsideIV += isotopicvector; } //!< Add a IsotopicVector to the Storage - - void TakeFractionFromStock(int IVId,double fraction); //!< Take a part from an IV in sotck; - void TakeFromStock(IsotopicVector isotopicvector); //!< - - - void AddIV(IsotopicVector isotopicvector); //!< Add an Isotopicvector to the IVArray - void AddToStock(IsotopicVector isotopicvector) {AddIV(isotopicvector);} //!< Add an Isotopicvector to the IVArray - void RemoveEmptyStocks(); //!< delete the empty Isotopicvectors contained in IVArray - - //@} - - - - -//********* Evolution Method *********// - - /*! - \name Evolution Method - */ - //@{ - - void Evolution(cSecond t); //!< Performe the evolution until the Time t - - //@} - - //********* In/Out Method *********// - - /*! - \name In/Out Method - */ - //@{ - - //{ - /// Write the Isotope composition of all IsotopicVector stored. - /*! - Make a new reactor - \param filenam CLASSLogger used for the log... - \param data only use to srite a date in the file, theyr is not treatment of the date in this method.... - */ - void Write(string filename,cSecond date = -1); - //} - - //@} - -protected : - -//********* Isotopic Quantity *********// - - - -//********* Private Method *********// - void StorageEvolution(cSecond t); //!< Deal the Storage Decay Evolution - - - - - ClassDef(Storage,3); -}; - -#endif diff --git a/source/branches/CLASSV3/include/StringLine.hxx b/source/branches/CLASSV3/include/StringLine.hxx deleted file mode 100755 index 9cd25243aed20c2923aef6f5aee5c9109f5cd296..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/StringLine.hxx +++ /dev/null @@ -1,275 +0,0 @@ -#ifndef _STRINGLINE_ -#define _STRINGLINE_ - -#include <string> -#include <sstream> -#include <iostream> -#include <algorithm> -#include <cctype> -using namespace std; -/*! - \file - \brief Header file for StingLine class. -*/ - -// Class extracting fields from a string / line. -/*! - The aim of this class is to provide tools to extract fields ("word") from - a string and convert a string in Upper/Lower case. - All methods are static so that it is not necessary to create object to use them - - example: - \code - string line="The temperature is : 300.6 K"; - int start; - - 1st method: creation of StringLine - - start=0; - StringLine SL; - string the=SL.NextWord(line,start); - string temperature_is=SL.NextWord(line,start,':'); - string colon=SL.NextWord(line,start); - double T=atof(SL.NextWord(line,start).c_str()); - cout<<the<<endl<<temperature_is<<endl<<T<<endl; - - 2nd method: "using" the static methods - - start=0; - the=StringLine::NextWord(line,start); - temperature_is=StringLine::NextWord(line,start,':'); - colon=StringLine::NextWord(line,start); - T=atof(StringLine::NextWord(line,start).c_str()); - cout<<the<<endl<<temperature_is<<endl<<T<<endl; - \endcode - @author PTO - @version 2.01 -*/ - -class StringLine -{ - public: - // Find the next word in a line. - /*! - Find Next word in a line starting from position "start" in the line. If an alternative - separator is given, the word length is defined by the first position of sep or alt_sep found. - The first value of start is in general 0 (i.e. the beginning of the Line) - \param Line : a line containing words - \param start : from where to start to find the begining of a word - \param sep : the separator between 2 words (default=space) - \param alt_sep : the alternative separator between 2 words (default='') - */ - static string NextWord(string Line,int &start,char sep=' ', char alt_sep='\0'); - // Find the previous word in a line. - /*! - Find Previous word in a line starting from position "start" in the line. If an alternative - separator is given, the word length is defined by the first position of sep or alt_sep found. - The first value of start is in general the end of the Line. - \param Line : a line containing words - \param start : from where to start to find the begining of a word - \param sep : the separator between 2 words (default=space) - \param alt_sep : the alternative separator between 2 words (default='') - */ - static string PreviousWord(string Line,int &start,char sep=' ', char alt_sep='\0'); - static void ToLower(string &Line); // convert a string to Lower case - static void ToUpper(string &Line); // convert a string to Upper case - - // Find \p search in \p Line from the begining. - /*! - returns the position, starting from the begenning of the first occurence - of \p search in \p Line if it is found, else returns -1 - \param search : a string to find - \param Line : where to search - */ - static int Find(const char *search,string Line); - // Find \p search in \p Line from the end. - /*! - returns the position, starting from the end of the first occurence - of \p search in \p Line if it is found, else returns -1 - \param search : a string to find - \param Line : where to search - */ - static int rFind(const char *search,string Line); - // convert a input type (\p in_T) to another (\p out_T). - /*! - Example: - \code - string s="32.12"; - double t=StringLine::convert<double>(s); - string temperature=StringLine::convert<string>(300.); - \endcode - \param t : the input value - */ - template <class out_T, class in_T> static out_T convert(const in_T & t); - // Find the start of a word in a line. - /*! - \param Line : a line containing words - \param CurrentPosition : from where to start to find the begining of a word - \param sep : the separator between 2 words (default=space) - \param alt_sep : the alternative separator between 2 words (default='') - */ - static int GetStartWord(string Line,int CurrentPosition,char sep=' ', char alt_sep='\0'); - // Find the end of a word in a line. - /*! - \param Line : a line containing words - \param CurrentPosition : from where to start to find the end of a word - \param sep : the separator between 2 words (default=space) - \param alt_sep : the alternative separator between 2 words (default='') - */ - static int GetEndWord(string Line,int CurrentPosition,char sep=' ', char alt_sep='\0'); - // Replace a sub-string by an other in a string. - /*! - \param InLine : the string which contains the sub-string to replace - \param ToReplace : the sub-string to replace - \param By : the sub-string ToReplace is replaced by the sub-string By in Inline - */ - string ReplaceAll(string InLine, string ToReplace, string By); -}; - - -//_________________________________________________________________________________ -inline string StringLine::NextWord(string Line,int &start,char sep, char alt_sep) -{ - string Word=""; - if(start>=int(Line.size())) - { - return Word; - } - start=GetStartWord(Line,start,sep,alt_sep); - int wordlength=GetEndWord(Line,start,sep,alt_sep)-start; - - Word=Line.substr(start,wordlength); - - start+=wordlength; - return Word; -} -//_________________________________________________________________________________ -inline string StringLine::PreviousWord(string Line,int &start,char sep, char alt_sep) -{ - string Word=""; - if(start<=0) - { - return Word; - } - int pos=Line.rfind(sep,start); - int alt_pos=-1; - int real_pos=pos; - char real_sep=sep; - if(alt_sep!='\0') - { - alt_pos=Line.rfind(alt_sep,start); - real_pos=max(pos,alt_pos); - if(real_pos!=pos) - real_sep=alt_sep; - } - int wordlength=start-Line.rfind(real_sep,real_pos); - if(real_pos<=0) - { - Word=Line.substr(0,start+1); - start=0; - return Word; - } - Word=Line.substr(real_pos+1,wordlength); - - start-=wordlength+1; - return Word; -} - -//_________________________________________________________________________________ -inline void StringLine::ToLower(string &Line) -{ - transform (Line.begin(), Line.end(), // source - Line.begin(), // destination - (int(*)(int))tolower); // operation -} - -//_________________________________________________________________________________ -inline void StringLine::ToUpper(string &Line) -{ - transform (Line.begin(), Line.end(), // source - Line.begin(), // destination - (int(*)(int))toupper); // operation -} - -//_________________________________________________________________________________ -inline int StringLine::GetStartWord(string Line,int CurrentPosition,char sep, char alt_sep) -{ - int pos=Line.find(sep,CurrentPosition); - int alt_pos=-1; - if(alt_sep!='\0') - alt_pos=Line.find(alt_sep,CurrentPosition); - int real_pos=pos; - char real_sep=sep; - if(alt_pos>=0) - { - real_pos=min(pos,alt_pos); - if(pos==int(string::npos))real_pos=alt_pos; - if(real_pos!=pos) - real_sep=alt_sep; - } - if(real_pos==int(string::npos)) return CurrentPosition; - while(CurrentPosition<int(Line.size()) && Line[CurrentPosition]==real_sep) - CurrentPosition++; - return CurrentPosition; -} - -//_________________________________________________________________________________ -inline int StringLine::GetEndWord(string Line,int CurrentPosition,char sep, char alt_sep) -{ - int pos=Line.find(sep,CurrentPosition); - int alt_pos=-1; - if(alt_sep!='\0') - alt_pos=Line.find(alt_sep,CurrentPosition); - int real_pos=pos; - if(alt_pos>=0) - { - real_pos=min(pos,alt_pos); - if(pos==int(string::npos))real_pos=alt_pos; - } - if(real_pos==int(string::npos)) - return Line.size(); - return real_pos; -} - -//_________________________________________________________________________________ -inline int StringLine::Find(const char *search,string Line) -{ - size_t Pos=Line.find(search); - if(Pos != string::npos ) return Pos; - return -1; -} - -//_________________________________________________________________________________ -inline int StringLine::rFind(const char *search,string Line) -{ - size_t Pos=Line.rfind(search); - if(Pos != string::npos) return Pos; - return -1; -} - -//_________________________________________________________________________________ -template <class out_T, class in_T> -inline out_T StringLine::convert(const in_T & t) -{ - stringstream stream; - stream << t; // insert value to stream - out_T result; // store conversion's result here - stream >> result; // write value to result - return result; -} - -//_________________________________________________________________________________ -inline string StringLine::ReplaceAll(string InLine, string ToReplace, string By) -{ - int start=0; - int pos=InLine.find(ToReplace,start); - while(pos!=int(string::npos)) - { - InLine.replace(pos,ToReplace.size(),By); - start=0; - pos=InLine.find(ToReplace,start); - } - return InLine; - -} -#endif diff --git a/source/branches/CLASSV3/include/XSModel.hxx b/source/branches/CLASSV3/include/XSModel.hxx deleted file mode 100644 index 832a2bdc7aba4fb49bac70db9b96e061fe849ac5..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/XSModel.hxx +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef _XSMODEL_HXX -#define _XSMODEL_HXX - - -/*! - \file - \brief Header file for XSMODEL class. - - - @author BLG - @version 1.0 - */ -#include "EvolutionData.hxx" -#include "CLASSObject.hxx" - - -using namespace std; - -class IsotopicVector; - -//-----------------------------------------------------------------------------// -/*! - Define a XS Interpolator -This is the class for method related to XS prediction - -see @/Models/XS/include/MLPXSModel.hxx -see @/Models/XS/include/ClosestXSModel.hxx -... - -!!!!!!!!!!!!!!!!CAUTION!!!!!!!!!!!!! -Never instantiate XSModel in your CLASS input but it's derivated class - - - @author BLG - @version 1.0 - */ -//________________________________________________________________________ - - -class XSModel : public CLASSObject -{ - - public : - - XSModel(); - XSModel(CLASSLogger* log); - - virtual EvolutionData GetCrossSections(IsotopicVector IV,double t=0) {return EvolutionData();} - - - -}; - -#endif - diff --git a/source/branches/CLASSV3/include/ZAI.hxx b/source/branches/CLASSV3/include/ZAI.hxx deleted file mode 100755 index df0b9b9650aba56e5c71c28a8ab7606685ccac68..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/ZAI.hxx +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef _ZAI_ -#define _ZAI_ - -/*! - \file - \brief Header file for ZAI classes. - */ - -#include <string> -#include "TObject.h" -#include <iostream> - -using namespace std; - -//-----------------------------------------------------------------------------// -/*! - Define a nuclei as : Z A I. - The aim of this class is to discribe each ZAI. - - @author BaM - @version 2.0 - */ -//________________________________________________________________________ - - - -class ZAI : public TObject -{ -public: - - -//********* Constructor/Destructor Method *********// - - /*! - \name Constructor/Desctructor - */ - //@{ - - ZAI(); ///< Default constructor - - //{ - ///< Normal Constructor. - /*! - Default: No parent - \param Z : number of protons - \param A : number of nucleons (A=0 means natural isotopes) - */ - ZAI(int Z, int A, int I=0); - //} - - - ~ZAI(); ///< Normal Destructor. - - -//********* ZAI main attributes Method *********// - - /*! - \name ZAI main attributes - */ - //@{ - int Z() const { return fZ; } //!< returns the number of protons - int A() const { return fA; } //!< returns the number of nucleons - int I() const { return fI; } //!< returns the Isomeric State - int N() const { return fA-fZ; } //!< returns the number of neutrons - - //@} - - - - ZAI operator=(ZAI IVa); //!< ... - bool operator <(const ZAI& zai) const { return (fZ != zai.Z())? - (fZ < zai.Z()) : ( (fA != zai.A())? - (fA < zai.A()) : (fI < zai.I()) ); } - - bool operator !=(const ZAI& zai) const { return ( fZ != zai.Z() ) || ( fA != zai.A() ) || ( fI != zai.I() ); } - bool operator ==(const ZAI& zai) const { return ( fZ == zai.Z() && fA == zai.A() && fI == zai.I()); } - void Print() const { cout << fZ << " " << fA << " " << fI << endl;} - - -protected : - - string fName; ///< Name of the ZAI - short fZ; ///< number of protons - short fA; ///< number of nucleons (A=0 means natural isotopes) - short fI; ///< Isomeric state - - ClassDef(ZAI,1); -}; - - -#endif diff --git a/source/branches/CLASSV3/include/ZAIMass.hxx b/source/branches/CLASSV3/include/ZAIMass.hxx deleted file mode 100644 index cbc2048738fc1b5720dfbb1dcdf1697137c5a0a1..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/include/ZAIMass.hxx +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef _ZAIMass_ -#define _ZAIMass_ - -/*! - \file - \brief Header file for ZAIMass classes. - - - @author BaM - @version 2.0 - */ - -#include <map> - -#include "ZAI.hxx" -#include "TObject.h" -#include <iostream> - -using namespace std; - - -class IsotopicVector; - -///< A ZAIMass . - -class ZAIMass -{ - - -public: - ///< Default constructor - ZAIMass(); - ///< Normal Constructor. - - ///< Normal Destructor. - ~ZAIMass(); - - map<ZAI, double> fZAIMass; //! ZAI mass list - - - double GetMass(ZAI zai ) const; - double GetMass(const int Z, const int A ) const { return GetMass( ZAI(Z, A, 0) ); } - - double GetMass(const IsotopicVector IV) const; //return Mass of HM in tons - - -}; - - -#endif diff --git a/source/branches/CLASSV3/src/CLASSBackEnd.cxx b/source/branches/CLASSV3/src/CLASSBackEnd.cxx deleted file mode 100644 index faf588e856e6850a32a33351c188a62d6935efeb..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/CLASSBackEnd.cxx +++ /dev/null @@ -1,126 +0,0 @@ -#include "CLASSBackEnd.hxx" - -#include "DecayDataBank.hxx" -#include "Scenario.hxx" -#include "CLASSLogger.hxx" - - -#include <sstream> -#include <string> -#include <iostream> -#include <cmath> -#include <algorithm> - -//________________________________________________________________________ -// -// CLASSBackEnd -// -// -// -// -//________________________________________________________________________ -ClassImp(CLASSBackEnd) - -CLASSBackEnd::CLASSBackEnd(int type):CLASSFacility(type) -{ - fDecayDataBase = 0; -} - -CLASSBackEnd::CLASSBackEnd(CLASSLogger* log, int type):CLASSFacility(log, type) -{ - fDecayDataBase = 0; -} - - -CLASSBackEnd::CLASSBackEnd(CLASSLogger* log, cSecond cycletime, int type):CLASSFacility(log, cycletime, type) -{ - fDecayDataBase = 0; -} - -//________________________________________________________________________ -void CLASSBackEnd::ClearIVArray() -{ - - IsotopicVector EmptyIV; - fInsideIV = EmptyIV; - fIVArray.clear(); - fIVArrayArrivalTime.clear(); -} - -//________________________________________________________________________ -void CLASSBackEnd::AddIV(IsotopicVector isotopicvector) -{ - - AddCumulativeIVIn(isotopicvector); - - fIVArray.push_back(isotopicvector); - fIVArrayArrivalTime.push_back(fInternalTime); - - -} -//________________________________________________________________________ -void CLASSBackEnd::UpdateInsideIV() -{ - DBGL - fInsideIV = IsotopicVector(); - for(int i = 0; i < (int)fIVArray.size(); i++) - fInsideIV += fIVArray[i]; - DBGL -} - - -//________________________________________________________________________ -// Get Decay -//________________________________________________________________________ -IsotopicVector CLASSBackEnd::GetDecay(IsotopicVector isotopicvector, cSecond t) -{ - DBGL - - IsotopicVector IV; - - map<ZAI ,double> isotopicquantity = isotopicvector.GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - { - if((*it).second > 0) - { - IsotopicVector ivtmp = fDecayDataBase->Evolution(it->first, t) * (*it).second ; - IV += ivtmp; - } - } - - DBGL - return IV; -} - - -map<cSecond,int> CLASSBackEnd::GetTheBackEndTimePath() -{ - DBGL - map<cSecond, int> TheBackEndTimePath; - - if(!fIsStorageType) - { - int FacilityType = GetFacilityType(); - cSecond step = GetCycleTime(); - - pair< map<cSecond, int>::iterator, bool > IResult = TheBackEndTimePath.insert(pair<cSecond,int> (step, FacilityType)); - if( !IResult.second ) IResult.first->second |= FacilityType; - - map<cSecond, int> TheBackEndTimePath_tmp = GetOutBackEndFacility()->GetTheBackEndTimePath(); - - map<cSecond, int>::iterator it; - for (it = TheBackEndTimePath_tmp.begin(); it != TheBackEndTimePath_tmp.end(); it++) - { - pair< map<cSecond, int>::iterator, bool > IResult; - - IResult = TheBackEndTimePath.insert( pair<cSecond ,int>(step + (*it).first, (*it).second) ); - if( !IResult.second ) - IResult.first->second |= (*it).second; - - } - } - - DBGL - return TheBackEndTimePath; -} \ No newline at end of file diff --git a/source/branches/CLASSV3/src/CLASSFacility.cxx b/source/branches/CLASSV3/src/CLASSFacility.cxx deleted file mode 100644 index 9759b0d3f28b797190322037066d83748d5075b3..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/CLASSFacility.cxx +++ /dev/null @@ -1,76 +0,0 @@ -#include "CLASSFacility.hxx" -#include "Scenario.hxx" - -using namespace std; - - //________________________________________________________________________ - // - // CLASSFacility - // - // - // - // - //________________________________________________________________________ - -ClassImp(CLASSFacility) - - - - -CLASSFacility::CLASSFacility(int type):CLASSObject() -{ - fParc = 0; - fFacilityType = type; - fInternalTime = 0; - fInCycleTime = 0; - fCycleTime = -1; -} - -CLASSFacility::CLASSFacility(CLASSLogger* log, int type):CLASSObject(log) -{ - fParc = 0; - - fFacilityType = type; - - fInternalTime = 0; - fInCycleTime = 0; - fCycleTime = -1; -} - - -CLASSFacility::CLASSFacility(CLASSLogger* log, cSecond cycletime, int type):CLASSObject(log) -{ - fParc = 0; - fFacilityType = type; - fInternalTime = 0; - fInCycleTime = 0; - fCycleTime = cycletime; - -} - -CLASSFacility::CLASSFacility(CLASSLogger* log, cSecond creationtime, cSecond lifetime, int type):CLASSObject(log) -{ - fParc = 0; - - fFacilityType = type; - - fInternalTime = 0; - fInCycleTime = 0; - fCycleTime = -1; - fCreationTime = creationtime; - fLifeTime = lifetime; -} - -CLASSFacility::CLASSFacility(CLASSLogger* log, cSecond creationtime, cSecond lifetime, cSecond cycletime, int type):CLASSObject(log) -{ - fParc = 0; - - fFacilityType = type; - - fInternalTime = 0; - fInCycleTime = 0; - fCycleTime = cycletime; - fCreationTime = creationtime; - fInternalTime = fCreationTime; - fLifeTime = lifetime; -} \ No newline at end of file diff --git a/source/branches/CLASSV3/src/CLASSFuel.cxx b/source/branches/CLASSV3/src/CLASSFuel.cxx deleted file mode 100644 index de1d23c3a457f1d36a24b5b2750a225b84e3a96d..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/CLASSFuel.cxx +++ /dev/null @@ -1,26 +0,0 @@ -#include "CLASSFuel.hxx" - -#include "CLASSLogger.hxx" - -using namespace std; - -//________________________________________________________________________ -// -// CLASSFuel -// -// -// -// -//________________________________________________________________________ - -CLASSFuel::CLASSFuel(EvolutionData* evo) -{ - fEvolutionData = evo; - fPhysicsModels = 0; -} - -CLASSFuel::CLASSFuel(PhysicsModels* evo) -{ - fEvolutionData = 0; - fPhysicsModels = evo; -} \ No newline at end of file diff --git a/source/branches/CLASSV3/src/CLASSFuelPlan.cxx b/source/branches/CLASSV3/src/CLASSFuelPlan.cxx deleted file mode 100644 index a57a24d78a38d333012c4d578b384c0b35e6cb3b..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/CLASSFuelPlan.cxx +++ /dev/null @@ -1,69 +0,0 @@ -#include "CLASSFuelPlan.hxx" - -#include "CLASSLogger.hxx" - -using namespace std; - -//________________________________________________________________________ -// -// CLASSFuelPlan -// -// -// -// -//________________________________________________________________________ - -CLASSFuelPlan::CLASSFuelPlan():CLASSObject() -{ - DBGL -} - -CLASSFuelPlan::CLASSFuelPlan(CLASSLogger* log):CLASSObject(log) -{ - DBGL - DBGL -} - -void CLASSFuelPlan::AddFuel(cSecond time, CLASSFuel fuel, double BurnUp) -{ - DBGL - fLoadingPlan.insert(pair< cSecond, pair< CLASSFuel, double > >(time, pair< CLASSFuel, double > (fuel, BurnUp)) ); - DBGL -} - -pair< CLASSFuel, double > CLASSFuelPlan::GetFuelAt(cSecond t) -{ - DBGL - - pair< CLASSFuel, double > FuelAtT = fLoadingPlan.begin()->second; - - map< cSecond, pair< CLASSFuel, double > >::iterator it; - - cSecond ThisFuelTime; - - for (it = fLoadingPlan.begin(); it != fLoadingPlan.end(); it++ ) - { - if( it == fLoadingPlan.begin()) - { - FuelAtT = (*it).second; - } - else - { - ThisFuelTime = (*it).first; - - if( t < ThisFuelTime ) - { - DBGL - return FuelAtT; - } - else - { - FuelAtT = (*it).second; - } - - } - } - - DBGL - return FuelAtT; -} diff --git a/source/branches/CLASSV3/src/CLASSLogger.cxx b/source/branches/CLASSV3/src/CLASSLogger.cxx deleted file mode 100755 index d5b95630f11a8fd7dfc8b7289bbc58c666af48a7..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/CLASSLogger.cxx +++ /dev/null @@ -1,201 +0,0 @@ - -#include "CLASSLogger.hxx" - -#include <iostream> -#include <ostream> -#include <algorithm> -using namespace std; - -//________________________________________________________________________ -// -// CLASSLogger -// -// -// -// -//________________________________________________________________________ -CLASSLogger::CLASSLogger() -{ - string CLASSLoggerName = "CLASS_OUTPUT.log"; - int VerboseLvl = 0; - int OutputLvl = 1; - - - fCLASSLoggerName = CLASSLoggerName; - fOutPutFile.open(CLASSLoggerName.c_str()); - fVerboseLVL = VerboseLvl; - if(!fOutPutFile) - { - cout << "Could not open the CLASSLogger: " << CLASSLoggerName << " !" << endl; - exit(-1); - } - - fError = 0; - fWarning = 0; - fDebug = 0; - fInfo = 0; - - if (VerboseLvl <= OutputLvl) - fMaxOutPutLVL = OutputLvl; - else - fMaxOutPutLVL = VerboseLvl; - - if(VerboseLvl >= 0) - { - if (!fError) - fError = new LogType(std::cout); - else - fError->SetSecondOutput(std::cout); - } - if(VerboseLvl >= 1) - { - if (!fWarning) - fWarning = new LogType(std::cout); - else - fWarning->SetSecondOutput(std::cout); - } - if(VerboseLvl >= 2) - { - if (!fInfo) - fInfo = new LogType(std::cout); - else - fInfo->SetSecondOutput(std::cout); - } - if(VerboseLvl >= 3) - { - if (!fDebug) - fDebug = new LogType(std::cout); - else - fDebug->SetSecondOutput(std::cout); - } - if(OutputLvl >= 0) - { - if (!fError) - fError = new LogType(fOutPutFile); - else - fError->SetSecondOutput(fOutPutFile); - } - if(OutputLvl >= 1) - { - if (!fWarning) - fWarning = new LogType(fOutPutFile); - else - fWarning->SetSecondOutput(fOutPutFile); - } - if(OutputLvl >= 2) - { - if (!fInfo) - fInfo = new LogType(fOutPutFile); - else - fInfo->SetSecondOutput(fOutPutFile); - } - if(OutputLvl >= 3) - { - if (!fDebug) - fDebug = new LogType(fOutPutFile); - else - fDebug->SetSecondOutput(fOutPutFile); - } - - - -} - - - -CLASSLogger::CLASSLogger(string CLASSLoggerName, int VerboseLvl, int OutputLvl ) -{ - fCLASSLoggerName = CLASSLoggerName; - fOutPutFile.open(CLASSLoggerName.c_str()); - fVerboseLVL = VerboseLvl; - if(!fOutPutFile) - { - cout << "Could not open the CLASSLogger: " << CLASSLoggerName << " !" << endl; - exit(-1); - } - - fError = 0; - fWarning = 0; - fDebug = 0; - fInfo = 0; - - if (VerboseLvl <= OutputLvl) - fMaxOutPutLVL = OutputLvl; - else - fMaxOutPutLVL = VerboseLvl; - - if(VerboseLvl >= 0) - { - if (!fError) - fError = new LogType(std::cout); - else - fError->SetSecondOutput(std::cout); - } - - if(VerboseLvl >= 1) - { - if (!fWarning) - fWarning = new LogType(std::cout); - else - fWarning->SetSecondOutput(std::cout); - } - if(VerboseLvl >= 2) - { - if (!fInfo) - fInfo = new LogType(std::cout); - else - fInfo->SetSecondOutput(std::cout); - } - if(VerboseLvl >= 3) - { - if (!fDebug) - fDebug = new LogType(std::cout); - else - fDebug->SetSecondOutput(std::cout); - } - - - if(OutputLvl >= 0) - { - if (!fError) - fError = new LogType(fOutPutFile); - else - fError->SetSecondOutput(fOutPutFile); - } - if(OutputLvl >= 1) - { - if (!fWarning) - fWarning = new LogType(fOutPutFile); - else - fWarning->SetSecondOutput(fOutPutFile); - } - if(OutputLvl >= 2) - { - if (!fInfo) - fInfo = new LogType(fOutPutFile); - else - fInfo->SetSecondOutput(fOutPutFile); - } - if(OutputLvl >= 3) - { - if (!fDebug) - fDebug = new LogType(fOutPutFile); - else - fDebug->SetSecondOutput(fOutPutFile); - } - - - -} - -//________________________________________________________________________ -CLASSLogger::~CLASSLogger() -{ - - fOutPutFile.close(); - -} - - - - diff --git a/source/branches/CLASSV3/src/CLASSObject.cxx b/source/branches/CLASSV3/src/CLASSObject.cxx deleted file mode 100644 index f0b19abdd91c6299e873fed3a05530e559881f12..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/CLASSObject.cxx +++ /dev/null @@ -1,26 +0,0 @@ -#include "CLASSObject.hxx" - -#include "CLASSLogger.hxx" - -using namespace std; - - //________________________________________________________________________ - // - // CLASSObject - // - // - // - // - //________________________________________________________________________ - -ClassImp(CLASSObject) - -CLASSObject::CLASSObject() -{ - fLog = 0; -} - -CLASSObject::CLASSObject(CLASSLogger* log) -{ - fLog = log; -} \ No newline at end of file diff --git a/source/branches/CLASSV3/src/DecayDataBank.cxx b/source/branches/CLASSV3/src/DecayDataBank.cxx deleted file mode 100644 index 1a01303c887757388f20942a943b31e5b0e05ebb..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/DecayDataBank.cxx +++ /dev/null @@ -1,158 +0,0 @@ -#include "DecayDataBank.hxx" - -#include "IsotopicVector.hxx" -#include "CLASSLogger.hxx" -#include "StringLine.hxx" - -#include <TGraph.h> -#include <TString.h> - - -#include <sstream> -#include <string> -#include <iostream> -#include <fstream> -#include <algorithm> -#include <cmath> - - -//________________________________________________________________________ -// -// DecayDataBank -// -// -// -// -//________________________________________________________________________ - -DecayDataBank::DecayDataBank():CLASSObject(new CLASSLogger("DecayDataBank.log")) -{ -} - -//________________________________________________________________________ -//________________________________________________________________________ -//________________________________________________________________________ -//________________________________________________________________________ -//________________________________________________________________________ - -DecayDataBank::DecayDataBank(CLASSLogger* log, string DB_index_file, bool olfreadmethod):CLASSObject(log) -{ - - fDataBaseIndex = DB_index_file; - fOldReadMethod = olfreadmethod; - - // Warning - INFO << " A EvolutionData has been define :" << endl; - INFO << "\t His index is : \"" << DB_index_file << "\"" << endl << endl; - -} - -//________________________________________________________________________ -DecayDataBank::~DecayDataBank() -{ - -} - -//________________________________________________________________________ -IsotopicVector DecayDataBank::Evolution(const ZAI& zai, double dt) -{ -DBGL - IsotopicVector returnIV; - - map<ZAI ,EvolutionData >::iterator it = fDecayDataBank.find(zai); - - if (it == fDecayDataBank.end() ) - { - ifstream DB_index(fDataBaseIndex.c_str()); - if( !DB_index) - { - ERROR << " Can't open \"" << fDataBaseIndex << "\"" << endl; - exit (1); - } - bool zaifind = false; - string tmp; - getline(DB_index,tmp); // Read first line - while (!DB_index.eof()) - { - string line; - int start=0; - getline(DB_index,line); // Read first line - string first=StringLine::NextWord(line,start); // Read first word - - if(first.size()==0) break; // If First word is null.... quit - - int rZ=atoi(first.c_str()); // Get Z - int rA=atoi(StringLine::NextWord(line,start).c_str()); // Get A - int rI=atoi(StringLine::NextWord(line,start).c_str()); // Get Isomeric State - - if(rZ == zai.Z() && rA == zai.A() && rI == zai.I() ) - { - string file_name = StringLine::NextWord(line,start); - EvolutionData evolutionproduct = EvolutionData(GetLog(), file_name, fOldReadMethod); -#pragma omp critical(DBupdate) - {fDecayDataBank.insert( pair<ZAI ,EvolutionData >(zai, evolutionproduct) );} - returnIV = evolutionproduct.GetIsotopicVectorAt(dt); - zaifind = true; - } - } - - if(!zaifind) - { - WARNING << " Oups... Can't Find the ZAI : " - << zai.Z() << " " << zai.A() << " " << zai.I() << "!!! It will be considered as stable !!" << endl; - - EvolutionData evolutionproduct = EvolutionData(GetLog()," " , false, zai); - {fDecayDataBank.insert( pair<ZAI, EvolutionData >(zai, evolutionproduct) );} - returnIV = evolutionproduct.GetIsotopicVectorAt(dt); - - - } - - - } - else returnIV = (*it).second.GetIsotopicVectorAt(dt); - -DBGL - return returnIV; -} - -bool DecayDataBank::IsDefine(const ZAI& zai) const -{ - - map<ZAI ,EvolutionData > evolutiondb = (*this).GetDecayDataBank(); - if (evolutiondb.find(zai) != evolutiondb.end()) - return true; - else - return false; - -} - - - -//________________________________________________________________________ -// Get Decay -//________________________________________________________________________ -IsotopicVector DecayDataBank::GetDecay(IsotopicVector isotopicvector, cSecond t) -{ -DBGL - IsotopicVector IV; - - map<ZAI ,double> isotopicquantity = isotopicvector.GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - { - if((*it).second > 0) - { - IsotopicVector ivtmp = Evolution(it->first, t) * (*it).second ; - IV += ivtmp; - } - } - -DBGL - return IV; -} -//________________________________________________________________________ -//________________________________________________________________________ -//________________________________________________________________________ -//________________________________________________________________________ -//________________________________________________________________________ diff --git a/source/branches/CLASSV3/src/DynamicalSystem.cxx b/source/branches/CLASSV3/src/DynamicalSystem.cxx deleted file mode 100644 index 5ec1540526b4dd0bdc994bd0f23268f9c2cc87d1..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/DynamicalSystem.cxx +++ /dev/null @@ -1,214 +0,0 @@ -#include <cstdio> -#include <iostream> -#include <fstream> -#include <cmath> -#include <vector> -#include <algorithm> - -#include "DynamicalSystem.hxx" - -using namespace std; - -//________________________________________________________________________ -DynamicalSystem::DynamicalSystem() -{ - - SetPrecision(); - fHestimate=1.; //this value is change in DynamicalSystem::RungeKutta - fHmin=0.; - fMaxHdid=-1e30; - fMinHdid=1e30; - fIsNegativeValueAllowed=true; -} - -//________________________________________________________________________ -DynamicalSystem::DynamicalSystem(const DynamicalSystem & DS) -{ - fNVar=DS.fNVar; - fPrecision=DS.fPrecision; - fHestimate=DS.fHestimate; - fHmin=DS.fHmin; - fMaxHdid=DS.fMaxHdid; - fMinHdid=DS.fMinHdid; - fIsNegativeValueAllowed=DS.fIsNegativeValueAllowed; -} - -//________________________________________________________________________ -DynamicalSystem::~DynamicalSystem() -{ - -} - -//________________________________________________________________________ -void DynamicalSystem::RungeKutta(double *YStart,double t1, double t2, int EquationNumber) -{ - //double shortestHalfLife=gMURE->GetShortestHalfLife(); - fNVar = EquationNumber; - int nstp; - double t,hnext,hdid,h; - double *yscal=new double[fNVar]; - double *y=new double[fNVar]; - double *dydt=new double[fNVar]; - - const double MAXSTP = 10000; - const double TINY = 1.0e-30; - - - - if(fabs(t1-t2)<=TINY) - cout << "Integration time is 0." << endl; - - t=t1; - fHestimate=(t2-t1)/100; - //h=(t2 > t1) ? fabs(fHestimate) : -fabs(fHestimate); - h=fHestimate; - - // pragma omp parallel for - for (int i = 0; i < fNVar; i++) y[i] = YStart[i]; - - for ( nstp = 1; nstp <= MAXSTP; nstp++) - { - BuildEqns(t,y,dydt); - - // pragma omp parallel for - for ( int i = 0; i < fNVar; i++) - yscal[i] = fabs(y[i]) + fabs(dydt[i]*h)+TINY; - - if ( (t+h-t2) * (t+h-t1) > 0.0 ) h=t2-t; - - AdaptStepSize(y,dydt,&t,h,fPrecision,yscal,&hdid,&hnext); - - if(fMaxHdid<hdid) fMaxHdid=hdid; - if(fMinHdid>hdid) fMinHdid=hdid; - - if ((t-t2)*(t2-t1) >= 0.0) - { - // pragma omp parallel for - for (int i=0;i<fNVar;i++) YStart[i]=y[i]; - - delete [] dydt; - delete [] y; - delete [] yscal; - //cout << "The maximum step used in RK was "<<fMaxHdid<<" Step NUM in RK was "<<nstp << endl; - return; - } - if (fabs(hnext) <= fHmin) - cout << "Step size too small in RungeKutta" << endl; - - h=hnext; - } - cout << "Too many steps in routine RungeKutta" << endl; -} - -//________________________________________________________________________ -void DynamicalSystem::RK4(double *y, double *dydx, double x, double h, double *yout) -{ - //cout<<"Calling Function RK4"<<endl; - double xh,hh,h6; - - double *dym=new double[fNVar]; - double *dyt=new double[fNVar]; - double *yt=new double[fNVar]; - hh=h*0.5; - h6=h/6.0; - xh=x+hh; - - // pragma omp parallel for - for (int i=0;i<fNVar;i++) yt[i]=y[i]+hh*dydx[i]; - - BuildEqns(xh,yt,dyt); - - // pragma omp parallel for - for (int i=0;i<fNVar;i++) yt[i]=y[i]+hh*dyt[i]; - - BuildEqns(xh,yt,dym); - - for (int i=0;i<fNVar;i++) - { - yt[i]=y[i]+h*dym[i]; - dym[i] += dyt[i]; - } - - BuildEqns(x+h,yt,dyt); - // pragma omp parallel for - for (int i=0;i<fNVar;i++) - { - yout[i]=y[i]+h6*(dydx[i]+dyt[i]+2.0*dym[i]); - if(!fIsNegativeValueAllowed && yout[i]<0) - { - //cout << "Material composition is negative " - //<<"i="<<i<<" ("/*<<fEvolvingMaterial->GetComposition()[i]->GetZAI()->PrintName() - // */<<") old proportion="<<y[i]<<" new="<<yout[i] - //<<". Setting to 0." << endl; - yout[i]=0.; - } - } - delete [] yt; - delete [] dyt; - delete [] dym; -} - -//________________________________________________________________________ -void DynamicalSystem::AdaptStepSize(double *y, double *dydx, double *x, double htry, - double eps, double *yscal, double *hdid, double *hnext) -{ - //cout<<"Calling Function AdaptStepSize()"<<endl; - double xsav,hh,h,temp,errmax; - double *dysav=new double[fNVar]; - double *ysav=new double[fNVar]; - double *ytemp=new double[fNVar]; - - const double PGROW =-0.20; - const double PSHRNK =-0.25; - const double FCOR =0.06666666 ; - const double SAFETY =0.9; - const double ERRCON =6.0e-4; - - xsav=(*x); - - // pragma omp parallel for - for (int i=0;i<fNVar;i++) - { - ysav[i]=y[i]; - dysav[i]=dydx[i]; - } - h=htry; - for (;;) - { - hh=0.5*h; - RK4(ysav,dysav,xsav,hh,ytemp); - *x=xsav+hh; - - BuildEqns(*x,ytemp,dydx); - RK4(ytemp,dydx,*x,hh,y); - *x=xsav+h; - if (*x == xsav ) - { - //cout << "Step size ("<<h<<") too small in routine AdaptStepSize" << endl; - } - RK4(ysav,dysav,xsav,h,ytemp); - errmax=0.0; - - for (int i=0;i<fNVar;i++) - { - ytemp[i]=y[i]-ytemp[i]; - temp=fabs(ytemp[i]/yscal[i]); - if (errmax < temp) errmax=temp; - } - errmax /= eps; - if (errmax <= 1.0) - { - *hdid=h; - *hnext=(errmax > ERRCON ? SAFETY*h*exp(PGROW*log(errmax)) : 4.0*h); - break; - } - h=SAFETY*h*exp(PSHRNK*log(errmax)); - } - - for (int i=0;i<fNVar;i++) y[i] += ytemp[i]*FCOR; - - delete [] ytemp; - delete [] dysav; - delete [] ysav; -} - diff --git a/source/branches/CLASSV3/src/EquivalenceModel.cxx b/source/branches/CLASSV3/src/EquivalenceModel.cxx deleted file mode 100644 index 3c85ee56ff49acc231e303710a13f01d37d47f63..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/EquivalenceModel.cxx +++ /dev/null @@ -1,232 +0,0 @@ -#include "EquivalenceModel.hxx" - - - - - - -EquivalenceModel::EquivalenceModel():CLASSObject() -{ - -} - -EquivalenceModel::EquivalenceModel(CLASSLogger* log):CLASSObject(log) -{ - -} - -EquivalenceModel::~EquivalenceModel() -{ - -} -//________________________________________________________________________ -vector<double> EquivalenceModel::BuildFuel(double BurnUp, double HMMass,vector<IsotopicVector> FissilArray, vector<IsotopicVector> FertilArray) -{ -DBGL - HMMass*=1e6;//tons to gram - - /****Some initializations**/ - vector<double> lambda ; //vector of portion of stocks taken (fissile & fertil) - for(int i = 0 ; i < (int)FissilArray.size() + (int)FertilArray.size() ; i++ ) - lambda.push_back(0); - - - if( (int)FissilArray.size()==0 ) - { WARNING<<" No fissile stocks available ! Fuel not build"<<endl; - lambda[0] = -1; - return lambda; - } - - - fOld_Lambda_Tot = 0; - fLambda_max = FindLambdaMax( FissilArray, HMMass ); - DBGV("fLambda_max "<<fLambda_max); - - IsotopicVector Fertile; - IsotopicVector Fissile; - double AvailablePuMass=0; - double PuMassNeeded=1000; //At present time I have no clue what is the requiered Pu mass, I assume at least 1kg is needed - double WeightPuContent=0; - double MassPrecision=100; //Mass precision is 100 grams - - while( fabs(PuMassNeeded - AvailablePuMass) > MassPrecision ) - { //Increase the portion of the stock stokID taken, according to the followings variables - double DeltaM=PuMassNeeded-AvailablePuMass; - GuessLambda( lambda,0,FissilArray.size()-1, DeltaM, FissilArray ,HMMass); - if(lambda[0]==-1) - { - for(int i=0 ; i < (int)FissilArray.size() + (int)FertilArray.size();i++ ) - lambda[i ]= -1; - WARNING<<"Not enought fissile material to build fuel"<<endl; - return lambda; - } - //Build the Plutonium vector from stocks - Fissile.Clear(); - - for( int i = 0 ; i < (int)FissilArray.size() ; i++ ) - Fissile +=lambda[i] * FissilArray[i]; - - AvailablePuMass = Fissile.GetTotalMass() * 1e6; //in grams - //Building complementary Fertile from stocks - double FertilMassNeeded = HMMass - AvailablePuMass; - double LAMBDA_FERTILE = FindLambdaMax(FertilArray, FertilMassNeeded); - SetLambda(lambda,FissilArray.size(), lambda.size()-1,LAMBDA_FERTILE); - int j=-1; - Fertile.Clear(); - for(int i = (int)FissilArray.size() ; i < (int)FissilArray.size()+(int)FertilArray.size() ; i++) - { j++; - Fertile += lambda[i] * FertilArray[j]; - } - - if( fabs(Fertile.GetTotalMass()*1e6 - FertilMassNeeded) > FertilMassNeeded * 1e-6)//Not enought fertile in stocks - { - for( int i = 0 ; i < (int)FissilArray.size() + (int)FertilArray.size() ; i++ ) - lambda[i] = -1; //error code (read by FabricationPlant) - WARNING<<"Not enought fertile material to build fuel"<<endl; - return lambda; - } - /*Calcul the quantity of this composition needed to reach the burnup*/ - double MolarPuContent = GetFissileMolarFraction(Fissile, Fertile, BurnUp); - double MeanMolarPu = Fissile.MeanMolar(); - double MeanMolarDepletedU = Fertile.MeanMolar(); - double MeanMolar = MeanMolarPu * MolarPuContent + (1-MolarPuContent)*MeanMolarDepletedU; - DBGV("MolarPuContent "<<MolarPuContent); - WeightPuContent = MolarPuContent * MeanMolarPu / MeanMolar ; - PuMassNeeded = WeightPuContent * HMMass ; - } - - - DBGV("Weight percent fissil : "<<PuMassNeeded/HMMass ); - DBGV("Lambda vector: "); - for(int i = 0 ; i < (int)FissilArray.size() + (int)FertilArray.size() ; i++ ) - DBGV(lambda[i]); - -DBGL - return lambda; -} -//________________________________________________________________________ -void EquivalenceModel::SetLambda(vector<double>& lambda ,int FirstStockID, int LastStockID, double LAMBDA_TOT) -{ - if(LAMBDA_TOT > LastStockID - FirstStockID + 1 ) - { - ERROR << " FATAL ERROR " <<endl; - exit(0); - } - - for(int i = FirstStockID ; i <= LastStockID ; i++) //set to 0 all non touched value (to be sure) - lambda[i] = 0 ; - - int PartieEntier = floor( LAMBDA_TOT ); - double PartieDecimal = LAMBDA_TOT - PartieEntier; - - for(int i=FirstStockID ; i < FirstStockID +PartieEntier ;i++ ) - lambda[i]=1; - - lambda[FirstStockID + PartieEntier] = PartieDecimal ; - -} -//________________________________________________________________________ -void EquivalenceModel::GuessLambda(vector<double>& lambda,int FirstStockID, int LastStockID, double DeltaM, vector<IsotopicVector> Stocks, double HMMass) -{ - double LAMBDA_TOT=0; - for (int i = FirstStockID; i <=LastStockID ; i++) - LAMBDA_TOT+=lambda[i] ; - - - if( LAMBDA_TOT == 0 ) //Initialization je cherche les lambda telle que j'ai 5% de HM !!! - { //cout<<"INITIALIZATION"<<endl; - double MASS = 0 ; - int ID_max = 0; - while( MASS < 0.05*HMMass ) - { - double StockMass = Stocks[ID_max].GetTotalMass() * 1e6; - - if( StockMass > HMMass ) - LAMBDA_TOT += 0.01*HMMass/StockMass; - else - LAMBDA_TOT += 0.01; - - if(LAMBDA_TOT > ID_max+1) - { - LAMBDA_TOT=ID_max+1; - ID_max++ ; - if( ID_max >=(int) Stocks.size()) - { lambda[0]=-1;//error code; - break; - } - } - - SetLambda(lambda,FirstStockID,LastStockID,LAMBDA_TOT ); - - IsotopicVector test; - int j=0; - for(int i=FirstStockID;i<=LastStockID;i++) - { - IsotopicVector IVTMP = lambda[i] * Stocks[j]; - test += IVTMP; - j++; - } - MASS = test.GetTotalMass() * 1e6; //in grams - //cout<<"LAMBDA_TOT "<<LAMBDA_TOT<<" MASS "<<MASS<<endl; - } - } - - else if( DeltaM > 0) - { - fOld_Lambda_Tot = LAMBDA_TOT; - LAMBDA_TOT += (fLambda_max - LAMBDA_TOT)/2.; - - if(LAMBDA_TOT > 0.99*fLambda_max) //if we get close to the total of the stocks - { - double MasseTot=0; - for(int i=0;i<(int)Stocks.size();i++) - MasseTot+=Stocks[i].GetTotalMass()*1e6; - - if( (fLambda_max -LAMBDA_TOT )*MasseTot < 5 ) //If it remains less than 5gram in stocks => the stocks are not enought - lambda[0]=-1;//error code; - } - //cout<<"DM>0 LAMBDA_TOT "<<LAMBDA_TOT<<endl; - else - SetLambda(lambda,FirstStockID,LastStockID,LAMBDA_TOT ); - } - - else if( DeltaM < 0) - { - //cout <<"fOld_Lambda_Tot[f] "<<fOld_Lambda_Tot[f]<<" LAMBDA_TOT "<<LAMBDA_TOT<< endl; - LAMBDA_TOT = LAMBDA_TOT - fabs(fOld_Lambda_Tot - LAMBDA_TOT) / 2. ; - //cout<<"DM<0 LAMBDA_TOT "<<LAMBDA_TOT<<endl; - SetLambda(lambda,FirstStockID,LastStockID,LAMBDA_TOT ); - } -} -//________________________________________________________________________ -double EquivalenceModel::FindLambdaMax(vector<IsotopicVector> Stocks, double HMMass) -{ - //je cherche les lambda telle que j'ai 100% de HMass ou bien la mass total des stocks - double LAMBDA = 0; - double TotStockMass = 0; - for (int i = 0 ; i < (int)Stocks.size() ; i++) - TotStockMass += Stocks[i].GetTotalMass() * 1e6; - - - if(TotStockMass <= HMMass) - return Stocks.size() ; - - else - { - double RemainHM=HMMass; - for(int i=0 ;i<(int)Stocks.size();i++ ) - { - if( RemainHM - Stocks[i].GetTotalMass() * 1e6 > 0) - { - RemainHM -= Stocks[i].GetTotalMass() * 1e6; - LAMBDA++; - } - else - { LAMBDA+= RemainHM / (Stocks[i].GetTotalMass() * 1e6); - return LAMBDA; - } - } - } - -return -1; -} \ No newline at end of file diff --git a/source/branches/CLASSV3/src/EvolutionData.cxx b/source/branches/CLASSV3/src/EvolutionData.cxx deleted file mode 100755 index fae33f540258416dd5ad2d5a5f2870260de9529d..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/EvolutionData.cxx +++ /dev/null @@ -1,1175 +0,0 @@ -#include "EvolutionData.hxx" - -#include "CLASSLogger.hxx" -#include "CLASSConstante.hxx" -#include "StringLine.hxx" - -#include <TGraph.h> -#include <TString.h> - -#include <cmath> -#include <iostream> -#include <fstream> -#include <algorithm> - - //________________________________________________________________________ - // - // EvolutionData - // - // - // - // - //________________________________________________________________________ - - - -struct my_tolower -{ - char operator()(char c) const - { - return std::tolower(static_cast<unsigned char>(c)); - } -}; - - //To Lower Case, convert any string in lower case -string tlc(string data) -{ - transform(data.begin(), data.end(), data.begin(), my_tolower()); - return data; -} - - - -double Distance(IsotopicVector IV1, EvolutionData Evd1 ) -{ - - double d2=0; - IsotopicVector IV2 = Evd1.GetIsotopicVectorAt(0.); - - IsotopicVector IVtmp = IV1; - map<ZAI ,double> IVtmpIsotopicQuantity = IVtmp.GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - - double SumOfXs = 0; - for( it = IVtmpIsotopicQuantity.begin(); it != IVtmpIsotopicQuantity.end(); it++) - { - - SumOfXs += Evd1.GetXSForAt(0., (*it).first, 1); - SumOfXs += Evd1.GetXSForAt(0., (*it).first, 2); - SumOfXs += Evd1.GetXSForAt(0., (*it).first, 3); - - } - - - for( it = IVtmpIsotopicQuantity.begin(); it != IVtmpIsotopicQuantity.end(); it++) - { - double Z1 = 0.0; - double Z2 = 0.0; - double XS = 0.0; - - Z1 = IV1.GetZAIIsotopicQuantity( (*it).first ); - Z2 = IV2.GetZAIIsotopicQuantity( (*it).first ); - XS = Evd1.GetXSForAt(0., (*it).first, 1) - + Evd1.GetXSForAt(0., (*it).first, 2) - + Evd1.GetXSForAt(0., (*it).first, 3); - - d2 += pow(Z1-Z2 , 2 ) * pow(XS,2); - - } - - return sqrt(d2)/SumOfXs; - -} - -double Distance(EvolutionData Evd1, IsotopicVector IV1 ) -{ - return Distance(IV1,Evd1); -} - //________________________________________________________________________ - //________________________________________________________________________ - //________________________________________________________________________ -EvolutionData operator*(EvolutionData const& evol, double F) -{ - - EvolutionData evoltmp; - - map<ZAI ,TGraph* > EvolutionData = evol.GetInventoryEvolution(); - map<ZAI ,TGraph* >::iterator it; - for(it = EvolutionData.begin(); it != EvolutionData.end(); it++) - { - double X[(*it).second->GetN()]; - double Y[(*it).second->GetN()]; - - for(int i = 0; i < (*it).second->GetN(); i++) - { - double y; - (*it).second->GetPoint( i, X[i], y ); - Y[i] = y*F; - } - evoltmp.NucleiInsert( pair<ZAI, TGraph*> ( (*it).first,new TGraph((*it).second->GetN(), X, Y) ) ); - - } - evoltmp.SetPower(evol.GetPower()*F); - evoltmp.SetFissionXS(evol.GetFissionXS()); - evoltmp.SetCaptureXS(evol.GetCaptureXS()); - evoltmp.Setn2nXS(evol.Getn2nXS()); - - - return evoltmp; - -} -//________________________________________________________________________ -EvolutionData operator*(double F, EvolutionData const& evol) -{ - - return evol*F; - -} -//________________________________________________________________________ -EvolutionData operator/(EvolutionData const& evol, double F) -{ - - return evol*(1./F); - -} - -EvolutionData Multiply(EvolutionData const& evol, double F) -{ - - EvolutionData evoltmp; - map<ZAI ,TGraph* > EvolutionData = evol.GetInventoryEvolution(); - map<ZAI ,TGraph* >::iterator it; - for(it = EvolutionData.begin(); it != EvolutionData.end(); it++) - { - double X[(*it).second->GetN()]; - double Y[(*it).second->GetN()]; - - for(int i = 0; i < (*it).second->GetN(); i++) - { - double y; - (*it).second->GetPoint( i, X[i], y ); - Y[i] = y*F; - } - evoltmp.NucleiInsert( pair<ZAI, TGraph*> ( (*it).first,new TGraph((*it).second->GetN(), X, Y) ) ); - - } - - - EvolutionData = evol.GetFissionXS(); - for(it = EvolutionData.begin(); it != EvolutionData.end(); it++) - { - double X[(*it).second->GetN()]; - double Y[(*it).second->GetN()]; - - for(int i = 0; i < (*it).second->GetN(); i++) - { - double y; - (*it).second->GetPoint( i, X[i], y ); - Y[i] = y*F; - } - evoltmp.FissionXSInsert( pair<ZAI, TGraph*> ( (*it).first,new TGraph((*it).second->GetN(), X, Y) ) ); - - } - - EvolutionData = evol.GetCaptureXS(); - for(it = EvolutionData.begin(); it != EvolutionData.end(); it++) - { - double X[(*it).second->GetN()]; - double Y[(*it).second->GetN()]; - - for(int i = 0; i < (*it).second->GetN(); i++) - { - double y; - (*it).second->GetPoint( i, X[i], y ); - Y[i] = y*F; - } - evoltmp.CaptureXSInsert( pair<ZAI, TGraph*> ( (*it).first,new TGraph((*it).second->GetN(), X, Y) ) ); - - } - EvolutionData = evol.Getn2nXS(); - for(it = EvolutionData.begin(); it != EvolutionData.end(); it++) - { - double X[(*it).second->GetN()]; - double Y[(*it).second->GetN()]; - - for(int i = 0; i < (*it).second->GetN(); i++) - { - double y; - (*it).second->GetPoint( i, X[i], y ); - Y[i] = y*F; - } - evoltmp.n2nXSInsert( pair<ZAI, TGraph*> ( (*it).first,new TGraph((*it).second->GetN(), X, Y) ) ); - - } - - evoltmp.SetPower(evol.GetPower()*F); - - - - return evoltmp; - -} - -//________________________________________________________________________ -EvolutionData Multiply(double F, EvolutionData const& evol) -{ - - return Multiply(evol,F); - -} - -EvolutionData Sum(EvolutionData const& evol1, EvolutionData const& evol2) -{ - EvolutionData EvolSum = evol1; - map<ZAI ,TGraph* > EvolutionData1 = EvolSum.GetInventoryEvolution(); - map<ZAI ,TGraph* > EvolutionData2 = evol2.GetInventoryEvolution(); - map<ZAI ,TGraph* >::iterator it; - - for(it = EvolutionData2.begin(); it != EvolutionData2.end(); it++) - { - pair<map<ZAI, TGraph*>::iterator, bool> IResult; - - IResult = EvolutionData1.insert( pair<ZAI, TGraph*> ( *it ) ); - if(!(IResult.second) ) - { - double X[(*it).second->GetN()]; - double Y[(*it).second->GetN()]; - map<ZAI ,TGraph* >::iterator it2 = EvolutionData1.find( (*it).first ); - - - for(int i = 0; i < (*it).second->GetN(); i++) - { - double y; - (*it).second->GetPoint( i, X[i], y ); - Y[i] = y + (*it2).second->Eval(X[i]); - } - IResult.first->second = new TGraph((*it).second->GetN(), X, Y); - - } - - } - EvolSum.SetInventoryEvolution(EvolutionData1); - - - EvolutionData1 = evol1.GetFissionXS(); - EvolutionData2 = evol2.GetFissionXS(); - - for(it = EvolutionData2.begin(); it != EvolutionData2.end(); it++) - { - pair<map<ZAI, TGraph*>::iterator, bool> IResult; - - IResult = EvolutionData1.insert( pair<ZAI, TGraph*> ( *it ) ); - - if(!(IResult.second) ) - { - double X[(*it).second->GetN()]; - double Y[(*it).second->GetN()]; - map<ZAI ,TGraph* >::iterator it2 = EvolutionData1.find( (*it).first ); - - - for(int i = 0; i < (*it).second->GetN(); i++) - { - double y; - (*it).second->GetPoint( i, X[i], y ); - Y[i] = y + (*it2).second->Eval(X[i]); - } - IResult.first->second = new TGraph((*it).second->GetN(), X, Y); - } - } - EvolSum.SetFissionXS(EvolutionData1); - - - EvolutionData1 = EvolSum.GetCaptureXS(); - EvolutionData2 = evol2.GetCaptureXS(); - - for(it = EvolutionData2.begin(); it != EvolutionData2.end(); it++) - { - pair<map<ZAI, TGraph*>::iterator, bool> IResult; - - IResult = EvolutionData1.insert( pair<ZAI, TGraph*> ( *it ) ); - - if(!(IResult.second) ) - { - double X[(*it).second->GetN()]; - double Y[(*it).second->GetN()]; - map<ZAI ,TGraph* >::iterator it2 = EvolutionData1.find( (*it).first ); - - - for(int i = 0; i < (*it).second->GetN(); i++) - { - double y; - (*it).second->GetPoint( i, X[i], y ); - Y[i] = y + (*it2).second->Eval(X[i]); - } - IResult.first->second = new TGraph((*it).second->GetN(), X, Y); - } - } - EvolSum.SetCaptureXS(EvolutionData1); - - - EvolutionData1 = EvolSum.Getn2nXS(); - EvolutionData2 = evol2.Getn2nXS(); - - for(it = EvolutionData2.begin(); it != EvolutionData2.end(); it++) - { - pair<map<ZAI, TGraph*>::iterator, bool> IResult; - - IResult = EvolutionData1.insert( pair<ZAI, TGraph*> ( *it ) ); - - if(!(IResult.second) ) - { - double X[(*it).second->GetN()]; - double Y[(*it).second->GetN()]; - map<ZAI ,TGraph* >::iterator it2 = EvolutionData1.find( (*it).first ); - - - for(int i = 0; i < (*it).second->GetN(); i++) - { - double y; - (*it).second->GetPoint( i, X[i], y ); - Y[i] = y + (*it2).second->Eval(X[i]); - } - IResult.first->second = new TGraph((*it).second->GetN(), X, Y); - } - } - EvolSum.Setn2nXS(EvolutionData1); - - return EvolSum; -} - - - - - //________________________________________________________________________ - //________________________________________________________________________ - - -ClassImp(EvolutionData) - - - -EvolutionData::EvolutionData():CLASSObject() -{ - fIsCrossSection = false; - fPower = 0; - fCycleTime = 0; - fKeff = 0; - fFlux = 0; -} - - //________________________________________________________________________ -EvolutionData::EvolutionData(CLASSLogger* log):CLASSObject(log) -{ - fIsCrossSection = false; - fPower = 0; - fCycleTime = 0; - fKeff = 0; - fFlux = 0; -} - - //________________________________________________________________________ -EvolutionData::EvolutionData(CLASSLogger* log, string DB_file, bool oldread, ZAI zai):CLASSObject(log) -{ - - fIsCrossSection = false; - fDB_file = DB_file; - fPower = 0; - fCycleTime = 0; - fKeff = 0; - fFlux = 0; - - if(zai != ZAI(0,0,0)) - AddAsStable(zai); - else - ReadDB( fDB_file, oldread); // Read Evolution Produc DB file name - - - - -} - - //________________________________________________________________________ -EvolutionData::~EvolutionData() -{ - -} -//________________________________________________________________________ -void EvolutionData::DeleteEvolutionData() -{ - - map<ZAI ,TGraph* >::iterator it_del; - - for( it_del = fInventoryEvolution.begin(); it_del != fInventoryEvolution.end(); it_del++) - { - delete (*it_del).second; - (*it_del).second = 0; - } - for( it_del = fFissionXS.begin(); it_del != fFissionXS.end(); it_del++) - { - delete (*it_del).second; - (*it_del).second = 0; - } - for( it_del = fCaptureXS.begin(); it_del != fCaptureXS.end(); it_del++) - { - delete (*it_del).second; - (*it_del).second = 0; - } - for( it_del = fn2nXS.begin(); it_del != fn2nXS.end(); it_del++) - { - delete (*it_del).second; - (*it_del).second = 0; - } - - - delete fKeff; - delete fFlux; - - fInventoryEvolution.clear(); - fFissionXS.clear(); - fCaptureXS.clear(); - fn2nXS.clear(); - - fFlux = 0; - fKeff = 0; - -} - - -bool EvolutionData::NucleiInsert(pair<ZAI, TGraph*> zaitoinsert) -{ - - pair<map<ZAI, TGraph*>::iterator, bool> IResult; - IResult = fInventoryEvolution.insert( zaitoinsert); - return IResult.second; - -} - -bool EvolutionData::FissionXSInsert(pair<ZAI, TGraph*> zaitoinsert) -{ - - pair<map<ZAI, TGraph*>::iterator, bool> IResult; - IResult = fFissionXS.insert( zaitoinsert); - return IResult.second; - -} - -bool EvolutionData::CaptureXSInsert(pair<ZAI, TGraph*> zaitoinsert) -{ - - pair<map<ZAI, TGraph*>::iterator, bool> IResult; - IResult = fCaptureXS.insert( zaitoinsert); - return IResult.second; - -} - -bool EvolutionData::n2nXSInsert(pair<ZAI, TGraph*> zaitoinsert) -{ - - pair<map<ZAI, TGraph*>::iterator, bool> IResult; - IResult = fn2nXS.insert( zaitoinsert); - return IResult.second; - -} - - //________________________________________________________________________ -void EvolutionData::AddAsStable(ZAI zai) -{ - - double time[2] = {0, (500*365.25*3600*24)}; - double quantity[2] = {1., 1.}; - - fInventoryEvolution.insert(pair<ZAI ,TGraph* >(zai, new TGraph(2, time, quantity) ) ); - -} - - //________________________________________________________________________ -Double_t EvolutionData::Interpolate(double t, TGraph& EvolutionGraph) -{ - - TString fOption; - return (double)EvolutionGraph.Eval(t,0x0,fOption); - -} - - //________________________________________________________________________ -TGraph* EvolutionData::GetEvolutionTGraph(const ZAI& zai) -{ - - map<ZAI ,TGraph *>::iterator it = GetInventoryEvolution().find(zai) ; - - if ( it != GetInventoryEvolution().end() ) - return it->second; - else - return new TGraph(); - - -} - - //________________________________________________________________________ -IsotopicVector EvolutionData::GetIsotopicVectorAt(double t) -{ - - IsotopicVector IsotopicVectorTmp; - map<ZAI ,TGraph* >::iterator it; - for( it = fInventoryEvolution.begin(); it != fInventoryEvolution.end(); it++ ) - { - IsotopicVectorTmp.Add( (*it).first, Interpolate(t, *((*it).second)) ); - } - - - return IsotopicVectorTmp; -} - - //________________________________________________________________________ -double EvolutionData::GetXSForAt(double t, ZAI zai, int ReactionId) -{ - - map<ZAI ,TGraph* > XSEvol; - switch(ReactionId) - { - case 1: XSEvol = GetFissionXS(); - break; - case 2: XSEvol = GetCaptureXS(); - break; - case 3: XSEvol = Getn2nXS(); - break; - default:ERROR << " Wrong ReactionId !!" << endl; - exit(1); - } - - map<ZAI ,TGraph* >::iterator it = XSEvol.find(zai); - - - if (it == XSEvol.end()) - return 0.; - else - return Interpolate(t, *((*it).second) ); - -} - - - - - - - - - - - - //________________________________________________________________________ - - //________________________________________________________________________ - - - - -void EvolutionData::ReadDB(string DBfile, bool oldread) -{ - - if(oldread) - { - - OldReadDB(DBfile); - return; - } - - ReadInfo(); // Read the .info associeted - - ifstream DecayDB(DBfile.c_str()); // Open the File - if(!DecayDB) //check if file is correctly open - { - INFO << " \n Can't open \"" << DBfile << "\"\n" << endl; - } - vector<double> vTime; - - string line; - int start = 0; - - getline(DecayDB, line); - if( tlc(StringLine::NextWord(line, start, ' ')) != "time") - { - ERROR << " Bad Database file : " << DBfile << endl; - ERROR << " The first Line MUST be the time line !!!" << endl; - exit (1); - } - - while(start < (int)line.size()) - vTime.push_back(atof(StringLine::NextWord(line, start, ' ').c_str())); - - fFinalTime = vTime.back(); - double Time[vTime.size()]; - for(int i=0; i < (int)vTime.size();i++) - Time[i] = vTime[i]; - const int NTimeStep = sizeof(Time)/sizeof(double); - - - enum { Keff=1, Flux, Inv, XSFis, XSCap, XSn2n }; - - map<string, int> keyword_map; - keyword_map["keff"] = Keff; - keyword_map["flux"] = Flux; - keyword_map["xsfis"] = XSFis; - keyword_map["xscap"] = XSCap; - keyword_map["xsn2n"] = XSn2n; - keyword_map["inv"] = Inv; - - getline(DecayDB, line); - do - { - start = 0; - switch (keyword_map[tlc(StringLine::NextWord(line, start, ' '))]) - { - case Keff: - ReadKeff(line, Time, NTimeStep); - break; - - case Flux: - ReadFlux(line, Time, NTimeStep); - break; - - case Inv: - ReadInv(line, Time, NTimeStep); - break; - - case XSFis: - ReadXSFis(line, Time, NTimeStep); - break; - - case XSCap: - ReadXSCap(line, Time, NTimeStep); - break; - - case XSn2n: - ReadXSn2n(line, Time, NTimeStep); - break; - - - default: - break; - } - - getline(DecayDB, line); - - - }while ( !DecayDB.eof() ); - - double M = 0; - { - map<ZAI, double >::iterator it ; - - - IsotopicVector IVtmp = GetIsotopicVectorAt(0.).GetActinidesComposition(); - map<ZAI, double >isotopicquantity = IVtmp.GetIsotopicQuantity(); - - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++ ) - { - M += (*it).second*cZAIMass.fZAIMass.find( (*it).first )->second/AVOGADRO*1e-6; - } - isotopicquantity.clear(); - - } - fHeavyMetalMass = M; - - DecayDB.close(); - - -} - -void EvolutionData::ReadKeff(string line, double* time, int NTimeStep) -{ - if(fKeff != 0) - delete fKeff; - - int start = 0; - if( tlc(StringLine::NextWord(line, start, ' ')) != "keff" ) // Check the keyword - { - ERROR << " Bad keyword : \"keff\" not found !" << endl; - exit(1); - } - - - double Keff[NTimeStep]; - - int i = 0; - while(start < (int)line.size() && i < NTimeStep ) // Read the Data - { - Keff[i] = atof(StringLine::NextWord(line, start, ' ').c_str()) ; - i++; - } - - - fKeff = new TGraph(NTimeStep, time, Keff); // Add the TGraph - - - - -} - -void EvolutionData::ReadFlux(string line, double* time, int NTimeStep) -{ - - if(fFlux != 0) - delete fFlux; - - int start = 0; - - if( tlc(StringLine::NextWord(line, start, ' ')) != "flux" ) // Check the keyword - { - ERROR << " Bad keyword : \"flux\" not found !" << endl; - exit(1); - } - - double Flux[NTimeStep]; - - int i = 0; - while(start < (int)line.size() && i < NTimeStep ) // Read the Data - { - Flux[i] = atof(StringLine::NextWord(line, start, ' ').c_str()) ; - i++; - } - - - fFlux = new TGraph(NTimeStep, time, Flux); // Add the TGraph - - - -} - - -void EvolutionData::ReadInv(string line, double* time, int NTimeStep) -{ - - - int start = 0; - if( tlc(StringLine::NextWord(line, start, ' ')) != "inv" ) // Check the keyword - { - ERROR << " Bad keyword : \"inv\" not found !" << endl; - exit(1); - } - // Read the Z A I - int Z = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int A = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int I = atoi(StringLine::NextWord(line, start, ' ').c_str()); - - if(A!=0 && Z!=0) - { - double Inv[NTimeStep]; - - int i = 0; - while(start < (int)line.size() && i < NTimeStep ) // Read the Data - { - Inv[i] = atof(StringLine::NextWord(line, start, ' ').c_str()) ; - i++; - } - // Add the TGraph - fInventoryEvolution.insert(pair<ZAI ,TGraph* >(ZAI(Z,A,I), new TGraph(NTimeStep, time, Inv) ) ); - } - - -} - - -void EvolutionData::ReadXSFis(string line, double* time, int NTimeStep) -{ - - - int start = 0; - if( tlc(StringLine::NextWord(line, start, ' ')) != "xsfis" ) // Check the keyword - { - ERROR << " Bad keyword : \"xsfis\" not found !" << endl; - exit(1); - } - // Read the Z A I - int Z = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int A = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int I = atoi(StringLine::NextWord(line, start, ' ').c_str()); - - if(A!=0 && Z!=0) - { - double XSFis[NTimeStep]; - - int i = 0; - while(start < (int)line.size() && i < NTimeStep ) // Read the Data - { - XSFis[i] = atof(StringLine::NextWord(line, start, ' ').c_str()) ; - i++; - } - - // Add the TGraph - fFissionXS.insert(pair<ZAI ,TGraph* >(ZAI(Z,A,I), new TGraph(NTimeStep, time, XSFis) ) ); - } - - -} - -void EvolutionData::ReadXSCap(string line, double* time, int NTimeStep) -{ - - - int start = 0; - if( tlc(StringLine::NextWord(line, start, ' ')) != "xscap" ) // Check the keyword - { - ERROR << " Bad keyword : \"xscap\" not found !" << endl; - exit(1); - } - // Read the Z A I - int Z = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int A = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int I = atoi(StringLine::NextWord(line, start, ' ').c_str()); - - if(A!=0 && Z!=0) - { - double XSCap[NTimeStep]; - - int i = 0; - while(start < (int)line.size() && i < NTimeStep ) // Read the Data - { - XSCap[i] = atof(StringLine::NextWord(line, start, ' ').c_str()) ; - i++; - } - - // Add the TGraph - fCaptureXS.insert(pair<ZAI ,TGraph* >(ZAI(Z,A,I), new TGraph(NTimeStep, time, XSCap) ) ); - } - - -} - -void EvolutionData::ReadXSn2n(string line, double* time, int NTimeStep) -{ - - - int start = 0; - if( tlc(StringLine::NextWord(line, start, ' ')) != "xsn2n" ) // Check the keyword - { - ERROR << " Bad keyword : \"xsn2n\" not found !" << endl; - exit(1); - } - // Read the Z A I - int Z = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int A = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int I = atoi(StringLine::NextWord(line, start, ' ').c_str()); - - if(A!=0 && Z!=0) - { - double XSn2n[NTimeStep]; - - int i = 0; - while(start < (int)line.size() && i < NTimeStep ) // Read the Data - { - XSn2n[i] = atof(StringLine::NextWord(line, start, ' ').c_str()) ; - i++; - } - // Add the TGraph - fn2nXS.insert(pair<ZAI ,TGraph* >(ZAI(Z,A,I), new TGraph(NTimeStep, time, XSn2n) ) ); - } - - -} - - - -void EvolutionData::ReadInfo() -{ - string InfoDBFile = fDB_file.erase(fDB_file.size()-3,fDB_file.size()); - InfoDBFile += "Info"; - ifstream InfoDB_tmp(InfoDBFile.c_str()); // Open the File - - if(!InfoDB_tmp) - { - InfoDBFile = InfoDBFile.erase(InfoDBFile.size()-4,InfoDBFile.size()); - InfoDBFile += "info"; - - } - InfoDB_tmp.close(); - - ifstream InfoDB(InfoDBFile.c_str()); // Open the File - if(!InfoDB) - { - WARNING << "!!ERROR!! !!!EvolutionData!!! \n Can't open \"" << InfoDBFile << "\"\n" << endl; - } - - int start = 0; - string line; - getline(InfoDB, line); - if ( tlc(StringLine::NextWord(line, start, ' ')) == "reactor") - fReactorType = StringLine::NextWord(line, start, ' '); - - start = 0; - getline(InfoDB, line); - if (tlc(StringLine::NextWord(line, start, ' ')) == "fueltype") - fFuelType = StringLine::NextWord(line, start, ' '); - start = 0; - getline(InfoDB, line); - if ( tlc(StringLine::NextWord(line, start, ' ')) == "cycletime") - fCycleTime = atof(StringLine::NextWord(line, start, ' ').c_str());; - getline(InfoDB, line); // Assembly HM Mass - start = 0; - getline(InfoDB, line); - if ( tlc(StringLine::NextWord(line, start, ' ')) == "constantpower") - fPower = atof(StringLine::NextWord(line, start, ' ').c_str()); - InfoDB.close(); -} - -void EvolutionData::OldReadDB(string DBfile) -{ - - - ifstream DecayDB(DBfile.c_str()); // Open the File - if(!DecayDB) - { - WARNING << " Can't open \"" << DBfile << "\"\n" << endl; - } - vector<double> vTime; - vector<double> vTimeErr; - - string line; - int start = 0; - - getline(DecayDB, line); - if( StringLine::NextWord(line, start, ' ') != "time") - { - ERROR << " Bad Database file : " << DBfile << endl; - exit (1); - } - - while(start < (int)line.size()) - vTime.push_back(atof(StringLine::NextWord(line, start, ' ').c_str())); - - fFinalTime = vTime.back(); - double Time[vTime.size()]; - for(int i=0; i < (int)vTime.size();i++) - Time[i] = vTime[i]; - vector<double> vFlux; - start = 0; - getline(DecayDB, line); - string tmp = StringLine::NextWord(line, start, ' '); - if ( tmp == "keff" || tmp == "Keff" ) - { - vector<double> vKeff; - while(start < (int)line.size()) - vKeff.push_back(atof(StringLine::NextWord(line, start, ' ').c_str())); - - double Keff[vKeff.size()]; - for(int i=0; i < (int)vKeff.size();i++) - Keff[i] = vKeff[i]; - - fKeff = new TGraph(vTime.size(), Time, Keff); - - start = 0; - getline(DecayDB, line); - if (StringLine::NextWord(line, start, ' ') == "flux") - { - - - while(start < (int)line.size()) - vFlux.push_back(atof(StringLine::NextWord(line, start, ' ').c_str())); - - double Flux[vFlux.size()]; - for(int i=0; i < (int)vFlux.size();i++) - Flux[i] = vFlux[i]; - - fFlux = new TGraph(vTime.size(), Time, Flux); - - } - } - - - do - { - - - start = 0; - int Z = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int A = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int I = atoi(StringLine::NextWord(line, start, ' ').c_str()); - - if(A!=0 && Z!=0) - { - double DPQuantity[vTime.size()]; - for(int k = 0; k < (int)vTime.size(); k++ ) - DPQuantity[k] = 0; - - - ZAI zaitmp(Z, A, I); - int i=0; - while(start < (int)line.size()) - { - double DPQuantityTmp = atof(StringLine::NextWord(line, start, ' ').c_str()); - DPQuantity[i] = (double)DPQuantityTmp; - i++; - - } - TGraph* tgraphtmp = new TGraph((int)vTime.size()-1, Time, DPQuantity); - fInventoryEvolution.insert(pair<ZAI ,TGraph* >(zaitmp, tgraphtmp) ); - } - - getline(DecayDB, line); - if(line == "" || line == "CrossSection" ) break; - }while (!DecayDB.eof() ); - - if(line == "CrossSection") - { - fIsCrossSection = true; - getline(DecayDB, line); - - if (line == "Fission") - { - getline(DecayDB, line); - - do - { - double DPQuantity[vTime.size()]; - for(int k = 0; k < (int)vTime.size(); k++ ) - DPQuantity[k] = 0; - - start = 0; - int Z = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int A = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int I = atoi(StringLine::NextWord(line, start, ' ').c_str()); - if(A!=0 && Z!=0) - { - - - ZAI zaitmp(Z, A, I); - int i=0; - while(start < (int)line.size()) - { - long double DPQuantityTmp = atof(StringLine::NextWord(line, start, ' ').c_str()); - DPQuantity[i] = (double)DPQuantityTmp; - i++; - - } - fFissionXS.insert(pair<ZAI ,TGraph* >(zaitmp, new TGraph(vTime.size()-1, Time, DPQuantity) ) ); - } - getline(DecayDB, line); - if(line == "" || line == "Capture" ) break; - }while ( !DecayDB.eof() ); - } - - if (line == "Capture") - { - getline(DecayDB, line); // Nuclei is given with "A Z" - - do - { - double DPQuantity[vTime.size()]; - for(int k = 0; k < (int)vTime.size(); k++ ) - DPQuantity[k] = 0; - - - start = 0; - int Z = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int A = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int I = atoi(StringLine::NextWord(line, start, ' ').c_str()); - - if(A!=0 && Z!=0) - { - - - ZAI zaitmp(Z, A, I); - int i=0; - while(start < (int)line.size()) - { - long double DPQuantityTmp = atof(StringLine::NextWord(line, start, ' ').c_str()); - DPQuantity[i] = (double)DPQuantityTmp; - i++; - - } - fCaptureXS.insert(pair<ZAI ,TGraph* >(zaitmp, new TGraph(vTime.size()-1, Time, DPQuantity) ) ); - } - getline(DecayDB, line); // Nuclei is given with "A Z" - if(line == "" || line == "n2n" ) break; - }while ( !DecayDB.eof() ); - - } - - if (line == "n2n") - { - - getline(DecayDB, line); // Nuclei is given with "A Z" - - do - { - double DPQuantity[vTime.size()]; - for(int k = 0; k < (int)vTime.size(); k++ ) - DPQuantity[k] = 0; - - start = 0; - int Z = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int A = atoi(StringLine::NextWord(line, start, ' ').c_str()); - int I = atoi(StringLine::NextWord(line, start, ' ').c_str()); - - if(A!=0 && Z!=0) - { - - - ZAI zaitmp(Z, A, I); - int i=0; - while(start < (int)line.size()) - { - long double DPQuantityTmp = atof(StringLine::NextWord(line, start, ' ').c_str()); - DPQuantity[i] = (double)DPQuantityTmp; - i++; - - } - fn2nXS.insert(pair<ZAI ,TGraph* >(zaitmp, new TGraph(vTime.size()-1, Time, DPQuantity) ) ); - } - getline(DecayDB, line); // Nuclei is given with "A Z" - if(line == "" ) break; - - }while ( !DecayDB.eof() ); - } - - } - DecayDB.close(); - start = 0; - - string InfoDBFile = DBfile.erase(DBfile.size()-3,DBfile.size()); - InfoDBFile += "info"; - ifstream InfoDB(InfoDBFile.c_str()); // Open the File - if(!InfoDB) - { - INFO << " Can't open \"" << InfoDBFile << "\"\n" << endl; - return; - } - - start = 0; - getline(InfoDB, line); - if (StringLine::NextWord(line, start, ' ') == "Reactor") - fReactorType = StringLine::NextWord(line, start, ' '); - start = 0; - getline(InfoDB, line); - if (StringLine::NextWord(line, start, ' ') == "Fueltype") - fFuelType = StringLine::NextWord(line, start, ' '); - start = 0; - getline(InfoDB, line); - if (StringLine::NextWord(line, start, ' ') == "CycleTime") - fCycleTime = atof(StringLine::NextWord(line, start, ' ').c_str());; - getline(InfoDB, line); // Assembly HM Mass - start = 0; - getline(InfoDB, line); - if (StringLine::NextWord(line, start, ' ') == "ConstantPower") - fPower = atof(StringLine::NextWord(line, start, ' ').c_str()); - getline(InfoDB, line); // cutoff - getline(InfoDB, line); // NUmber of Nuclei - start = 0; - getline(InfoDB, line); - if (StringLine::NextWord(line, start, ' ') == "NormalizationFactor") - { - double NormFactor = atof(StringLine::NextWord(line, start, ' ').c_str()); - fPower = fPower * NormFactor; - double Flux[vFlux.size()]; - for(int i=0; i < (int)vFlux.size();i++) - Flux[i] = vFlux[i]; - - fFlux = new TGraph(vTime.size()-1, Time, Flux); - } - InfoDB.close(); -} - - - - - diff --git a/source/branches/CLASSV3/src/FabricationPlant.cxx b/source/branches/CLASSV3/src/FabricationPlant.cxx deleted file mode 100644 index 8cc6367379c0c80cf9aafb05948150121ca03c6d..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/FabricationPlant.cxx +++ /dev/null @@ -1,624 +0,0 @@ -#include "FabricationPlant.hxx" - -#include "Storage.hxx" -#include "Reactor.hxx" -#include "EvolutionData.hxx" -#include "DecayDataBank.hxx" -#include "PhysicsModels.hxx" -#include "IsotopicVector.hxx" -#include "Scenario.hxx" -#include "CLASSLogger.hxx" -#include "CLASSConstante.hxx" - - - - -#include "TMatrixT.h" - -#include <sstream> -#include <string> -#include <iostream> -#include <cmath> -#include <algorithm> - -ClassImp(FabricationPlant) - - //________________________________________________________________________ - //________________________________________________________________________ - //________________________________________________________________________ - // - // FabricationPlant - // - // - // - // - //________________________________________________________________________ - //________________________________________________________________________ - - -FabricationPlant::FabricationPlant():CLASSFacility(16) -{ - SetName("F_FabricationPLant."); - - fReUsable = 0; - fIsReusable = false; -} - - -FabricationPlant::FabricationPlant(CLASSLogger* log, double fabricationtime):CLASSFacility(log, fabricationtime, 16) -{ -DBGL - SetName("F_FabricationPLant."); - - fFiFo = false; - fSubstitutionFuel = false; - - fReUsable = 0; - fIsReusable = false; - - INFO << " A FabricationPlant has been define :" << endl; - INFO << "\t Chronological Stock Priority has been set! "<< endl; - INFO << "\t Fabrication time set to \t " << (double)(GetCycleTime()/3600/24/365.25) << " year" << endl << endl; -DBGL -} - - - - //________________________________________________________________________ -FabricationPlant::~FabricationPlant() -{ - - -} - - - //________________________________________________________________________ -void FabricationPlant::SetSeparartionEfficiencyIV(ZAI zai, double factor) -{ - - pair<map<ZAI, double>::iterator, bool> IResult; - if(factor > 1) factor = 1; - - if(factor > 0) - { - IResult = fSeparationLostFraction.GetIsotopicQuantity().insert( pair<ZAI ,double>(zai, 1 - factor)); - if(!IResult.second) - IResult.first->second = 1 - factor; - } - -} - - - - //________________________________________________________________________ - //_______________________________ Evolution ______________________________ - //________________________________________________________________________ -void FabricationPlant::Evolution(cSecond t) -{ - - // Check if the FabricationPlant has been created ... - if(t == fInternalTime && t != 0) return; - // Make the evolution for the FabricationPlant ... - FabricationPlantEvolution(t); - //Update Inside IsotopicVector - UpdateInsideIV(); - // ... And Finaly update the AbsoluteInternalTime - fInternalTime = t; - -} - - //________________________________________________________________________ -void FabricationPlant::FabricationPlantEvolution(cSecond t) -{ -DBGL - map<int ,cSecond >::iterator it; - for( it = fReactorNextStep.begin(); it!= fReactorNextStep.end(); it++ ) - { - double R_CreactionTime = GetParc()->GetReactor()[ (*it).first ]->GetCreationTime(); - double R_LifeTime = GetParc()->GetReactor()[ (*it).first ]->GetLifeTime(); - - int ReactorId = (*it).first; - pair<CLASSFuel, double> R_Fuel = GetParc()->GetReactor()[ReactorId]->GetFuelPlan()->GetFuelAt( t + GetCycleTime() ); - double R_BU = R_Fuel.second; - double R_Power = GetParc()->GetReactor()[ReactorId]->GetPower(); - double R_HMMass = GetParc()->GetReactor()[ReactorId]->GetHeavyMetalMass(); - cSecond R_CycleTime = cSecond (R_BU / R_Power * R_HMMass * 1e9 *3600*24); - if( R_CycleTime < GetCycleTime()) - { - ERROR << "Reactor Cycle Time is shorter than Fabrication Time of the fuel, we cannot deal it upto now!!!"<< endl; - exit(1); - } - - if( t + GetCycleTime() >= R_CreactionTime - && t + GetCycleTime() < R_CreactionTime + R_LifeTime) - { - if( (*it).second == t ) - { -#pragma omp critical(FuelBuild) - { - if( R_Fuel.first.GetPhysicsModels() ) - { - BuildFuelForReactor( (*it).first, t ); - } - (*it).second += R_CycleTime; - } - - } - else if ( (*it).second - R_CycleTime + GetCycleTime() >= t && (*it).second - R_CycleTime < t ) - { - map<int ,IsotopicVector >::iterator it2 = fReactorFuturIV.find( (*it).first ); - if (it2 != fReactorFuturIV.end()) - (*it2).second = GetDecay((*it2).second, t - fInternalTime ); - } - } - } - - -DBGL -} - -void FabricationPlant::UpdateInsideIV() -{ - DBGL - fInsideIV = IsotopicVector(); - - map< int,IsotopicVector >::iterator it; - for( it = fReactorFuturIV.begin(); it != fReactorFuturIV.end(); it++ ) - fInsideIV += (*it).second; - - DBGL -} - - - //________________________________________________________________________ -void FabricationPlant::BuildFuelForReactor(int ReactorId, cSecond t) -{ - DBGL - if(fFissileStorage.size() == 0) - { - ERROR << " One need at least one Fissile storage to build fuel " << endl; - ERROR << " Use AddFissileStorage to add a stock to provide fissil material... " << endl; - ERROR << " One need at least one Fissile storage to build fuel " << endl; - exit(1); - } - - - - double R_HM_Mass = GetParc()->GetReactor()[ ReactorId ]->GetHeavyMetalMass(); - double R_CycleTime = GetParc()->GetReactor()[ ReactorId ]->GetCycleTime(); - double R_Power = GetParc()->GetReactor()[ ReactorId ]->GetPower(); - - pair<CLASSFuel, double > FuelBU = GetParc()->GetReactor()[ReactorId]->GetFuelPlan()->GetFuelAt(t+GetCycleTime()) ; - PhysicsModels FuelType = *FuelBU.first.GetPhysicsModels(); - double R_BU = FuelBU.second; - - fFissileList = FuelType.GetEquivalenceModel()->GetFissileList(); - BuildFissileArray(); - - - fFertileList = FuelType.GetEquivalenceModel()->GetFertileList(); - - - if(fFertileStorage.size() != 0) // If the fertile need to be taken in stock - BuildFertileArray(); - else // if their is not stock and the fertile come from outside of the park - { - fFertileArray.push_back( fFertileList / fFertileList.GetTotalMass() * R_HM_Mass ); - } - - vector<double> LambdaArray = FuelType.GetEquivalenceModel()->BuildFuel(R_BU, R_HM_Mass, fFissileArray, fFertileArray); - - double LambdaSum = 0; - for(int i = 0; i < (int)fFissileArray.size();i++) - LambdaSum += LambdaArray[i]; - - if(LambdaArray[0] != -1 && LambdaSum > 0 ) - { - IsotopicVector IV = BuildFuelFromEqModel(LambdaArray); - EvolutionData EvolDB = FuelType.GenerateEvolutionData( GetDecay(IV,fCycleTime), R_CycleTime, R_Power); - - { - pair<map<int, IsotopicVector>::iterator, bool> IResult; - IResult = fReactorFuturIV.insert( pair<int, IsotopicVector>(ReactorId, IV) ); - if(!IResult.second) - IResult.first->second = IV; - } - { - pair<map<int, EvolutionData>::iterator, bool> IResult; - IResult = fReactorFuturDB.insert( pair<int, EvolutionData>(ReactorId,EvolDB) ); - if(!IResult.second) - IResult.first->second = EvolDB; - } - fInsideIV += IV; - AddCumulativeIVIn(IV); - DBGL - return; - } - else - { - - if (!fSubstitutionFuel) - { - { - EvolutionData EmptyDB; - pair<map<int, EvolutionData>::iterator, bool> IResult; - IResult = fReactorFuturDB.insert( pair<int, EvolutionData>(ReactorId,EmptyDB) ); - if(!IResult.second) - IResult.first->second = EmptyDB; - } - { - IsotopicVector EmptyIV; - pair<map<int, IsotopicVector>::iterator, bool> IResult; - IResult = fReactorFuturIV.insert( pair<int, IsotopicVector>(ReactorId,EmptyIV) ); - if(!IResult.second) - IResult.first->second = EmptyIV; - } - } - else - { - - IsotopicVector IV = fSubstitutionEvolutionData.GetIsotopicVectorAt(0); - EvolutionData evolutiondb = fSubstitutionEvolutionData * R_HM_Mass / IV.GetTotalMass(); - - IV = IV* R_HM_Mass / IV.GetTotalMass(); - { - pair<map<int, IsotopicVector>::iterator, bool> IResult; - IResult = fReactorFuturIV.insert( pair<int, IsotopicVector>(ReactorId, IV) ); - if(!IResult.second) - IResult.first->second = IV; - } - { - pair<map<int, EvolutionData>::iterator, bool> IResult; - IResult = fReactorFuturDB.insert( pair<int, EvolutionData>(ReactorId,evolutiondb) ); - if(!IResult.second) - IResult.first->second = evolutiondb; - } - GetParc()->AddOutIncome( IV ); - fInsideIV += IV; - AddCumulativeIVIn(IV); - - - - }DBGL - return; - } -DBGL -} - - - -void FabricationPlant::BuildFissileArray() -{ - - for(int i = 0; i < (int)fFissileStorage.size(); i++) - { - vector<IsotopicVector> IVArray = fFissileStorage[i]->GetIVArray(); - - for(int j = 0; j < (int)IVArray.size(); j++) - { - - IsotopicVector SeparatedIV = Separation(IVArray[j], fFissileList).first; - - if(Norme(SeparatedIV) != 0) - { - IsotopicVector CooledSeparatedIV = GetDecay( SeparatedIV , GetCycleTime()); - - fFissileArray.push_back( CooledSeparatedIV ); - fFissileArrayAdress.push_back( pair<int,int>(i,j) ); - fFissileArrayTime.push_back(fFissileStorage[i]->GetIVArrayArrivalTime()[j]); - } - - } - - } - - SortArray(0); -} - - -void FabricationPlant::BuildFertileArray() -{ - - - for(int i = 0; i < (int)fFertileStorage.size(); i++) - { - vector<IsotopicVector> IVArray = fFertileStorage[i]->GetIVArray(); - for(int j = 0; j < (int)IVArray.size(); j++) - { - - IsotopicVector SeparatedIV = Separation(IVArray[j], fFertileList).first; - if(Norme(SeparatedIV) != 0) - { - IsotopicVector CooledSeparatedIV = GetDecay( SeparatedIV , GetCycleTime()); - - fFertileArray.push_back( CooledSeparatedIV ); - fFertileArrayAdress.push_back( pair<int,int>(i,j) ); - fFertileArrayTime.push_back(fFertileStorage[i]->GetIVArrayArrivalTime()[j]); - } - } - - } - - SortArray(1); - -} - -void FabricationPlant::SortArray(int i) -{ - - - vector<IsotopicVector> IVArray; - vector<cSecond> TimeArray; - vector< pair<int,int> > AdressArray; - - if(i==0) //Fissile - { - IVArray = fFissileArray; - TimeArray = fFissileArrayTime; - AdressArray = fFissileArrayAdress; - } - else if (i==1) //Fertile - { - IVArray = fFertileArray; - TimeArray = fFertileArrayTime; - AdressArray = fFertileArrayAdress; - - } - - if(fFiFo) - { - for(int j = 0; j < (int)TimeArray.size(); j++) - { - for (int k = j+1; k < (int)TimeArray.size(); k++) - { - cSecond time_tmp = TimeArray[j]; - pair<int,int> Adress_tmp = AdressArray[j]; - IsotopicVector IV_tmp = IVArray[j]; - - if(time_tmp > TimeArray[k]) - { - TimeArray[j] = TimeArray[k]; - TimeArray[k] = time_tmp; - - AdressArray[j] = AdressArray[k]; - AdressArray[k] = Adress_tmp; - - IVArray[j] = IVArray[k]; - IVArray[k] = IV_tmp; - } - - } - } - } - else - { - for(int j = 0; j < (int)fFissileArrayTime.size(); j++) - { - for (int k = j+1; k < (int)TimeArray.size(); k++) - { - cSecond time_tmp = TimeArray[j]; - pair<int,int> Adress_tmp = AdressArray[j]; - IsotopicVector IV_tmp = IVArray[j]; - - if(time_tmp < TimeArray[k]) - { - TimeArray[j] = TimeArray[k]; - TimeArray[k] = time_tmp; - - AdressArray[j] = AdressArray[k]; - AdressArray[k] = Adress_tmp; - - IVArray[j] = IVArray[k]; - IVArray[k] = IV_tmp; - } - - } - } - } - - - if(i==0) //Fissile - { - fFissileArray = IVArray; - fFissileArrayTime = TimeArray; - fFissileArrayAdress = AdressArray; - } - else if (i==1) //Fertile - { - fFertileArray = IVArray; - fFertileArrayTime = TimeArray; - fFertileArrayAdress = AdressArray; - - } - - -} - - - - -//________________________________________________________________________ -void FabricationPlant::SetSubstitutionFuel(EvolutionData fuel) -{ - - fSubstitutionFuel = true; - map<ZAI ,double>::iterator it; - map<ZAI ,double> isotopicquantity = fuel.GetIsotopicVectorAt(0.).GetActinidesComposition().GetIsotopicQuantity(); - double M0 = 0; - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++ ) - M0 += (*it).second*cZAIMass.fZAIMass.find( (*it).first )->second/AVOGADRO*1e-6; - fSubstitutionEvolutionData = fuel / M0; - -} - - - //________________________________________________________________________ - //_____________________________ Reactor & DB _____________________________ - //________________________________________________________________________ - //________________________________________________________________________ -void FabricationPlant::TakeReactorFuel(int Id) -{ -DBGL - IsotopicVector IV; - map<int ,IsotopicVector >::iterator it2 = fReactorFuturIV.find( Id ); - - AddCumulativeIVOut(it2->second); - - if (it2 != fReactorFuturIV.end()) - (*it2).second = IV; - - map< int,EvolutionData >::iterator it = fReactorFuturDB.find(Id); - (*it).second = EvolutionData(); - - UpdateInsideIV(); -DBGL -} - -//________________________________________________________________________ -EvolutionData FabricationPlant::GetReactorEvolutionDB(int ReactorId) -{ - - map< int,EvolutionData >::iterator it = fReactorFuturDB.find(ReactorId); - return (*it).second; -} - //________________________________________________________________________ - //_______________________________ Storage ________________________________ - //________________________________________________________________________ -IsotopicVector FabricationPlant::BuildFuelFromEqModel(vector<double> LambdaArray) -{ -DBGL - IsotopicVector BuildedFuel; - IsotopicVector Lost; - - for(int i = 0; i < (int)fFissileArray.size(); i++) - { - if(LambdaArray[i] != 0) - { - int Stor_N = fFissileArrayAdress[i].first; - int IV_N = fFissileArrayAdress[i].second; - - pair<IsotopicVector, IsotopicVector> Separated_Lost; - Separated_Lost = Separation( fFissileStorage[Stor_N]->GetIVArray()[IV_N]*LambdaArray[i], fFissileList ); - BuildedFuel += Separated_Lost.first; - Lost += Separated_Lost.second; - - } - } - - if(fFertileStorage.size() != 0) - { - for(int i = fFissileArray.size(); i < (int)(fFertileArray.size()+fFissileArray.size()); i++) - { - if(LambdaArray[i] != 0) - { - int Stor_N = fFertileArrayAdress[i].first; - int IV_N = fFertileArrayAdress[i].second; - - pair<IsotopicVector, IsotopicVector> Separated_Lost; - Separated_Lost = Separation( fFertileStorage[Stor_N]->GetIVArray()[IV_N]*LambdaArray[i], fFertileList); - BuildedFuel += Separated_Lost.first; - Lost += Separated_Lost.second; - } - } - } - else - BuildedFuel += fFertileArray[0]*LambdaArray.back(); - - if(fIsReusable) - fReUsable->AddIV(Lost); - else - GetParc()->AddWaste(Lost); - - DumpStock(LambdaArray); - -DBGL - return BuildedFuel; -} - - - //________________________________________________________________________ -void FabricationPlant::DumpStock(vector<double> LambdaArray) -{ -DBGL - - for(int i = 0; i < (int)fFissileArray.size(); i++) - { - if(LambdaArray[i] != 0) - { - int Stor_N = fFissileArrayAdress[i].first; - int IV_N = fFissileArrayAdress[i].second; - fFissileStorage[Stor_N]->TakeFractionFromStock( IV_N, LambdaArray[i] ); - } - } - if(fFertileStorage.size() != 0) - { - for(int i = fFissileArray.size(); i < (int)(fFertileArray.size()+fFissileArray.size()); i++) - { - if(LambdaArray[i] != 0) - { - int Stor_N = fFertileArrayAdress[i].first; - int IV_N = fFertileArrayAdress[i].second; - - fFertileStorage[Stor_N]->TakeFractionFromStock( IV_N, LambdaArray[i] ); - } - } - } - else - GetParc()->AddOutIncome( fFertileArray[0]*LambdaArray.back() ); - - - //Clear the Building Array (Fissile and Fertile) - fFissileArray.clear(); - fFissileArrayTime.clear(); - fFissileArrayAdress.clear(); - fFertileArray.clear(); - fFertileArrayTime.clear(); - fFertileArrayAdress.clear(); - - fFertileList = fFissileList = IsotopicVector(); - -DBGL -} - - //________________________________________________________________________ -pair<IsotopicVector, IsotopicVector> FabricationPlant::Separation(IsotopicVector isotopicvector, IsotopicVector ExtractedList) -{ -DBGL - //[0] = re-use ; [1] = waste - IsotopicVector LostInReprocessing = isotopicvector.GetThisComposition(ExtractedList) * fSeparationLostFraction; - IsotopicVector SeparatedPart = isotopicvector.GetThisComposition(ExtractedList) - LostInReprocessing; - IsotopicVector LostPart = isotopicvector - SeparatedPart; -DBGL - return pair<IsotopicVector, IsotopicVector> (SeparatedPart, LostPart); -} - - - -//________________________________________________________________________ -// Get Decay -//________________________________________________________________________ -IsotopicVector FabricationPlant::GetDecay(IsotopicVector isotopicvector, cSecond t) -{ - - IsotopicVector IV; - - map<ZAI ,double> isotopicquantity = isotopicvector.GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - { - if((*it).second > 0) - { - IsotopicVector ivtmp = fDecayDataBase->Evolution(it->first, t) * (*it).second ; - IV += ivtmp; - } - } - - return IV; - -} - - - - - - diff --git a/source/branches/CLASSV3/src/IrradiationModel.cxx b/source/branches/CLASSV3/src/IrradiationModel.cxx deleted file mode 100644 index 4c5fba0a0a7340a8b6b0abf763f666c52a2b29e0..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/IrradiationModel.cxx +++ /dev/null @@ -1,824 +0,0 @@ -// -// IrradiationModel.cxx -// CLASSSource -// -// Created by BaM on 04/05/2014. -// Copyright (c) 2014 BaM. All rights reserved. -// - -#include "IrradiationModel.hxx" - -#include "IsotopicVector.hxx" -#include "CLASSLogger.hxx" -#include "StringLine.hxx" - -#include <TGraph.h> -#include <TString.h> - - -#include <sstream> -#include <string> -#include <iostream> -#include <fstream> -#include <algorithm> -#include <cmath> - - -using namespace std; - -IrradiationModel::IrradiationModel():CLASSObject() -{ - fShorstestHalflife = 3600.*24*2.; - fZAIThreshold = 90; - - - fDataDirectoryName = getenv("CLASS_PATH"); - fDataDirectoryName += "/data/"; - fDataFileName = "chart.JEF3T"; -} - -IrradiationModel::IrradiationModel(CLASSLogger* log):CLASSObject(log) -{ - fShorstestHalflife = 3600.*24*2.; - fZAIThreshold = 90; - - - fDataDirectoryName = getenv("CLASS_PATH"); - fDataDirectoryName += "/data/"; - fDataFileName = "chart.JEF3T"; -} - - -//________________________________________________________________________ -//________________________________________________________________________ -/* Physics */ -//________________________________________________________________________ -//________________________________________________________________________ - - - -//________________________________________________________________________ -/* Decay Stuff */ -//________________________________________________________________________ -string IrradiationModel::GetDecay(string DecayModes, double &BR,int &Iso, int &StartPos) -{ - string header; - - BR=0; - //extraction of the decay mode and the BR - string DecayBR=StringLine::NextWord(DecayModes,StartPos,','); - //extraction of the decay - int ss=0; - string Decay=StringLine::NextWord(DecayBR,ss,':'); - //extraction of the BR if exist (i.e. for non stable isotop) - if(ss<int(DecayBR.size())) - BR=atof(DecayBR.substr(ss+1).c_str()); - //BR in % -> BR - BR/=100.; - //find the Isomeric state of Daughter - Iso=0; - if(Decay.find("/",0)<string::npos) - { - Iso=atoi(Decay.substr(Decay.find("/")+1).c_str()); - Decay=Decay.substr(0,Decay.find("/")); - } - return Decay; -} - -//________________________________________________________________________ -void IrradiationModel::BuildDecayMatrix() -{ -DBGL - fDecayMatrix.Clear(); - - // List of Decay Time and Properties - map<ZAI, pair<double, map< ZAI, double > > > ZAIDecay; - - { // TMP - map< ZAI, double > toAdd; - toAdd.insert(pair<ZAI, double> ( ZAI(-3,-3,-3) , 1) ); - ZAIDecay.insert( pair< ZAI, pair<double, map< ZAI, double > > >( ZAI(-3,-3,-3), pair<double, map< ZAI, double > > ( 1e28 ,toAdd )) ) ; - } - { // PF - map< ZAI, double > toAdd; - toAdd.insert(pair<ZAI, double> ( ZAI(-2,-2,-2), 1) ); - ZAIDecay.insert( pair< ZAI, pair<double, map< ZAI, double > > >( ZAI(-2,-2,-2), pair<double, map< ZAI, double > > ( 1e28 ,toAdd )) ) ; - } - - - string DataFullPathName = GetDataDirectoryName()+ GetDataFileName(); - ifstream infile(DataFullPathName.c_str()); - - if(!infile) - WARNING << " Can't open \"" << DataFullPathName<< "\"" << endl; - - - do - { - int A = -1; - int Z = -1; - int I = -1; - string zainame; - string Iname; - int unkown; - double HalfLife; - string DecayModes; - - infile >> A >> Z >> zainame >> Iname >> unkown >> HalfLife >> DecayModes; - if(Z >= fZAIThreshold ) - { - // Get Isomeric State; - - if(Iname=="gs") - I = 0; - else - if(Iname[0]=='m') - { - if( atoi( Iname.substr(1).c_str() )==0 ) - I = 1; - else - I = atoi( Iname.substr(1).c_str() ); - - } - - - int start=0; - double branch_test=0; - double branch_test_f=0; - - ZAI ParentZAI = ZAI(Z,A,I); - IsotopicVector DaughtersMap; - bool stable = true; - - while(start<int(DecayModes.size())) - { - ZAI DaughterZAI; - double BR; - int daughter_A=0; - int daughter_N=0; - int daughter_Z=0; - int Iso=0; - int DM=-1; - // FPDistribution *FP=0; - string decay_name = GetDecay(DecayModes, BR, Iso, start); - - if (decay_name == "s") {DM=0;daughter_N=(A-Z); daughter_Z=Z;BR=1;} - if (decay_name == "b-") {DM=1;stable=false; daughter_N=(A-Z)-1; daughter_Z=Z+1;} - if (decay_name == "n") {DM=2;stable=false; daughter_N=(A-Z)-1; daughter_Z=Z;} - if (decay_name == "nn") {DM=3;stable=false; daughter_N=(A-Z)-2; daughter_Z=Z;} - if (decay_name == "b-n"){DM=4;stable=false; daughter_N=(A-Z)-2; daughter_Z=Z+1;} - if (decay_name == "p") {DM=5;stable=false; daughter_N=(A-Z); daughter_Z=Z-1;} - if (decay_name == "b-a"){DM=6;stable=false; daughter_N=(A-Z)-3; daughter_Z=Z-1;} - if (decay_name == "pp") {DM=7;stable=false; daughter_N=(A-Z); daughter_Z=Z-2;} - if (decay_name == "ce") {DM=8;stable=false; daughter_N=(A-Z)+1; daughter_Z=Z-1;} - if (decay_name == "a") {DM=9;stable=false; daughter_N=(A-Z)-2; daughter_Z=Z-2;} - if (decay_name == "cen"){DM=10;stable=false; daughter_N=(A-Z); daughter_Z=Z-1;} - if (decay_name == "cep"){DM=11;stable=false; daughter_N=(A-Z)+1; daughter_Z=Z-2;} - if (decay_name == "it") {DM=12;stable=false; daughter_N=(A-Z); daughter_Z=Z;Iso = I-1;} - if (decay_name == "db-"){DM=13;stable=false; daughter_N=(A-Z)-2; daughter_Z=Z+2;} - if (decay_name == "db+"){DM=14;stable=false; daughter_N=(A-Z)+2; daughter_Z=Z-2;} - if (decay_name == "ita"){DM=15;stable=false; daughter_N=(A-Z)-2; daughter_Z=Z-2;} - if (decay_name == "sf") {DM=16;stable=false; daughter_N=0; daughter_Z=-2; Iso = -2;} - if (decay_name == "cesf"){DM=17;stable=false; daughter_N=0; daughter_Z=-2; Iso = -2;} - if (decay_name == "b-sf"){DM=18;stable=false; daughter_N=0; daughter_Z=-2; Iso = -2;} - - daughter_A = daughter_Z + daughter_N; - { - if( daughter_Z < fZAIThreshold && daughter_Z!=-2 ) - daughter_A = daughter_Z = Iso = -3; - // not spontaneous fission - ZAI DaughterZAI = ZAI(daughter_Z,daughter_A,Iso); - - if((BR>1e-10) && (!stable)) - { - if(DM <= 15) - { - DaughtersMap += BR * DaughterZAI; - branch_test+=BR; - } - else if( DM <= 18) - { - if(fSpontaneusYield.size() == 0 || fReactionYield.size() == 0 || DM == 17 || DM == 18) - { - DaughtersMap += 2*BR * ZAI(-2,-2,-2); - - branch_test_f += BR; - } - else - { - - map<ZAI, IsotopicVector>::iterator it_yield = fSpontaneusYield.find(ParentZAI); - if(it_yield != fSpontaneusYield.end()) - { - DaughtersMap += (BR* (*it_yield).second ); - branch_test_f += BR* (*it_yield).second.GetSumOfAll() / 2.; - - } - else - { - DaughtersMap += 2*BR * ZAI(-2,-2,-2); - branch_test_f += BR; - } - } - } - - } - - } - if (DM !=0) - stable = false; - // End of While loop - } - - double btest = fabs(branch_test + branch_test_f-1.0); - if ( btest > 1e-8 && !stable ) - if(branch_test+branch_test_f > 0) - DaughtersMap = DaughtersMap /(branch_test+branch_test_f); - - - - if (HalfLife < fShorstestHalflife && !stable) - fFastDecay.insert( pair< ZAI, map<ZAI, double> > ( ParentZAI, DaughtersMap.GetIsotopicQuantity() ) ); - else if (stable) - { - IsotopicVector StableIV = ParentZAI *1; - ZAIDecay.insert( pair< ZAI, pair<double, map< ZAI, double > > > - (ParentZAI, pair<double, map< ZAI, double > > - ( 1e36, StableIV.GetIsotopicQuantity()) ) ); - } - else - ZAIDecay.insert( pair< ZAI, pair<double, map< ZAI, double > > > - (ParentZAI, pair<double, map< ZAI, double > > - ( HalfLife, DaughtersMap.GetIsotopicQuantity()) ) ); - - - } - - } while (!infile.eof()); - - { - int i = 0; - map<ZAI, pair<double, map< ZAI, double > > >::iterator it; - for(it = ZAIDecay.begin() ; it != ZAIDecay.end(); it++) - { - findex.insert( pair<int, ZAI > ( i, (*it).first ) ); - findex_inver.insert( pair<ZAI, int > ( (*it).first , i )); - i++; - } - } -DBGL - // Fill the Decay Part of the Bateman Matrix Always the same ! - bool FastDecayValidation = false; - while (!FastDecayValidation) - { - map<ZAI, map<ZAI, double> > FastDecayCopy = fFastDecay; - - map<ZAI, map<ZAI, double> >::iterator FD_it; - map<ZAI, map<ZAI, double> >::iterator FD_it_Origin; - - - for(FD_it = FastDecayCopy.begin(); FD_it != FastDecayCopy.end(); FD_it++) - { - - FD_it_Origin = fFastDecay.find(FD_it->first); - - map<ZAI, double> BR = (*FD_it).second; - map<ZAI, double>::iterator BR_it; - - for(BR_it = BR.begin(); BR_it != BR.end(); BR_it++) - { - - map<ZAI, int>::iterator it_index = findex_inver.find( (*BR_it).first ); - - if( it_index == findex_inver.end() ) - { - map<ZAI, map<ZAI, double> >::iterator FD2_it = FastDecayCopy.find((*BR_it).first); - if( FD2_it != FastDecayCopy.end() ) - { - map<ZAI, double>::iterator BR2_it; - (*FD_it_Origin).second.erase((*BR_it).first); - - for (BR2_it = (*FD2_it).second.begin(); BR2_it != (*FD2_it).second.end(); BR2_it++) - { - - pair<map<ZAI, double>::iterator, bool> IResult; - IResult = (*FD_it_Origin).second.insert( pair<ZAI, double> ( (*BR2_it).first, (*BR_it).second * (*BR2_it).second ) ); - - if( !IResult.second) - (*IResult.first).second += (*BR_it).second * (*BR2_it).second ; - - - } - - } - else - { - (*FD_it_Origin).second.erase( (*BR_it).first ); - pair< map<ZAI, double>::iterator, bool> IResult; - IResult = (*FD_it_Origin).second.insert( pair<ZAI, double> ( ZAI(-3,-3,-3), (*BR_it).second) ); - if( !IResult.second) - (*IResult.first).second += (*BR_it).second ; - } - - - - } - } - - } - - - FastDecayValidation = true; - for(FD_it = fFastDecay.begin(); FD_it != fFastDecay.end(); FD_it++) - { - map<ZAI, double>::iterator BR_it; - for (BR_it = (*FD_it).second.begin(); BR_it != (*FD_it).second.end(); BR_it++) - { - map<ZAI, int>::iterator Index_it = findex_inver.find( (*BR_it).first ); - map<ZAI, map<ZAI, double> >::iterator FD2_it = fFastDecay.find( (*BR_it).first ); - if(Index_it == findex_inver.end() && FD2_it == fFastDecay.end()) - FastDecayValidation = false; - } - } - } -DBGL - - fDecayMatrix.ResizeTo(findex.size(),findex.size()); - for(int i = 0; i < (int)findex.size(); i++) - for(int j = 0; j < (int)findex.size(); j++) - fDecayMatrix[i][j] = 0; - - - - - { - int i = 0; - map<ZAI, pair<double, map< ZAI, double > > >::iterator it; - for(it = ZAIDecay.begin() ; it != ZAIDecay.end(); it++) - { - map< ZAI, double >::iterator it2; - map< ZAI, double > decaylist = (*it).second.second; - for(it2 = decaylist.begin(); it2!= decaylist.end(); it2++) - { - - map<ZAI, int >::iterator it3 = findex_inver.find( (*it2).first ); - if( it3 != findex_inver.end() ) - { - fDecayMatrix[(*it3).second][i] += log(2.)/(*it).second.first * (*it2).second; - } - else - { - map<ZAI, map<ZAI, double> >::iterator it4 = fFastDecay.find( (*it2).first ); - - if( it4 == fFastDecay.end() ) - { - - - fDecayMatrix[0][i] += log(2.)/(*it).second.first * (*it2).second; - } - else - { - map< ZAI, double >::iterator it5; - map< ZAI, double > decaylist2 = (*it4).second; - for(it5 = decaylist2.begin(); it5!= decaylist2.end(); it5++) - { - it3 = findex_inver.find( (*it5).first ); - if( it3 == findex_inver.end() ) - fDecayMatrix[0][i] += log(2.)/(*it).second.first * (*it2).second * (*it5).second; - - else - { - fDecayMatrix[(*it3).second][i] += log(2.)/(*it).second.first * (*it2).second * (*it5).second; - - } - } - } - - } - } - fDecayMatrix[i][i] += -log(2.)/(*it).second.first; - - i++; - - - } - } -DBGL -} - -//________________________________________________________________________ -/* Fission Stuff */ -//________________________________________________________________________ -void IrradiationModel::SetFissionEnergy(ZAI zai, double E) -{ - pair<map<ZAI, double>::iterator, bool> IResult; - IResult = fFissionEnergy.insert( pair<ZAI ,double>(zai, E)); - if(!IResult.second) - IResult.first->second = E; - -} - -//________________________________________________________________________ -void IrradiationModel::SetFissionEnergy(string FissionEnergyFile) -{ - ifstream FissionFile(FissionEnergyFile.c_str()); // Open the File - if(!FissionFile) //check if file is correctly open - WARNING << " Can't open \"" << FissionEnergyFile << "\"\n" << endl; - - do { - int Z = 0; - int A = 0; - int I = 0; - double E = 0; - FissionFile >> Z >> A >> I >> E; - SetFissionEnergy(Z, A, I, E); - } while (!FissionFile.eof()); -} - -//________________________________________________________________________ -map< ZAI,IsotopicVector > IrradiationModel::ReadFPYield(string Yield) -{ - IsotopicVector EmptyIV; - map< ZAI,IsotopicVector > Yield_map; - - ifstream infile(Yield.c_str()); - if(!infile) - WARNING << " Can't open \"" << Yield<< "\"\n" << endl; - - - string line; - int start = 0; - - getline(infile, line); - - do - { - int Z = atof(StringLine::NextWord(line, start, ' ').c_str()); - int A = atof(StringLine::NextWord(line, start, ' ').c_str()); - int I = 0; - - // if(Z!=0 && A!=0) - { - pair<map<ZAI, IsotopicVector>::iterator, bool> IResult; - IResult = Yield_map.insert(pair<ZAI,IsotopicVector>(ZAI(Z,A,I),EmptyIV) ); - if(!IResult.second) - { - ERROR << " Many accurance of ZAI " << Z << " " << A << " in " << Yield << " file!! " << endl; - exit(1); - - } - } - }while(start < (int)line.size()-1); - - do - { - start = 0; - - getline(infile, line); - int Z = atof(StringLine::NextWord(line, start, ' ').c_str()); - int A = atof(StringLine::NextWord(line, start, ' ').c_str()); - int I = atof(StringLine::NextWord(line, start, ' ').c_str()); - map<ZAI, IsotopicVector>::iterator it = Yield_map.begin(); - do - { - if (it == Yield_map.end()) - { - ERROR << " Many accurance of the PF " << Z << " " << A << " in " << Yield << " file!! "; - ERROR << "(Number of yield does not match the number of ZAI that fission !!!" << endl; - exit(1); - - } - - double Yield_values = atof(StringLine::NextWord(line, start, ' ').c_str()); - (*it).second += Yield_values * ZAI(Z,A,I); - - it++; - }while(start < (int)line.size()-1); - - - - - } while (!infile.eof()); - return Yield_map; -} - -//________________________________________________________________________ -void IrradiationModel::LoadFPYield(string SponfaneusYield, string ReactionYield) -{ - - fSpontaneusYield = ReadFPYield(SponfaneusYield); - fReactionYield = ReadFPYield(ReactionYield); - fZAIThreshold = 0; -} - - - - - -//________________________________________________________________________ -/* Reaction Stuff */ -//________________________________________________________________________ -TMatrixT<double> IrradiationModel::GetFissionXsMatrix(EvolutionData EvolutionDataStep,double TStep) -{ -DBGL - map<ZAI ,TGraph* >::iterator it; - TMatrixT<double> BatemanMatrix = TMatrixT<double>(findex.size(),findex.size()); - for(int i = 0; i < (int)findex.size(); i++) - for(int j = 0; j < (int)findex.size(); j++) - BatemanMatrix[i][j] = 0; - - // ---------------- A(n,.) X+Y - - map<ZAI ,TGraph* > FissionXS = EvolutionDataStep.GetFissionXS(); - - for(it = FissionXS.begin() ; it != FissionXS.end(); it++) - { - map<ZAI, int>::iterator findex_inver_it = findex_inver.find( (*it).first ); - if( findex_inver_it != findex_inver.end() ) - { - double y = (*it).second->Eval(TStep); - BatemanMatrix[ findex_inver_it->second ][ findex_inver_it->second ] += -y* 1e-24; - - if(fSpontaneusYield.size() == 0 || fReactionYield.size() == 0) - BatemanMatrix[1][ findex_inver_it->second ] += 2*y* 1e-24; - else - { - map<ZAI, IsotopicVector>::iterator it_yield = fReactionYield.find( (*it).first ); - - if( it_yield != fReactionYield.end()) - { - map<ZAI ,double>::iterator it_IVQ; - map<ZAI ,double> IVQ = (*it_yield).second.GetIsotopicQuantity(); - - for( it_IVQ = IVQ.begin(); it_IVQ != IVQ.end(); it_IVQ++ ) - { - map<ZAI, int>::iterator findex_it_PF = findex_inver.find( (*it_IVQ).first ); - - if(findex_it_PF != findex_inver.end() ) - BatemanMatrix[(*findex_it_PF).second][ (*findex_inver_it).second ] += (*it_IVQ).second*y* 1e-24; - else - { - map<ZAI, map<ZAI, double> >::iterator it_FD = fFastDecay.find( (*it_IVQ).first); - - if( it_FD == fFastDecay.end() ) - { - BatemanMatrix[1][ (*findex_inver_it).second ] += (*it_IVQ).second * y * 1e-24 ; - } - else - { - - map< ZAI, double >::iterator it5; - map< ZAI, double > decaylist2 = (*it_FD).second; - for(it5 = decaylist2.begin(); it5!= decaylist2.end(); it5++) - { - findex_it_PF = findex_inver.find( (*it5).first ); - if( findex_it_PF == findex_inver.end() ) - BatemanMatrix[0][findex_inver_it->second] += - (*it_IVQ).second * y * 1e-24 * (*it5).second; - else - BatemanMatrix[(*findex_it_PF).second][findex_inver_it->second]+= - (*it_IVQ).second * y * 1e-24 * (*it5).second; - } - } - - } - - } - } - else - BatemanMatrix[1][ findex_inver_it->second ] += 2*y* 1e-24; - - } - } - - } - -DBGL - return BatemanMatrix; -} - -//________________________________________________________________________ -TMatrixT<double> IrradiationModel::GetCaptureXsMatrix(EvolutionData EvolutionDataStep,double TStep) -{ -DBGL - map<ZAI ,TGraph* >::iterator it; - TMatrixT<double> BatemanMatrix = TMatrixT<double>(findex.size(),findex.size()); - for(int i = 0; i < (int)findex.size(); i++) - for(int j = 0; j < (int)findex.size(); j++) - BatemanMatrix[i][j] = 0; - - map<ZAI, map<ZAI, double> > Capture; - { // 241Am - map<ZAI, double> toAdd ; - toAdd.insert(pair<ZAI, double> ( ZAI(96,242,0) , 0.8733*0.827) ); //directly cut the Am242 as in MURE - toAdd.insert(pair<ZAI, double> ( ZAI(94,242,0) , 0.8733*0.173) ); //directly cut the Am242 as in MURE - toAdd.insert(pair<ZAI, double> ( ZAI(95,242,1) , 0.1267) ); - Capture.insert( pair< ZAI, map<ZAI, double> > ( ZAI(95,241,0), toAdd ) ); - } - - - - // ---------------- A(n,.)A+1 - map<ZAI ,TGraph* > CaptureXS = EvolutionDataStep.GetCaptureXS(); - for(it = CaptureXS.begin(); it != CaptureXS.end(); it++) - { - map<ZAI, int>::iterator Index_it = findex_inver.find( (*it).first ); - if( Index_it != findex_inver.end() ) - { - double y; - y = (*it).second->Eval(TStep); - - BatemanMatrix[Index_it->second][ Index_it->second ] += -y* 1e-24 ; - - map<ZAI, map<ZAI, double> >::iterator it3 = Capture.find( (*it).first ); - - if( it3 == Capture.end() ) - { - map<ZAI, int >::iterator it6 = findex_inver.find( ZAI( (*it).first.Z(), (*it).first.A()+1, 0) ); - - if( it6 != findex_inver.end() ) - { - BatemanMatrix[(*it6).second][Index_it->second] += y* 1e-24 ; - } - else - { - map<ZAI, map<ZAI, double> >::iterator it4 = fFastDecay.find( ZAI( (*it).first.Z(), (*it).first.A()+1, 0) ); - - if( it4 == fFastDecay.end() ) - { - BatemanMatrix[0][Index_it->second] += y* 1e-24 ; - } - else - { - - map< ZAI, double >::iterator it5; - map< ZAI, double > decaylist2 = (*it4).second; - for(it5 = decaylist2.begin(); it5!= decaylist2.end(); it5++) - { - it6 = findex_inver.find( (*it5).first ); - if( it6 == findex_inver.end() ) - BatemanMatrix[0][Index_it->second] += y* 1e-24 * (*it5).second; - else - BatemanMatrix[(*it6).second][Index_it->second] += y* 1e-24 * (*it5).second; - } - } - } - } - else - { - map<ZAI, double>::iterator it4; - map<ZAI, double> CaptureList = (*it3).second; - for(it4 = CaptureList.begin(); it4 != CaptureList.end() ; it4++) - { - - map<ZAI, int >::iterator it6 = findex_inver.find( (*it4).first ); - if( it6 != findex_inver.end() ) - BatemanMatrix[(*it6).second][Index_it->second] += y* 1e-24 * (*it4).second ; - else - { - map<ZAI, map<ZAI, double> >::iterator it7 = fFastDecay.find( (*it4).first ); - - if( it7 == fFastDecay.end() ) - { - ERROR << " CaptureList Problem in FastDecay for nuclei " << (*it7).first.Z() << " " << (*it7).first.A() << " " << (*it7).first.I() << endl; - exit(1); - } - - map< ZAI, double >::iterator it5; - map< ZAI, double > decaylist2 = (*it7).second; - for(it5 = decaylist2.begin(); it5!= decaylist2.end(); it5++) - { - - it6 = findex_inver.find( (*it5).first ); - if( it6 == findex_inver.end() ) - { - ERROR << " CaptureList Problem in FastDecay for nuclei " << (*it7).first.Z() << " " << (*it7).first.A() << " " << (*it7).first.I() << endl; - exit(1); - } - - BatemanMatrix[(*it6).second][Index_it->second] += y * 1e-24 * (*it5).second * (*it4).second; - } - } - - } - } - - - } - } -DBGL - return BatemanMatrix; -} - - -//________________________________________________________________________ -TMatrixT<double> IrradiationModel::Getn2nXsMatrix(EvolutionData EvolutionDataStep,double TStep) -{ -DBGL - - map<ZAI ,TGraph* >::iterator it; - TMatrixT<double> BatemanMatrix = TMatrixT<double>(findex.size(),findex.size()); - for(int i = 0; i < (int)findex.size(); i++) - for(int j = 0; j < (int)findex.size(); j++) - BatemanMatrix[i][j] = 0; - - map<ZAI, map<ZAI, double> > n2n; - { // 237Np - map<ZAI, double> toAdd ; - toAdd.insert(pair<ZAI, double> ( ZAI(93,236,0) , 0.2) ); - toAdd.insert(pair<ZAI, double> ( ZAI(93,236,1) , 0.8) ); - n2n.insert( pair< ZAI, map<ZAI, double> > ( ZAI(93,237,0), toAdd ) ); - } - - // ---------------- A(n,2n)A-1 - map<ZAI ,TGraph* > n2nXS = EvolutionDataStep.Getn2nXS(); - for(it = n2nXS.begin(); it != n2nXS.end(); it++) - { - map<ZAI, int>::iterator Index_it = findex_inver.find( (*it).first ); - if( Index_it != findex_inver.end() ) - { - double y; - y = (*it).second->Eval(TStep); - - BatemanMatrix[Index_it->second][ Index_it->second ] += -y* 1e-24 ; - - map<ZAI, map<ZAI, double> >::iterator it3 = n2n.find( (*it).first ); - - if( it3 == n2n.end() ) - { - map<ZAI, int >::iterator it6 = findex_inver.find( ZAI( (*it).first.Z(), (*it).first.A()-1, 0) ); - - if( it6 != findex_inver.end() ) - { - BatemanMatrix[(*it6).second][Index_it->second] += y* 1e-24 ; - } - else - { - map<ZAI, map<ZAI, double> >::iterator it4 = fFastDecay.find( ZAI( (*it).first.Z(), (*it).first.A()-1, 0) ); - - if( it4 == fFastDecay.end() ) - { - BatemanMatrix[0][Index_it->second] += y* 1e-24 ; - } - else - { - - map< ZAI, double >::iterator it5; - map< ZAI, double > decaylist2 = (*it4).second; - for(it5 = decaylist2.begin(); it5!= decaylist2.end(); it5++) - { - it6 = findex_inver.find( (*it5).first ); - if( it6 == findex_inver.end() ) - BatemanMatrix[0][Index_it->second] += y* 1e-24 * (*it5).second; - else - BatemanMatrix[(*it6).second][Index_it->second] += y* 1e-24 * (*it5).second; - } - } - } - } - else - { - map<ZAI, double>::iterator it4; - map<ZAI, double> n2nList = (*it3).second; - for(it4 = n2nList.begin(); it4 != n2nList.end() ; it4++) - { - - map<ZAI, int >::iterator it6 = findex_inver.find( (*it4).first ); - if( it6 != findex_inver.end() ) - BatemanMatrix[(*it6).second][Index_it->second] += y* 1e-24 * (*it4).second ; - else - { - map<ZAI, map<ZAI, double> >::iterator it7 = fFastDecay.find( (*it4).first ); - - if( it7 == fFastDecay.end() ) - { - ERROR << " n2nList Problem in FastDecay for nuclei " << (*it7).first.Z() << " " << (*it7).first.A() << " " << (*it7).first.I() << endl; - exit(1); - } - - map< ZAI, double >::iterator it5; - map< ZAI, double > decaylist2 = (*it7).second; - for(it5 = decaylist2.begin(); it5!= decaylist2.end(); it5++) - { - - it6 = findex_inver.find( (*it5).first ); - if( it6 == findex_inver.end() ) - { - ERROR << " n2nList Problem in FastDecay for nuclei " << (*it7).first.Z() << " " << (*it7).first.A() << " " << (*it7).first.I() << endl; - exit(1); - } - - BatemanMatrix[(*it6).second][Index_it->second] += y * 1e-24 * (*it5).second * (*it4).second; - } - } - - } - } - - - } - } -DBGL - return BatemanMatrix; -} - diff --git a/source/branches/CLASSV3/src/IsotopicVector.cxx b/source/branches/CLASSV3/src/IsotopicVector.cxx deleted file mode 100755 index 982fa5056a2a339fac89a4fd873a9ff380392cce..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/IsotopicVector.cxx +++ /dev/null @@ -1,663 +0,0 @@ -#include "IsotopicVector.hxx" - -#include "CLASSLogger.hxx" -#include "CLASSConstante.hxx" - - -#include <cmath> -#include <iostream> -#include <fstream> -#include <string> -#include <algorithm> -//________________________________________________________________________ -//________________________________________________________________________ -// -// -// -// IsotopicVector -// -// -//________________________________________________________________________ -//________________________________________________________________________ - - - - -//________________________________________________________________________ -//__________________________Operator Overlaoding__________________________ -//________________________________________________________________________ - - - -//____________________________General Operator____________________________ -//________________________________________________________________________ - -ClassImp(IsotopicVector) - -double Norme(IsotopicVector IV1, int DistanceType, IsotopicVector DistanceParameter) -{ - - IsotopicVector IV; - - return Distance(IV1, IV, DistanceType,DistanceParameter); - -} -double DistanceStandard(IsotopicVector IV1, IsotopicVector IV2) -{ - - double d2=0; - IsotopicVector IVtmp = IV1 + IV2; - map<ZAI ,double> IVtmpIsotopicQuantity = IVtmp.GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for( it = IVtmpIsotopicQuantity.begin(); it != IVtmpIsotopicQuantity.end(); it++) - { - double Z1 = IV1.GetZAIIsotopicQuantity( (*it).first ); - double Z2 = IV2.GetZAIIsotopicQuantity( (*it).first ); - d2 += pow(Z1-Z2 , 2 ); - } - return sqrt(d2); - -} -double DistanceAdjusted(IsotopicVector IV1, IsotopicVector IV2, IsotopicVector DistanceParameter) -{ - - double d2=0; - IsotopicVector IVtmp = IV1 + IV2; - map<ZAI ,double> IVtmpIsotopicQuantity = IVtmp.GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for( it = IVtmpIsotopicQuantity.begin(); it != IVtmpIsotopicQuantity.end(); it++) - { - double Z1 = IV1.GetZAIIsotopicQuantity( (*it).first ); - double Z2 = IV2.GetZAIIsotopicQuantity( (*it).first ); - double lambda = DistanceParameter.GetZAIIsotopicQuantity( (*it).first ); - d2 += lambda*abs(Z1-Z2); - } - return d2; - -} - - - -double Distance(IsotopicVector IV1, IsotopicVector IV2, int DistanceType, IsotopicVector DistanceParameter) -{ - - if(DistanceType==0) - { - return DistanceStandard(IV1,IV2); - } - else if(DistanceType==1||DistanceType==2){ - return DistanceAdjusted(IV1,IV2,DistanceParameter); - } - else - { - cout << " DistanceType defined by the user isn't recognized by the code" << endl; - - exit(1); - } - -} - - -double RelativDistance(IsotopicVector IV1, IsotopicVector IV2 ) -{ - - double d2 = 0; - - IsotopicVector IVtmp = IV1 + IV2; - map<ZAI ,double> IVtmpIsotopicQuantity = IVtmp.GetIsotopicQuantity(); - - double Z1total = 0; - double Z2total = 0; - map<ZAI ,double >::iterator it; - for( it = IVtmpIsotopicQuantity.begin(); it != IVtmpIsotopicQuantity.end(); it++) - { - Z1total += IV1.GetZAIIsotopicQuantity( (*it).first ); - Z2total += IV2.GetZAIIsotopicQuantity( (*it).first ); - } - for( it = IVtmpIsotopicQuantity.begin(); it != IVtmpIsotopicQuantity.end(); it++) - { - double Z1 = IV1.GetZAIIsotopicQuantity( (*it).first ); - double Z2 = IV2.GetZAIIsotopicQuantity( (*it).first ); - d2 += pow( (Z1/Z1total - Z2/Z2total) , 2 ); - } - - - return sqrt(d2); -} - - -IsotopicVector operator+(IsotopicVector const& IVa, IsotopicVector const& IVb) -{ - - IsotopicVector IVtmp; - IVtmp = IVa; - return IVtmp += IVb; -} - -//________________________________________________________________________ -IsotopicVector operator-(IsotopicVector const& IVa, IsotopicVector const& IVb) -{ - - IsotopicVector IVtmp; - IVtmp = IVa; - return IVtmp -= IVb; -} - - -//________________________________________________________________________ -IsotopicVector operator*(ZAI const& zai, double F) -{ - - IsotopicVector IVtmp; - - IVtmp.Add( zai, F); - return IVtmp; -} - - -//________________________________________________________________________ -IsotopicVector operator/(ZAI const& zai, double F) -{ - IsotopicVector IVtmp; - - IVtmp.Add( zai, 1./F); - - return IVtmp; -} - - -//________________________________________________________________________ -IsotopicVector operator*(double F, IsotopicVector const& IVA) {return IVA*F;} - -//________________________________________________________________________ -IsotopicVector operator*(IsotopicVector const& IVA, double F) -{ - - IsotopicVector IV = IVA; - IV.Multiply(F); - return IV; -} - -//________________________________________________________________________ -IsotopicVector operator*(double F, ZAI const& zai) -{ - return zai*F; -} - -//________________________________________________________________________ -IsotopicVector operator*(IsotopicVector const& IVa, IsotopicVector const& IVb) -{ - - IsotopicVector IVtmp; - IVtmp = IVa; - IVtmp *= IVb; - return IVtmp; -} - -//________________________________________________________________________ -IsotopicVector operator/(IsotopicVector const& IVA, double F) -{ - - IsotopicVector IV = IVA; - IV.Multiply(1./F); - return IV; -} - - -//____________________________InClass Operator____________________________ - -//________________________________________________________________________ -IsotopicVector& IsotopicVector::operator+=(const IsotopicVector& IVa) -{ - - Add(IVa); - return *this; - -} - -//________________________________________________________________________ -IsotopicVector& IsotopicVector::operator-=(const IsotopicVector& IVa) -{ - - Remove(IVa); - return *this; - -} -//________________________________________________________________________ -IsotopicVector& IsotopicVector::operator*=(const IsotopicVector& IVa) -{ - map<ZAI, double> IVA_isotopicquantity = IVa.GetIsotopicQuantity(); - - map<ZAI, double> isotopicquantity = (*this).GetIsotopicQuantity(); // get the isotopic quantity to loop on it - map<ZAI, double>::iterator isotopicIT; // iterator on a isotopic quantity map - - for(isotopicIT = isotopicquantity.begin(); isotopicIT != isotopicquantity.end(); isotopicIT++) // loop on the isotopicquantity... - { - map<ZAI, double>::iterator IVa_isotopicIT = IVA_isotopicquantity.find( (*isotopicIT).first ); - - if( IVa_isotopicIT != IVA_isotopicquantity.end() ) - (*isotopicIT).second *= (*IVa_isotopicIT).second; - else - (*isotopicIT).second = 0; - - } - - fIsotopicQuantity = isotopicquantity; - - return *this; - -} - -//________________________________________________________________________ -bool IsotopicVector::operator<(const IsotopicVector& isotopicvector) const -{ - - if( Norme(*this) != Norme(isotopicvector) ) - return Norme(*this) < Norme(isotopicvector); - else if( (*this).GetIsotopicQuantity().size() != isotopicvector.GetIsotopicQuantity().size() ) - return (*this).GetIsotopicQuantity().size() < isotopicvector.GetIsotopicQuantity().size(); - else - { - map<ZAI ,double>::iterator it; - map<ZAI ,double>::iterator it2 = isotopicvector.GetIsotopicQuantity().begin(); - map<ZAI ,double> IsotopicQuantity = (*this).GetIsotopicQuantity(); - for( it = IsotopicQuantity.begin(); it != IsotopicQuantity.end(); it++ ) - { - if( (*it).first != (*it2).first ) - return (*it).first < (*it2).first; - else it2++; - } - return false; - } - -} - - -//________________________________________________________________________ -//________________________Constructor & Destructor________________________ -//________________________________________________________________________ -IsotopicVector::IsotopicVector() -{ -} - - -//_____________________________________________________GetSpeciesComposition___________________ -IsotopicVector::~IsotopicVector() -{ - fIsotopicQuantity.clear(); - fIsotopicQuantityNeeded.clear(); -} - - - -//________________________________________________________________________ -//_____________________________General Method_____________________________ -//________________________________________________________________________ -void IsotopicVector::Clear() -{ - - fIsotopicQuantityNeeded.clear(); - fIsotopicQuantity.clear(); - -} -//________________________________________________________________________ -void IsotopicVector::ClearNeed() -{ - - fIsotopicQuantityNeeded.clear(); - -} - -//________________________________________________________________________ -void IsotopicVector::Multiply(double factor) -{ - - map<ZAI ,double >::iterator it; - for( it = fIsotopicQuantity.begin(); it != fIsotopicQuantity.end(); it++) - (*it).second = (*it).second * factor; - for( it = fIsotopicQuantityNeeded.begin(); it != fIsotopicQuantityNeeded.end(); it++) - (*it).second = (*it).second * factor; - - -} - -//________________________________________________________________________ - -double IsotopicVector::GetSumOfAll() const -{ - double Sum = 0; - map<ZAI ,double >::iterator it; - map<ZAI ,double > isotopicquantity = GetIsotopicQuantity(); - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - Sum += (*it).second; - - return Sum; - -} -//________________________________________________________________________ -void IsotopicVector::Add(const ZAI& zai, double quantity) -{ - - if( ceil(quantity*1e50) - quantity*1e50 > quantity*1e50 - floor(quantity*1e50) ) - quantity = floor(quantity*1e50)*1/1e50; - else quantity = ceil(quantity*1e50)*1/1e50; - - - if(quantity > 0) - { - pair<map<ZAI, double>::iterator, bool> IResult; - IResult = fIsotopicQuantity.insert( pair<ZAI ,double>(zai, quantity)); - if(!IResult.second) - IResult.first->second += quantity; - } - - -} -//________________________________________________________________________ - -void IsotopicVector::Add(const IsotopicVector& isotopicvector) -{ - - map<ZAI ,double> isotopicquantity = isotopicvector.GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - Add( (*it).first, (*it).second); - - -} -//________________________________________________________________________ - -void IsotopicVector::Add(const map<ZAI ,double>& quantity) -{ - - map<ZAI ,double> isotopicquantity = quantity; - map<ZAI ,double >::iterator it; - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - Add( (*it).first, (*it).second); - - -} - - -//________________________________________________________________________ -void IsotopicVector::Remove(const ZAI& zai, double quantity) -{ - - - map<ZAI ,double>::iterator it; - it = fIsotopicQuantity.find(zai); - - if(quantity > 0) - { - if ( it != fIsotopicQuantity.end() ) - { - if (it->second > quantity) - it->second = it->second - quantity; - else - { - if( (it->second - quantity)/it->second > 1e-16 ) // to fit with double precision : 16 digits - Need(zai, quantity - it->second ); - it->second = 0; - } - } - else - { - Need(zai, quantity); - } - } - - -} - -//________________________________________________________________________ -void IsotopicVector::Remove(const IsotopicVector& isotopicvector) -{ - - map<ZAI ,double> isotopicquantity = isotopicvector.GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - Remove( (*it).first, (*it).second); - -} - -//________________________________________________________________________ -void IsotopicVector::Need(const ZAI& zai, double quantity) -{ - if(quantity < 0.5) quantity = 0; - - pair<map<ZAI, double>::iterator, bool> IResult; - if(quantity > 0) - { cout << "Negative quantity : "<<quantity <<" for ZAI " << zai.Z() << " " << zai.A() << " " << zai.I() << " in this IsotopicVector" << endl; - exit(0); - IResult = fIsotopicQuantityNeeded.insert( pair<ZAI ,double>(zai, quantity)); - if(!IResult.second) - IResult.first->second += quantity; - } - - -} - -//________________________________________________________________________ -void IsotopicVector::Need(const IsotopicVector& isotopicvector) -{ - - map<ZAI ,double> isotopicquantity = isotopicvector.GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - Need( (*it).first, (*it).second); - -} - - -//________________________________________________________________________ -double IsotopicVector::GetZAIIsotopicQuantity(const ZAI& zai) const -{ - - map<ZAI ,double> IsotopicQuantity = fIsotopicQuantity; - - map<ZAI ,double>::iterator it; - it = IsotopicQuantity.find(zai); - - - if ( it != IsotopicQuantity.end() ) - { - return it->second; - } - else - { - return 0; - } -} - -//________________________________________________________________________ -double IsotopicVector::GetZAIIsotopicQuantity(const int z, const int a, const int i) const -{ - - ZAI zai(z, a, i); - return GetZAIIsotopicQuantity(zai); -} - -IsotopicVector IsotopicVector::GetSpeciesComposition(int z) const -{ - - IsotopicVector IV; - map<ZAI ,double > IsotopicQuantity = GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for( it = IsotopicQuantity.begin(); it != IsotopicQuantity.end(); it++) - if( (*it).first.Z() == z ) - IV += (*it).first * (*it).second; - - return IV; - -} - - -IsotopicVector IsotopicVector::GetThisComposition(IsotopicVector IV) const -{ - IsotopicVector IVtmp; - map<ZAI ,double > IsotopicQuantity = IV.GetIsotopicQuantity(); - map<ZAI ,double > THISIsotopicQuantity = (*this).GetIsotopicQuantity(); - - map<ZAI ,double >::iterator it; - for( it = IsotopicQuantity.begin(); it != IsotopicQuantity.end(); it++) - { - map<ZAI ,double >::iterator it2 = THISIsotopicQuantity.find( (*it).first ); - if(it2 != THISIsotopicQuantity.end()) - IVtmp += (*it2).first * (*it2).second ; - - } - - return IVtmp; - -} -//________________________________________________________________________ -double IsotopicVector::GetTotalMass() const -{ - return cZAIMass.GetMass(*this);//in tons -} -//________________________________________________________________________ - -double IsotopicVector::MeanMolar() const -{ - return GetTotalMass() * 1e6 * AVOGADRO / GetActinidesComposition().GetSumOfAll(); -} -//________________________________________________________________________ - -vector<ZAI> IsotopicVector::GetZAIList() const -{ - - map<ZAI ,double > IsotopicQuantity = GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - vector<ZAI> zailist; - for( it = IsotopicQuantity.begin(); it != IsotopicQuantity.end(); it++) - zailist.push_back( (*it).first ); - - return zailist; - -} - -IsotopicVector IsotopicVector::GetActinidesComposition() const -{ - - IsotopicVector IV; - for (int i = 0; i <12; i++) - IV += GetSpeciesComposition(89+i); - return IV; - -} - -vector<int> IsotopicVector::GetChemicalSpecies() const -{ - - vector<int> ChemicalSpecies; - - map<ZAI ,double > IsotopicQuantity = GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for( it = IsotopicQuantity.begin(); it != IsotopicQuantity.end(); it++) - if( (int)ChemicalSpecies.size() ==0 || (*it).first.Z() != ChemicalSpecies.back() ) - ChemicalSpecies.push_back((*it).first.Z()); - - - return ChemicalSpecies; -} - - -//________________________________________________________________________ -void IsotopicVector::Write(string filename, cSecond time) const -{ - ofstream IVfile(filename.c_str(), ios_base::app); // Open the File - if(!IVfile) - cout << "!!Warning!! !!!IsotopicVector!!! \n Can't open \"" << filename << "\"\n" << endl; - - if(time != -1) - IVfile << "Time "<< time/365.25/3600./24. << endl; - - map<ZAI ,double> IsotopicQuantity = GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for(it = IsotopicQuantity.begin(); it != IsotopicQuantity.end(); it++) - { - IVfile << (*it).first.Z() << " "; - IVfile << (*it).first.A() << " "; - IVfile << (*it).first.I() << " "; - IVfile << (*it).second << " " << endl; - } - IVfile << endl; -} -//________________________________________________________________________ -void IsotopicVector::Print(string option) const -{ - - cout << "**************************" << endl; - cout << "*Isotopic Vector Property*" << endl; - cout << "**************************" << endl << endl; - - bool QuantityPrint = false; - bool DBPrint = false; - - QuantityPrint = true; - - if(QuantityPrint) - { - cout << "*Isotopic Vector Quantity*" << endl; - map<ZAI ,double> IsotopicQuantity = GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for(it = IsotopicQuantity.begin();it != IsotopicQuantity.end(); it++) - { - cout << (*it).first.Z() << " "; - cout << (*it).first.A() << " "; - cout << (*it).first.I() << " "; - cout << ": " << (*it).second; - cout << endl; - } - cout << endl; - cout << "*Isotopic Vector Quantity Needed*" << endl; - map<ZAI ,double> IsotopicQuantityNeeded = GetIsotopicQuantityNeeded(); - for(it = IsotopicQuantityNeeded.begin(); it != IsotopicQuantityNeeded.end(); it++) - { - cout << (*it).first.Z() << " "; - cout << (*it).first.A() << " "; - cout << (*it).first.I() << " "; - cout << ": " << (*it).second; - cout << endl; - } - cout << endl; - } - if(DBPrint) - { - cout << "****Isotopic Vector DB****" << endl; - } - -} - - -void IsotopicVector::PrintList(string option) const -{ - bool QuantityPrint = false; - bool DBPrint = false; - - QuantityPrint = true; - - if(QuantityPrint) - { - map<ZAI ,double> IsotopicQuantity = GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for(it = IsotopicQuantity.begin();it != IsotopicQuantity.end(); it++) - { - cout << (*it).first.Z() << " "; - cout << (*it).first.A() << " "; - cout << (*it).first.I() << " "; - cout << endl; - } - cout << endl; - - } - if(DBPrint) - { - cout << "****Isotopic Vector DB****" << endl; - } - -} - - - - diff --git a/source/branches/CLASSV3/src/Makefile b/source/branches/CLASSV3/src/Makefile deleted file mode 100755 index 205cd4dea428b41b76d413ef707b6e7c9ee26c0b..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/Makefile +++ /dev/null @@ -1,124 +0,0 @@ -# Directory containing libraries -LIBDIR = $(CLASS_lib) -# Directory containing includes for CLASS -LOCALINC = $(CLASS_include) - - -EQM = ../Model/Equivalence -IM = ../Model/Irradiation -XSM = ../Model/XS - - -ROOTCFLAGS = `root-config --cflags` -ROOTLIBS = `root-config --libs` -ROOTGLIBS = `root-config --glibs` - -######### nothing to change from here ######### -INCLUDES = $(LOCALINC)/*.hxx -LIBNAME = CLASSpkg -OBJS = CLASSLogger.o \ - ZAI.o ZAIDict.o \ - IsotopicVector.o IsotopicVectorDict.o \ - ZAIMass.o \ - CLASSObject.o CLASSObjectDict.o\ - CLASSFacility.o CLASSFacilityDict.o\ - FabricationPlant.o FabricationPlantDict.o \ - Reactor.o ReactorDict.o \ - CLASSBackEnd.o CLASSBackEndDict.o\ - SeparationPlant.o SeparationPlantDict.o\ - Storage.o StorageDict.o\ - Pool.o PoolDict.o\ - DecayDataBank.o \ - DynamicalSystem.o\ - IrradiationModel.o \ - EquivalenceModel.o \ - XSModel.o \ - CLASSFuel.o\ - PhysicsModels.o \ - EvolutionData.o EvolutionDataDict.o \ - CLASSFuelPlan.o\ - Scenario.o - -OBJMODEL = $(EQM)/EQM_MLP_PWR_MOX.o $(EQM)/EQM_QUAD_PWR_MOX.o $(EQM)/EQM_LIN_PWR_MOX.o \ - $(XSM)/XSM_MLP.o $(XSM)/XSM_CLOSEST.o \ - $(IM)/IM_RK4.o $(IM)/IM_Matrix.o - - -ROOTOBJS = CLASSLogger.o \ - ZAI.o ZAIDict.o \ - IsotopicVector.o IsotopicVectorDict.o \ - ZAIMass.o \ - CLASSObject.o CLASSObjectDict.o\ - CLASSFacility.o CLASSFacilityDict.o\ - Reactor.o ReactorDict.o \ - FabricationPlant.o FabricationPlantDict.o \ - CLASSBackEnd.o CLASSBackEndDict.o\ - Storage.o StorageDict.o\ - Pool.o PoolDict.o\ - SeparationPlant.o SeparationPlantDict.o\ - DecayDataBank.o \ - DynamicalSystem.o\ - CLASSFuel.o\ - EvolutionData.o EvolutionDataDict.o \ - CLASSFuelPlan.o\ - PhysicsModels.o - - -CXX = g++ -CXXFLAGS = -O2 -g -Wall -fopenmp -fPIC -I$(LOCALINC) $(ROOTCFLAGS) -LD = g++ -LDFLAGS = -g -Wall -fPIC $(ROOTLIBS) -lTMVA -shared -lgomp - -all: $(OBJS) $(OBJMODEL) - $(LD) $(LDFLAGS) $(OBJS) $(OBJMODEL) -o $(LIBDIR)/lib$(LIBNAME).so - @echo "lib$(LIBNAME).so done" - $(LD) $(LDFLAGS) $(ROOTOBJS) -o $(LIBDIR)/lib$(LIBNAME)_root.so - @echo "lib$(LIBNAME)_root.so done" - -clean: - @rm -vf $(OBJS) $(OBJMODEL) *~ core *Dict.cxx *Dict.h - - -install: - @ln -sf ../Model/* ../include/ - - - -CLASSObjectDict.cxx: $(LOCALINC)/CLASSObject.hxx - rootcint -f $@ -c $^ - -CLASSFacilityDict.cxx: $(LOCALINC)/CLASSFacility.hxx - rootcint -f $@ -c $^ - -CLASSBackEndDict.cxx: $(LOCALINC)/CLASSBackEnd.hxx - rootcint -f $@ -c $^ - -StorageDict.cxx: $(LOCALINC)/Storage.hxx - rootcint -f $@ -c $^ - -ReactorDict.cxx: $(LOCALINC)/Reactor.hxx - rootcint -f $@ -c $^ - -FabricationPlantDict.cxx: $(LOCALINC)/FabricationPlant.hxx - rootcint -f $@ -c $^ - -PoolDict.cxx: $(LOCALINC)/Pool.hxx - rootcint -f $@ -c $^ - -SeparationPlantDict.cxx: $(LOCALINC)/SeparationPlant.hxx - rootcint -f $@ -c $^ - -IsotopicVectorDict.cxx: $(LOCALINC)/IsotopicVector.hxx - rootcint -f $@ -c $^ - -ZAIDict.cxx: $(LOCALINC)/ZAI.hxx - rootcint -f $@ -c $^ - -EvolutionDataDict.cxx: $(LOCALINC)/EvolutionData.hxx - rootcint -f $@ -c $^ - - -.SUFFIXES: .cxx - -%.o: %.cxx $(INCLUDES) - $(CXX) $(CXXFLAGS) -c $*.cxx -o $*.o diff --git a/source/branches/CLASSV3/src/PhysicsModels.cxx b/source/branches/CLASSV3/src/PhysicsModels.cxx deleted file mode 100644 index 1e18a41107797cb42d7abe6159b4523de9e21e30..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/PhysicsModels.cxx +++ /dev/null @@ -1,50 +0,0 @@ -#include "PhysicsModels.hxx" - -//________________________________________________________________________ -// -// PhysicsModels -// -// -// -// -//________________________________________________________________________ - - - -PhysicsModels::PhysicsModels():CLASSObject() -{ - - fXSModel = 0; - fEquivalenceModel = 0; - fIrradiationModel = 0; - - -} -//________________________________________________________________________ -PhysicsModels::PhysicsModels(XSModel* XS, EquivalenceModel* EM, IrradiationModel* IM ):CLASSObject() -{ - - fXSModel = XS; - fEquivalenceModel = EM; - fIrradiationModel = IM; - - -} -//________________________________________________________________________ -PhysicsModels::PhysicsModels(CLASSLogger* log, XSModel* XS, EquivalenceModel* EM, IrradiationModel* IM ):CLASSObject(log) -{ - - fXSModel = XS; - fEquivalenceModel = EM; - fIrradiationModel = IM; - - -} - -//________________________________________________________________________ -EvolutionData PhysicsModels::GenerateEvolutionData(IsotopicVector IV, double cycletime, double Power) -{ - - return fIrradiationModel->GenerateEvolutionData(IV, fXSModel->GetCrossSections(IV), Power, cycletime); -} -//________________________________________________________________________ diff --git a/source/branches/CLASSV3/src/Pool.cxx b/source/branches/CLASSV3/src/Pool.cxx deleted file mode 100755 index cbbb3cc0bcd8bca24f11685ac1b7180cd01c0a7b..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/Pool.cxx +++ /dev/null @@ -1,226 +0,0 @@ -#include "Pool.hxx" - -#include "IsotopicVector.hxx" -#include "Storage.hxx" -#include "Scenario.hxx" -#include "CLASSLogger.hxx" - -#include <sstream> -#include <string> -#include <iostream> -#include <cmath> -#include <algorithm> - -//________________________________________________________________________ -// -// Pool -// -// -// -// -//________________________________________________________________________ -ClassImp(Pool) - - -Pool::Pool():CLASSBackEnd(8) -{ - fOutBackEndFacility = 0; - SetName("P_Pool."); -} - - //________________________________________________________________________ -Pool::Pool(CLASSLogger* log, cSecond coolingtime):CLASSBackEnd(log, coolingtime, 8) -{ - DBGL - - - fCycleTime = (cSecond)coolingtime; - fPutToWaste = true; - fCoolingLastIndex = 0; - - fOutBackEndFacility = 0; - SetName("P_Pool."); - - - INFO << " A new Pool has been define :" << endl; - INFO << "\t The Cooling Time set at\t " << (double)(fCycleTime/3600/24/365.25) << " year" << endl; - WARNING << " All Cooled Fuel goes directly to WASTE after cooling !! " << endl; - - DBGL - -} - -//________________________________________________________________________ -Pool::Pool(CLASSLogger* log, CLASSBackEnd* storage, cSecond coolingtime):CLASSBackEnd(log, coolingtime, 8) -{ - DBGL - - fOutBackEndFacility = storage; - SetIsStorageType(false); - - fPutToWaste = false; - fCoolingLastIndex = 0; - SetName("P_Pool."); - - - - INFO << " A new Pool has been define :" << endl; - INFO << "\t The Cooling Time set at\t " << (double)(fCycleTime/3600/24/365.25) << " year" << endl; - - DBGL - -} - -//________________________________________________________________________ -Pool::~Pool() -{ - - -} - -//________________________________________________________________________ -//________________________________________________________________________ -void Pool::SetIVArray(vector<IsotopicVector> ivarray) -{ - INFO << "This method as no effect !!!" << endl; - INFO << "Use SetIVArray(vector<IsotopicVector> ivarray, vector<cSecond>n timearray) unstead!!!!"<<endl; -} - - -//________________________________________________________________________ -void Pool::SetIVArray(vector<IsotopicVector> ivarray, vector<cSecond> timearray) -{ - fIVArray = ivarray; - fIVArrayArrivalTime = timearray; - -} -//________________________________________________________________________ -// Add Temporary IV : -// Cooling -// -//________________________________________________________________________ -void Pool::AddIV(IsotopicVector IV) -{ - - fIVArray.push_back(IV); - fInsideIV += IV; - fIVArrayArrivalTime.push_back(fInternalTime); - fCoolingLastIndex++; - fCoolingIndex.push_back(fCoolingLastIndex); - - AddCumulativeIVIn(IV); - -} - - -//________________________________________________________________________ -void Pool::RemoveIVCooling(int i) //!< Remove a Cooling IsotopicVector -{ - AddCumulativeIVOut(fIVArray[i]); - - fIVArray.erase(fIVArray.begin()+i); - fIVArrayArrivalTime.erase( fIVArrayArrivalTime.begin()+i); - fCoolingIndex.erase(fCoolingIndex.begin()+i); - UpdateInsideIV(); -} - - - - -//________________________________________________________________________ -// Time Action with the reste of the Universe : -// Out Storage -// Evolution : -// Cooling -//________________________________________________________________________ - - - - -//________________________________________________________________________ -void Pool::CoolingEvolution(cSecond t) -{ -DBGL - - if(t == fInternalTime && t!=0) return; - int RemainingCoolingTime; - cSecond EvolutionTime = t - fInternalTime; - -#pragma omp parallel for - for ( int i = 0 ; i < (int)fIVArray.size() ; i++) - { - if ( abs(t - fIVArrayArrivalTime[i] - fCycleTime) < 3600 ) // ">" should not append, only "=" is normal... - { - if (t - fIVArrayArrivalTime[i] > fCycleTime) // Warning & Quit - { - ERROR << " Cooling Step : " << t/3600./24/365.25<< " :" << " an evolution Step is probably missing ! " << " " << endl; - exit (1); - } - - RemainingCoolingTime = fCycleTime - (fInternalTime - fIVArrayArrivalTime[i]); - //Cooling Decay - fIVArray[i] = GetDecay( fIVArray[i], RemainingCoolingTime); - - -#pragma omp critical(DeleteCoolingIVPB) - {fCoolingEndOfCycle.push_back(i);} - - } - else if ( fIVArrayArrivalTime[i] != t ) - { - fIVArray[i] = GetDecay( fIVArray[i] , EvolutionTime); - } - } -#pragma omp critical(DeleteCoolingIVPB) - {sort (fCoolingEndOfCycle.begin(), fCoolingEndOfCycle.end());} - -DBGL -} - - -//________________________________________________________________________ -void Pool::Evolution(cSecond t) -{ - - // Check if the Pool has been created ... - if(t == fInternalTime && t!=0) return; - // Make the evolution for the Cooling IV ... - CoolingEvolution(t); - // Update Inside IV - UpdateInsideIV(); - // ... And Finaly update the AbsoluteInternalTime - fInternalTime = t; - - - -} - - -//________________________________________________________________________ -void Pool::Dump() -{ -DBGL -//------ Cooling ------// - for(int i = (int)fCoolingEndOfCycle.size()-1; i >=0 ; i--) // IV End Of Cooling - { - - int idx = fCoolingEndOfCycle[i]; // Get Index number - - if(!fPutToWaste) - fOutBackEndFacility->AddIV(fIVArray[idx]); - else - GetParc()->AddWaste(fIVArray[idx]); - - fCoolingEndOfCycle.erase(fCoolingEndOfCycle.begin()+i); // Remove index entry - RemoveIVCooling(idx); // Remove IVcooling - } - - if((int)fCoolingEndOfCycle.size() != 0 )// Control - { - ERROR << "Problem while Dumping Cooling"<< endl; - exit (1); - } -DBGL -} - - diff --git a/source/branches/CLASSV3/src/Reactor.cxx b/source/branches/CLASSV3/src/Reactor.cxx deleted file mode 100755 index 1c72ad8c321e3a780529810880e708233486fc49..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/Reactor.cxx +++ /dev/null @@ -1,621 +0,0 @@ -#include "Reactor.hxx" - -#include "EvolutionData.hxx" -#include "Pool.hxx" -#include "FabricationPlant.hxx" -#include "Storage.hxx" -#include "Scenario.hxx" -#include "CLASSConstante.hxx" - -#include "CLASSLogger.hxx" - -#include <iostream> -#include <cmath> -#include <omp.h> -#include <typeinfo> - -//________________________________________________________________________ -// -// Reactor -// -// -// -// -//________________________________________________________________________ - - - -ClassImp(Reactor) - - -Reactor::Reactor():CLASSFacility(4) -{ - - SetName("R_Reactor."); - - fOutBackEndFacility = 0; - fStorage = 0; - fFabricationPlant = 0; - -} - -Reactor::Reactor(CLASSLogger* log):CLASSFacility(log, 4) -{ - DBGL - - fOutBackEndFacility = 0; - fStorage = 0; - fFabricationPlant = 0; - SetName("R_Reactor."); - - DBGL -} - -Reactor::Reactor(CLASSLogger* log, - CLASSBackEnd* Pool, - cSecond creationtime, - cSecond lifetime, - double power, double HMMass, double CapacityFactor ):CLASSFacility(log, creationtime, lifetime, 4) -{ - DBGL - (*this).SetName("R_Reactor."); - - - fIsStarted = false; - fIsShutDown = false; - fIsAtEndOfCycle = false; - - fStorage = 0; - fFabricationPlant = 0; - - fFixedFuel = true; - fIsStorage = false; - - fOutBackEndFacility = Pool; - - fPower = power * CapacityFactor; - - fHeavyMetalMass = HMMass; - - fBurnUp = -1; - fCycleTime = (-1); - - fIVBeginCycle = fEvolutionDB.GetIsotopicVectorAt(0); - fIVInCycle = fEvolutionDB.GetIsotopicVectorAt(0); - fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) ); - - - fFuelPlan = 0; - - INFO << " A Reactor has been define :" << endl; - INFO << "\t Fuel Composition is fixed (for now)! "<< endl; - INFO << "\t Creation time set at \t " << (double)(GetCreationTime()/3600/24/365.25) << " year" << endl; - INFO << "\t Life time (Operating's Duration) set at \t " << (double)(GetLifeTime()/3600/24/365.25) << " year" << endl; - INFO << "\t The Effective Thermal Power is \t " << (double)(fPower *1e-6) << " MW (with Full Power " << power << " and " << CapacityFactor << " capacity factor)"<< endl; - INFO << "\t The Heavy Metal Mass in the Core set at " << (double)(fHeavyMetalMass) << " tons" << endl << endl; - - DBGL - -} - -Reactor::Reactor(CLASSLogger* log, - FabricationPlant* fabricationplant, CLASSBackEnd* Pool, - cSecond creationtime, cSecond lifetime, - double Power, double HMMass, double CapacityFactor):CLASSFacility(log, creationtime, lifetime, 4) -{ - DBGL - (*this).SetName("R_Reactor."); - - - fStorage = 0; - fIsStarted = false; - fIsShutDown = false; - fIsAtEndOfCycle = false; - - fFabricationPlant = fabricationplant; - fFixedFuel = false; - - fOutBackEndFacility = Pool; - - fBurnUp = -1; - fHeavyMetalMass = HMMass; - fPower = Power*CapacityFactor; - fCycleTime = -1; //BU in GWd/t - - fFuelPlan = 0; - - - - INFO << " A Reactor has been define :" << endl; - INFO << "\t Fuel Composition is not fixed (for now)! "<< endl; - INFO << "\t Creation time set at \t " << (double)(GetCreationTime()/3600/24/365.25) << " year" << endl; - INFO << "\t Life time (Operating's Duration) set at \t " << (double)(GetLifeTime()/3600/24/365.25) << " year" << endl; - INFO << "\t The Effective Thermal Power is \t " << (double)(fPower *1e-6) << " MW (with Full Power " << Power << " and " << CapacityFactor << " capacity factor)"<< endl; - INFO << "\t The Heavy Metal Mass in the Core set at " << (double)(fHeavyMetalMass) << " tons" << endl << endl; - - - DBGL - -} - - -Reactor::Reactor(CLASSLogger* log, PhysicsModels* fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool, - cSecond creationtime, cSecond lifetime, - double Power, double HMMass, double BurnUp, double CapacityFactor):CLASSFacility(log, creationtime, lifetime, 4) -{ - DBGL - (*this).SetName("R_Reactor."); - - - fStorage = 0; - fIsStarted = false; - fIsShutDown = false; - fIsAtEndOfCycle = false; - - fFabricationPlant = fabricationplant; - - fFixedFuel = false; - - fOutBackEndFacility = Pool; - - fBurnUp = BurnUp; - fHeavyMetalMass = HMMass; - fPower = Power*CapacityFactor; - fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); //BU in GWd/t - - fFuelPlan = new CLASSFuelPlan(log); - fFuelPlan->AddFuel(creationtime, CLASSFuel(fueltypeDB), fBurnUp); - - - - INFO << " A Reactor has been define :" << endl; - INFO << "\t Fuel Composition is not fixed ! "<< endl; - INFO << "\t Creation time set at \t " << (double)(GetCreationTime()/3600/24/365.25) << " year" << endl; - INFO << "\t Life time (Operating's Duration) set at \t " << (double)(GetLifeTime()/3600/24/365.25) << " year" << endl; - INFO << "\t The Effective Thermal Power is \t " << (double)(fPower *1e-6) << " MW (with Full Power " << Power << " and " << CapacityFactor << " capacity factor)"<< endl; - INFO << "\t Burn-Up at end of Cycle set at \t " << (double)(fBurnUp) << " GWj/t" << endl; - INFO << "\t The corresponding Cycle Time is\t " << (double)(fCycleTime/3600/24/365.25) << " year" << endl; - INFO << "\t The Heavy Metal Mass in the Core set at " << (double)(fHeavyMetalMass) << " tons" << endl << endl; - - - DBGL - -} - -Reactor::Reactor(CLASSLogger* log, PhysicsModels* fueltypeDB, - FabricationPlant* fabricationplant, - CLASSBackEnd* Pool, - cSecond creationtime, cSecond lifetime, cSecond cycletime, - double HMMass, double BurnUp):CLASSFacility(log, creationtime, lifetime, cycletime, 4) -{ - DBGL - (*this).SetName("R_Reactor."); - - - fIsStarted = false; - fIsShutDown = false; - fIsAtEndOfCycle = false; - - fStorage = 0; - - fFabricationPlant = fabricationplant; - fFixedFuel = false; - fBurnUp = BurnUp; - fHeavyMetalMass = HMMass; - - fOutBackEndFacility = Pool; - fPower = BurnUp*3600.*24. / (fCycleTime) * HMMass *1e9; //BU in GWd/t - - fFuelPlan = new CLASSFuelPlan(log); - fFuelPlan->AddFuel(creationtime, CLASSFuel(fueltypeDB), fBurnUp); - - - INFO << " A Reactor has been define :" << endl; - INFO << "\t Fuel Composition is not fixed ! "<< endl; - INFO << "\t Creation time set at \t " << (double)(GetCreationTime()/3600/24/365.25) << " year" << endl; - INFO << "\t Life time (Operating's Duration) set at \t " << (double)(GetCreationTime()/3600/24/365.25) << " year" << endl; - INFO << "\t The Cycle Time set at\t " << (double)(fCycleTime/3600/24/365.25) << " year" << endl; - INFO << "\t Burn-Up at end of Cycle set at \t " << (double)(fBurnUp) << " GWj/t" << endl; - INFO << "\t The corresponding Effective Thermal Power is \t " << (double)(fPower *1e-6) << " MW" << endl; - INFO << "\t The Heavy Metal Mass in the Core set at " << (double)(fHeavyMetalMass) << " tons" << endl << endl; - - - DBGL - -} - - -Reactor::Reactor(CLASSLogger* log, EvolutionData* evolutivedb, - CLASSBackEnd* Pool, - cSecond creationtime, - cSecond lifetime, - double power, double HMMass, double BurnUp, double CapacityFactor ):CLASSFacility(log, creationtime, lifetime, 4) -{ - DBGL - (*this).SetName("R_Reactor."); - - - fIsStarted = false; - fIsShutDown = false; - fIsAtEndOfCycle = false; - - fStorage = 0; - fFabricationPlant = 0; - - fFixedFuel = true; - fIsStorage = false; - - fOutBackEndFacility = Pool; - - fPower = power * CapacityFactor; - - fHeavyMetalMass = HMMass; - - map<ZAI ,double>::iterator it; - map<ZAI ,double> isotopicquantity = evolutivedb->GetIsotopicVectorAt(0.).GetActinidesComposition().GetIsotopicQuantity(); - double M0 = 0; - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++ ) - M0 += (*it).second*cZAIMass.fZAIMass.find( (*it).first )->second/AVOGADRO*1e-6; - - fEvolutionDB = *evolutivedb * (fHeavyMetalMass/M0); - - fBurnUp = BurnUp; - fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); - - fIVBeginCycle = fEvolutionDB.GetIsotopicVectorAt(0); - fIVInCycle = fEvolutionDB.GetIsotopicVectorAt(0); - fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) ); - - fFuelPlan = new CLASSFuelPlan(log); - fFuelPlan->AddFuel(creationtime, CLASSFuel(evolutivedb), fBurnUp); - - INFO << " A Reactor has been define :" << endl; - INFO << "\t Fuel Composition is fixed ! "<< endl; - INFO << "\t Creation time set at \t " << (double)(GetCreationTime()/3600/24/365.25) << " year" << endl; - INFO << "\t Life time (Operating's Duration) set at \t " << (double)(GetLifeTime()/3600/24/365.25) << " year" << endl; - INFO << "\t The Cycle Time set at\t " << (double)(fCycleTime/3600/24/365.25) << " year" << endl; - INFO << "\t The Effective Thermal Power is \t " << (double)(fPower *1e-6) << " MW (with Full Power " << power << " and " << CapacityFactor << " capacity factor)"<< endl; - INFO << "\t The Heavy Metal Mass in the Core set at " << (double)(fHeavyMetalMass) << " tons" << endl << endl; - - - DBGL -} - -Reactor::Reactor(CLASSLogger* log, EvolutionData* evolutivedb, - CLASSBackEnd* Pool, - cSecond creationtime, cSecond lifetime, cSecond cycletime, - double HMMass, double BurnUp ):CLASSFacility(log, creationtime, lifetime, cycletime, 4) -{ - DBGL - (*this).SetName("R_Reactor."); - - - fIsStarted = false; - fIsShutDown = false; - fIsAtEndOfCycle = false; - - fStorage = 0; - fFabricationPlant = 0; - - fFixedFuel = true; - fIsStorage = false; - - fOutBackEndFacility = Pool; - - fPower = BurnUp*3600.*24. / (fCycleTime) * HMMass *1e9; //BU in GWd/t - - fHeavyMetalMass = HMMass; - - map<ZAI ,double>::iterator it; - map<ZAI ,double> isotopicquantity = evolutivedb->GetIsotopicVectorAt(0.).GetActinidesComposition().GetIsotopicQuantity(); - double M0 = 0; - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++ ) - M0 += (*it).second*cZAIMass.fZAIMass.find( (*it).first )->second/AVOGADRO*1e-6; - - fEvolutionDB = *evolutivedb * (fHeavyMetalMass/M0); - - fBurnUp = BurnUp; - - fIVBeginCycle = fEvolutionDB.GetIsotopicVectorAt(0); - fIVInCycle = fEvolutionDB.GetIsotopicVectorAt(0); - fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) ); - - - fFuelPlan->AddFuel(creationtime, CLASSFuel(evolutivedb), fBurnUp); - - INFO << " A Reactor has been define :" << endl; - INFO << "\t Fuel Composition is fixed ! "<< endl; - INFO << "\t Creation time set at \t " << (double)(GetCreationTime()/3600/24/365.25) << " year" << endl; - INFO << "\t Life time (Operating's Duration) set at \t " << (double)(GetLifeTime()/3600/24/365.25) << " year" << endl; - INFO << "\t The Cycle Time set at\t " << (double)(fCycleTime/3600/24/365.25) << " year" << endl; - INFO << "\t The Effective Thermal Power is \t " << (double)(fPower *1e-6) << " MW (with Full Power " << fPower << endl; - INFO << "\t The Heavy Metal Mass in the Core set at " << (double)(fHeavyMetalMass) << " tons" << endl << endl; - - DBGL -} - - -//________________________________________________________________________ -Reactor::~Reactor() -{ - - -} - -//________________________________________________________________________ -void Reactor::SetCycleTime(double cycletime) -{ - fCycleTime = (cSecond)cycletime; - - if(fFixedFuel==true) - { - fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt(fCycleTime/fEvolutionDB.GetPower()*fPower); - fBurnUp = fPower*fCycleTime/3600./24./fHeavyMetalMass; - } - else - { - fBurnUp = fPower*fCycleTime/3600./24./fHeavyMetalMass; - } -} -//________________________________________________________________________ -void Reactor::SetPower(double Power) -{ - fPower = Power; - - if(fFixedFuel==true) - { - fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); - fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) ); - } - else - fCycleTime = (cSecond)(fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); //BU in GWd/t - - -} -//________________________________________________________________________ -void Reactor::SetBurnUp(double BU) -{ - - fBurnUp = BU; - - if(fFixedFuel==true) - { - fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); - fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) ); - } - else - fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); - -} - -//________________________________________________________________________ -void Reactor::SetEvolutionDB(EvolutionData evolutionDB) -{ - map<ZAI ,double>::iterator it; - map<ZAI ,double> isotopicquantity = evolutionDB.GetIsotopicVectorAt(0.).GetActinidesComposition().GetIsotopicQuantity(); - double M0 = 0; - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++ ) - M0 += (*it).second*cZAIMass.fZAIMass.find( (*it).first )->second/AVOGADRO*1e-6; - fEvolutionDB = evolutionDB * (fHeavyMetalMass/M0); - - fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) ); - fIVBeginCycle = fEvolutionDB.GetIsotopicVectorAt(0); - - - -} - -//________________________________________________________________________ -void Reactor::SetNewFuel(EvolutionData ivdb) -{ - - SetEvolutionDB(ivdb); - -} - -//________________________________________________________________________ -void Reactor::Evolution(cSecond t) -{ -DBGL - - - if( fIsShutDown || t < GetCreationTime() ) return; // Reactor stop or not started... - - if(Norme(fInsideIV)!=0) - { -#pragma omp critical(ParcPowerUpdate) - {GetParc()->AddToPower(fPower);} - } - else if(fIsStarted==true) - { - WARNING << " Reactor should be working but have no Heavy Nucleus Inside. It's not working so have a zero power..." - << " Time : "<< t/365.25/3600/24 << " years" << endl; - } - - - if( t < fInternalTime ) return; - if( t == fInternalTime && t!=GetCreationTime() ) return; - - - - if( t == GetCreationTime() && !fIsStarted) // Start of the Reactor - { - fIsAtEndOfCycle = true; - fInsideIV = fIVBeginCycle; - fInternalTime = t; - fInCycleTime = 0; - - } - - // Check if the Reactor if started ... - if(!fIsStarted) return; // If the reactor just start don't need to make Fuel evolution - - - cSecond EvolutionTime = t - fInternalTime; // Calculation of the evolution time (relativ) - - - if( EvolutionTime + fInCycleTime == fCycleTime ) //End of Cycle - { - fIsAtEndOfCycle = true; - fInternalTime += EvolutionTime; // Update Internal Time - fInCycleTime += EvolutionTime; // Update InCycleTime - - if(t >= GetCreationTime() + GetLifeTime()) // if the Next Cycle don't 'Exist... - fIsShutDown = true; - - - } - else if(EvolutionTime + fInCycleTime < fCycleTime ) // During Cycle - { - - fInternalTime += EvolutionTime; // Update Internal Time - fInCycleTime += EvolutionTime; // Update InCycleTime - - fInsideIV = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fInCycleTime/fEvolutionDB.GetPower()*fPower) ); // update the fuel composition - if(t>=GetCreationTime() + GetLifeTime()) fIsShutDown = true; - } - else - { - // Evolution goes after the end of cycle.... check it - ERROR << " " << (*this).GetName() << endl; - ERROR << " Evolution Time is " << t << endl; - ERROR << " Evolution is too long! There is a problem in Reactor evolution at " << t/365.25/3600/24 << endl; - ERROR << " This is too long of : " << EvolutionTime + fInCycleTime - fCycleTime << endl; - ERROR << " I have spend " << fInCycleTime +EvolutionTime << " and should have been " << fCycleTime << endl; - exit(1); - } - -DBGL -} - -//________________________________________________________________________ -void Reactor::Dump() -{ -DBGL - - - if(fInternalTime < GetCreationTime()) return; - if(fIsShutDown && !fIsStarted) return; // Reactor stopped... - if(!fIsAtEndOfCycle && !fIsShutDown) return; - -// First trash the irradiated fuel - if(fIsAtEndOfCycle && !fIsShutDown ) - { - if(fIsStarted ) // A Cycle has already been done - { - fOutBackEndFacility->AddIV(fInsideIV); - AddCumulativeIVOut(fInsideIV); - } - else fIsStarted = true; // Just start the first cycle - - } - else if (fIsAtEndOfCycle && fIsShutDown ) //shutdown at end of Cycle - { - - fOutBackEndFacility->AddIV(fIVOutCycle); - AddCumulativeIVOut(fIVOutCycle); - fInsideIV.Clear(); - fInCycleTime = 0; - fIsStarted = false; // shut down the Reactor - } - else if (!fIsAtEndOfCycle && fIsShutDown ) //shutdown during Cycle - { - fOutBackEndFacility->AddIV(fInsideIV); - AddCumulativeIVOut(fInsideIV); - fInsideIV.Clear(); - fInCycleTime = 0; - fIsStarted = false; // shut down the Reactor - } - - - DBGL - - -// Get the new Fuel ! - pair<CLASSFuel, double> NextFuel = fFuelPlan->GetFuelAt(fInternalTime); - SetBurnUp((NextFuel).second); - - if( NextFuel.first.GetPhysicsModels() ) - fFixedFuel = false; - else if( NextFuel.first.GetEvolutionData() ) - fFixedFuel = true; - else - { - ERROR << typeid(NextFuel.first).name() << endl; - ERROR << "WRONG Fuel Format Correct it !! " << endl; - exit(1); - } - DBGL - - if(fFixedFuel ) - { - DBGL - if(fIsAtEndOfCycle && !fIsShutDown ) - { - SetEvolutionDB( *(NextFuel.first.GetEvolutionData()) ); - fIsAtEndOfCycle = false; - - - if(!GetParc()->GetStockManagement() && fIsStorage ) - { - IsotopicVector BuildIVtmp ; - IsotopicVector OutIncomePart; - - //Get The Storage Compostion - BuildIVtmp.Add(fStorage->GetInsideIV().GetIsotopicQuantity()); - //Get the rest after IVIn creation - BuildIVtmp -= fIVInCycle; - //Get the OutIncome part form this rest - OutIncomePart.Add(BuildIVtmp.GetIsotopicQuantityNeeded()) ; - //Take what you can from Storage... - fStorage->TakeFromStock( fIVInCycle - OutIncomePart); - //And Get the rest from OutIncome - GetParc()->AddOutIncome(OutIncomePart); - - } - else GetParc()->AddOutIncome(fIVInCycle); - - - fInsideIV = fIVBeginCycle; - AddCumulativeIVIn(fIVBeginCycle); - - fInCycleTime = 0; - } - DBGL - - } - else - { - DBGL - if(!GetParc()->GetStockManagement()) - { - ERROR << " Can't have unfixedFuel without stock management" << endl; - exit(1); - } - - if(fIsAtEndOfCycle && !fIsShutDown ) - { - fIsAtEndOfCycle = false; - - SetNewFuel(fFabricationPlant->GetReactorEvolutionDB(GetId())); - fFabricationPlant->TakeReactorFuel(GetId()); - - - fInsideIV = fIVBeginCycle; - AddCumulativeIVIn(fIVBeginCycle); - - fInCycleTime = 0; - } - - DBGL - - - - } - -DBGL -} - - - - diff --git a/source/branches/CLASSV3/src/Scenario.cxx b/source/branches/CLASSV3/src/Scenario.cxx deleted file mode 100755 index 0feee545df5fae52100c52dab2f93c495ffdca5f..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/Scenario.cxx +++ /dev/null @@ -1,875 +0,0 @@ -#include "Scenario.hxx" - -#include <ctime> -#include "time.h" -#include <cmath> -#include <iomanip> -#include <fstream> -#include <sstream> -#include <algorithm> -#include <omp.h> -#include "stdlib.h" - -#include "Storage.hxx" -#include "Reactor.hxx" -#include "CLASSBackEnd.hxx" -#include "Pool.hxx" -#include "FabricationPlant.hxx" -#include "SeparationPlant.hxx" -#include "CLASSLogger.hxx" - - -//________________________________________________________________________ -// -// CLASS -// -// -// -// -//________________________________________________________________________ - - - -float random(float a, float b) //peak random numebr between a and b -{ - float range = pow(2., 31); - srand(time(NULL)); //initialize the srand - return (float)a + (float)(b-a)*rand()/range; -} - -string dtoa(double num) -{ - ostringstream os(ostringstream::out); - os<<setprecision(3)<<num; - return os.str(); -} - -//________________________________________________________________________ -Scenario::Scenario():CLASSObject(new CLASSLogger("CLASS_OUTPUT.log")) -{ - - fNewTtree = true; - fPrintStep = (cSecond)(3600*24*365.25); // One Step per Year - fAbsoluteTime = 0; - fStartingTime = fAbsoluteTime; - - fStockManagement = true; - fLogTimeStep = false; - - fOutputFileName = "CLASS_Default.root"; - fOutputTreeName = "Data"; - fOutFile = 0; - fOutT = 0; - fParcPower = 0; - - // Warning - - INFO << "!!INFO!! !!!Scenario!!! Parc has been define :" << endl; - INFO << "\t Print set at : " << (double)(fPrintStep/3600/24/365.25) << " year" << endl; - INFO << "\t StockManagement set at : true" << endl; - INFO << "\t OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; - INFO << "\t Log will be in " << GetLog()->GetCLASSLoggerName() << endl; - -} - - -//________________________________________________________________________ -Scenario::Scenario(cSecond abstime):CLASSObject(new CLASSLogger()) -{ - - fNewTtree = true; - fPrintStep = (cSecond)(3600*24*365.25); // One Step per Year - fAbsoluteTime = abstime; - fStartingTime = fAbsoluteTime; - - fStockManagement = true; - fLogTimeStep = false; - - fOutputFileName = "CLASS_Default.root"; - fOutputTreeName = "Data"; - fOutFile = 0; - fOutT = 0; - fParcPower = 0; - - // Warning - - INFO << "!!INFO!! !!!Scenario!!! Parc has been define :" << endl; - INFO << "\t Print set at : " << (double)(fPrintStep/3600/24/365.25) << " year" << endl; - INFO << "\t StockManagement set at : true" << endl; - INFO << "\t OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; - INFO << "\t Log will be in " << GetLog()->GetCLASSLoggerName() << endl; - -} - - -//________________________________________________________________________ -Scenario::Scenario(CLASSLogger* log, cSecond abstime):CLASSObject(log) -{ - - - fNewTtree = true; - fPrintStep = (cSecond)(3600*24*365.25); // One Step per Year - fAbsoluteTime = abstime; - fStartingTime = fAbsoluteTime; - - fStockManagement = true; - fLogTimeStep = false; - - fOutputFileName = "CLASS_Default.root"; - fOutputTreeName = "Data"; - fOutFile = 0; - fOutT = 0; - - fParcPower = 0; - - - // Warning - - - INFO << " Parc has been define :" << endl; - INFO << " Print set at : " << (double)(fPrintStep/3600/24/365.25) << " year" << endl; - INFO << " StockManagement set at : true" << endl; - INFO << " OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; - INFO << " Log will be in " << GetLog()->GetCLASSLoggerName() << endl; - - - -} -//________________________________________________________________________ -Scenario::Scenario(cSecond abstime, CLASSLogger* log):CLASSObject(log) -{ - - fNewTtree = true; - fPrintStep = (cSecond)(3600*24*365.25); // One Step per Year - fAbsoluteTime = abstime; - fStartingTime = fAbsoluteTime; - - fStockManagement = true; - fLogTimeStep = false; - - fOutputFileName = "CLASS_Default.root"; - fOutputTreeName = "Data"; - fOutFile = 0; - fOutT = 0; - fParcPower = 0; - - // Warning - - INFO << "!!INFO!! !!!Scenario!!! Parc has been define :" << endl; - INFO << "\t Print set at : " << (double)(fPrintStep/3600/24/365.25) << " year" << endl; - INFO << "\t StockManagement set at : true" << endl; - INFO << "\t OutPut will be in \"" << fOutputFileName << "\" File and \"" << fOutputTreeName << "\" TTree" << endl; - INFO << "\t Log will be in " << GetLog()->GetCLASSLoggerName() << endl; - -} - - -//________________________________________________________________________ -Scenario::~Scenario() -{ - -#pragma omp single - {CloseOutputTree();} - - -} - -//________________________________________________________________________ -void Scenario::AddPool(Pool* Pool) -{ - - - fPool.push_back(Pool); - fPool.back()->SetParc(this); - fPool.back()->SetDecayDataBank( (*this).GetDecayDataBase() ); - fPool.back()->SetLog(GetLog()); - fPool.back()->SetId((int)fPool.size()-1); - fPool.back()->SetInternalTime(fAbsoluteTime); - - - string Pool_name = fPool.back()->GetName(); - if(Pool_name == "P_Pool.") - { - Pool_name = "P_Pool"; - Pool_name += dtoa(fPool.back()->GetId()); - Pool_name += "."; - fPool.back()->SetName(Pool_name.c_str()); - } - else - { - string name_tmp = Pool_name; - Pool_name = "P_"; - Pool_name += name_tmp; - Pool_name += "."; - fPool.back()->SetName(Pool_name.c_str()); - } - - if(!fNewTtree) - fOutT->Branch(fPool.back()->GetName(), "Pool", &fPool.back()); - - -} - -//________________________________________________________________________ -void Scenario::AddReactor(Reactor* reactor) -{ - - fReactor.push_back(reactor); - fReactor.back()->SetParc(this); - fReactor.back()->SetLog(GetLog()); - fReactor.back()->SetId((int)fReactor.size()-1); - fReactor.back()->SetInternalTime(fAbsoluteTime); - - - string Reactor_name = fReactor.back()->GetName(); - if(Reactor_name == "R_Reactor.") - { - Reactor_name = "R_Reactor"; - Reactor_name += dtoa(fReactor.back()->GetId()); - Reactor_name += "."; - fReactor.back()->SetName(Reactor_name.c_str()); - } - else - { - string name_tmp = Reactor_name; - Reactor_name = "R_"; - Reactor_name += name_tmp; - Reactor_name += "."; - fReactor.back()->SetName(Reactor_name.c_str()); - } - - if(!fNewTtree) - fOutT->Branch(fReactor.back()->GetName(), "Reactor", &fReactor.back()); - - -} - -//________________________________________________________________________ -void Scenario::AddStorage(Storage* storage) -{ - - fStorage.push_back(storage); - fStorage.back()->SetParc(this); - fStorage.back()->SetDecayDataBank( (*this).GetDecayDataBase() ); - fStorage.back()->SetLog(GetLog()); - fStorage.back()->SetId((int)fStorage.size()-1); - fStorage.back()->SetInternalTime(fAbsoluteTime); - - string Storage_name = fStorage.back()->GetName(); - - if(Storage_name == "S_Storage.") - { - Storage_name = "S_Storage"; - Storage_name += dtoa(fStorage.back()->GetId()); - Storage_name += "."; - fStorage.back()->SetName(Storage_name.c_str()); - } - else - { - string name_tmp = Storage_name; - Storage_name = "S_"; - Storage_name += name_tmp; - Storage_name += "."; - fStorage.back()->SetName(Storage_name.c_str()); - } - - if(!fNewTtree) - fOutT->Branch(fStorage.back()->GetName(), "Storage", &fStorage.back()); - - -} -//________________________________________________________________________ -void Scenario::AddFabricationPlant(FabricationPlant* fabricationplant) -{ - - fFabricationPlant.push_back(fabricationplant); - fFabricationPlant.back()->SetParc(this); - fFabricationPlant.back()->SetDecayDataBank( (*this).GetDecayDataBase() ); - fFabricationPlant.back()->SetLog(GetLog()); - fFabricationPlant.back()->SetId((int)fStorage.size()-1); - fFabricationPlant.back()->SetInternalTime(fAbsoluteTime); - - - string FP_name = fFabricationPlant.back()->GetName(); - if(FP_name == "F_FabricationPlant.") - { - FP_name = "F_FabricationPlant"; - FP_name += dtoa(fFabricationPlant.back()->GetId()); - FP_name += "."; - fFabricationPlant.back()->SetName(FP_name.c_str()); - } - else - { - string name_tmp = FP_name; - FP_name = "F_"; - FP_name += name_tmp; - FP_name += "."; - fFabricationPlant.back()->SetName(FP_name.c_str()); - } - - if(!fNewTtree) - fOutT->Branch(fFabricationPlant.back()->GetName(), "FabricationPlant", &fFabricationPlant.back()); -} -//________________________________________________________________________ -void Scenario::AddSeparationPlant(SeparationPlant* SeparationPlant) -{ - - - fSeparationPlant.push_back(SeparationPlant); - fSeparationPlant.back()->SetParc(this); - fSeparationPlant.back()->SetDecayDataBank( (*this).GetDecayDataBase() ); - fSeparationPlant.back()->SetLog(GetLog()); - fSeparationPlant.back()->SetId((int)fSeparationPlant.size()-1); - fSeparationPlant.back()->SetInternalTime(fAbsoluteTime); - - - string SeparationPlant_name = fSeparationPlant.back()->GetName(); - if(SeparationPlant_name == "C_SepPlant.") - { - SeparationPlant_name = "C_SepPlant"; - SeparationPlant_name += dtoa(fSeparationPlant.back()->GetId()); - SeparationPlant_name += "."; - fSeparationPlant.back()->SetName(SeparationPlant_name.c_str()); - } - else - { - string name_tmp = SeparationPlant_name; - SeparationPlant_name = "C_"; - SeparationPlant_name += name_tmp; - SeparationPlant_name += "."; - fSeparationPlant.back()->SetName(SeparationPlant_name.c_str()); - } - - if(!fNewTtree) - fOutT->Branch(fSeparationPlant.back()->GetName(), "SeparationPlant", &fSeparationPlant.back()); - - -} - - -//________________________________________________________________________ - - -//________________________________________________________________________ -void Scenario::BuildTimeVector(cSecond t) -{ - DBGL - fTimeStep.clear(); - fTimeStep.insert( pair<cSecond ,int>(t,1) ); - //********* Printing Step *********// - { - DBGL - cSecond step = fStartingTime; - - if(step >= fAbsoluteTime ) - fTimeStep.insert( pair<cSecond ,int>(step,1) ); - step += fPrintStep; - cSecond timescale = 1; - - do - { - - if(step >= fAbsoluteTime ) - fTimeStep.insert( pair<cSecond ,int>(step,1) ); - - if(fLogTimeStep) - { - timescale *= 10; - step = fPrintStep*timescale; - } - else - step += fPrintStep; - - } - while( step < t ); - DBGL - } - - - for(int i = 0; i < (int)fReactor.size();i++) - { - DBGL - cSecond R_StartingTime = fReactor[i]->GetCreationTime(); - cSecond R_ShutDownTime = fReactor[i]->GetCreationTime() + fReactor[i]->GetLifeTime(); - - double R_Power = fReactor[i]->GetPower(); - double R_HMMass = fReactor[i]->GetHeavyMetalMass(); - pair<CLASSFuel, double> R_Fuel = fReactor[i]->GetFuelPlan()->GetFuelAt(R_StartingTime); - - double R_BU = R_Fuel.second; - cSecond R_CycleTime = (cSecond) (R_BU / R_Power * R_HMMass * 1e9 *3600*24); - if(R_CycleTime == 0) - { - ERROR << " Be carefull a reactor cycletime is set to 0 second....\"\n" << endl; - exit(1); - } - - int R_FacilityType = fReactor[i]->GetFacilityType(); - - - cSecond F_CycleTime = 0; - - - cSecond step = R_StartingTime; - - map< cSecond, int > R_BackEndTimePath = fReactor[i]->GetOutBackEndFacility()->GetTheBackEndTimePath(); - - if( R_Fuel.first.GetPhysicsModels() ) - F_CycleTime = fReactor[i]->GetFabricationPlant()->GetCycleTime(); - - - //********* Reactor Evolution Step *********// - // ShutDown of a reactor - - // Test if the sutdown of the reactor is after the actual time (AbsolutreTime) and before the end of the evolution (t) - if( R_ShutDownTime < t ) - { - // Shutdown - if( R_ShutDownTime > fAbsoluteTime) - { - pair< map<cSecond, int>::iterator, bool > IResult; - IResult = fTimeStep.insert( pair<cSecond ,int>(R_ShutDownTime, 2) ); - if( !IResult.second ) - IResult.first->second |= 2; - } - - // BackEnd fuel Cycle after reactor Shutdown - - map< cSecond, int >::iterator TV_it; // the time vector iterator - - // Loop on the BackEnd fuel Cycle Time path - for(TV_it = R_BackEndTimePath.begin(); TV_it != R_BackEndTimePath.end(); TV_it++) - { - // Test if each step of the Fuel Cycle BackEnd is after the actual time (AbsolutreTime) and before the end of the evolution (t) - if( R_ShutDownTime + (*TV_it).first >= fAbsoluteTime && R_ShutDownTime + (*TV_it).first <= t) - { - pair< map<cSecond, int>::iterator, bool > IResult; - IResult = fTimeStep.insert( pair<cSecond ,int>(R_ShutDownTime + (*TV_it).first, (*TV_it).second) ); - if( !IResult.second ) - IResult.first->second |= (*TV_it).second; - } - } - - - } - - // Start the reactor and the Fuel Fabrication - if(step >= fAbsoluteTime && step <= t && step < R_ShutDownTime) - { - pair< map<cSecond, int>::iterator, bool > IResult; - IResult = fTimeStep.insert( pair<cSecond ,int>(step, R_FacilityType) ); - if( !IResult.second ) - IResult.first->second |= R_FacilityType; - } - - - //********* FabricationPlant Evolution Step *********// - - - if( R_Fuel.first.GetPhysicsModels() ) - { - - fReactor[i]->GetFabricationPlant()->AddReactor( i, step ); - - - F_CycleTime = fReactor[i]->GetFabricationPlant()->GetCycleTime(); - - if(step - F_CycleTime >= fAbsoluteTime && step - F_CycleTime <= t && step < R_ShutDownTime) - { // Set End of reactor cycle - pair< map<cSecond, int>::iterator, bool > IResult; - IResult = fTimeStep.insert( pair<cSecond ,int>(step - F_CycleTime,16) ); - if( !IResult.second ) IResult.first->second |= 16; - } - else if( step - F_CycleTime < fStartingTime ) - { - ERROR << " Can't Build Fuel before Scenario's start\"\n" << endl; - exit(1); - } - } - - step += R_CycleTime; - //Prepare the first Cycle - R_Fuel = fReactor[i]->GetFuelPlan()->GetFuelAt(step); - - R_BU = fReactor[i]->GetFuelPlan()->GetFuelAt(step).second; - R_CycleTime = (cSecond) (R_BU / R_Power * R_HMMass * 1e9 *3600*24); - - if(R_CycleTime == 0) - { - ERROR << " Be carefull a reactor cycletime is set to 0 second....\"\n" << endl; - exit(1); - } - - - while(step <= t && step <= R_ShutDownTime ) - { - DBGL - - // FabricationPlant Evolution Step - if( R_Fuel.first.GetPhysicsModels() ) - { - fReactor[i]->GetFabricationPlant()->AddReactor( i, step ); - - F_CycleTime = fReactor[i]->GetFabricationPlant()->GetCycleTime(); - - if(step - F_CycleTime >= fAbsoluteTime && step - F_CycleTime <= t && step < R_ShutDownTime) - { // Set End of reactor cycle - pair< map<cSecond, int>::iterator, bool > IResult; - IResult = fTimeStep.insert( pair<cSecond ,int>(step - F_CycleTime,16) ); - if( !IResult.second ) IResult.first->second |= 16; - } - } - - - if(step >= fAbsoluteTime && step <= t && step < R_ShutDownTime) - { // Set End of reactor cycle - pair< map<cSecond, int>::iterator, bool > IResult = fTimeStep.insert( pair<cSecond ,int>(step,4) ); - if( !IResult.second ) IResult.first->second |= 4; - } - - // End/Start Of Reactor Cycle Step // - - - map< cSecond, int >::iterator TV_it; // the time vector iterator - // BackEnd fuel Cycle - // Loop on the BackEnd fuel Cycle Time path - for(TV_it = R_BackEndTimePath.begin(); TV_it != R_BackEndTimePath.end(); TV_it++) - { - - if(step + (*TV_it).first >= fAbsoluteTime && - step + (*TV_it).first <= t) - { // Test if each step of the Fuel Cycle BackEnd is after the actual time (AbsolutreTime) and before the end of the evolution (t) - pair< map<cSecond, int>::iterator, bool > IResult; - - IResult = fTimeStep.insert( pair<cSecond ,int>(step + (*TV_it).first, (*TV_it).second) ); - if( !IResult.second ) - IResult.first->second |= (*TV_it).second; - } - } - - - step += R_CycleTime; - - // Update to the next fuel - R_Fuel = fReactor[i]->GetFuelPlan()->GetFuelAt(step); - - R_BU = fReactor[i]->GetFuelPlan()->GetFuelAt(step).second; - R_CycleTime = (cSecond) (R_BU / R_Power * R_HMMass * 1e9 *3600*24); - if(R_CycleTime == 0) - { - ERROR << " Be carefull a reactor cycletime is set to 0 second....\"\n" << endl; - exit(1); - } - - DBGL - } - - - - DBGL - } - //****** Print the Time Index ******// - ofstream TimeStepfile("CLASS_TimeStep", ios_base::app); // Open the File - - if(!TimeStepfile) - WARNING << " Can't open \" CLASS_TimeStep \"\n" << endl; - - map<cSecond ,int >::iterator it; - for( it = fTimeStep.begin(); it != fTimeStep.end(); it++) - TimeStepfile << (*it).first << " " << (*it).second << endl; - - DBGL -} - - -//________________________________________________________________________ -//___________________________ Evolution Method ___________________________ -//________________________________________________________________________ - -void Scenario::PoolEvolution() -{ - DBGL -#pragma omp parallel for - for(int i = 0; i < (int) fPool.size();i++) - fPool[i]->Evolution(fAbsoluteTime); - - for(int i = 0; i < (int) fPool.size();i++) - fPool[i]->Dump(); - DBGL -} - -void Scenario::StorageEvolution() -{ - DBGL -#pragma omp parallel for - for(int i = 0; i < (int) fStorage.size();i++) - fStorage[i]->Evolution(fAbsoluteTime); - - DBGL -} - -void Scenario::FabricationPlantEvolution() -{ - DBGL - //#pragma omp parallel for - for(int i = 0; i < (int) fFabricationPlant.size();i++) - fFabricationPlant[i]->Evolution(fAbsoluteTime); - - DBGL -} - -//________________________________________________________________________ -void Scenario::ReactorEvolution() -{ - DBGL - fParcPower = 0; -#pragma omp parallel for - for(int i = 0; i < (int)fReactor.size(); i++) - fReactor[i]->Evolution(fAbsoluteTime); - - - for(int i = 0; i < (int)fReactor.size(); i++) - fReactor[i]->Dump(); - - DBGL -} - -//________________________________________________________________________ -void Scenario::Evolution(cSecond t) -{ - DBGL - - BuildTimeVector(t); - - if(fNewTtree) - { - OpenOutputTree(); - OutAttach(); - UpdateParc(); - fOutT->Fill(); - } - - map<cSecond ,int >::iterator it; - for(it = fTimeStep.begin(); it != fTimeStep.end(); it++) - { - - fWaste = fDecayDataBase->GetDecay(fWaste, (*it).first - fAbsoluteTime); - fAbsoluteTime = (*it).first; - - - if( (*it).second & 1 || (*it).second & 4 || (*it).second & 8 || (*it).second & 16 ) - StorageEvolution(); - - if( (*it).second & 1 || (*it).second & 2 || (*it).second & 4 || (*it).second & 8 || (*it).second & 16 ) - PoolEvolution(); - - if( (*it).second & 1 || (*it).second & 2 || (*it).second & 4 || (*it).second & 16 ) - FabricationPlantEvolution(); - - if( (*it).second & 1 || (*it).second & 2 || (*it).second & 4 ) - ReactorEvolution(); - - if( (*it).second & 1 || it == fTimeStep.begin() ) - { -#pragma omp single - { - UpdateParc(); - fOutT->Fill(); - ProgressPrintout( (cSecond)t); - } - } - - } - cout << endl; - - DBGL -} - -void Scenario::ProgressPrintout(cSecond t) -{ - - double Time = (fAbsoluteTime-fStartingTime)/3600/24/365.25 ; - double Total = (t-fStartingTime)/3600/24/365.25; - - // Reset the line - for(int i = 0; i < 10; i++) - cout << " "; - cout << flush ; - - cout << "\r["; - for(int i = 0; i < (int)(Time/Total*20.0); i++) - cout << "|"; - for(int i = 20; i >= (int)(Time/Total*20.0); i--) - cout << "-"; - cout << "] "; - - cout << " Processed "; - if (Time < 10) cout << " "; - if (Time < 100) cout << " "; - cout << (int)Time << " / " << (int)Total << " Years \r"; - if( fLog->GetVerboseLVL() < 2) cout << flush; - else cout << endl; - - - INFO << " Proccessed " << (int)Time << " / " << (int)Total << " Years \r" << endl; - -} - -//________________________________________________________________________ -//______________________________ Out Method ______________________________ -//________________________________________________________________________ -void Scenario::UpdateParc() -{ - - ResetQuantity(); - - for(int i =0; i < (int)fFabricationPlant.size(); i++) - fFuelFabrication += fFabricationPlant[i]->GetInsideIV(); - - for(int i = 0; i < (int) fPool.size();i++) - fTotalCooling += fPool[i]->GetInsideIV(); - - for(int i = 0; i < (int)fStorage.size(); i++) - fTotalStorage += fStorage[i]->GetInsideIV(); - - for(int i = 0; i < (int)fReactor.size(); i++) - fTotalInReactor += fReactor[i]->GetIVReactor(); - - fIVTotal = fWaste + fTotalStorage + fTotalCooling + fFuelFabrication + fTotalInReactor; - fIVInCycleTotal = fTotalStorage + fTotalCooling + fFuelFabrication + fTotalInReactor; - - -} - - - -void Scenario::ResetQuantity() -{ - - fTotalInReactor.Clear(); - fTotalStorage.Clear(); - fTotalCooling.Clear(); - fFuelFabrication.Clear(); - fIVInCycleTotal.Clear(); - fIVTotal.Clear(); - -} - -//________________________________________________________________________ -void Scenario::OpenOutputTree() -{ - - - INFO << "Opening : " << fOutputFileName << " ...\t"; - fOutFile = new TFile(fOutputFileName.c_str(),"UPDATE"); - - if(!fOutFile) - { - ERROR << "\nCould not open " << fOutputFileName <<endl; - exit(-1); - } - INFO << "\t ...OK!" << endl; - - - fOutT = new TTree(fOutputTreeName.c_str(), "Data Tree"); - INFO << "Creating Data Tree ...\t"; - if(!fOutT) - { - ERROR << "\nCould not create Data Tree in " << fOutputFileName << endl; - exit(-1); - } - fNewTtree = false; - INFO << "\t ...OK!" << endl; - -} -void Scenario::CloseOutputTree() -{ - - - fOutFile->ls(); - INFO << "Writing outTree " << fOutputFileName << endl; - fOutFile->Write(); - - if(fOutFile->IsOpen()) { - INFO << "Deleting outTree : " << endl; - delete fOutT; - INFO << "Closing file : " << fOutputFileName <<endl; - fOutFile-> Close(); - delete fOutFile; - } else { - ERROR << "File was not opened " << fOutputFileName << endl; - exit(-1); - } -} -//________________________________________________________________________ -void Scenario::OutAttach() -{ - - ResetQuantity(); - //Branch Absolut Time - fOutT->Branch("AbsTime",&fAbsoluteTime,"AbsoluteTime/L"); - //Branch The Power installed in the Parc - fOutT->Branch("ParcPower",&fParcPower,"ParcPower/D"); - - - - // Branch the Sum IV - - - fOutT->Branch("STOCK.", "IsotopicVector", &fTotalStorage); - fOutT->Branch("FUELFABRICATION.", "IsotopicVector", &fFuelFabrication); - fOutT->Branch("COOLING.", "IsotopicVector", &fTotalCooling); - fOutT->Branch("REACTOR.", "IsotopicVector", &fTotalInReactor); - fOutT->Branch("INCYCLE.", "IsotopicVector", &fIVInCycleTotal); - fOutT->Branch("TOTAL.", "IsotopicVector", &fIVTotal); - - fOutT->Branch("OUTINCOME.", "IsotopicVector", &fOutIncome); - fOutT->Branch("WASTE.", "IsotopicVector", &fWaste); - - // Branch the separate object - - for(int i = 0; i < (int)fStorage.size(); i++) - fOutT->Branch(fStorage[i]->GetName(), "Storage", &fStorage[i]); - - for(int i = 0; i < (int)fPool.size(); i++) - - fOutT->Branch(fPool[i]->GetName(), "Pool", &fPool[i]); - - for(int i = 0; i < (int)fReactor.size(); i++) - - fOutT->Branch(fReactor[i]->GetName(), "Reactor", &fReactor[i]); - - for(int i = 0; i < (int)fFabricationPlant.size(); i++) - fOutT->Branch(fFabricationPlant[i]->GetName(), "FabricationPlant", &fFabricationPlant[i]); - - -} - -//________________________________________________________________________ -void Scenario::Write() -{ - - - - -} - -//________________________________________________________________________ -void Scenario::Print() -{ - - for(int i = 0; i < (int) fPool.size();i++) - { - INFO << "!!!!!!!!!STEP : " << fAbsoluteTime/(int)(3600*24*365.25) << endl; - INFO << "Pool : " << endl; - INFO << "Cooling "; - INFO << fPool[i]->GetIVArray().size()<< endl; - } - - for(int i = 0; i < (int)fReactor.size(); i++) - { - INFO << "Reactor" << endl; - fReactor[i]->GetIVReactor().Print(); - } - -} diff --git a/source/branches/CLASSV3/src/SeparationPlant.cxx b/source/branches/CLASSV3/src/SeparationPlant.cxx deleted file mode 100644 index 065f66a41bbbb096e738fa297e3824df51e43eb5..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/SeparationPlant.cxx +++ /dev/null @@ -1,161 +0,0 @@ -#include "SeparationPlant.hxx" - -#include "IsotopicVector.hxx" -#include "Storage.hxx" -#include "Scenario.hxx" -#include "CLASSLogger.hxx" - -#include <sstream> -#include <string> -#include <iostream> -#include <cmath> -#include <algorithm> - -//________________________________________________________________________ -// -// SeparationPlant -// -// -// -// -//________________________________________________________________________ -ClassImp(SeparationPlant) - - -SeparationPlant::SeparationPlant():CLASSBackEnd(-2) -{ - fOutBackEndFacility = 0; - SetName("C_SeparationPlant."); - SetIsStorageType(); -} - -//________________________________________________________________________ -SeparationPlant::SeparationPlant(CLASSLogger* log):CLASSBackEnd(log, -2) -{ - - - fCycleTime = 0; - fIsStarted = false; - fPutToWaste = true; - fCoolingLastIndex = 0; - - fOutBackEndFacility = 0; - SetName("C_SeparationPlant."); - - SetIsStorageType(); - - INFO << " A new SeparationPlant has been define :" << endl; - INFO << "\t The Separation Time set at\t " << (double)(fCycleTime/3600/24/365.25) << " year" << endl; - WARNING << " All Separated Fuel go directly to WASTE after cooling !! " << endl; - - -} - - -//________________________________________________________________________ -SeparationPlant::~SeparationPlant() -{ - - -} - -//________________________________________________________________________ - -//________________________________________________________________________ -void SeparationPlant::SetBackEndDestination(CLASSBackEnd* storagedestination, IsotopicVector isotopicvector, cSecond destinationstartingtime) -{ - DBGL - - fDestinationStorageStartingTime.push_back(destinationstartingtime); - fDestinationStorage.push_back(storagedestination); - fDestinationStorageIV.push_back(isotopicvector); - - if(fDestinationStorage.size()>=2) - { - //checker que pas 2 fois le même ZAI - //Dans VectorIsotopic, BaM a fait des trucs cools - //-> IV->GetThisComposition(IV2) - } - if (fDestinationStorage.size() != fDestinationStorageIV.size()) - ERROR << " fDestinationStorage.size() != fDestinationStorageIV.size() !! " << endl; - - -/* - - - -les pertes non gérées -> WASTE par défaut - - - - -*/ - DBGL - -} - - -void SeparationPlant::AddIV(IsotopicVector IV) -{ -DBGL - for(int fds=0; fds<(int)fDestinationStorage.size(); fds++) - { - cSecond CurrentTime = GetParc()->GetAbsoluteTime(); - - INFO << "Separation..." <<endl; - INFO << "Current Time : " << CurrentTime <<endl; - INFO << "IV Separation Time : " << fDestinationStorageStartingTime[fds] <<endl; - - if(CurrentTime >= fDestinationStorageStartingTime[fds]) - { - IsotopicVector IVtmp; - IVtmp = IV*fDestinationStorageIV[fds]; - fDestinationStorage[fds]->AddIV(IVtmp); - IV -= IVtmp; - } - - } - - GetParc()->AddWaste(IV); - - DBGL -} - - - -map<cSecond,int> SeparationPlant::GetTheBackEndTimePath() -{ - DBGL - - map<cSecond, int> TheBackEndTimePath; - for( int i = 0; i < (int)fDestinationStorage.size(); i++ ) - { - map<cSecond, int> TheBackEndTimePath_tmp = fDestinationStorage[i]->GetTheBackEndTimePath(); - map<cSecond, int>::iterator it; - for (it = TheBackEndTimePath_tmp.begin(); it != TheBackEndTimePath_tmp.end(); it++) - { - pair< map<cSecond, int>::iterator, bool > IResult; - IResult = TheBackEndTimePath.insert( pair<cSecond ,int>((*it).first, (*it).second) ); - if( !IResult.second ) - IResult.first->second |= (*it).second; - - } - } - - DBGL - return TheBackEndTimePath; -} - - - - - -//________________________________________________________________________ -// Time Action with the reste of the Universe : -// Out Storage -// Evolution : -// Cooling -//________________________________________________________________________ - - - diff --git a/source/branches/CLASSV3/src/Storage.cxx b/source/branches/CLASSV3/src/Storage.cxx deleted file mode 100644 index 5bbff10feed82004efa78718a6979ae3fe95983e..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/Storage.cxx +++ /dev/null @@ -1,218 +0,0 @@ -#include "Storage.hxx" - -#include "Scenario.hxx" -#include "CLASSLogger.hxx" - - -#include <sstream> -#include <string> -#include <iostream> -#include <cmath> -#include <algorithm> - -//________________________________________________________________________ -// -// Storage -// -// -// -// -//________________________________________________________________________ -ClassImp(Storage) - - - - -Storage::Storage():CLASSBackEnd(-1) -{ - DBGL - SetIsStorageType(); - SetName("S_Storage."); - - DBGL -} - -Storage::Storage(CLASSLogger* log):CLASSBackEnd(log, -1) -{ - DBGL - SetIsStorageType(); - - SetName("S_Storage."); - - INFO << " A new Storage has been define." << endl; - -} -//________________________________________________________________________ -Storage::Storage(CLASSLogger* log, DecayDataBank* evolutivedb):CLASSBackEnd(log, -1) -{ - DBGL - SetIsStorageType(); - - SetDecayDataBank(evolutivedb); - - SetName("S_Storage."); - - INFO << " A new Storage has been define." << endl; - - - DBGL -} - -//________________________________________________________________________ -Storage::~Storage() -{ - - -} - -//________________________________________________________________________ -void Storage::AddIV(IsotopicVector isotopicvector) -{ - - AddCumulativeIVIn(isotopicvector); - - if(GetParc()) - { - if(GetParc()->GetStockManagement() ) - { - fIVArray.push_back(isotopicvector); - fIVArrayArrivalTime.push_back(fInternalTime); - } - } - else - { - fIVArray.push_back(isotopicvector); - fIVArrayArrivalTime.push_back(fInternalTime); - } - AddToFullStock(isotopicvector); - -} - -//________________________________________________________________________ -void Storage::TakeFractionFromStock(int IVId,double fraction) -{ -DBGL - if(GetParc()) - { - if(GetParc()->GetStockManagement() ) - { - if(fraction > 1 || fraction < 0) - { - WARNING << " You try to remove fraction superior than 1 or a negative one..." << endl; - } - else - { - AddCumulativeIVOut(fIVArray[IVId]*fraction); - fIVArray[IVId] -= fIVArray[IVId] * fraction; - } - - } - else - { - ERROR << " TakeFractionFromStock can't be DEFINE without REAL stock management" << endl; - exit(1); - - } - } - else - { - if(fraction > 1 || fraction < 0) - { - WARNING << " You try to remove fraction superior than 1 or a negative one..." << endl; - } - else - { - AddCumulativeIVOut(fIVArray[IVId]*fraction); - fIVArray[IVId] -= fIVArray[IVId] * fraction; - } - - } - UpdateInsideIV(); - DBGL -} - -void Storage::TakeFromStock(IsotopicVector isotopicvector) -{ - - if(GetParc()) - { - if(!GetParc()->GetStockManagement()) - { - - AddCumulativeIVOut(isotopicvector); - fInsideIV -= isotopicvector; - } - else - { - ERROR << " TakeFromStock can't be DEFINE WITH REAL stock management" << endl; - exit(1); - } - } - else - { - AddCumulativeIVOut(isotopicvector); - fInsideIV -= isotopicvector; - - } - -} - -//________________________________________________________________________ -void Storage::StorageEvolution(cSecond t) -{ -DBGL - - if(t == fInternalTime && t !=0 ) return; - - RemoveEmptyStocks(); - - cSecond EvolutionTime = t - fInternalTime; - - fInsideIV = GetDecay(fInsideIV , EvolutionTime); - -#pragma omp parallel for - for (int i=0; i <(int) fIVArray.size() ; i++) - { - fIVArray[i] = GetDecay(fIVArray[i] , EvolutionTime); - } -DBGL -} - -//________________________________________________________________________ -void Storage::Evolution(cSecond t) -{ - - // Check if the Storage has been created ... - if(t == fInternalTime && t!=0) return; - // Make the evolution for the Storage ... - StorageEvolution(t); - - // Update Inside IV; - UpdateInsideIV(); - - // ... And Finaly update the AbsoluteInternalTime - fInternalTime = t; - -} - -void Storage::Write(string filename, cSecond date) -{ - - for(int i=0;i < (int)fIVArray.size(); i++) - { - - fIVArray[i].Write(filename, date); - } - -} -//________________________________________________________________________ -void Storage::RemoveEmptyStocks() -{ - for(int i = (int)fIVArray.size()-1 ; i >=0; i--) //Removing empty Stock - if(Norme(fIVArray[i]) == 0) - { - fIVArray.erase(fIVArray.begin()+i); - fIVArrayArrivalTime.erase(fIVArrayArrivalTime.begin()+i); - - } -} diff --git a/source/branches/CLASSV3/src/XSModel.cxx b/source/branches/CLASSV3/src/XSModel.cxx deleted file mode 100644 index 6c5f38452c4c92c5d1d66d466bbd94924b98a732..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/XSModel.cxx +++ /dev/null @@ -1,22 +0,0 @@ -// -// XSModel.cxx -// CLASSSource -// -// Created by BaM on 04/05/2014. -// Copyright (c) 2014 BLG. All rights reserved. -// - -#include "XSModel.hxx" - -using namespace std; - -XSModel::XSModel():CLASSObject() -{ - -} - - -XSModel::XSModel(CLASSLogger* log):CLASSObject(log) -{ - -} \ No newline at end of file diff --git a/source/branches/CLASSV3/src/ZAI.cxx b/source/branches/CLASSV3/src/ZAI.cxx deleted file mode 100755 index 220ce8d9b2439aec1fc1a1006df4a6af0d1eca96..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/ZAI.cxx +++ /dev/null @@ -1,63 +0,0 @@ -#include "ZAI.hxx" -#include "stdlib.h" - - -//const string DEFAULTDATABASE = "DecayBase.dat"; -//________________________________________________________________________ -// -// ZAI -// -// -// -// -//________________________________________________________________________ -//____________________________InClass Operator____________________________ -//________________________________________________________________________ -ClassImp(ZAI) - -ZAI ZAI::operator=(ZAI IVa) -{ - fZ = IVa.Z(); - fA = IVa.A(); - fI = IVa.I(); - return *this; -} - - - -ZAI::ZAI() -{ - - fName=""; - fZ=0; - fA=0; - fI=0; - -} - - -//________________________________________________________________________ -ZAI::ZAI(int Z, int A, int I) -{ - - if( Z > A ) - { - cout << "!!!ERROR!!! " << "[" << __FILE__ << ":" << __FUNCTION__ << "]" << endl; - cout << "!!!ERROR!!! Z:" << Z << " is higher than A: " << A << endl; - cout << "!!!ERROR!!! CLASS did not manage yet anti-mater!!! Update comming soon !!!" << endl; - exit(1); - } - - fZ=Z; - fA=A; - fI=I; - -} - - -ZAI::~ZAI() -{ - -} - - diff --git a/source/branches/CLASSV3/src/ZAIMass.cxx b/source/branches/CLASSV3/src/ZAIMass.cxx deleted file mode 100644 index 58e342941582a9f60dea3c2f64c0992070a07b67..0000000000000000000000000000000000000000 --- a/source/branches/CLASSV3/src/ZAIMass.cxx +++ /dev/null @@ -1,82 +0,0 @@ -#include "ZAIMass.hxx" - -#include "CLASSConstante.hxx" - -#include "stdlib.h" -#include <fstream> -#include <string> - -#include "IsotopicVector.hxx" - //________________________________________________________________________ - // - // ZAI - // - // - // - // - //________________________________________________________________________ - //____________________________InClass Operator____________________________ - //________________________________________________________________________ - - -ZAIMass::ZAIMass() -{ - string CLASSPATH = getenv("CLASS_PATH"); - string MassDataFile = CLASSPATH + "/data/Mass.dat"; - - ifstream infile(MassDataFile.c_str()); - - if(!infile.good()) - { - cout << " ZAIMass Error.\n can't find/open file " << MassDataFile << endl; - exit(1); - } - - int Z,A; - string Name; - double MassUnity,MassDec,error; - while (infile>>Z>>A>>Name>>MassUnity>>MassDec>>error) - { - double Masse=MassUnity+MassDec*1e-6; - fZAIMass.insert( pair< ZAI,double >( ZAI(Z,A,0), Masse ) ); - } - - infile.close(); - -} - - -ZAIMass::~ZAIMass() -{ - fZAIMass.clear(); -} - - -double ZAIMass::GetMass(ZAI zai ) const -{ - map<ZAI,double> ZAIMasscpy = fZAIMass ; - map<ZAI,double>::iterator MassIT = ZAIMasscpy.find( ZAI(zai.Z(), zai.A(), 0) ); - - if(MassIT==fZAIMass.end()) - return zai.A(); - else - return MassIT->second; - -} - - -double ZAIMass::GetMass(const IsotopicVector IV) const -{ - - double TotalMass = 0; - - map<ZAI ,double >::iterator it; - map<ZAI ,double > isotopicquantity = IV.GetIsotopicQuantity(); - for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - { - TotalMass += (*it).second/AVOGADRO * GetMass( (*it).first ) ; - } - - return TotalMass*1e-6; - -} \ No newline at end of file