Skip to content

Commit 9bc21f8

Browse files
Prevent plasma ionization past the atomic number (#1343)
1 parent 9d9ffdc commit 9bc21f8

5 files changed

Lines changed: 54 additions & 44 deletions

File tree

src/particles/plasma/PlasmaParticleContainer.H

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ public:
279279
bool m_can_field_ionize = false; /**< whether this plasma can ionize from the field */
280280
bool m_can_laser_ionize = false; /**< whether this plasma can ionize from a laser */
281281
int m_init_ion_lev = -1; /**< initial Ion level of each particle */
282+
int m_max_ion_lev = 0; /**< maximum ionization level */
282283
std::string m_product_name = ""; /**< name of Ionization product plasma */
283284
PlasmaParticleContainer* m_product_pc = nullptr; /**< Ionization product plasma */
284285
/** to calculate Ionization probability with ADK formula */

src/particles/plasma/PlasmaParticleContainer.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ IonizationModule (const int lev,
418418
amrex::Real* AMREX_RESTRICT adk_prefactor = m_adk_prefactor.data();
419419
amrex::Real* AMREX_RESTRICT adk_exp_prefactor = m_adk_exp_prefactor.data();
420420
amrex::Real* AMREX_RESTRICT adk_power = m_adk_power.data();
421+
const int max_ion_lev = m_max_ion_lev;
421422

422423
long num_ions = ptile_ion.numParticles();
423424

@@ -466,6 +467,9 @@ IonizationModule (const int lev,
466467
const amrex::Real gamma_psi = plasma_gamma_psi(ux, uy, 1._rt / psi,
467468
/* Assumes Aabssq == 0 */ 0._rt);
468469
const int ion_lev_loc = ptd_ion.idata(PlasmaIdx::ion_lev)[ip];
470+
if (ion_lev_loc >= max_ion_lev) {
471+
return;
472+
}
469473
// gamma / (psi + 1) to complete dt for QSA
470474
amrex::Real w_dtau = gamma_psi * adk_prefactor[ion_lev_loc] *
471475
std::pow(Ep, adk_power[ion_lev_loc]) *
@@ -611,6 +615,7 @@ LaserIonization (const int islice,
611615
amrex::Real* AMREX_RESTRICT laser_adk_prefactor = m_laser_adk_prefactor.data();
612616
amrex::Real* AMREX_RESTRICT laser_dp_prefactor = m_laser_dp_prefactor.data();
613617
amrex::Real* AMREX_RESTRICT laser_dp_second_prefactor = m_laser_dp_second_prefactor.data();
618+
const int max_ion_lev = m_max_ion_lev;
614619

615620
long num_ions = ptile_ion.numParticles();
616621

@@ -660,6 +665,9 @@ LaserIonization (const int islice,
660665
const amrex::Real gamma_psi = plasma_gamma_psi(ux, uy, 1._rt / psi,
661666
/* Assumes Aabssq == 0 */ 0._rt);
662667
const int ion_lev_loc = ptd_ion.idata(PlasmaIdx::ion_lev)[ip];
668+
if (ion_lev_loc >= max_ion_lev) {
669+
return;
670+
}
663671
// gamma / (psi + 1) to complete dt for QSA
664672
amrex::Real w_dtau_dc = gamma_psi * adk_prefactor[ion_lev_loc] *
665673
std::pow(Ep, adk_power[ion_lev_loc]) *

src/particles/plasma/PlasmaParticleContainerInit.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ InitIonizationModule (const amrex::Geometry& geom, const amrex::Real background_
426426
// Get atomic number and ionization energies from file
427427
const int ion_element_id = ion_map_ids[physical_element];
428428
const int ion_atomic_number = ion_atomic_numbers[ion_element_id];
429+
m_max_ion_lev = ion_atomic_number;
429430
amrex::Vector<amrex::Real> h_ionization_energies(ion_atomic_number);
430431
const int offset = ion_energy_offsets[ion_element_id];
431432
for(int i=0; i<ion_atomic_number; i++){
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
{
22
"lev=0": {
3-
"Bx": 2682248.7024631,
4-
"By": 2693948.2701062,
5-
"Bz": 461542.25627809,
6-
"Ex": 2027829034919000.0,
7-
"ExmBy": 1615808683503300.0,
8-
"Ey": 2028075445665300.0,
9-
"EypBx": 1618198281458700.0,
10-
"Ez": 661283577718300.0,
11-
"Psi": 10769981625.527,
12-
"Sx": 7.6153143258378e+17,
13-
"Sy": 7.6749661894861e+17,
14-
"chi": 2095164842379900.0,
15-
"jx": 5.1803326128365e+17,
16-
"jx_beam": 231581099135240.0,
17-
"jy": 5.166188820914e+17,
18-
"jy_beam": 230138000597450.0,
19-
"jz_beam": 1.6907142961473e+17,
20-
"rhomjz": 8996307093.0909
3+
"Bx": 2620311.1374515,
4+
"By": 2635709.7531506,
5+
"Bz": 414833.05353295,
6+
"Ex": 2012939150389200.0,
7+
"ExmBy": 1596237863501100.0,
8+
"Ey": 1985459967332800.0,
9+
"EypBx": 1577025752807400.0,
10+
"Ez": 679659182354100.0,
11+
"Psi": 10548202179.363,
12+
"Sx": 7.6385240482099e+17,
13+
"Sy": 7.6031507997545e+17,
14+
"chi": 2108090067779600.0,
15+
"jx": 5.1771260837627e+17,
16+
"jx_beam": 229049530186220.0,
17+
"jy": 5.1922551204841e+17,
18+
"jy_beam": 224659467158600.0,
19+
"jz_beam": 1.6907142196764e+17,
20+
"rhomjz": 9012917997.7387
2121
},
2222
"beam": {
2323
"charge": 1.127932350336e-16,
2424
"id": 248160,
2525
"mass": 6.4130061345856e-28,
26-
"x": 0.00024861156909874,
27-
"y": 0.00024733653838739,
28-
"z": 0.014359549367759,
29-
"ux": 3002.9712551376,
30-
"uy": 3008.114106705,
31-
"uz": 1386735.4183111,
26+
"x": 0.00024635902135382,
27+
"y": 0.00024286960511978,
28+
"z": 0.014359553378628,
29+
"ux": 3013.9898183181,
30+
"uy": 3014.5223974211,
31+
"uz": 1386709.9483869,
3232
"w": 825000000.0
3333
}
3434
}

tests/checksum/benchmarks_json/laser_ionization.1Rank.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
{
22
"lev=0": {
3-
"Bx": 3.5819859018319,
4-
"By": 3.7269958544827,
5-
"Bz": 2204.1195988099,
6-
"Ex": 1117325248.1712,
3+
"Bx": 3.7149515661811,
4+
"By": 3.7865224175932,
5+
"Bz": 2314.4198911339,
6+
"Ex": 1135170862.8424,
77
"ExmBy": 0.0,
8-
"Ey": 1073852358.0315,
8+
"Ey": 1113714461.3764,
99
"EypBx": 0.0,
10-
"Ez": 775468649901.41,
10+
"Ez": 707934921502.67,
1111
"Psi": 0.0,
12-
"Sx": 308477798484.84,
13-
"Sy": 326849048142.86,
12+
"Sx": 316753118383.02,
13+
"Sy": 324030818911.92,
1414
"aabs": 0.46877495720552,
15-
"chi": 265988685160760.0,
16-
"jx": 700828092230540.0,
15+
"chi": 267414764966510.0,
16+
"jx": 702652162565720.0,
1717
"jx_beam": 0.0,
1818
"jy": 0.0,
1919
"jy_beam": 0.0,
2020
"jz_beam": 0.0,
21-
"laserChi": 907831282357500.0,
21+
"laserChi": 909177572466960.0,
2222
"laserEnvelope": 74.898701643489,
23-
"rho_elec": 1202810276.6959,
24-
"rho_ion": 1202806069.8845,
23+
"rho_elec": 1209259053.802,
24+
"rho_ion": 1209254830.8364,
2525
"rhomjz": 0.0,
26-
"ux^2_elec": 0.26699411903602,
26+
"ux^2_elec": 0.26780158956573,
2727
"ux^2_ion": 0.0,
28-
"ux_elec": 83.376249717662,
28+
"ux_elec": 83.593256064089,
2929
"ux_ion": 0.0,
3030
"uy^2_elec": 0.0,
3131
"uy^2_ion": 0.0,
3232
"uy_elec": 0.0,
3333
"uy_ion": 0.0,
34-
"uz^2_elec": 1.6555627362415e-06,
35-
"uz^2_ion": 1.4839081226415e-20,
36-
"uz_elec": 0.14984820708954,
37-
"uz_ion": 4.8429931176486e-09,
38-
"w_elec": 480470478299.92,
34+
"uz^2_elec": 1.6568753834647e-06,
35+
"uz^2_ion": 1.5025085926483e-20,
36+
"uz_elec": 0.15044101093153,
37+
"uz_ion": 4.8989912126984e-09,
38+
"w_elec": 483046484939.32,
3939
"w_ion": 1400000000000.1,
4040
"|a^2|": 0.46877495720552
4141
}

0 commit comments

Comments
 (0)