Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // >> 27 // $Id: G4StatMFMacroTemperature.cc,v 1.5 2006/06/29 20:25:21 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-08-03-patch-01 $ 27 // 29 // 28 // Hadronic Process: Nuclear De-excitations 30 // Hadronic Process: Nuclear De-excitations 29 // by V. Lara 31 // by V. Lara 30 // << 32 31 // Modified: << 32 // 25.07.08 I.Pshenichnov (in collaboration wi << 33 // Mishustin (FIAS, Frankfurt, INR, M << 34 // Moscow, pshenich@fias.uni-frankfur << 35 // original MF model << 36 // 16.04.10 V.Ivanchenko improved logic of sol << 37 // to protect code from rare unwanted << 38 // and destructor to source << 39 // 28.10.10 V.Ivanchenko defined members in co << 40 33 41 #include "G4StatMFMacroTemperature.hh" 34 #include "G4StatMFMacroTemperature.hh" 42 #include "G4PhysicalConstants.hh" << 35 43 #include "G4SystemOfUnits.hh" << 36 // operators definitions 44 #include "G4Pow.hh" << 37 G4StatMFMacroTemperature & 45 << 38 G4StatMFMacroTemperature::operator=(const G4StatMFMacroTemperature & ) 46 G4StatMFMacroTemperature::G4StatMFMacroTempera << 39 { 47 const G4double ExEnergy, const G4double Free << 40 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroTemperature::operator= meant to not be accessable"); 48 std::vector<G4VStatMFMacroCluster*> * Cluste << 41 return *this; 49 theA(anA), << 42 } 50 theZ(aZ), << 43 51 _ExEnergy(ExEnergy), << 44 G4bool G4StatMFMacroTemperature::operator==(const G4StatMFMacroTemperature & ) const 52 _FreeInternalE0(FreeE0), << 45 { 53 _Kappa(kappa), << 46 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroTemperature::operator== meant to not be accessable"); 54 _MeanMultiplicity(0.0), << 47 return false; 55 _MeanTemperature(0.0), << 48 } 56 _ChemPotentialMu(0.0), << 49 57 _ChemPotentialNu(0.0), << 50 58 _MeanEntropy(0.0), << 51 G4bool G4StatMFMacroTemperature::operator!=(const G4StatMFMacroTemperature & ) const 59 _theClusters(ClusterVector) << 52 { 60 {} << 53 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroTemperature::operator!= meant to not be accessable"); 61 << 54 return true; 62 G4StatMFMacroTemperature::~G4StatMFMacroTemper << 55 } 63 {} << 56 >> 57 >> 58 64 59 65 G4double G4StatMFMacroTemperature::CalcTempera 60 G4double G4StatMFMacroTemperature::CalcTemperature(void) >> 61 // Calculate Chemical potential \nu 66 { 62 { 67 // Inital guess for the interval of the ense << 63 // Temperature 68 G4double Ta = 0.5; << 64 G4double Ta = 0.00012; 69 G4double Tb = std::max(std::sqrt(_ExEnergy/( << 65 G4double Tb = std::max(std::sqrt(_ExEnergy/(theA*0.12)),0.01*MeV); 70 66 71 G4double fTa = this->operator()(Ta); << 67 G4double fTa = this->operator()(Ta); 72 G4double fTb = this->operator()(Tb); << 68 G4double fTb = this->operator()(Tb); 73 << 74 // Bracketing the solution << 75 // T should be greater than 0. << 76 // The interval is [Ta,Tb] << 77 // We start with a value for Ta = 0.5 MeV << 78 // it should be enough to have fTa > 0 If it << 79 // the case, we decrease Ta. But carefully, << 80 // fTa growes very fast when Ta is near 0 an << 81 // an overflow. << 82 << 83 G4int iterations = 0; << 84 // Loop checking, 05-Aug-2015, Vladimir Ivan << 85 while (fTa < 0.0 && ++iterations < 10) { << 86 Ta -= 0.5*Ta; << 87 fTa = this->operator()(Ta); << 88 } << 89 // Usually, fTb will be less than 0, but if << 90 iterations = 0; << 91 // Loop checking, 05-Aug-2015, Vladimir Ivan << 92 while (fTa*fTb > 0.0 && iterations++ < 10) { << 93 Tb += 2.*std::fabs(Tb-Ta); << 94 fTb = this->operator()(Tb); << 95 } << 96 << 97 if (fTa*fTb > 0.0) { << 98 G4cerr <<"G4StatMFMacroTemperature:"<<" Ta << 99 G4cerr <<"G4StatMFMacroTemperature:"<<" fT << 100 throw G4HadronicException(__FILE__, __LINE << 101 } << 102 << 103 G4Solver<G4StatMFMacroTemperature> * theSolv << 104 new G4Solver<G4StatMFMacroTemperature>(100 << 105 theSolver->SetIntervalLimits(Ta,Tb); << 106 if (!theSolver->Crenshaw(*this)){ << 107 G4cout <<"G4StatMFMacroTemperature, Crensh << 108 <<Ta<<" Tb="<<Tb<< G4endl; << 109 G4cout <<"G4StatMFMacroTemperature, Crensh << 110 <<fTa<<" fTb="<<fTb<< G4endl; << 111 } << 112 _MeanTemperature = theSolver->GetRoot(); << 113 G4double FunctionValureAtRoot = this->opera << 114 delete theSolver; << 115 << 116 // Verify if the root is found and it is ind << 117 // say, between 1 and 50 MeV, otherwise try << 118 if (std::fabs(FunctionValureAtRoot) > 5.e-2) << 119 if (_MeanTemperature < 1. || _MeanTemperat << 120 G4cout << "Crenshaw method failed; funct << 121 << " solution? = " << _MeanTemperature << 122 G4Solver<G4StatMFMacroTemperature> * the << 123 new G4Solver<G4StatMFMacroTemperature>(200,1 << 124 theSolverBrent->SetIntervalLimits(Ta,Tb) << 125 if (!theSolverBrent->Brent(*this)){ << 126 G4cout <<"G4StatMFMacroTemperature, Brent me << 127 <<" Ta="<<Ta<<" Tb="<<Tb<< G4endl; << 128 G4cout <<"G4StatMFMacroTemperature, Brent me << 129 <<" fTa="<<fTa<<" fTb="<<fTb<< G4endl << 130 throw G4HadronicException(__FILE__, __LINE__ << 131 } << 132 69 133 _MeanTemperature = theSolverBrent->GetRo << 70 // Bracketing the solution 134 FunctionValureAtRoot = this->operator() << 71 // T should be greater than 0. 135 delete theSolverBrent; << 72 // The interval is [Ta,Tb] >> 73 // We start with a low value for Ta = 0.0012 K >> 74 // it should be enough to have fTa > 0 If it isn't >> 75 // the case, we decrease Ta. But carefully, because >> 76 // fTa growes very fast when Ta is near 0 and we could have >> 77 // an overflow. >> 78 >> 79 G4int iterations = 0; >> 80 while (fTa < 0.0 && iterations++ < 10) { >> 81 Ta -= 0.5*Ta; >> 82 fTa = this->operator()(Ta); 136 } 83 } 137 if (std::abs(FunctionValureAtRoot) > 5.e-2 << 84 // Usually, fTb will be less than 0, but if it is not the case: 138 G4cout << "Brent method failed; function << 85 iterations = 0; 139 << " solution? = " << _MeanTemperature << 86 while (fTa*fTb > 0.0 && iterations++ < 10) { 140 throw G4HadronicException(__FILE__, __LI << 87 Tb += 1.5*std::abs(Tb-Ta); >> 88 fTb = this->operator()(Tb); 141 } 89 } 142 } << 90 143 //G4cout << "G4StatMFMacroTemperature::CalcT << 91 if (fTa*fTb > 0.0) { 144 //<< FunctionValureAtRoot << 92 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroTemperature::CalcTemperature: I couldn't bracket the solution."); 145 // << " T(MeV)= " << _MeanTemperature << << 93 } 146 return _MeanTemperature; << 94 >> 95 G4Solver<G4StatMFMacroTemperature> * theSolver = new G4Solver<G4StatMFMacroTemperature>(100,1.e-4); >> 96 theSolver->SetIntervalLimits(Ta,Tb); >> 97 // if (!theSolver->Crenshaw(*this)) >> 98 if (!theSolver->Brent(*this)) >> 99 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroTemperature::CalcTemperature: I couldn't find the root."); >> 100 _MeanTemperature = theSolver->GetRoot(); >> 101 delete theSolver; >> 102 return _MeanTemperature; 147 } 103 } 148 104 >> 105 >> 106 149 G4double G4StatMFMacroTemperature::FragsExcitE 107 G4double G4StatMFMacroTemperature::FragsExcitEnergy(const G4double T) 150 // Calculates excitation energy per nucleon an << 108 // Calculates excitation energy per nucleon and summed fragment multiplicity and entropy 151 // multiplicity and entropy << 152 { 109 { 153 // Model Parameters << 110 154 G4Pow* g4calc = G4Pow::GetInstance(); << 111 // Model Parameters 155 G4double R0 = G4StatMFParameters::Getr0()*g4 << 112 G4double R0 = G4StatMFParameters::Getr0()*std::pow(theA,1./3.); 156 G4double R = R0*g4calc->A13(1.0+G4StatMFPara << 113 G4double R = R0*std::pow(1.0+G4StatMFParameters::GetKappaCoulomb(), 1./3.); 157 G4double FreeVol = _Kappa*(4.*pi/3.)*R0*R0*R << 114 G4double FreeVol = _Kappa*(4.*pi/3.)*R0*R0*R0; >> 115 158 116 159 // Calculate Chemical potentials << 117 // Calculate Chemical potentials 160 CalcChemicalPotentialNu(T); << 118 CalcChemicalPotentialNu(T); 161 119 162 120 163 // Average total fragment energy << 121 // Average total fragment energy 164 G4double AverageEnergy = 0.0; << 122 G4double AverageEnergy = 0.0; 165 std::vector<G4VStatMFMacroCluster*>::iterato << 123 std::vector<G4VStatMFMacroCluster*>::iterator i; 166 for (i = _theClusters->begin(); i != _theCl << 124 for (i = _theClusters->begin(); i != _theClusters->end(); ++i) 167 { << 125 { 168 AverageEnergy += (*i)->GetMeanMultiplici << 126 AverageEnergy += (*i)->GetMeanMultiplicity() * (*i)->CalcEnergy(T); 169 } << 127 } 170 128 171 // Add Coulomb energy << 129 // Add Coulomb energy 172 AverageEnergy += 0.6*elm_coupling*theZ*theZ/ << 130 AverageEnergy += (3./5.)*elm_coupling*theZ*theZ/R; 173 131 174 // Calculate mean entropy << 132 // Calculate mean entropy 175 _MeanEntropy = 0.0; << 133 _MeanEntropy = 0.0; 176 for (i = _theClusters->begin(); i != _theClu << 134 for (i = _theClusters->begin(); i != _theClusters->end(); ++i) 177 { << 135 { 178 _MeanEntropy += (*i)->CalcEntropy(T,Free << 136 _MeanEntropy += (*i)->CalcEntropy(T,FreeVol); 179 } << 137 } >> 138 >> 139 // Excitation energy per nucleon >> 140 G4double FragsExcitEnergy = AverageEnergy - _FreeInternalE0; >> 141 >> 142 return FragsExcitEnergy; 180 143 181 // Excitation energy per nucleon << 182 return AverageEnergy - _FreeInternalE0; << 183 } 144 } 184 145 >> 146 185 void G4StatMFMacroTemperature::CalcChemicalPot 147 void G4StatMFMacroTemperature::CalcChemicalPotentialNu(const G4double T) 186 // Calculates the chemical potential \nu << 148 // Calculates the chemical potential \nu >> 149 187 { 150 { 188 G4StatMFMacroChemicalPotential * theChemPot << 151 G4StatMFMacroChemicalPotential * theChemPot = new 189 G4StatMFMacroChemicalPotential(theA,theZ,_ << 152 G4StatMFMacroChemicalPotential(theA,theZ,_Kappa,T,_theClusters); >> 153 190 154 191 _ChemPotentialNu = theChemPot->CalcChemicalP << 155 _ChemPotentialNu = theChemPot->CalcChemicalPotentialNu(); 192 _ChemPotentialMu = theChemPot->GetChemicalPo << 156 _ChemPotentialMu = theChemPot->GetChemicalPotentialMu(); 193 _MeanMultiplicity = theChemPot->GetMeanMulti << 157 _MeanMultiplicity = theChemPot->GetMeanMultiplicity(); 194 delete theChemPot; << 158 >> 159 delete theChemPot; 195 160 196 return; << 161 return; >> 162 197 } 163 } 198 164 199 165 200 166