From 5345d311b80c6ceb524333183590628d2cce7d6b Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot <mouginot.baptiste@gmail.com> Date: Fri, 7 Nov 2014 16:05:41 +0000 Subject: [PATCH] remove direct call to ZAIMass map, and change it to GetMass (which are much simpler) Change in Scenario the call to BackEnd Evolution, to First Evolution of all BackEnd, then Dump it... (it should have resolved some potential issue...) git-svn-id: svn+ssh://svn.in2p3.fr/class@425 0e7d625b-0364-4367-a6be-d5be4a48d228 --- .../CLASSV3/Model/Irradiation/IM_Matrix.cxx | 16 +---------- .../CLASSV3/Model/Irradiation/IM_RK4.cxx | 15 +---------- .../CLASSV3/include/IsotopicVector.hxx | 1 + source/branches/CLASSV3/include/Scenario.hxx | 5 +++- source/branches/CLASSV3/include/ZAI.hxx | 1 - source/branches/CLASSV3/include/ZAIMass.hxx | 10 ++++--- source/branches/CLASSV3/src/EvolutionData.cxx | 17 +----------- .../branches/CLASSV3/src/FabricationPlant.cxx | 7 ++--- source/branches/CLASSV3/src/Reactor.cxx | 22 ++++----------- source/branches/CLASSV3/src/Scenario.cxx | 27 ++++++++++++++----- source/branches/CLASSV3/src/ZAI.cxx | 1 - source/branches/CLASSV3/src/ZAIMass.cxx | 2 +- 12 files changed, 42 insertions(+), 82 deletions(-) diff --git a/source/branches/CLASSV3/Model/Irradiation/IM_Matrix.cxx b/source/branches/CLASSV3/Model/Irradiation/IM_Matrix.cxx index 09c128c8e..d6679a1ef 100644 --- a/source/branches/CLASSV3/Model/Irradiation/IM_Matrix.cxx +++ b/source/branches/CLASSV3/Model/Irradiation/IM_Matrix.cxx @@ -98,23 +98,9 @@ EvolutionData IM_Matrix::GenerateEvolutionData(IsotopicVector isotopicvector, Ev ReactorType = XSSet.GetReactorType(); double M_ref = XSSet.GetHeavyMetalMass(); - double M = 0; + double M = cZAIMass.GetMass(isotopicvector.GetActinidesComposition()); 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(); diff --git a/source/branches/CLASSV3/Model/Irradiation/IM_RK4.cxx b/source/branches/CLASSV3/Model/Irradiation/IM_RK4.cxx index 20123efd3..e8c614dd3 100644 --- a/source/branches/CLASSV3/Model/Irradiation/IM_RK4.cxx +++ b/source/branches/CLASSV3/Model/Irradiation/IM_RK4.cxx @@ -117,22 +117,9 @@ EvolutionData IM_RK4::GenerateEvolutionData(IsotopicVector isotopicvector, Evolu ReactorType = XSSet.GetReactorType(); double M_ref = XSSet.GetHeavyMetalMass(); - double M = 0; + double M = cZAIMass.GetMass(isotopicvector.GetActinidesComposition()); 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(); diff --git a/source/branches/CLASSV3/include/IsotopicVector.hxx b/source/branches/CLASSV3/include/IsotopicVector.hxx index c59b9ca5c..f633ad336 100755 --- a/source/branches/CLASSV3/include/IsotopicVector.hxx +++ b/source/branches/CLASSV3/include/IsotopicVector.hxx @@ -137,6 +137,7 @@ public : protected : map<ZAI ,double> fIsotopicQuantity; ///< Isotopic vector composition in Atome Number + map<ZAI ,double> fIsotopicQuantityNeeded; ///< Isotopic vector request and not present ClassDef(IsotopicVector,1); diff --git a/source/branches/CLASSV3/include/Scenario.hxx b/source/branches/CLASSV3/include/Scenario.hxx index 3f889dedc..29d88d5dd 100755 --- a/source/branches/CLASSV3/include/Scenario.hxx +++ b/source/branches/CLASSV3/include/Scenario.hxx @@ -187,7 +187,10 @@ public : /// \li 16 fuel Fabrication void Evolution(cSecond t); ///< Perform the Evolution - void PoolEvolution(); ///< Perform TF Evolution + void BackEndEvolution(); ///< Perform BackEnd Evolution + void PoolEvolution(); ///< Perform Pool Evolution + void PoolDump(); + void ReactorEvolution(); ///< Perform the Reactor Evolution void FabricationPlantEvolution(); ///< Perform the FabricationPlant Evolution void StorageEvolution(); ///< Perform the Storage Evolution diff --git a/source/branches/CLASSV3/include/ZAI.hxx b/source/branches/CLASSV3/include/ZAI.hxx index df0b9b965..3aca697e1 100755 --- a/source/branches/CLASSV3/include/ZAI.hxx +++ b/source/branches/CLASSV3/include/ZAI.hxx @@ -79,7 +79,6 @@ public: 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 diff --git a/source/branches/CLASSV3/include/ZAIMass.hxx b/source/branches/CLASSV3/include/ZAIMass.hxx index cbc204873..6ae5690de 100644 --- a/source/branches/CLASSV3/include/ZAIMass.hxx +++ b/source/branches/CLASSV3/include/ZAIMass.hxx @@ -6,7 +6,7 @@ \brief Header file for ZAIMass classes. - @author BaM + @author BaM & BaL @version 2.0 */ @@ -35,13 +35,15 @@ public: ///< 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 int Z, const int A ) const { return GetMass( ZAI(Z, A, 0) ); } + + double GetMass(const IsotopicVector IV) const; //return Mass of IV in tons - double GetMass(const IsotopicVector IV) const; //return Mass of HM in tons +private: + map<ZAI, double> fZAIMass; //! ZAI mass list }; diff --git a/source/branches/CLASSV3/src/EvolutionData.cxx b/source/branches/CLASSV3/src/EvolutionData.cxx index fae33f540..371b63b30 100755 --- a/source/branches/CLASSV3/src/EvolutionData.cxx +++ b/source/branches/CLASSV3/src/EvolutionData.cxx @@ -654,22 +654,7 @@ void EvolutionData::ReadDB(string DBfile, bool oldread) }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; + fHeavyMetalMass = cZAIMass.GetMass( GetIsotopicVectorAt(0.).GetActinidesComposition() ); DecayDB.close(); diff --git a/source/branches/CLASSV3/src/FabricationPlant.cxx b/source/branches/CLASSV3/src/FabricationPlant.cxx index 8cc636737..5abc02eff 100644 --- a/source/branches/CLASSV3/src/FabricationPlant.cxx +++ b/source/branches/CLASSV3/src/FabricationPlant.cxx @@ -442,11 +442,8 @@ 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; + + double M0 = cZAIMass.GetMass( fuel.GetIsotopicVectorAt(0.).GetActinidesComposition() ); fSubstitutionEvolutionData = fuel / M0; } diff --git a/source/branches/CLASSV3/src/Reactor.cxx b/source/branches/CLASSV3/src/Reactor.cxx index 1c72ad8c3..7196ed611 100755 --- a/source/branches/CLASSV3/src/Reactor.cxx +++ b/source/branches/CLASSV3/src/Reactor.cxx @@ -251,13 +251,9 @@ Reactor::Reactor(CLASSLogger* log, EvolutionData* evolutivedb, 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; + double M0 = cZAIMass.GetMass( evolutivedb->GetIsotopicVectorAt(0.).GetActinidesComposition() ); - fEvolutionDB = *evolutivedb * (fHeavyMetalMass/M0); + fEvolutionDB = (*evolutivedb) * (fHeavyMetalMass/M0); fBurnUp = BurnUp; fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower) * fHeavyMetalMass *3600*24); @@ -306,13 +302,9 @@ Reactor::Reactor(CLASSLogger* log, EvolutionData* evolutivedb, 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; + double M0 = cZAIMass.GetMass( evolutivedb->GetIsotopicVectorAt(0.).GetActinidesComposition() ); - fEvolutionDB = *evolutivedb * (fHeavyMetalMass/M0); + fEvolutionDB = (*evolutivedb) * (fHeavyMetalMass/M0); fBurnUp = BurnUp; @@ -391,11 +383,7 @@ void Reactor::SetBurnUp(double BU) //________________________________________________________________________ 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; + double M0 = cZAIMass.GetMass( evolutionDB.GetIsotopicVectorAt(0.).GetActinidesComposition() ); fEvolutionDB = evolutionDB * (fHeavyMetalMass/M0); fIVOutCycle = fEvolutionDB.GetIsotopicVectorAt( (cSecond)(fCycleTime/fEvolutionDB.GetPower()*fPower) ); diff --git a/source/branches/CLASSV3/src/Scenario.cxx b/source/branches/CLASSV3/src/Scenario.cxx index 0feee545d..487c45ec0 100755 --- a/source/branches/CLASSV3/src/Scenario.cxx +++ b/source/branches/CLASSV3/src/Scenario.cxx @@ -586,6 +586,16 @@ void Scenario::BuildTimeVector(cSecond t) //___________________________ Evolution Method ___________________________ //________________________________________________________________________ +void Scenario::BackEndEvolution() +{ + DBGL + StorageEvolution(); + PoolEvolution(); + + PoolDump(); + DBGL +} + void Scenario::PoolEvolution() { DBGL @@ -593,8 +603,6 @@ void Scenario::PoolEvolution() 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 } @@ -618,6 +626,15 @@ void Scenario::FabricationPlantEvolution() DBGL } + +void Scenario::PoolDump() +{ + DBGL + for(int i = 0; i < (int) fPool.size();i++) + fPool[i]->Dump(); + DBGL +} + //________________________________________________________________________ void Scenario::ReactorEvolution() { @@ -656,12 +673,8 @@ void Scenario::Evolution(cSecond t) 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(); + BackEndEvolution(); if( (*it).second & 1 || (*it).second & 2 || (*it).second & 4 || (*it).second & 16 ) FabricationPlantEvolution(); diff --git a/source/branches/CLASSV3/src/ZAI.cxx b/source/branches/CLASSV3/src/ZAI.cxx index 220ce8d9b..a75992d85 100755 --- a/source/branches/CLASSV3/src/ZAI.cxx +++ b/source/branches/CLASSV3/src/ZAI.cxx @@ -28,7 +28,6 @@ ZAI ZAI::operator=(ZAI IVa) ZAI::ZAI() { - fName=""; fZ=0; fA=0; fI=0; diff --git a/source/branches/CLASSV3/src/ZAIMass.cxx b/source/branches/CLASSV3/src/ZAIMass.cxx index 58e342941..ef2e009e7 100644 --- a/source/branches/CLASSV3/src/ZAIMass.cxx +++ b/source/branches/CLASSV3/src/ZAIMass.cxx @@ -37,7 +37,7 @@ ZAIMass::ZAIMass() double MassUnity,MassDec,error; while (infile>>Z>>A>>Name>>MassUnity>>MassDec>>error) { - double Masse=MassUnity+MassDec*1e-6; + double Masse = MassUnity + MassDec * 1e-6; fZAIMass.insert( pair< ZAI,double >( ZAI(Z,A,0), Masse ) ); } -- GitLab