G4StatMFMacroTemperature Class Reference

#include <G4StatMFMacroTemperature.hh>


Public Member Functions

 G4StatMFMacroTemperature (const G4double anA, const G4double aZ, const G4double ExEnergy, const G4double FreeE0, const G4double kappa, std::vector< G4VStatMFMacroCluster * > *ClusterVector)
 ~G4StatMFMacroTemperature ()
G4double operator() (const G4double T)
G4double GetMeanMultiplicity (void) const
G4double GetChemicalPotentialMu (void) const
G4double GetChemicalPotentialNu (void) const
G4double GetTemperature (void) const
G4double GetEntropy (void) const
G4double CalcTemperature (void)


Detailed Description

Definition at line 42 of file G4StatMFMacroTemperature.hh.


Constructor & Destructor Documentation

G4StatMFMacroTemperature::G4StatMFMacroTemperature ( const G4double  anA,
const G4double  aZ,
const G4double  ExEnergy,
const G4double  FreeE0,
const G4double  kappa,
std::vector< G4VStatMFMacroCluster * > *  ClusterVector 
)

Definition at line 46 of file G4StatMFMacroTemperature.cc.

References G4StatMFMacroTemperature().

Referenced by G4StatMFMacroTemperature().

00048                                                      :
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 {}
        

G4StatMFMacroTemperature::~G4StatMFMacroTemperature (  ) 

Definition at line 62 of file G4StatMFMacroTemperature.cc.

00063 {}


Member Function Documentation

G4double G4StatMFMacroTemperature::CalcTemperature ( void   ) 

Definition at line 66 of file G4StatMFMacroTemperature.cc.

References G4Solver< Function >::Brent(), G4Solver< Function >::Crenshaw(), G4cerr, G4cout, G4endl, G4Solver< Function >::GetRoot(), operator()(), and G4Solver< Function >::SetIntervalLimits().

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 }

G4double G4StatMFMacroTemperature::GetChemicalPotentialMu ( void   )  const [inline]

Definition at line 74 of file G4StatMFMacroTemperature.hh.

00074 {return _ChemPotentialMu;}

G4double G4StatMFMacroTemperature::GetChemicalPotentialNu ( void   )  const [inline]

Definition at line 76 of file G4StatMFMacroTemperature.hh.

00076 {return _ChemPotentialNu;}

G4double G4StatMFMacroTemperature::GetEntropy ( void   )  const [inline]

Definition at line 80 of file G4StatMFMacroTemperature.hh.

00080 {return _MeanEntropy;}

G4double G4StatMFMacroTemperature::GetMeanMultiplicity ( void   )  const [inline]

Definition at line 72 of file G4StatMFMacroTemperature.hh.

00072 {return _MeanMultiplicity;}

G4double G4StatMFMacroTemperature::GetTemperature ( void   )  const [inline]

Definition at line 78 of file G4StatMFMacroTemperature.hh.

00078 {return _MeanTemperature;}

G4double G4StatMFMacroTemperature::operator() ( const G4double  T  )  [inline]

Definition at line 53 of file G4StatMFMacroTemperature.hh.

Referenced by CalcTemperature().

00054         { return (_ExEnergy - this->FragsExcitEnergy(T))/_ExEnergy; }   


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:26 2013 for Geant4 by  doxygen 1.4.7