57 : fMaterial(mat), fVerbose(0), fWarnings(0), nlev(n)
65 for(
G4int i=0; i<nlev; ++i) {
72 fConductivity = sternx = 0.0;
89 for(
G4int i = 0; i < nshell; ++i) {
93 if(i < nshell-1 || !conductor) {
102 for(
G4int i=0; i<nlev; ++i) {
105 sum += fConductivity;
107 const G4double invsum = (sum > 0.0) ? 1./sum : 0.0;
108 for(
G4int i=0; i<nlev; ++i) {
111 fConductivity *= invsum;
127 G4cout <<
"G4DensityEffectCalculator::ComputeDensityCorrection for "
131 const G4double exact = FermiDeltaCalculation(x);
134 G4cout <<
" Delta: computed= " << exact
135 <<
", parametrized= " << approx <<
G4endl;
137 if(approx >= 0. && exact < 0.) {
142 ed <<
"Sternheimer fit failed for " << fMaterial->
GetName()
143 <<
", x = " << x <<
": Delta exact= "
144 << exact <<
", approx= " << approx;
145 G4Exception(
"G4DensityEffectCalculator::DensityCorrection",
"mat008",
156 if(approx >= 0. && std::abs(exact - approx) > 1.) {
161 ed <<
"Sternheimer exact= " << exact <<
" and approx= "
162 << approx <<
" are too different for "
163 << fMaterial->
GetName() <<
", x = " << x;
164 G4Exception(
"G4DensityEffectCalculator::DensityCorrection",
"mat008",
182 if(x > 20.) {
return -1.; }
185 G4double sternrho = Newton(1.5,
true);
189 if(sternrho <= 0. || sternrho > 100.) {
194 ed <<
"Sternheimer computation failed for " << fMaterial->
GetName()
195 <<
", x = " << x <<
":\n"
196 <<
"Could not solve for Sternheimer rho. Probably you have a \n"
197 <<
"mean ionization energy which is incompatible with your\n"
198 <<
"distribution of energy levels, or an unusually dense material.\n"
199 <<
"Number of levels: " << nlev
200 <<
" Mean ionization energy(eV): " << meanexcite
201 <<
" Plasma energy(eV): " << plasmaE <<
"\n";
202 for(
G4int i = 0; i < nlev; ++i) {
203 ed <<
"Level " << i <<
": strength " << sternf[i]
204 <<
": energy(eV)= " << levE[i] <<
"\n";
206 G4Exception(
"G4DensityEffectCalculator::SetupFermiDeltaCalc",
"mat008",
215 for(
G4int i=0; i<nlev; ++i) {
216 sternEbar[i] = levE[i] * (sternrho/plasmaE);
217 sternl[i] = std::sqrt(gpow->
powN(sternEbar[i], 2) + (2./3.)*sternf[i]);
230 if(fConductivity == 0 && Ell(0) <= 0)
238 for(
G4int startLi = -10; startLi < 30; ++startLi){
239 const G4double sternL = Newton(gpow->
powN(2, startLi),
false);
241 return DeltaOnceSolved(sternL);
253 const G4int maxIter = 100;
254 G4int nbad = 0, ngood = 0;
259 G4cout <<
"G4DensityEffectCalculator::Newton: strat= " << start
260 <<
" type: " << first <<
G4endl;
264 value = FRho(lambda);
265 dvalue = DFRho(lambda);
268 dvalue = DEll(lambda);
270 if(dvalue == 0.0) {
break; }
274 const G4double eps = std::abs(del/lambda);
286 if(nbad > maxIter || std::isnan(value) || std::isinf(value)) {
break; }
289 G4cout <<
" Failed to converge last value= " << value
290 <<
" dvalue= " << dvalue <<
" lambda= " <<
lambda <<
G4endl;
300 for(
G4int i = 0; i < nlev; ++i) {
302 ans += sternf[i] * gpow->
powN(levE[i], 2) * rho /
303 (gpow->
powN(levE[i] * rho, 2)
304 + 2./3. * sternf[i] * gpow->
powN(plasmaE, 2));
315 for(
G4int i = 0; i<nlev; ++i) {
317 ans += sternf[i] *
G4Log(gpow->
powN(levE[i]*rho, 2) +
318 2./3. * sternf[i]*gpow->
powN(plasmaE, 2));
323 if(fConductivity > 0.) {
324 ans += fConductivity *
G4Log(plasmaE * std::sqrt(fConductivity));
326 ans -=
G4Log(meanexcite);
335 for(
G4int i=0; i<nlev; ++i) {
336 if(sternf[i] > 0 && (sternEbar[i] > 0. || L != 0.)) {
338 ans += sternf[i]/gpow->
powN(y + L*L, 2);
341 ans += fConductivity/gpow->
powN(L*L, 2);
351 for(
G4int i=0; i<nlev; ++i) {
352 if(sternf[i] > 0. && (sternEbar[i] > 0. || L != 0.)) {
353 ans += sternf[i]/(gpow->
powN(sternEbar[i], 2) +
L*
L);
356 if(fConductivity > 0. && L != 0.) {
357 ans += fConductivity/(
L*
L);
359 ans -= gpow->
powZ(10, -2 * sternx);
371 for(
G4int i=0; i<nlev; ++i) {
373 ans += sternf[i] *
G4Log((gpow->
powN(sternl[i], 2)
374 + gpow->
powN(sternL, 2))/gpow->
powN(sternl[i], 2));
379 if(fConductivity > 0) {
380 ans += fConductivity *
G4Log((fConductivity
381 + gpow->
powN(sternL, 2))/fConductivity);
383 ans -= gpow->
powN(sternL, 2)/(1 + gpow->
powZ(10, 2 * sternx));
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Log(G4double x)
G4GLOB_DLL std::ostream G4cout
static G4int GetNumberOfElectrons(G4int Z, G4int SubshellNb)
static G4double GetBindingEnergy(G4int Z, G4int SubshellNb)
static G4int GetNumberOfShells(G4int Z)
G4DensityEffectCalculator(const G4Material *, G4int)
~G4DensityEffectCalculator()
G4double ComputeDensityCorrection(G4double x)
G4double GetMeanExcitationEnergy() const
G4double GetDensityCorrection(G4double x) const
G4double GetPlasmaEnergy() const
G4double GetTotNbOfAtomsPerVolume() const
const G4Element * GetElement(G4int iel) const
G4IonisParamMat * GetIonisation() const
G4double GetFreeElectronDensity() const
size_t GetNumberOfElements() const
const G4double * GetVecNbOfAtomsPerVolume() const
const G4String & GetName() const
static G4NistManager * Instance()
static G4Pow * GetInstance()
G4double powZ(G4int Z, G4double y) const
G4double powN(G4double x, G4int n) const