49 std::vector<G4VStatMFMacroCluster*> * ClusterVector) :
53 _FreeInternalE0(FreeE0),
55 _MeanMultiplicity(0.0),
56 _MeanTemperature(0.0),
57 _ChemPotentialMu(0.0),
58 _ChemPotentialNu(0.0),
60 _theClusters(ClusterVector)
86 while (fTa < 0.0 && ++iterations < 10) {
93 while (fTa*fTb > 0.0 && iterations++ < 10) {
94 Tb += 2.*std::fabs(Tb-Ta);
99 G4cerr <<
"G4StatMFMacroTemperature:"<<
" Ta="<<Ta<<
" Tb="<<Tb<<
G4endl;
100 G4cerr <<
"G4StatMFMacroTemperature:"<<
" fTa="<<fTa<<
" fTb="<<fTb<<
G4endl;
101 throw G4HadronicException(__FILE__, __LINE__,
"G4StatMFMacroTemperature::CalcTemperature: I couldn't bracket the solution.");
108 G4cout <<
"G4StatMFMacroTemperature, Crenshaw method failed:"<<
" Ta="
109 <<Ta<<
" Tb="<<Tb<<
G4endl;
110 G4cout <<
"G4StatMFMacroTemperature, Crenshaw method failed:"<<
" fTa="
111 <<fTa<<
" fTb="<<fTb<<
G4endl;
113 _MeanTemperature = theSolver->
GetRoot();
119 if (std::fabs(FunctionValureAtRoot) > 5.e-2) {
120 if (_MeanTemperature < 1. || _MeanTemperature > 50.) {
121 G4cout <<
"Crenshaw method failed; function = " << FunctionValureAtRoot
122 <<
" solution? = " << _MeanTemperature <<
" MeV " <<
G4endl;
126 if (!theSolverBrent->
Brent(*
this)){
127 G4cout <<
"G4StatMFMacroTemperature, Brent method failed:"
128 <<
" Ta="<<Ta<<
" Tb="<<Tb<<
G4endl;
129 G4cout <<
"G4StatMFMacroTemperature, Brent method failed:"
130 <<
" fTa="<<fTa<<
" fTb="<<fTb<<
G4endl;
131 throw G4HadronicException(__FILE__, __LINE__,
"G4StatMFMacroTemperature::CalcTemperature: I couldn't find the root with any method.");
134 _MeanTemperature = theSolverBrent->
GetRoot();
135 FunctionValureAtRoot = this->
operator()(_MeanTemperature);
136 delete theSolverBrent;
138 if (std::abs(FunctionValureAtRoot) > 5.e-2) {
139 G4cout <<
"Brent method failed; function = " << FunctionValureAtRoot
140 <<
" solution? = " << _MeanTemperature <<
" MeV " <<
G4endl;
141 throw G4HadronicException(__FILE__, __LINE__,
"G4StatMFMacroTemperature::CalcTemperature: I couldn't find the root with any method.");
147 return _MeanTemperature;
158 G4double FreeVol = _Kappa*(4.*
pi/3.)*R0*R0*R0;
161 CalcChemicalPotentialNu(T);
166 std::vector<G4VStatMFMacroCluster*>::iterator i;
167 for (i = _theClusters->begin(); i != _theClusters->end(); ++i)
169 AverageEnergy += (*i)->GetMeanMultiplicity() * (*i)->CalcEnergy(T);
177 for (i = _theClusters->begin(); i != _theClusters->end(); ++i)
179 _MeanEntropy += (*i)->CalcEntropy(T,FreeVol);
183 return AverageEnergy - _FreeInternalE0;
186 void G4StatMFMacroTemperature::CalcChemicalPotentialNu(
const G4double T)
G4StatMFMacroTemperature(const G4double anA, const G4double aZ, const G4double ExEnergy, const G4double FreeE0, const G4double kappa, std::vector< G4VStatMFMacroCluster * > *ClusterVector)
static G4Pow * GetInstance()
G4double GetMeanMultiplicity(void) const
static G4double GetKappaCoulomb()
void SetIntervalLimits(const G4double Limit1, const G4double Limit2)
G4bool Brent(Function &theFunction)
G4GLOB_DLL std::ostream G4cout
G4double Z13(G4int Z) const
G4double CalcTemperature(void)
G4double GetRoot(void) const
G4double A13(G4double A) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double CalcChemicalPotentialNu(void)
~G4StatMFMacroTemperature()
G4double operator()(const G4double T)
static constexpr double MeV
static constexpr double pi
G4bool Crenshaw(Function &theFunction)
G4double GetChemicalPotentialMu(void) const
G4GLOB_DLL std::ostream G4cerr