Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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::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.

48 :
49 theA(anA),
50 theZ(aZ),
51 _ExEnergy(ExEnergy),
52 _FreeInternalE0(FreeE0),
53 _Kappa(kappa),
54 _MeanMultiplicity(0.0),
55 _MeanTemperature(0.0),
56 _ChemPotentialMu(0.0),
57 _ChemPotentialNu(0.0),
58 _MeanEntropy(0.0),
59 _theClusters(ClusterVector)
60{}

Referenced by G4StatMFMacroTemperature().

◆ ~G4StatMFMacroTemperature()

G4StatMFMacroTemperature::~G4StatMFMacroTemperature ( )

Definition at line 62 of file G4StatMFMacroTemperature.cc.

63{}

Member Function Documentation

◆ CalcTemperature()

G4double G4StatMFMacroTemperature::CalcTemperature ( void  )

Definition at line 66 of file G4StatMFMacroTemperature.cc.

67{
68 // Inital guess for the interval of the ensemble temperature values
69 G4double Ta = 0.5;
70 G4double Tb = std::max(std::sqrt(_ExEnergy/(theA*0.12)),0.01*MeV);
71
72 G4double fTa = this->operator()(Ta);
73 G4double fTb = this->operator()(Tb);
74
75 // Bracketing the solution
76 // T should be greater than 0.
77 // The interval is [Ta,Tb]
78 // We start with a value for Ta = 0.5 MeV
79 // it should be enough to have fTa > 0 If it isn't
80 // the case, we decrease Ta. But carefully, because
81 // fTa growes very fast when Ta is near 0 and we could have
82 // an overflow.
83
84 G4int iterations = 0;
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 it is not the case:
90 iterations = 0;
91 while (fTa*fTb > 0.0 && iterations++ < 10) {
92 Tb += 2.*std::fabs(Tb-Ta);
93 fTb = this->operator()(Tb);
94 }
95
96 if (fTa*fTb > 0.0) {
97 G4cerr <<"G4StatMFMacroTemperature:"<<" Ta="<<Ta<<" Tb="<<Tb<< G4endl;
98 G4cerr <<"G4StatMFMacroTemperature:"<<" fTa="<<fTa<<" fTb="<<fTb<< G4endl;
99 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroTemperature::CalcTemperature: I couldn't bracket the solution.");
100 }
101
103 theSolver->SetIntervalLimits(Ta,Tb);
104 if (!theSolver->Crenshaw(*this)){
105 G4cout <<"G4StatMFMacroTemperature, Crenshaw method failed:"<<" Ta="<<Ta<<" Tb="<<Tb<< G4endl;
106 G4cout <<"G4StatMFMacroTemperature, Crenshaw method failed:"<<" fTa="<<fTa<<" fTb="<<fTb<< G4endl;
107 }
108 _MeanTemperature = theSolver->GetRoot();
109 G4double FunctionValureAtRoot = this->operator()(_MeanTemperature);
110 delete theSolver;
111
112 // Verify if the root is found and it is indeed within the physical domain,
113 // say, between 1 and 50 MeV, otherwise try Brent method:
114 if (std::fabs(FunctionValureAtRoot) > 5.e-2) {
115 if (_MeanTemperature < 1. || _MeanTemperature > 50.) {
116 G4cout << "Crenshaw method failed; function = " << FunctionValureAtRoot
117 << " solution? = " << _MeanTemperature << " MeV " << G4endl;
119 theSolverBrent->SetIntervalLimits(Ta,Tb);
120 if (!theSolverBrent->Brent(*this)){
121 G4cout <<"G4StatMFMacroTemperature, Brent method failed:"<<" Ta="<<Ta<<" Tb="<<Tb<< G4endl;
122 G4cout <<"G4StatMFMacroTemperature, Brent method failed:"<<" fTa="<<fTa<<" fTb="<<fTb<< G4endl;
123 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroTemperature::CalcTemperature: I couldn't find the root with any method.");
124 }
125
126 _MeanTemperature = theSolverBrent->GetRoot();
127 FunctionValureAtRoot = this->operator()(_MeanTemperature);
128 delete theSolverBrent;
129 }
130 if (std::abs(FunctionValureAtRoot) > 5.e-2) {
131 //if (_MeanTemperature < 1. || _MeanTemperature > 50. || std::abs(FunctionValureAtRoot) > 5.e-2) {
132 G4cout << "Brent method failed; function = " << FunctionValureAtRoot << " solution? = " << _MeanTemperature << " MeV " << G4endl;
133 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroTemperature::CalcTemperature: I couldn't find the root with any method.");
134 }
135 }
136 //G4cout << "G4StatMFMacroTemperature::CalcTemperature: function = " << FunctionValureAtRoot
137 // << " T(MeV)= " << _MeanTemperature << G4endl;
138 return _MeanTemperature;
139}
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
G4bool Brent(Function &theFunction)
void SetIntervalLimits(const G4double Limit1, const G4double Limit2)
G4double GetRoot(void) const
Definition: G4Solver.hh:77
G4bool Crenshaw(Function &theFunction)
G4double operator()(const G4double T)

◆ GetChemicalPotentialMu()

G4double G4StatMFMacroTemperature::GetChemicalPotentialMu ( void  ) const
inline

Definition at line 74 of file G4StatMFMacroTemperature.hh.

74{return _ChemPotentialMu;}

◆ GetChemicalPotentialNu()

G4double G4StatMFMacroTemperature::GetChemicalPotentialNu ( void  ) const
inline

Definition at line 76 of file G4StatMFMacroTemperature.hh.

76{return _ChemPotentialNu;}

◆ GetEntropy()

G4double G4StatMFMacroTemperature::GetEntropy ( void  ) const
inline

Definition at line 80 of file G4StatMFMacroTemperature.hh.

80{return _MeanEntropy;}

◆ GetMeanMultiplicity()

G4double G4StatMFMacroTemperature::GetMeanMultiplicity ( void  ) const
inline

Definition at line 72 of file G4StatMFMacroTemperature.hh.

72{return _MeanMultiplicity;}

◆ GetTemperature()

G4double G4StatMFMacroTemperature::GetTemperature ( void  ) const
inline

Definition at line 78 of file G4StatMFMacroTemperature.hh.

78{return _MeanTemperature;}

◆ operator()()

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

Definition at line 53 of file G4StatMFMacroTemperature.hh.

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

Referenced by CalcTemperature().


The documentation for this class was generated from the following files: