G4StatMFMacroTemperature.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // Hadronic Process: Nuclear De-excitations
00030 // by V. Lara
00031 //
00032 // Modified:
00033 // 25.07.08 I.Pshenichnov (in collaboration with Alexander Botvina and Igor 
00034 //          Mishustin (FIAS, Frankfurt, INR, Moscow and Kurchatov Institute, 
00035 //          Moscow, pshenich@fias.uni-frankfurt.de) make algorithm closer to
00036 //          original MF model
00037 // 16.04.10 V.Ivanchenko improved logic of solving equation for tempetature
00038 //          to protect code from rare unwanted exception; moved constructor 
00039 //          and destructor to source  
00040 // 28.10.10 V.Ivanchenko defined members in constructor and cleaned up
00041 
00042 #include "G4StatMFMacroTemperature.hh"
00043 #include "G4PhysicalConstants.hh"
00044 #include "G4SystemOfUnits.hh"
00045 
00046 G4StatMFMacroTemperature::G4StatMFMacroTemperature(const G4double anA, const G4double aZ, 
00047   const G4double ExEnergy, const G4double FreeE0, const G4double kappa, 
00048   std::vector<G4VStatMFMacroCluster*> * ClusterVector) :
00049   theA(anA),
00050   theZ(aZ),
00051   _ExEnergy(ExEnergy),
00052   _FreeInternalE0(FreeE0),
00053   _Kappa(kappa),
00054   _MeanMultiplicity(0.0),
00055   _MeanTemperature(0.0),
00056   _ChemPotentialMu(0.0),
00057   _ChemPotentialNu(0.0),
00058   _MeanEntropy(0.0),
00059   _theClusters(ClusterVector) 
00060 {}
00061         
00062 G4StatMFMacroTemperature::~G4StatMFMacroTemperature() 
00063 {}
00064 
00065 
00066 G4double G4StatMFMacroTemperature::CalcTemperature(void) 
00067 {
00068     // Inital guess for the interval of the ensemble temperature values
00069     G4double Ta = 0.5; 
00070     G4double Tb = std::max(std::sqrt(_ExEnergy/(theA*0.12)),0.01*MeV);
00071     
00072     G4double fTa = this->operator()(Ta); 
00073     G4double fTb = this->operator()(Tb); 
00074 
00075     // Bracketing the solution
00076     // T should be greater than 0.
00077     // The interval is [Ta,Tb]
00078     // We start with a value for Ta = 0.5 MeV
00079     // it should be enough to have fTa > 0 If it isn't 
00080     // the case, we decrease Ta. But carefully, because 
00081     // fTa growes very fast when Ta is near 0 and we could have
00082     // an overflow.
00083 
00084     G4int iterations = 0;  
00085     while (fTa < 0.0 && ++iterations < 10) {
00086         Ta -= 0.5*Ta;
00087         fTa = this->operator()(Ta);
00088     }
00089     // Usually, fTb will be less than 0, but if it is not the case: 
00090     iterations = 0;  
00091     while (fTa*fTb > 0.0 && iterations++ < 10) {
00092         Tb += 2.*std::fabs(Tb-Ta);
00093         fTb = this->operator()(Tb);
00094     }
00095         
00096     if (fTa*fTb > 0.0) {
00097       G4cerr <<"G4StatMFMacroTemperature:"<<" Ta="<<Ta<<" Tb="<<Tb<< G4endl;
00098       G4cerr <<"G4StatMFMacroTemperature:"<<" fTa="<<fTa<<" fTb="<<fTb<< G4endl;
00099       throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroTemperature::CalcTemperature: I couldn't bracket the solution.");
00100     }
00101 
00102     G4Solver<G4StatMFMacroTemperature> * theSolver = new G4Solver<G4StatMFMacroTemperature>(100,1.e-4);
00103     theSolver->SetIntervalLimits(Ta,Tb);
00104     if (!theSolver->Crenshaw(*this)){ 
00105       G4cout <<"G4StatMFMacroTemperature, Crenshaw method failed:"<<" Ta="<<Ta<<" Tb="<<Tb<< G4endl;
00106       G4cout <<"G4StatMFMacroTemperature, Crenshaw method failed:"<<" fTa="<<fTa<<" fTb="<<fTb<< G4endl;
00107     }
00108     _MeanTemperature = theSolver->GetRoot();
00109     G4double FunctionValureAtRoot =  this->operator()(_MeanTemperature);
00110     delete  theSolver;
00111 
00112     // Verify if the root is found and it is indeed within the physical domain, 
00113     // say, between 1 and 50 MeV, otherwise try Brent method:
00114     if (std::fabs(FunctionValureAtRoot) > 5.e-2) {
00115       if (_MeanTemperature < 1. || _MeanTemperature > 50.) {
00116         G4cout << "Crenshaw method failed; function = " << FunctionValureAtRoot 
00117                << " solution? = " << _MeanTemperature << " MeV " << G4endl;
00118         G4Solver<G4StatMFMacroTemperature> * theSolverBrent = new G4Solver<G4StatMFMacroTemperature>(200,1.e-3);
00119         theSolverBrent->SetIntervalLimits(Ta,Tb);
00120         if (!theSolverBrent->Brent(*this)){
00121           G4cout <<"G4StatMFMacroTemperature, Brent method failed:"<<" Ta="<<Ta<<" Tb="<<Tb<< G4endl;
00122           G4cout <<"G4StatMFMacroTemperature, Brent method failed:"<<" fTa="<<fTa<<" fTb="<<fTb<< G4endl; 
00123           throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroTemperature::CalcTemperature: I couldn't find the root with any method.");
00124         }
00125 
00126         _MeanTemperature = theSolverBrent->GetRoot();
00127         FunctionValureAtRoot =  this->operator()(_MeanTemperature);
00128         delete theSolverBrent;
00129       }
00130       if (std::abs(FunctionValureAtRoot) > 5.e-2) {
00131         //if (_MeanTemperature < 1. || _MeanTemperature > 50. || std::abs(FunctionValureAtRoot) > 5.e-2) {
00132         G4cout << "Brent method failed; function = " << FunctionValureAtRoot << " solution? = " << _MeanTemperature << " MeV " << G4endl;
00133         throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroTemperature::CalcTemperature: I couldn't find the root with any method.");
00134       }
00135     }
00136     //G4cout << "G4StatMFMacroTemperature::CalcTemperature: function = " << FunctionValureAtRoot 
00137     //     << " T(MeV)= " << _MeanTemperature << G4endl;
00138     return _MeanTemperature;
00139 }
00140 
00141 
00142 
00143 G4double G4StatMFMacroTemperature::FragsExcitEnergy(const G4double T)
00144     // Calculates excitation energy per nucleon and summed fragment multiplicity and entropy
00145 {
00146 
00147     // Model Parameters
00148     G4double R0 = G4StatMFParameters::Getr0()*std::pow(theA,1./3.);
00149     G4double R = R0*std::pow(1.0+G4StatMFParameters::GetKappaCoulomb(), 1./3.);
00150     G4double FreeVol = _Kappa*(4.*pi/3.)*R0*R0*R0; 
00151  
00152  
00153     // Calculate Chemical potentials
00154     CalcChemicalPotentialNu(T);
00155 
00156 
00157     // Average total fragment energy
00158     G4double AverageEnergy = 0.0;
00159     std::vector<G4VStatMFMacroCluster*>::iterator i;
00160     for (i =  _theClusters->begin(); i != _theClusters->end(); ++i) 
00161       {
00162         AverageEnergy += (*i)->GetMeanMultiplicity() * (*i)->CalcEnergy(T);
00163       }
00164     
00165     // Add Coulomb energy                       
00166     AverageEnergy += (3./5.)*elm_coupling*theZ*theZ/R;          
00167     
00168     // Calculate mean entropy
00169     _MeanEntropy = 0.0;
00170     for (i = _theClusters->begin(); i != _theClusters->end(); ++i) 
00171       {
00172         _MeanEntropy += (*i)->CalcEntropy(T,FreeVol);   
00173       }
00174 
00175     // Excitation energy per nucleon
00176     return AverageEnergy - _FreeInternalE0;
00177 
00178 }
00179 
00180 
00181 void G4StatMFMacroTemperature::CalcChemicalPotentialNu(const G4double T)
00182     // Calculates the chemical potential \nu 
00183 
00184 {
00185     G4StatMFMacroChemicalPotential * theChemPot = new
00186         G4StatMFMacroChemicalPotential(theA,theZ,_Kappa,T,_theClusters);
00187 
00188 
00189     _ChemPotentialNu = theChemPot->CalcChemicalPotentialNu();
00190     _ChemPotentialMu = theChemPot->GetChemicalPotentialMu();
00191     _MeanMultiplicity = theChemPot->GetMeanMultiplicity();      
00192         
00193     delete theChemPot;
00194                     
00195     return;
00196 
00197 }
00198 
00199 

Generated on Mon May 27 17:49:54 2013 for Geant4 by  doxygen 1.4.7