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 = (sum > 0.0) ? 1./sum : 0.0;
106 for(
G4int i=0; i<nlev; ++i) {
124 G4cout <<
"G4DensityEffectCalculator::ComputeDensityCorrection for "
128 const G4double exact = FermiDeltaCalculation(x);
131 G4cout <<
" Delta: computed= " << exact
132 <<
", parametrized= " << approx <<
G4endl;
134 if(approx > 0. && exact < 0.) {
139 ed <<
"Sternheimer fit failed for " << fMaterial->
GetName()
140 <<
", x = " << x <<
": Delta exact= "
141 << exact <<
", approx= " << approx;
142 G4Exception(
"G4DensityEffectCalculator::DensityCorrection",
"mat008",
153 if(approx >= 0. && std::abs(exact - approx) > 1.) {
158 ed <<
"Sternheimer exact= " << exact <<
" and approx= "
159 << approx <<
" are too different for "
160 << fMaterial->
GetName() <<
", x = " << x;
161 G4Exception(
"G4DensityEffectCalculator::DensityCorrection",
"mat008",
179 if(x > 20.) {
return -1.; }
182 G4double sternrho = Newton(1.5,
true);
186 if(sternrho <= 0. || sternrho > 100.) {
191 ed <<
"Sternheimer computation failed for " << fMaterial->
GetName()
192 <<
", x = " << x <<
":\n"
193 <<
"Could not solve for Sternheimer rho. Probably you have a \n"
194 <<
"mean ionization energy which is incompatible with your\n"
195 <<
"distribution of energy levels, or an unusually dense material.\n"
196 <<
"Number of levels: " << nlev
197 <<
" Mean ionization energy(eV): " << meanexcite
198 <<
" Plasma energy(eV): " << plasmaE <<
"\n";
199 for(
G4int i = 0; i < nlev; ++i) {
200 ed <<
"Level " << i <<
": strength " << sternf[i]
201 <<
": energy(eV)= " << levE[i] <<
"\n";
203 G4Exception(
"G4DensityEffectCalculator::SetupFermiDeltaCalc",
"mat008",
213 for(
G4int i=0; i<nlev; ++i) {
214 sternEbar[i] = levE[i] * sternrho;
215 sternl[i] = std::sqrt(gpow->
powN(sternEbar[i], 2) + 2./3.*sternf[i]);
219 const G4double sternL = Newton(sternrho,
false);
221 return DeltaOnceSolved(sternL);
233 const G4int maxIter = 100;
234 G4int nbad = 0, ngood = 0;
239 G4cout <<
"G4DensityEffectCalculator::Newton: strat= " << start
240 <<
" type: " << first <<
G4endl;
244 value = FRho(lambda);
245 dvalue = DFRho(lambda);
248 dvalue = DEll(lambda);
250 if(dvalue == 0.0) {
break; }
266 if(nbad > maxIter || eps > 1.) {
break; }
269 G4cout <<
" Failed to converge last value= " << value
270 <<
" dvalue= " << dvalue <<
" lambda= " <<
lambda <<
G4endl;
280 for(
G4int i = 0; i < nlev; ++i) {
282 ans += sternf[i] * gpow->
powN(levE[i], 2) * rho /
283 (gpow->
powN(levE[i] * rho, 2)
284 + 2./3. * sternf[i] * gpow->
powN(plasmaE, 2));
295 for(
G4int i = 0; i<nlev; ++i) {
297 ans += sternf[i] *
G4Log(gpow->
powN(levE[i]*rho, 2) +
298 2./3. * sternf[i]*gpow->
powN(plasmaE, 2));
303 if(fConductivity > 0.) {
304 ans += fConductivity *
G4Log(plasmaE * std::sqrt(fConductivity));
306 ans -=
G4Log(meanexcite);
315 for(
G4int i=0; i<nlev; ++i) {
316 if(sternf[i] > 0 && (sternEbar[i] > 0. || L != 0.)) {
318 ans += sternf[i]/gpow->
powN(y + L*L, 2);
330 for(
G4int i=0; i<nlev; ++i) {
331 if(sternf[i] > 0. && (sternEbar[i] > 0. || L != 0.)) {
332 ans += sternf[i]/(gpow->
powN(sternEbar[i], 2) + L*L);
335 ans -= gpow->
powZ(10, -2 * sternx);
347 for(
G4int i=0; i<nlev; ++i) {
349 ans += sternf[i] *
G4Log((gpow->
powN(sternl[i], 2)
350 + gpow->
powN(sternL, 2))/gpow->
powN(sternl[i], 2));
353 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 GetDensityCorrection(G4double x)
G4double GetMeanExcitationEnergy() 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