58 : fMaterial(mat), nlev(n)
66 for (
G4int i = 0; i < nlev; ++i) {
73 fConductivity = sternx = 0.0;
90 for (
G4int i = 0; i < nshell; ++i) {
94 if (i < nshell - 1 || ! conductor) {
104 for (
G4int i = 0; i < nlev; ++i) {
107 sum += fConductivity;
109 const G4double invsum = (sum > 0.0) ? 1. / sum : 0.0;
110 for (
G4int i = 0; i < nlev; ++i) {
113 fConductivity *= invsum;
129 G4cout <<
"G4DensityEffectCalculator::ComputeDensityCorrection for " << fMaterial->
GetName()
130 <<
", x= " << x <<
G4endl;
133 const G4double exact = FermiDeltaCalculation(x);
136 G4cout <<
" Delta: computed= " << exact <<
", parametrized= " << approx <<
G4endl;
138 if (approx >= 0. && exact < 0.) {
143 ed <<
"Sternheimer fit failed for " << fMaterial->
GetName() <<
", x = " << x
144 <<
": Delta exact= " << exact <<
", approx= " << approx;
155 if (approx >= 0. && std::abs(exact - approx) > 1.) {
160 ed <<
"Sternheimer exact= " << exact <<
" and approx= " << approx
161 <<
" are too different for " << fMaterial->
GetName() <<
", x = " << x;
184 G4double sternrho = Newton(1.5,
true);
188 if (sternrho <= 0. || sternrho > 100.) {
193 ed <<
"Sternheimer computation failed for " << fMaterial->
GetName() <<
", x = " << x
195 <<
"Could not solve for Sternheimer rho. Probably you have a \n"
196 <<
"mean ionization energy which is incompatible with your\n"
197 <<
"distribution of energy levels, or an unusually dense material.\n"
198 <<
"Number of levels: " << nlev <<
" Mean ionization energy(eV): " << meanexcite
199 <<
" Plasma energy(eV): " << plasmaE <<
"\n";
200 for (
G4int i = 0; i < nlev; ++i) {
201 ed <<
"Level " << i <<
": strength " << sternf[i] <<
": energy(eV)= " << levE[i] <<
"\n";
211 for (
G4int i = 0; i < nlev; ++i) {
212 sternEbar[i] = levE[i] * (sternrho / plasmaE);
213 sternl[i] = std::sqrt(gpow->
powN(sternEbar[i], 2) + (2. / 3.) * sternf[i]);
226 if (fConductivity == 0 && Ell(0) <= 0) {
233 for (
G4int startLi = -10; startLi < 30; ++startLi) {
234 const G4double sternL = Newton(gpow->
powN(2, startLi),
false);
236 return DeltaOnceSolved(sternL);
248 const G4int maxIter = 100;
249 G4int nbad = 0, ngood = 0;
254 G4cout <<
"G4DensityEffectCalculator::Newton: strat= " << start <<
" type: " << first <<
G4endl;
258 value = FRho(lambda);
259 dvalue = DFRho(lambda);
263 dvalue = DEll(lambda);
268 const G4double del = value / dvalue;
271 const G4double eps = std::abs(del / lambda);
284 if (nbad > maxIter || std::isnan(value) || std::isinf(value)) {
289 G4cout <<
" Failed to converge last value= " << value <<
" dvalue= " << dvalue
300 for (
G4int i = 0; i < nlev; ++i) {
301 if (sternf[i] > 0.) {
302 ans += sternf[i] * gpow->
powN(levE[i], 2) * rho /
303 (gpow->
powN(levE[i] * rho, 2) + 2. / 3. * sternf[i] * gpow->
powN(plasmaE, 2));
314 for (
G4int i = 0; i < nlev; ++i) {
315 if (sternf[i] > 0.) {
317 G4Log(gpow->
powN(levE[i] * rho, 2) + 2. / 3. * sternf[i] * gpow->
powN(plasmaE, 2));
322 if (fConductivity > 0.) {
323 ans += fConductivity *
G4Log(plasmaE * std::sqrt(fConductivity));
325 ans -=
G4Log(meanexcite);
334 for (
G4int i = 0; i < nlev; ++i) {
335 if (sternf[i] > 0 && (sternEbar[i] > 0. || L != 0.)) {
337 ans += sternf[i] / gpow->
powN(y + L * L, 2);
340 ans += fConductivity / gpow->
powN(L * L, 2);
350 for (
G4int i = 0; i < nlev; ++i) {
351 if (sternf[i] > 0. && (sternEbar[i] > 0. || L != 0.)) {
352 ans += sternf[i] / (gpow->
powN(sternEbar[i], 2) + L * L);
355 if (fConductivity > 0. && L != 0.) {
356 ans += fConductivity / (L * L);
358 ans -= gpow->
powZ(10, -2 * sternx);
370 for (
G4int i = 0; i < nlev; ++i) {
371 if (sternf[i] > 0.) {
373 G4Log((gpow->
powN(sternl[i], 2) + gpow->
powN(sternL, 2)) / gpow->
powN(sternl[i], 2));
378 if (fConductivity > 0) {
379 ans += fConductivity *
G4Log((fConductivity + gpow->
powN(sternL, 2)) / fConductivity);
381 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
const G4double * GetVecNbOfAtomsPerVolume() const
std::size_t GetNumberOfElements() 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