15void PrintNotImplemented(
const std::string& cls,
const std::string& fcn) {
16 std::cerr << cls <<
"::" << fcn <<
": Function is not implemented.\n";
19void PrintOutOfRange(
const std::string& cls,
const std::string& fcn,
20 const size_t i,
const size_t j,
const size_t k) {
21 std::cerr << cls <<
"::" << fcn <<
": Index (" << i <<
", " << j <<
", " << k
22 <<
") out of range.\n";
25void PrintDataNotAvailable(
const std::string& cls,
const std::string& fcn) {
26 std::cerr << cls <<
"::" << fcn <<
": Data not available.\n";
29bool CheckFields(
const std::vector<double>& fields,
const std::string& hdr,
30 const std::string& lbl) {
32 std::cerr << hdr <<
": Number of " << lbl <<
" must be > 0.\n";
37 if (fields.front() < 0.) {
38 std::cerr << hdr <<
": " << lbl <<
" must be >= 0.\n";
42 const size_t nEntries = fields.size();
45 for (
size_t i = 1; i < nEntries; ++i) {
46 if (fields[i] <= fields[i - 1]) {
47 std::cerr << hdr <<
": " << lbl <<
" are not in ascending order.\n";
66 SetFieldGrid(100., 100000., 20,
true, 0., 0., 1, HalfPi, HalfPi, 1);
74 <<
" Temperature [K] must be greater than zero.\n";
84 <<
" Pressure [Torr] must be greater than zero.\n";
93 std::cerr <<
m_className <<
"::SetDielectricConstant:\n"
94 <<
" Dielectric constant must be >= 1.\n";
107 std::cerr <<
m_className <<
"::GetComponent: Index out of range.\n";
117 <<
" Atomic number must be >= 1.\n";
127 <<
" Atomic weight must be greater than zero.\n";
136 std::cerr <<
m_className <<
"::SetNumberDensity:\n"
137 <<
" Density [cm-3] must be greater than zero.\n";
147 <<
" Density [g/cm3] must be greater than zero.\n";
153 <<
" Atomic weight is not defined.\n";
161 const double bx,
const double by,
const double bz,
162 const std::vector<std::vector<std::vector<double> > >& velE,
163 const std::vector<std::vector<std::vector<double> > >& velB,
164 const std::vector<std::vector<std::vector<double> > >& velX,
165 const double q,
double& vx,
double& vy,
double& vz)
const {
169 if (velE.empty())
return false;
172 const double e = sqrt(ex * ex + ey * ey + ez * ez);
174 if (e < Small || e0 < Small)
return false;
177 const double b = sqrt(bx * bx + by * by + bz * bz);
179 const double ebang =
GetAngle(ex, ey, ez, bx, by, bz, e, b);
184 std::cerr <<
m_className <<
"::Velocity: Interpolation along E failed.\n";
189 const double mu = q * ve / e;
194 }
else if (velX.empty() || velB.empty()) {
196 const double mu = q * ve / e;
197 const double mu2 = mu * mu;
198 const double eb = bx * ex + by * ey + bz * ez;
199 const double f = mu / (1. + mu2 * b * b);
200 vx = f * (ex + mu * (ey * bz - ez * by) + mu2 * bx * eb);
201 vy = f * (ey + mu * (ez * bx - ex * bz) + mu2 * by * eb);
202 vz = f * (ez + mu * (ex * by - ey * bx) + mu2 * bz * eb);
208 double ue[3] = {ex / e, ey / e, ez / e};
209 double uexb[3] = {ey * bz - ez * by, ez * bx - ex * bz, ex * by - ey * bx};
211 sqrt(uexb[0] * uexb[0] + uexb[1] * uexb[1] + uexb[2] * uexb[2]);
222 double ubt[3] = {uexb[1] * ez - uexb[2] * ey, uexb[2] * ex - uexb[0] * ez,
223 uexb[0] * ey - uexb[1] * ex};
224 const double bt = sqrt(ubt[0] * ubt[0] + ubt[1] * ubt[1] + ubt[2] * ubt[2]);
236 std::cout << std::setprecision(5);
238 <<
" unit vector along E: (" << ue[0] <<
", " << ue[1]
239 <<
", " << ue[2] <<
")\n";
240 std::cout <<
" unit vector along E x B: (" << uexb[0] <<
", "
241 << uexb[1] <<
", " << uexb[2] <<
")\n";
242 std::cout <<
" unit vector along Bt: (" << ubt[0] <<
", " << ubt[1]
243 <<
", " << ubt[2] <<
")\n";
249 std::cerr <<
m_className <<
"::Velocity: Interpolation along ExB failed.\n";
254 std::cerr <<
m_className <<
"::Velocity: Interpolation along Bt failed.\n";
257 if (ex * bx + ey * by + ez * bz > 0.) {
262 vx = q * (ve * ue[0] + q * q * vbt * ubt[0] + q * vexb * uexb[0]);
263 vy = q * (ve * ue[1] + q * q * vbt * ubt[1] + q * vexb * uexb[1]);
264 vz = q * (ve * ue[2] + q * q * vbt * ubt[2] + q * vexb * uexb[2]);
270 const double bx,
const double by,
const double bz,
271 const std::vector<std::vector<std::vector<double> > >& difL,
272 const std::vector<std::vector<std::vector<double> > >& difT,
273 double& dl,
double& dt)
const {
277 const double e = sqrt(ex * ex + ey * ey + ez * ez);
279 if (e < Small || e0 < Small)
return true;
282 const double b =
m_tab2d ? sqrt(bx * bx + by * by + bz * bz) : 0.;
284 const double ebang =
m_tab2d ?
GetAngle(ex, ey, ez, bx, by, bz, e, b) : 0.;
296 if (difL.empty() || difT.empty()) {
297 const double d = sqrt(2. * BoltzmannConstant *
m_temperature / e);
298 if (difL.empty()) dl = d;
299 if (difT.empty()) dt = d;
308 const double bx,
const double by,
const double bz,
309 const std::vector<std::vector<std::vector<std::vector<double> > > >& diff,
310 double cov[3][3])
const {
313 cov[0][0] = cov[0][1] = cov[0][2] = 0.;
314 cov[1][0] = cov[1][1] = cov[1][2] = 0.;
315 cov[2][0] = cov[2][1] = cov[2][2] = 0.;
317 if (diff.empty())
return false;
320 const double e = sqrt(ex * ex + ey * ey + ez * ez);
322 if (e < Small || e0 < Small)
return true;
325 const double b =
m_tab2d ? sqrt(bx * bx + by * by + bz * bz) : 0.;
327 const double ebang =
m_tab2d ?
GetAngle(ex, ey, ez, bx, by, bz, e, b) : 0.;
329 for (
int j = 0; j < 6; ++j) {
338 cov[0][1] = cov[1][0] = y;
340 cov[0][2] = cov[2][0] = y;
342 cov[1][2] = cov[2][1] = y;
349 const double bx,
const double by,
const double bz,
350 const std::vector<std::vector<std::vector<double> > >& tab,
351 unsigned int intp,
const unsigned int thr,
352 const std::pair<unsigned int, unsigned int>& extr,
353 double& alpha)
const {
356 if (tab.empty())
return false;
359 const double e = sqrt(ex * ex + ey * ey + ez * ez);
361 if (e < Small || e0 < Small)
return true;
364 const double b =
m_tab2d ? sqrt(bx * bx + by * by + bz * bz) : 0.;
366 const double ebang =
m_tab2d ?
GetAngle(ex, ey, ez, bx, by, bz, e, b) : 0.;
370 if (!
Interpolate(e0, b, ebang, tab, alpha, intp, extr)) alpha = -30.;
380 const double bx,
const double by,
const double bz,
381 double& vx,
double& vy,
double& vz) {
383 return Velocity(ex, ey, ez, bx, by, bz,
m_eVelE,
m_eVelB,
m_eVelX, -1.,
388 const double ez,
const double bx,
389 const double by,
const double bz,
double& dl,
396 const double ez,
const double bx,
397 const double by,
const double bz,
404 const double bx,
const double by,
const double bz,
407 if (!
Alpha(ex, ey, ez, bx, by, bz,
m_eAlp,
m_intpAlp,
m_eThrAlp,
m_extrAlp,
417 const double ez,
const double bx,
418 const double by,
const double bz,
double& eta) {
420 if (!
Alpha(ex, ey, ez, bx, by, bz,
m_eAtt,
m_intpAtt,
m_eThrAtt,
m_extrAtt,
430 const double ez,
const double bx,
431 const double by,
const double bz,
434 if (
m_eLor.empty())
return false;
437 const double e = sqrt(ex * ex + ey * ey + ez * ez);
439 if (e < Small || e0 < Small)
return true;
442 const double b =
m_tab2d ? sqrt(bx * bx + by * by + bz * bz) : 0.;
444 const double ebang =
m_tab2d ?
GetAngle(ex, ey, ez, bx, by, bz, e, b) : 0.;
454 if (
m_eVelE.empty())
return -1.;
459 const double pz,
double& vx,
double& vy,
460 double& vz,
const int band) {
462 std::cerr <<
m_className <<
"::GetElectronEnergy:\n";
463 std::cerr <<
" Unknown band index.\n";
466 vx = SpeedOfLight * px / ElectronMass;
467 vy = SpeedOfLight * py / ElectronMass;
468 vz = SpeedOfLight * pz / ElectronMass;
470 return 0.5 * (px * px + py * py + pz * pz) / ElectronMass;
474 double& pz,
int& band) {
475 const double p = sqrt(2. * ElectronMass * e) / SpeedOfLight;
492 const double e,
int& type,
int& level,
double& e1,
double& dx,
double& dy,
493 double& dz, std::vector<std::pair<int, double> >& ,
494 int& ndxc,
int& band) {
505 double& s,
int& type,
506 double& energy)
const {
514 const double bx,
const double by,
const double bz,
515 double& vx,
double& vy,
double& vz) {
517 return Velocity(ex, ey, ez, bx, by, bz,
m_hVelE,
m_hVelB,
m_hVelX, +1.,
522 const double bx,
const double by,
const double bz,
523 double& dl,
double& dt) {
528 const double bx,
const double by,
const double bz,
535 const double bx,
const double by,
const double bz,
538 if (!
Alpha(ex, ey, ez, bx, by, bz,
m_hAlp,
m_intpAlp,
m_hThrAlp,
m_extrAlp,
548 const double bx,
const double by,
const double bz,
551 if (!
Alpha(ex, ey, ez, bx, by, bz,
m_hAtt,
m_intpAtt,
m_hThrAtt,
m_extrAtt,
561 if (
m_hVelE.empty())
return -1.;
566 const double bx,
const double by,
const double bz,
567 double& vx,
double& vy,
double& vz) {
569 if (
m_iMob.empty())
return false;
571 const double e = sqrt(ex * ex + ey * ey + ez * ez);
573 if (e < Small || e0 < Small)
return true;
575 const double b = sqrt(bx * bx + by * by + bz * bz);
578 const double ebang =
m_tab2d ?
GetAngle(ex, ey, ez, bx, by, bz, e, b) : 0.;
582 constexpr double q = 1.;
589 const double eb = bx * ex + by * ey + bz * ez;
590 const double mu2 = mu * mu;
591 const double f = mu / (1. + mu2 * b * b);
592 vx = f * (ex + mu * (ey * bz - ez * by) + mu2 * bx * eb);
593 vy = f * (ey + mu * (ez * bx - ex * bz) + mu2 * by * eb);
594 vz = f * (ez + mu * (ex * by - ey * bx) + mu2 * bz * eb);
601 const double bx,
const double by,
const double bz,
602 double& dl,
double& dt) {
608 const double bx,
const double by,
const double bz,
611 if (!
Alpha(ex, ey, ez, bx, by, bz,
m_iDis,
m_intpDis,
m_iThrDis,
m_extrDis,
625 const unsigned int i) {
627 std::cerr <<
m_className <<
"::GetOpticalDataRange: Index out of range.\n";
637 const unsigned int i) {
639 std::cerr <<
m_className <<
"::GetDielectricFunction: Index out of range.\n";
644 std::cerr <<
m_className <<
"::GetDielectricFunction: Energy must be > 0.\n";
655 const unsigned int i) {
657 std::cerr <<
m_className <<
"::GetPhotoAbsorptionCrossSection:\n";
658 std::cerr <<
" Component " << i <<
" does not exist.\n";
663 std::cerr <<
m_className <<
"::GetPhotoAbsorptionCrossSection:\n";
664 std::cerr <<
" Energy must be > 0.\n";
669 PrintNotImplemented(
m_className,
"GetPhotoAbsorptionCrossSection");
683 double& e1,
double& ctheta,
int& nsec,
694 double bmin,
double bmax,
const size_t nb,
695 double amin,
double amax,
const size_t na) {
699 <<
" Number of E-fields must be > 0.\n";
703 if (emin < 0. || emax < 0.) {
705 <<
" Electric fields must be positive.\n";
710 std::cerr <<
m_className <<
"::SetFieldGrid: Swapping min./max. E-field.\n";
711 std::swap(emin, emax);
719 <<
" Min. E-field must be non-zero for log. scale.\n";
724 <<
" Number of E-fields must be > 1 for log. scale.\n";
727 estep = pow(emax / emin, 1. / (ne - 1.));
730 if (ne > 1) estep = (emax - emin) / (ne - 1.);
736 <<
" Number of B-fields must be > 0.\n";
739 if (bmax < 0. || bmin < 0.) {
741 <<
" Magnetic fields must be positive.\n";
745 std::cerr <<
m_className <<
"::SetFieldGrid: Swapping min./max. B-field.\n";
746 std::swap(bmin, bmax);
749 const double bstep = nb > 1 ? (bmax - bmin) / (nb - 1.) : 0.;
754 <<
" Number of angles must be > 0.\n";
757 if (amax < 0. || amin < 0.) {
759 <<
" Angles must be positive.\n";
763 std::cerr <<
m_className <<
"::SetFieldGrid: Swapping min./max. angle.\n";
764 std::swap(amin, amax);
766 const double astep = na > 1 ? (amax - amin) / (na - 1.) : 0;
769 std::vector<double> eFields(ne);
770 std::vector<double> bFields(nb);
771 std::vector<double> bAngles(na);
772 for (
size_t i = 0; i < ne; ++i) {
773 eFields[i] = logE ? emin * pow(estep, i) : emin + i * estep;
775 for (
size_t i = 0; i < nb; ++i) {
776 bFields[i] = bmin + i * bstep;
778 for (
size_t i = 0; i < na; ++i) {
779 bAngles[i] = amin + i * astep;
785 const std::vector<double>& bfields,
786 const std::vector<double>& angles) {
787 const std::string hdr =
m_className +
"::SetFieldGrid";
788 if (!CheckFields(efields, hdr,
"E-fields"))
return;
789 if (!CheckFields(bfields, hdr,
"B-fields"))
return;
790 if (!CheckFields(angles, hdr,
"angles"))
return;
793 std::cout <<
m_className <<
"::SetFieldGrid:\n E-fields:\n";
794 for (
const auto efield : efields) std::cout <<
" " << efield <<
"\n";
795 std::cout <<
" B-fields:\n";
796 for (
const auto bfield : bfields) std::cout <<
" " << bfield <<
"\n";
797 std::cout <<
" Angles:\n";
798 for (
const auto angle : angles) std::cout <<
" " << angle <<
"\n";
804 "electron velocity along E");
806 "electron velocity along Bt");
808 "electron velocity along ExB");
810 "electron longitudinal diffusion");
812 "electron transverse diffusion");
814 "electron Townsend coefficient");
816 "electron attachment coefficient");
818 "electron Lorentz angle");
821 "electron diffusion tensor");
826 "hole velocity along E");
828 "hole velocity along Bt");
830 "hole velocity along ExB");
832 "hole longitudinal diffusion");
834 "hole transverse diffusion");
836 "hole Townsend coefficient");
838 "hole attachment coefficient");
841 "hole diffusion tensor");
848 "ion longitudinal diffusion");
850 "ion transverse diffusion");
854 if (bfields.size() > 1 || angles.size() > 1)
m_tab2d =
true;
861 std::vector<double>& bfields,
862 std::vector<double>& angles) {
869 const std::string& fcn,
870 std::vector<std::vector<std::vector<double> > >& tab,
874 PrintOutOfRange(
m_className,
"Set" + fcn, i, j, k);
885 const std::string& fcn,
886 const std::vector<std::vector<std::vector<double> > >& tab,
890 PrintOutOfRange(
m_className,
"Get" + fcn, i, j, k);
919 const std::vector<double>& efields,
920 const std::vector<double>& bfields,
921 const std::vector<double>& angles,
922 const unsigned int intp,
923 const std::pair<unsigned int, unsigned int>& extr,
924 const double init,
const std::string& lbl) {
926 std::cout <<
m_className <<
"::Clone: Copying " << lbl <<
" to new grid.\n";
934 const auto nE = efields.size();
935 const auto nB = bfields.size();
936 const auto nA = angles.size();
939 std::vector<std::vector<std::vector<double> > > tabClone;
940 Init(nE, nB, nA, tabClone, init);
943 for (
size_t i = 0; i < nE; ++i) {
944 const double e = efields[i];
945 for (
size_t j = 0; j < nB; ++j) {
946 const double b = bfields[j];
947 for (
size_t k = 0; k < nA; ++k) {
948 const double a = angles[k];
952 <<
" Interpolation of " << lbl <<
" failed.\n"
953 <<
" Cannot copy value to new grid at E = " << e
954 <<
", B = " << b <<
", angle: " << a <<
"\n";
957 tabClone[k][j][i] = val;
966 std::vector<std::vector<std::vector<std::vector<double> > > >& tab,
967 const size_t n,
const std::vector<double>& efields,
968 const std::vector<double>& bfields,
const std::vector<double>& angles,
969 const unsigned int intp,
const std::pair<unsigned int, unsigned int>& extr,
970 const double init,
const std::string& lbl) {
972 if (tab.empty())
return;
975 const auto nE = efields.size();
976 const auto nB = bfields.size();
977 const auto nA = angles.size();
980 std::vector<std::vector<std::vector<std::vector<double> > > > tabClone;
981 Init(nE, nB, nA, n, tabClone, init);
984 for (
size_t l = 0; l < n; ++l) {
985 for (
size_t i = 0; i < nE; ++i) {
986 const double e = efields[i];
987 for (
size_t j = 0; j < nB; ++j) {
988 const double b = bfields[j];
989 for (
size_t k = 0; k < nA; ++k) {
990 const double a = angles[k];
992 if (!
Interpolate(e, b, a, tab[l], val, intp, extr)) {
994 <<
" Interpolation of " << lbl <<
" failed.\n"
995 <<
" Cannot copy value to new grid at index " << l
996 <<
", E = " << e <<
", B = " << b <<
", angle: " << a
1000 tabClone[l][k][j][i] = val;
1010 const size_t ia,
const double mu) {
1014 PrintOutOfRange(
m_className,
"SetIonMobility", ie, ib, ia);
1020 <<
" Ion mobility table not initialised.\n";
1025 std::cerr <<
m_className <<
"::SetIonMobility: Zero value not allowed.\n";
1031 std::cout <<
m_className <<
"::SetIonMobility:\n Ion mobility at E = "
1034 <<
m_bAngles[ia] <<
" set to " << mu <<
" cm2/(V ns).\n";
1040 const std::vector<double>& mobs) {
1041 if (efields.size() != mobs.size()) {
1043 <<
" E-field and mobility arrays have different sizes.\n";
1052 for (
size_t i = 0; i < nE; ++i) {
1059 for (
size_t i = 0; i < nA; ++i) {
1060 for (
size_t j = 0; j < nB; ++j) {
1061 for (
size_t k = 0; k < nE; ++k) {
1071 const std::string& high) {
1076 const std::string& high) {
1081 const std::string& high) {
1086 const std::string& high) {
1091 const std::string& high) {
1096 const std::string& high) {
1101 const std::string& high,
1102 std::pair<unsigned int, unsigned int>& extr,
1103 const std::string& fcn) {
1108 std::cerr <<
m_className <<
"::SetExtrapolationMethod" << fcn <<
":\n"
1109 <<
" Unknown extrapolation method (" << low <<
")\n";
1115 std::cerr <<
m_className <<
"::SetExtrapolationMethod" << fcn <<
":\n"
1116 <<
" Unknown extrapolation method (" << high <<
")\n";
1122 std::transform(str.begin(), str.end(), str.begin(), toupper);
1124 if (str ==
"CONST" || str ==
"CONSTANT") {
1126 }
else if (str ==
"LIN" || str ==
"LINEAR") {
1128 }
else if (str ==
"EXP" || str ==
"EXPONENTIAL") {
1138 const std::vector<std::vector<std::vector<double> > >& tab)
const {
1140 if (tab.empty())
return 0;
1144 for (
size_t i = 0; i < nE; ++i) {
1146 for (
size_t k = 0; k < nA; ++k) {
1147 for (
size_t j = 0; j < nB; ++j) {
1148 if (tab[k][j][i] < -20.) {
1155 if (below)
continue;
1186 const double bx,
const double by,
const double bz,
1187 const double e,
const double b)
const {
1188 const double eb = e * b;
1190 const double einb = fabs(ex * bx + ey * by + ez * bz);
1191 if (einb > 0.2 * eb) {
1192 const double ebxy = ex * by - ey * bx;
1193 const double ebxz = ex * bz - ez * bx;
1194 const double ebzy = ez * by - ey * bz;
1196 std::min(1., sqrt(ebxy * ebxy + ebxz * ebxz + ebzy * ebzy) / eb));
1198 return acos(std::min(1., einb / eb));
1202 const double e,
const double b,
const double a,
1203 const std::vector<std::vector<std::vector<double> > >& table,
double& y,
1204 const unsigned int intp,
1205 const std::pair<unsigned int, unsigned int>& extr)
const {
1206 if (table.empty()) {
1222 const double e,
const std::vector<double>& table,
1223 const std::vector<double>& fields,
const unsigned int intpMeth,
1224 const std::pair<unsigned int, unsigned int>& extr)
const {
1229 const auto nSizeTable = fields.size();
1231 if (e < 0. || nSizeTable < 1)
return 0.;
1235 if (nSizeTable == 1) {
1238 }
else if (e < fields[0]) {
1240 if (fields[0] >= fields[1]) {
1243 std::cerr <<
" First two field values coincide.\n";
1244 std::cerr <<
" No extrapolation to lower fields.\n";
1247 }
else if (extr.first == 1) {
1249 const double extr4 = (table[1] - table[0]) / (fields[1] - fields[0]);
1250 const double extr3 = table[0] - extr4 * fields[0];
1251 result = extr3 + extr4 * e;
1252 }
else if (extr.first == 2) {
1254 const double extr4 = log(table[1] / table[0]) / (fields[1] - fields[0]);
1255 const double extr3 = log(table[0] - extr4 * fields[0]);
1256 result = std::exp(std::min(50., extr3 + extr4 * e));
1260 }
else if (e > fields[nSizeTable - 1]) {
1262 if (fields[nSizeTable - 1] <= fields[nSizeTable - 2]) {
1265 std::cerr <<
" Last two field values coincide.\n";
1266 std::cerr <<
" No extrapolation to higher fields.\n";
1268 result = table[nSizeTable - 1];
1269 }
else if (extr.second == 1) {
1271 const double extr2 = (table[nSizeTable - 1] - table[nSizeTable - 2]) /
1272 (fields[nSizeTable - 1] - fields[nSizeTable - 2]);
1273 const double extr1 =
1274 table[nSizeTable - 1] - extr2 * fields[nSizeTable - 1];
1275 result = extr1 + extr2 * e;
1276 }
else if (extr.second == 2) {
1278 const double extr2 = log(table[nSizeTable - 1] / table[nSizeTable - 2]) /
1279 (fields[nSizeTable - 1] - fields[nSizeTable - 2]);
1280 const double extr1 =
1281 log(table[nSizeTable - 1]) - extr2 * fields[nSizeTable - 1];
1282 result = exp(std::min(50., extr1 + extr2 * e));
1284 result = table[nSizeTable - 1];
1296 std::vector<std::vector<std::vector<double> > >& tab,
1298 if (nE == 0 || nB == 0 || nA == 0) {
1299 std::cerr <<
m_className <<
"::Init: Invalid grid.\n";
1303 nA, std::vector<std::vector<double> >(nB, std::vector<double>(nE, val)));
1307 const size_t nE,
const size_t nB,
const size_t nA,
const size_t nT,
1308 std::vector<std::vector<std::vector<std::vector<double> > > >& tab,
1310 if (nE == 0 || nB == 0 || nA == 0 || nT == 0) {
1311 std::cerr <<
m_className <<
"::Init: Invalid grid.\n";
1315 tab.assign(nT, std::vector<std::vector<std::vector<double> > >(
1316 nA, std::vector<std::vector<double> >(
1317 nB, std::vector<double>(nE, val))));
virtual double IonMobility()
Low-field mobility [cm2 V-1 ns-1].
void ResetHoleAttachment()
virtual void GetComponent(const unsigned int i, std::string &label, double &f)
Get the name and fraction of a given component.
bool Interpolate(const double e, const double b, const double a, const std::vector< std::vector< std::vector< double > > > &table, double &y, const unsigned int intp, const std::pair< unsigned int, unsigned int > &extr) const
virtual bool GetPhotonCollision(const double e, int &type, int &level, double &e1, double &ctheta, int &nsec, double &esec)
virtual double UnScaleElectricField(const double e) const
void ResetElectronAttachment()
virtual double GetMassDensity() const
Get the mass density [g/cm3].
std::vector< double > m_bFields
virtual void GetElectronMomentum(const double e, double &px, double &py, double &pz, int &band)
void SetTemperature(const double t)
Set the temperature [K].
void ResetElectronLorentzAngle()
virtual bool HoleTownsend(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &alpha)
Ionisation coefficient [cm-1].
virtual double ScaleAttachment(const double eta) const
bool GetEntry(const size_t i, const size_t j, const size_t k, const std::string &fcn, const std::vector< std::vector< std::vector< double > > > &tab, double &val) const
void SetExtrapolationMethodIonDissociation(const std::string &extrLow, const std::string &extrHigh)
void SetInterpolationMethodIonDissociation(const unsigned int intrp)
double Interpolate1D(const double e, const std::vector< double > &table, const std::vector< double > &fields, const unsigned int intpMeth, const std::pair< unsigned int, unsigned int > &extr) const
double GetAngle(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, const double e, const double b) const
virtual double ScaleDiffusion(const double d) const
virtual double ElectronMobility()
Low-field mobility [cm2 V-1 ns-1].
virtual bool HoleVelocity(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &vx, double &vy, double &vz)
Drift velocity [cm / ns].
virtual double ScaleLorentzAngle(const double lor) const
virtual bool ElectronLorentzAngle(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &lor)
Lorentz angle.
bool Diffusion(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, const std::vector< std::vector< std::vector< double > > > &difL, const std::vector< std::vector< std::vector< double > > > &difT, double &dl, double &dt) const
std::vector< std::vector< std::vector< double > > > m_eAlp
std::vector< std::vector< std::vector< double > > > m_hAlp
void ResetIonDissociation()
virtual bool GetDielectricFunction(const double e, double &eps1, double &eps2, const unsigned int i=0)
Get the complex dielectric function at a given energy.
virtual void SetNumberDensity(const double n)
Set the number density [cm-3].
virtual bool ElectronVelocity(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &vx, double &vy, double &vz)
Drift velocity [cm / ns].
virtual bool IonVelocity(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &vx, double &vy, double &vz)
Drift velocity [cm / ns].
std::pair< unsigned int, unsigned int > m_extrAtt
void SetExtrapolationMethodTownsend(const std::string &extrLow, const std::string &extrHigh)
virtual void SetAtomicNumber(const double z)
Set the effective atomic number.
virtual bool GetElectronCollision(const double e, int &type, int &level, double &e1, double &dx, double &dy, double &dz, std::vector< std::pair< int, double > > &secondaries, int &ndxc, int &band)
Sample the collision type. Update energy and direction vector.
std::vector< std::vector< std::vector< double > > > m_iDifT
void SetExtrapolationMethodIonMobility(const std::string &extrLow, const std::string &extrHigh)
std::pair< unsigned int, unsigned int > m_extrVel
virtual double ScaleElectricField(const double e) const
virtual double ScaleDiffusionTensor(const double d) const
std::vector< std::vector< std::vector< double > > > m_hDifL
virtual double GetElectronNullCollisionRate(const int band=0)
Null-collision rate [ns-1].
size_t SetThreshold(const std::vector< std::vector< std::vector< double > > > &tab) const
std::vector< std::vector< std::vector< double > > > m_eVelE
std::vector< std::vector< std::vector< double > > > m_eVelX
std::vector< std::vector< std::vector< double > > > m_eDifL
void Init(const size_t nE, const size_t nB, const size_t nA, std::vector< std::vector< std::vector< double > > > &tab, const double val)
virtual double ScaleTownsend(const double alpha) const
virtual double GetPhotonCollisionRate(const double e)
void SetDielectricConstant(const double eps)
Set the relative static dielectric constant.
virtual bool GetDeexcitationProduct(const unsigned int i, double &t, double &s, int &type, double &energy) const
virtual double GetElectronCollisionRate(const double e, const int band=0)
Collision rate [ns-1] for given electron energy.
bool GetExtrapolationIndex(std::string str, unsigned int &nb) const
void SetInterpolationMethodVelocity(const unsigned int intrp)
Set the degree of polynomial interpolation (usually 2).
virtual bool ElectronDiffusion(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &dl, double &dt)
Longitudinal and transverse diffusion coefficients [cm1/2].
void SetInterpolationMethodDiffusion(const unsigned int intrp)
void SetExtrapolationMethodDiffusion(const std::string &extrLow, const std::string &extrHigh)
std::vector< double > m_eFields
void GetFieldGrid(std::vector< double > &efields, std::vector< double > &bfields, std::vector< double > &angles)
Get the fields and E-B angles used in the transport tables.
std::vector< std::vector< std::vector< double > > > m_hDifT
virtual bool ElectronTownsend(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &alpha)
Ionisation coefficient [cm-1].
void ResetElectronDiffusion()
void SetFieldGrid(double emin, double emax, const size_t ne, bool logE, double bmin=0., double bmax=0., const size_t nb=1, double amin=HalfPi, double amax=HalfPi, const size_t na=1)
Set the range of fields to be covered by the transport tables.
virtual bool GetOpticalDataRange(double &emin, double &emax, const unsigned int i=0)
Get the energy range [eV] of the available optical data.
std::vector< std::vector< std::vector< double > > > m_eAtt
virtual void SetMassDensity(const double rho)
Set the mass density [g/cm3].
virtual double ScaleDissociation(const double diss) const
bool Alpha(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, const std::vector< std::vector< std::vector< double > > > &tab, unsigned int intp, const unsigned int thr, const std::pair< unsigned int, unsigned int > &extr, double &alpha) const
std::vector< double > m_bAngles
std::vector< std::vector< std::vector< double > > > m_iDifL
std::vector< std::vector< std::vector< double > > > m_hVelE
std::vector< std::vector< std::vector< double > > > m_eLor
std::vector< std::vector< std::vector< double > > > m_eDifT
virtual double GetElectronEnergy(const double px, const double py, const double pz, double &vx, double &vy, double &vz, const int band=0)
Dispersion relation (energy vs. wave vector)
void SetInterpolationMethodIonMobility(const unsigned int intrp)
void SetExtrapolationMethodVelocity(const std::string &extrLow, const std::string &extrHigh)
virtual bool ElectronAttachment(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &eta)
Attachment coefficient [cm-1].
virtual double HoleMobility()
Low-field mobility [cm2 V-1 ns-1].
std::pair< unsigned int, unsigned int > m_extrDis
std::vector< std::vector< std::vector< double > > > m_hAtt
void SetPressure(const double p)
void SetExtrapolationMethod(const std::string &low, const std::string &high, std::pair< unsigned int, unsigned int > &extr, const std::string &fcn)
std::pair< unsigned int, unsigned int > m_extrAlp
std::vector< std::vector< std::vector< double > > > m_eVelB
virtual void SetAtomicWeight(const double a)
Set the effective atomic weight.
void SetExtrapolationMethodAttachment(const std::string &extrLow, const std::string &extrHigh)
std::pair< unsigned int, unsigned int > m_extrLor
unsigned int m_nComponents
std::pair< unsigned int, unsigned int > m_extrDif
void SetInterpolationMethodAttachment(const unsigned int intrp)
virtual bool HoleDiffusion(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &dl, double &dt)
Longitudinal and transverse diffusion coefficients [cm1/2].
virtual bool IonDissociation(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &diss)
Dissociation coefficient.
virtual void ResetTables()
Reset all tables of transport parameters.
std::vector< std::vector< std::vector< double > > > m_hVelX
virtual ~Medium()
Destructor.
std::pair< unsigned int, unsigned int > m_extrMob
void Clone(std::vector< std::vector< std::vector< double > > > &tab, const std::vector< double > &efields, const std::vector< double > &bfields, const std::vector< double > &angles, const unsigned int intp, const std::pair< unsigned int, unsigned int > &extr, const double init, const std::string &label)
void ResetHoleDiffusion()
std::vector< std::vector< std::vector< std::vector< double > > > > m_eDifM
std::vector< std::vector< std::vector< double > > > m_hVelB
bool Velocity(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, const std::vector< std::vector< std::vector< double > > > &velE, const std::vector< std::vector< std::vector< double > > > &velB, const std::vector< std::vector< std::vector< double > > > &velX, const double q, double &vx, double &vy, double &vz) const
std::vector< std::vector< std::vector< std::vector< double > > > > m_hDifM
std::vector< std::vector< std::vector< double > > > m_iMob
bool SetEntry(const size_t i, const size_t j, const size_t k, const std::string &fcn, std::vector< std::vector< std::vector< double > > > &tab, const double val)
void ResetElectronTownsend()
virtual bool HoleAttachment(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &eta)
Attachment coefficient [cm-1].
void ResetElectronVelocity()
void SetInterpolationMethodTownsend(const unsigned int intrp)
virtual bool GetPhotoAbsorptionCrossSection(const double e, double &sigma, const unsigned int i=0)
virtual bool IonDiffusion(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &dl, double &dt)
Longitudinal and transverse diffusion coefficients [cm1/2].
std::vector< std::vector< std::vector< double > > > m_iDis
bool SetIonMobility(const std::vector< double > &fields, const std::vector< double > &mobilities)
bool Boxin3(const std::vector< std::vector< std::vector< double > > > &value, const std::vector< double > &xAxis, const std::vector< double > &yAxis, const std::vector< double > &zAxis, const int nx, const int ny, const int nz, const double xx, const double yy, const double zz, double &f, const int iOrder)
double Divdif(const std::vector< double > &f, const std::vector< double > &a, int nn, double x, int mm)
void RndmDirection(double &dx, double &dy, double &dz, const double length=1.)
Draw a random (isotropic) direction vector.