Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4StatMFMacroTemperature.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id$
28 //
29 // Hadronic Process: Nuclear De-excitations
30 // by V. Lara
31 //
32 // Modified:
33 // 25.07.08 I.Pshenichnov (in collaboration with Alexander Botvina and Igor
34 // Mishustin (FIAS, Frankfurt, INR, Moscow and Kurchatov Institute,
35 // Moscow, pshenich@fias.uni-frankfurt.de) make algorithm closer to
36 // original MF model
37 // 16.04.10 V.Ivanchenko improved logic of solving equation for tempetature
38 // to protect code from rare unwanted exception; moved constructor
39 // and destructor to source
40 // 28.10.10 V.Ivanchenko defined members in constructor and cleaned up
41 
43 #include "G4PhysicalConstants.hh"
44 #include "G4SystemOfUnits.hh"
45 
47  const G4double ExEnergy, const G4double FreeE0, const G4double kappa,
48  std::vector<G4VStatMFMacroCluster*> * ClusterVector) :
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 {}
61 
63 {}
64 
65 
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 }
140 
141 
142 
143 G4double G4StatMFMacroTemperature::FragsExcitEnergy(const G4double T)
144  // Calculates excitation energy per nucleon and summed fragment multiplicity and entropy
145 {
146 
147  // Model Parameters
148  G4double R0 = G4StatMFParameters::Getr0()*std::pow(theA,1./3.);
149  G4double R = R0*std::pow(1.0+G4StatMFParameters::GetKappaCoulomb(), 1./3.);
150  G4double FreeVol = _Kappa*(4.*pi/3.)*R0*R0*R0;
151 
152 
153  // Calculate Chemical potentials
154  CalcChemicalPotentialNu(T);
155 
156 
157  // Average total fragment energy
158  G4double AverageEnergy = 0.0;
159  std::vector<G4VStatMFMacroCluster*>::iterator i;
160  for (i = _theClusters->begin(); i != _theClusters->end(); ++i)
161  {
162  AverageEnergy += (*i)->GetMeanMultiplicity() * (*i)->CalcEnergy(T);
163  }
164 
165  // Add Coulomb energy
166  AverageEnergy += (3./5.)*elm_coupling*theZ*theZ/R;
167 
168  // Calculate mean entropy
169  _MeanEntropy = 0.0;
170  for (i = _theClusters->begin(); i != _theClusters->end(); ++i)
171  {
172  _MeanEntropy += (*i)->CalcEntropy(T,FreeVol);
173  }
174 
175  // Excitation energy per nucleon
176  return AverageEnergy - _FreeInternalE0;
177 
178 }
179 
180 
181 void G4StatMFMacroTemperature::CalcChemicalPotentialNu(const G4double T)
182  // Calculates the chemical potential \nu
183 
184 {
185  G4StatMFMacroChemicalPotential * theChemPot = new
186  G4StatMFMacroChemicalPotential(theA,theZ,_Kappa,T,_theClusters);
187 
188 
189  _ChemPotentialNu = theChemPot->CalcChemicalPotentialNu();
190  _ChemPotentialMu = theChemPot->GetChemicalPotentialMu();
191  _MeanMultiplicity = theChemPot->GetMeanMultiplicity();
192 
193  delete theChemPot;
194 
195  return;
196 
197 }
198 
199