From 14dcba0dbaa82c2478b31cb34848f268fbedf61e Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot <mouginot.baptiste@gmail.com> Date: Mon, 30 Jun 2014 13:41:55 +0000 Subject: [PATCH] =?UTF-8?q?First=20FP=20modification=E2=80=A6.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding Pointer in PhysicsModel Eq model : Adding Fertile and Fissile List IV : Add GetThisComposition(IV) return an isotopic vector according the list given in arg… git-svn-id: svn+ssh://svn.in2p3.fr/class@281 0e7d625b-0364-4367-a6be-d5be4a48d228 --- .../CLASSV3/include/EQM_MLP_PWR_MOX.hxx | 2 +- .../CLASSV3/include/EquivalenceModel.hxx | 12 +- .../CLASSV3/include/FabricationPlant.hxx | 11 +- .../CLASSV3/include/IsotopicVector.hxx | 3 + .../branches/CLASSV3/include/PhysicModels.hxx | 14 +- .../branches/CLASSV3/src/FabricationPlant.cxx | 80 ++-- .../branches/CLASSV3/src/IsotopicVector.cxx | 355 ++++++++++-------- source/branches/CLASSV3/src/Makefile | 6 +- source/branches/CLASSV3/src/PhysicModels.cxx | 6 +- 9 files changed, 271 insertions(+), 218 deletions(-) diff --git a/source/branches/CLASSV3/include/EQM_MLP_PWR_MOX.hxx b/source/branches/CLASSV3/include/EQM_MLP_PWR_MOX.hxx index a8b65e003..cc7cfeb05 100644 --- a/source/branches/CLASSV3/include/EQM_MLP_PWR_MOX.hxx +++ b/source/branches/CLASSV3/include/EQM_MLP_PWR_MOX.hxx @@ -45,7 +45,7 @@ class EQM_MLP_MOX : public EquivalenceModel \param vector<IsotopicVector> FertilArray, isotopicvectors to use to get the fertil part of the fuel (if empty take it from the god) */ - vector<double> BuildFuel(double BurnUp, double HMMass,vector<IsotopicVector> FissilArray, vector<IsotopicVector> FertilArray = 0); + vector<double> BuildFuel(double BurnUp, double HMMass,vector<IsotopicVector> FissilArray, vector<IsotopicVector> FertilArray = vector<IsotopicVector>()); //} private : diff --git a/source/branches/CLASSV3/include/EquivalenceModel.hxx b/source/branches/CLASSV3/include/EquivalenceModel.hxx index 133b06e96..74044a80b 100644 --- a/source/branches/CLASSV3/include/EquivalenceModel.hxx +++ b/source/branches/CLASSV3/include/EquivalenceModel.hxx @@ -48,13 +48,19 @@ class EquivalenceModel : public TObject //} - + + IsotopicVector GetFertileList() {return fFertileList;} + IsotopicVector GetFissileList() {return fFissileList;} + + void SetFertileList(IsotopicVector IV) {fFertileList = IV;} + void SetFissileList(IsotopicVector IV) {fFissileList = IV;} + protected : - IsotopicVector fFertileListe; - IsotopicVector fFissileListe; + IsotopicVector fFertileList; + IsotopicVector fFissileList; }; diff --git a/source/branches/CLASSV3/include/FabricationPlant.hxx b/source/branches/CLASSV3/include/FabricationPlant.hxx index c98a04102..54c2cede5 100644 --- a/source/branches/CLASSV3/include/FabricationPlant.hxx +++ b/source/branches/CLASSV3/include/FabricationPlant.hxx @@ -132,7 +132,7 @@ public : */ //@{ - void AddValorisableIV(ZAI zai, double factor); ///< Add Valorisable Element + void SetSeparartionEfficiencyIV(ZAI zai, double factor); ///< Add Valorisable Element void Evolution(cSecond t); //!< Perform the Evolution virtual void BuildFuelForReactor(int ReactorId); //!< Build a Fuel for the reactor ReactorId void RecycleStock(double fraction); //!< Take a franction of the current stock @@ -141,7 +141,10 @@ public : EvolutionData BuildEvolutiveDB(int ReactorId, IsotopicVector isotopicvector); //!< Build the Evolution Database for the Reactir ReactorId Fuel void TakeReactorFuel(int ReactorId) ; //!< Remove the Fuel of reactor ReactorId - + + + void BuildFissileArray(IsotopicVector FissileList); + //@} @@ -151,7 +154,7 @@ protected : bool fUpdateReferenceDBatEachStep; ///< Set to true if the Reference Evolution Product must be updated at each calculation step (in the DataBank calculation) //********* Internal Parameter *********// - map<ZAI ,double> fValorisableIV; ///< The Valorisable Table + IsotopicVector fSeparationLostFraction; ///< The speration efficiency Table map<int, cSecond > fReactorNextStep; ///< Next Time Step to Build a New Fuel map< int,EvolutionData > fReactorFuturDB; ///< List of the Futur EvolutionData use in the reactor @@ -183,7 +186,7 @@ protected : \li IV[0] -> To Keep \li IV[1] -> To Waste */ - pair<IsotopicVector, IsotopicVector> Separation(IsotopicVector isotopicvector); + pair<IsotopicVector, IsotopicVector> Separation(IsotopicVector isotopicvector, IsotopicVector ExtractedList); //} diff --git a/source/branches/CLASSV3/include/IsotopicVector.hxx b/source/branches/CLASSV3/include/IsotopicVector.hxx index f30f5aa9c..738d2580d 100755 --- a/source/branches/CLASSV3/include/IsotopicVector.hxx +++ b/source/branches/CLASSV3/include/IsotopicVector.hxx @@ -59,6 +59,7 @@ public : 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 @@ -105,6 +106,7 @@ public : IsotopicVector& operator+=(IsotopicVector const& IVb); //!<.... IsotopicVector& operator-=(IsotopicVector const& IVb); //!<.... + IsotopicVector& operator*=(IsotopicVector const& IVb); //!<.... bool operator <(const IsotopicVector& isotopicvector) const; //!< IsotopicVector Comparator //@} @@ -143,6 +145,7 @@ 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); diff --git a/source/branches/CLASSV3/include/PhysicModels.hxx b/source/branches/CLASSV3/include/PhysicModels.hxx index d2c7f99f1..cc6fe9c18 100644 --- a/source/branches/CLASSV3/include/PhysicModels.hxx +++ b/source/branches/CLASSV3/include/PhysicModels.hxx @@ -51,16 +51,16 @@ class PhysicModels : public CLASSObject */ //@{ - PhysicModels(XSModel XS,EquivalenceModel EM,IrradiationModel IM ); + PhysicModels(XSModel* XS,EquivalenceModel* EM,IrradiationModel* IM ); ~PhysicModels() {;} //{ EvolutionData GenerateEvolutionData(IsotopicVector IV, double cycletime, double Power); - XSModel GetXSModel() {return fXSModel;} - EquivalenceModel GetEquivalenceModel() {return fEquivalenceModel;} - IrradiationModel GetIrradiationModel() {return fIrradiationModel;} + XSModel* GetXSModel() {return fXSModel;} + EquivalenceModel* GetEquivalenceModel() {return fEquivalenceModel;} + IrradiationModel* GetIrradiationModel() {return fIrradiationModel;} @@ -69,9 +69,9 @@ class PhysicModels : public CLASSObject private : - XSModel fXSModel; - EquivalenceModel fEquivalenceModel; - IrradiationModel fIrradiationModel; + XSModel* fXSModel; + EquivalenceModel* fEquivalenceModel; + IrradiationModel* fIrradiationModel; diff --git a/source/branches/CLASSV3/src/FabricationPlant.cxx b/source/branches/CLASSV3/src/FabricationPlant.cxx index 3380bdbf8..c270b9a94 100644 --- a/source/branches/CLASSV3/src/FabricationPlant.cxx +++ b/source/branches/CLASSV3/src/FabricationPlant.cxx @@ -87,17 +87,17 @@ FabricationPlant::~FabricationPlant() //________________________________________________________________________ -void FabricationPlant::AddValorisableIV(ZAI zai, double factor) +void FabricationPlant::SetSeparartionEfficiencyIV(ZAI zai, double factor) { - + pair<map<ZAI, double>::iterator, bool> IResult; if(factor > 1) factor = 1; if(factor > 0) { - IResult = fValorisableIV.insert( pair<ZAI ,double>(zai, factor)); + IResult = fSeparationLostFraction.GetIsotopicQuantity().insert( pair<ZAI ,double>(zai, 1 - factor)); if(!IResult.second) - IResult.first->second = factor; + IResult.first->second = 1 - factor; } } @@ -156,7 +156,6 @@ void FabricationPlant::FabricationPlantEvolution(cSecond t) //________________________________________________________________________ - void FabricationPlant::BuildFuelForReactor(int ReactorId) { @@ -171,8 +170,30 @@ void FabricationPlant::BuildFuelForReactor(int ReactorId) // PhysicModels* FuelType = GetParc()->GetReactor()[ReactorId]->GetFuelType(); + + PhysicModels* FuelType; + + IsotopicVector FissileList = FuelType->GetEquivalenceModel()->GetFissileList(); + + BuildFissileArray(FissileList); +} + + + +void FabricationPlant::BuildFissileArray(IsotopicVector FissileList) +{ + + + + + } + + + + + //________________________________________________________________________ void FabricationPlant::SetSubstitutionFuel(EvolutionData fuel) { @@ -288,26 +309,7 @@ void FabricationPlant::RecycleStock(double fraction) void FabricationPlant::DumpStock() { - for(int i = (int)fFractionToTake.size()-1; i >= 0; i--) - { - pair<IsotopicVector, IsotopicVector> SeparatedIV; - IsotopicVector IV_in_Stock_i = fStorage->GetIVArray()[fFractionToTake[i].first]; - double Fraction_Taken_from_Stock_i = fFractionToTake[i].second ; - - SeparatedIV = Separation( Fraction_Taken_from_Stock_i * ( IV_in_Stock_i - IV_in_Stock_i.GetSpeciesComposition(94) ) ); - - fReUsable->AddIV(SeparatedIV.first); - GetParc()->AddWaste(SeparatedIV.second); - - - - - fStorage->TakeFractionFromStock(fFractionToTake[i].first,fFractionToTake[i].second); - - - } - fFractionToTake.clear(); @@ -315,31 +317,17 @@ void FabricationPlant::DumpStock() } //________________________________________________________________________ -pair<IsotopicVector, IsotopicVector> FabricationPlant::Separation(IsotopicVector isotopicvector) +//pair<IsotopicVector, IsotopicVector> FabricationPlant::Separation(IsotopicVector IVStock, IsotopicVector IVToExtract) +pair<IsotopicVector, IsotopicVector> FabricationPlant::Separation(IsotopicVector isotopicvector, IsotopicVector ExtractedList) { //[0] = re-use ; [1] = waste - pair<IsotopicVector, IsotopicVector> IVTmp; - - map<ZAI ,double> isotopicquantity = isotopicvector.GetIsotopicQuantity(); - map<ZAI ,double >::iterator it; - for(it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - { - map<ZAI ,double>::iterator it2; - it2 = fValorisableIV.find((*it).first); - if ( it2 != fValorisableIV.end() ) - { - IVTmp.first.Add( (*it).first, (*it).second * (*it2).second ); //re-use - IVTmp.second.Add( (*it).first, (*it).second * (1-(*it2).second) ); //waste - } - else - { - IVTmp.first.Add( (*it).first, (*it).second ); //re-use -// IVTmp.second.Add( (*it).first, (*it).second * (1-(*it2).second) ); //waste -> Empty - } - } - - return IVTmp; + IsotopicVector LostPart = isotopicvector.GetThisComposition(ExtractedList) * fSeparationLostFraction; + IsotopicVector SeparatedPart = isotopicvector.GetThisComposition(ExtractedList) - LostPart; + LostPart = isotopicvector - SeparatedPart; + + + return pair<IsotopicVector, IsotopicVector> (SeparatedPart, LostPart); } diff --git a/source/branches/CLASSV3/src/IsotopicVector.cxx b/source/branches/CLASSV3/src/IsotopicVector.cxx index 8441ad37d..c9b27e0a2 100755 --- a/source/branches/CLASSV3/src/IsotopicVector.cxx +++ b/source/branches/CLASSV3/src/IsotopicVector.cxx @@ -9,42 +9,42 @@ #include <string> #include <algorithm> #include "CLASSHeaders.hxx" - //________________________________________________________________________ - //________________________________________________________________________ - // - // - // - // IsotopicVector - // - // - //________________________________________________________________________ - //________________________________________________________________________ +//________________________________________________________________________ +//________________________________________________________________________ +// +// +// +// IsotopicVector +// +// +//________________________________________________________________________ +//________________________________________________________________________ - //________________________________________________________________________ - //__________________________Operator Overlaoding__________________________ - //________________________________________________________________________ +//________________________________________________________________________ +//__________________________Operator Overlaoding__________________________ +//________________________________________________________________________ - //____________________________General Operator____________________________ - //________________________________________________________________________ +//____________________________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(); @@ -56,11 +56,11 @@ double DistanceStandard(IsotopicVector IV1, IsotopicVector IV2) 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(); @@ -73,14 +73,14 @@ double DistanceAdjusted(IsotopicVector IV1, IsotopicVector IV2, IsotopicVector D d2 += lambda*abs(Z1-Z2); } return d2; - + } double Distance(IsotopicVector IV1, IsotopicVector IV2 ,int DistanceType, IsotopicVector DistanceParameter) { - + if(DistanceType==0) { return DistanceStandard(IV1,IV2); @@ -92,21 +92,21 @@ double Distance(IsotopicVector IV1, IsotopicVector IV2 ,int DistanceType, Isotop { cout << "!!ERROR!! !!!Distance!!!" << " 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; @@ -121,103 +121,139 @@ double RelativDistance(IsotopicVector IV1, IsotopicVector IV2 ) 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*(double F, ZAI const& zai) +{ + return zai*F; +} + +//________________________________________________________________________ +IsotopicVector operator*(IsotopicVector const& IVa, IsotopicVector const& IVb) +{ + + IsotopicVector IVtmp; + IVtmp = IVa; + return IVtmp *= IVb; +} - //________________________________________________________________________ +//________________________________________________________________________ IsotopicVector operator/(IsotopicVector const& IVA, double F) { - + IsotopicVector IV = IVA; IV.Multiply(1./F); return IV; } - //____________________________InClass Operator____________________________ +//____________________________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; + + } + + return *this; +} + +//________________________________________________________________________ bool IsotopicVector::operator<(const IsotopicVector& isotopicvector) const { - + if( Norme(*this) != Norme(isotopicvector) ) - return Norme(*this) < Norme(isotopicvector); + return Norme(*this) < Norme(isotopicvector); else if( (*this).GetIsotopicQuantity().size() != isotopicvector.GetIsotopicQuantity().size() ) - return (*this).GetIsotopicQuantity().size() < isotopicvector.GetIsotopicQuantity().size(); + return (*this).GetIsotopicQuantity().size() < isotopicvector.GetIsotopicQuantity().size(); else { map<ZAI ,double>::iterator it; @@ -226,26 +262,26 @@ bool IsotopicVector::operator<(const IsotopicVector& isotopicvector) const for( it = IsotopicQuantity.begin(); it != IsotopicQuantity.end(); it++ ) { if( (*it).first != (*it2).first ) - return (*it).first < (*it2).first; + return (*it).first < (*it2).first; else it2++; } return false; } - + } - //________________________________________________________________________ - //________________________Constructor & Destructor________________________ - //________________________________________________________________________ +//________________________________________________________________________ +//________________________Constructor & Destructor________________________ +//________________________________________________________________________ IsotopicVector::IsotopicVector() { - - + + } - //________________________________________________________________________ +//_____________________________________________________GetSpeciesComposition___________________ IsotopicVector::~IsotopicVector() { fIsotopicQuantity.clear(); @@ -254,31 +290,31 @@ IsotopicVector::~IsotopicVector() - //________________________________________________________________________ - //_____________________________General Method_____________________________ - //________________________________________________________________________ +//________________________________________________________________________ +//_____________________________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; + (*it).second = (*it).second * factor; for( it = fIsotopicQuantityNeeded.begin(); it != fIsotopicQuantityNeeded.end(); it++) (*it).second = (*it).second * factor; @@ -293,70 +329,70 @@ double IsotopicVector::GetSumOfAll() const map<ZAI ,double >::iterator it; map<ZAI ,double > isotopicquantity = GetIsotopicQuantity(); for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - Sum += (*it).second; + Sum += (*it).second; return Sum; } - //________________________________________________________________________ +//________________________________________________________________________ void IsotopicVector::Add(const ZAI& zai, double quantity) { - + if( ceil(quantity*1e25) - quantity*1e25 > quantity*1e25 - floor(quantity*1e25) ) - quantity = floor(quantity*1e25)*1/1e25; + quantity = floor(quantity*1e25)*1/1e25; else quantity = ceil(quantity*1e25)*1/1e25; - - + + 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; + 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); - - + 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); - - + 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; + it->second = it->second - quantity; else { Need(zai, quantity - it->second ); @@ -368,22 +404,22 @@ void IsotopicVector::Remove(const ZAI& zai, double quantity) 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); - + Remove( (*it).first, (*it).second); + } - //________________________________________________________________________ +//________________________________________________________________________ void IsotopicVector::Need(const ZAI& zai, double quantity) { pair<map<ZAI, double>::iterator, bool> IResult; @@ -391,34 +427,34 @@ void IsotopicVector::Need(const ZAI& zai, double quantity) { IResult = fIsotopicQuantityNeeded.insert( pair<ZAI ,double>(zai, quantity)); if(!IResult.second) - IResult.first->second += quantity; + 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); - + 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; @@ -429,26 +465,43 @@ double IsotopicVector::GetZAIIsotopicQuantity(const ZAI& zai) const } } - //________________________________________________________________________ +//________________________________________________________________________ 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 >::iterator it; + for( it = IsotopicQuantity.begin(); it != IsotopicQuantity.end(); it++) + { + map<ZAI ,double >::iterator it2 = GetIsotopicQuantity().find((*it).first); + if(it2 != GetIsotopicQuantity().end()) + IVtmp += (*it2).first * (*it2).second ; + + } + + return IVtmp; } //________________________________________________________________________ @@ -463,8 +516,8 @@ double IsotopicVector::GetTotalMass() const ZAI zai = ((*it).first); double MolarMass = zai.GetMass(); TotalMass += (*it).second/AVOGADRO * MolarMass ; - } - + } + return TotalMass*1e-6;//in tons @@ -480,15 +533,15 @@ double IsotopicVector::MeanMolar() const double NTot=0; for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) - NTot+= (*it).second ; + NTot+= (*it).second ; for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++) { ZAI zai = ((*it).first); double MolarMass = zai.GetMass(); MeanMolar += (*it).second/NTot * MolarMass ; - } - + } + return MeanMolar; @@ -497,53 +550,53 @@ double IsotopicVector::MeanMolar() const 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 ); - + zailist.push_back( (*it).first ); + return zailist; - + } IsotopicVector IsotopicVector::GetActinidesComposition() const { - + IsotopicVector IV; for (int i = 0; i <12; i++) - IV += GetSpeciesComposition(89+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()); - - + 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; - + cout << "!!Warning!! !!!IsotopicVector!!! \n Can't open \"" << filename << "\"\n" << endl; + if(time != -1) - IVfile << "Time "<< time/365.25/3600./24. << endl; - + 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++) @@ -555,19 +608,19 @@ void IsotopicVector::Write(string filename, cSecond time) const } 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; @@ -598,7 +651,7 @@ void IsotopicVector::Print(string option) const { cout << "****Isotopic Vector DB****" << endl; } - + } diff --git a/source/branches/CLASSV3/src/Makefile b/source/branches/CLASSV3/src/Makefile index 507a0dd70..eb84ed95f 100755 --- a/source/branches/CLASSV3/src/Makefile +++ b/source/branches/CLASSV3/src/Makefile @@ -14,6 +14,9 @@ ROOTGLIBS = `root-config --glibs` INCLUDES = $(LOCALINC)/*.hxx LIBNAME = CLASSpkg OBJS = CLASS.o \ + IsotopicVector.o IsotopicVectorDict.o \ + ZAIMass.o \ + ZAI.o ZAIDict.o \ CLASSObject.o CLASSObjectDict.o\ CLASSFacility.o CLASSFacilityDict.o\ CLASSBackEnd.o CLASSBackEndDict.o\ @@ -23,9 +26,6 @@ OBJS = CLASS.o \ PWR_THPU_FabricationPlant.o \ Pool.o PoolDict.o\ Reactor.o ReactorDict.o \ - IsotopicVector.o IsotopicVectorDict.o \ - ZAIMass.o \ - ZAI.o ZAIDict.o \ FuelDataBank.o DecayDataBank.o \ DynamicalSystem.o\ EvolutionData.o EvolutionDataDict.o \ diff --git a/source/branches/CLASSV3/src/PhysicModels.cxx b/source/branches/CLASSV3/src/PhysicModels.cxx index 821d1b534..47a25e1fe 100644 --- a/source/branches/CLASSV3/src/PhysicModels.cxx +++ b/source/branches/CLASSV3/src/PhysicModels.cxx @@ -8,10 +8,10 @@ // // //________________________________________________________________________ -PhysicModels::PhysicModels(XSModel XS,EquivalenceModel EM,IrradiationModel IM ) +PhysicModels::PhysicModels(XSModel* XS,EquivalenceModel* EM,IrradiationModel* IM ) { - fXSModel = XS; + fXSModel = XS; fEquivalenceModel = EM; fIrradiationModel = IM; @@ -22,7 +22,7 @@ EvolutionData PhysicModels::GenerateEvolutionData(IsotopicVector IV, double cycl { - return fIrradiationModel.GenerateEvolutionData(IV, fXSModel.GetCrossSections(IV),Power,cycletime); + return fIrradiationModel->GenerateEvolutionData(IV, fXSModel->GetCrossSections(IV), Power, cycletime); } -- GitLab