From 56158d6ddf42e5339b8ed6662508309197c9782d Mon Sep 17 00:00:00 2001 From: Eya Dammak Date: Fri, 17 Jan 2025 14:36:48 +0100 Subject: [PATCH 01/97] new prefactor for calculation of width_p for momentum in linear --- src/particles/plasma/PlasmaParticleContainerInit.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/particles/plasma/PlasmaParticleContainerInit.cpp b/src/particles/plasma/PlasmaParticleContainerInit.cpp index 189247bb5e..fcc94d0075 100644 --- a/src/particles/plasma/PlasmaParticleContainerInit.cpp +++ b/src/particles/plasma/PlasmaParticleContainerInit.cpp @@ -431,11 +431,13 @@ InitIonizationModule (const amrex::Geometry& geom, const amrex::Real background_ m_adk_prefactor.resize(ion_atomic_number); m_adk_exp_prefactor.resize(ion_atomic_number); m_laser_adk_prefactor.resize(ion_atomic_number); + m_laser_dp_prefactor.resize(ion_atomic_number); amrex::Gpu::PinnedVector h_adk_power(ion_atomic_number); amrex::Gpu::PinnedVector h_adk_prefactor(ion_atomic_number); amrex::Gpu::PinnedVector h_adk_exp_prefactor(ion_atomic_number); amrex::Gpu::PinnedVector h_laser_adk_prefactor(ion_atomic_number); + amrex::Gpu::PinnedVector h_laser_dp_prefactor(ion_atomic_number); for (int i=0; i Date: Fri, 17 Jan 2025 14:46:32 +0100 Subject: [PATCH 02/97] Update PlasmaParticleContainer.cpp --- .../plasma/PlasmaParticleContainer.cpp | 79 +++++++++++++++---- 1 file changed, 65 insertions(+), 14 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 31fa883973..2a8665142d 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -426,7 +426,7 @@ IonizationModule (const int lev, const long pidx = pid + old_size; // Copy ion data to new electron - amrex::ParticleIDWrapper{idcpu_elec[pidx]} = 2; // sets the ionized electron ID to 2 (valid/invalid) for the new electron + amrex::ParticleIDWrapper{idcpu_elec[pidx]} = 2; // sets the ionized electron ID to 2 (valid/invalid) for the ionized electrons amrex::ParticleCPUWrapper{idcpu_elec[pidx]} = lev; // current level arrdata_elec[PlasmaIdx::x ][pidx] = arrdata_ion[PlasmaIdx::x ][ip]; arrdata_elec[PlasmaIdx::y ][pidx] = arrdata_ion[PlasmaIdx::y ][ip]; @@ -623,30 +623,81 @@ LaserIonization (const int islice, amrex::Gpu::DeviceScalar ip_elec(0); uint32_t * AMREX_RESTRICT p_ip_elec = ip_elec.dataPtr(); - // This kernel adds the new ionized electrons to the Plasma Particle Container - amrex::ParallelFor(num_ions, - [=] AMREX_GPU_DEVICE (long ip) { + // This kernel supports multiple deposition orders (0, 1, 2, 3) at compile time + // and calculates the momentum of the ionized electron based on equations (B8) and (B9) + // from the Massimo, 2020 article. It computes the energy of the emitted electron + // and assigns the resulting properties (momentum, position, etc.) to the new electrons + // created in the plasma container. + amrex::AnyCTO( + amrex::TypeList< + amrex::CompileTimeOptions<0, 1, 2, 3> + >{}, { + Hipace::m_depos_order_xy + }, + [&] (auto cto_func) { + amrex::ParallelForRNG(num_ions, cto_func); + }, + [=] AMREX_GPU_DEVICE (long ip, const amrex::RandomEngine& engine, + auto depos_order_xy) { + + // Avoid temp slice + const amrex::Real xp = x_prev[ip]; + const amrex::Real yp = y_prev[ip]; + + if (amrex::ConstParticleIDWrapper(idcpup[ip]) < 0 || + !laser_bounds.contains(xp, yp)) return; + + Complex A = 0; + Complex A_dx = 0; + Complex A_dzeta = 0; + + doLaserGatherShapeN(xp, yp, A, A_dx, A_dzeta, laser_arr, + dx_inv, dy_inv, dzeta_inv, x_pos_offset, y_pos_offset); + const Complex Et = I * A * omega0 + A_dzeta * phys_const.c; // transverse component + const Complex El = - A_dx * phys_const.c; // longitudinal component + + amrex::Real Ep = std::sqrt( amrex::abs(Et*Et) + amrex::abs(El*El) ); + Ep *= phys_const.m_e * phys_const.c / phys_const.q_e; + Ep *= E0; + + amrex::Real ux, uy, uz; + const int ion_lev_loc = ion_lev[ip]; + + if (linear_polarization) { + amrex::Real width_p; + amrex::Real p_pol; + width_p = std::sqrt(laser_dp_prefactor[ion_lev_loc] * Ep) * std::sqrt(amrex::abs(A*A)); // equation (4) art. Massimo + p_pol = amrex::RandomNormal(0.0, width_p, engine); + ux = p_pol; + uy = 0._rt; + uz = (amrex::abs(A * A) / 4. + p_pol * p_pol / 2.); + } else { + amrex::Real angle; + angle = amrex::Random(engine) * 2 * MathConst::pi; + ux = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::cos(angle); + uy = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::sin(angle); + uz = amrex::abs(A*A) / 2.; + } + if(p_ion_mask[ip] != 0) { - const long pid = amrex::Gpu::Atomic::Add( p_ip_elec, 1u ); // ensures thread-safe access when incrementing `p_ip_elec` + const long pid = amrex::Gpu::Atomic::Add( p_ip_elec, 1u ); const long pidx = pid + old_size; - // Copy ion data to new electron - amrex::ParticleIDWrapper{idcpu_elec[pidx]} = 2; // sets the ionized electron ID to 2 (valid/invalid) for the new electron + amrex::ParticleIDWrapper{idcpu_elec[pidx]} = 2; // sets the ionized electron ID to 2 (valid/invalid) for the ionized electrons amrex::ParticleCPUWrapper{idcpu_elec[pidx]} = amrex::ParticleCPUWrapper{idcpu_ion[pidx]}; // current level arrdata_elec[PlasmaIdx::x ][pidx] = arrdata_ion[PlasmaIdx::x ][ip]; arrdata_elec[PlasmaIdx::y ][pidx] = arrdata_ion[PlasmaIdx::y ][ip]; - arrdata_elec[PlasmaIdx::w ][pidx] = arrdata_ion[PlasmaIdx::w ][ip]; - arrdata_elec[PlasmaIdx::ux ][pidx] = 0._rt; - arrdata_elec[PlasmaIdx::uy ][pidx] = 0._rt; - arrdata_elec[PlasmaIdx::psi ][pidx] = 1._rt; + arrdata_elec[PlasmaIdx::ux ][pidx] = ux * phys_const.c; + arrdata_elec[PlasmaIdx::uy ][pidx] = uy * phys_const.c; + arrdata_elec[PlasmaIdx::psi ][pidx] = std::sqrt(1._rt + ux*ux + uy*uy + uz*uz)-uz; //psi = gamma - uz arrdata_elec[PlasmaIdx::x_prev ][pidx] = arrdata_ion[PlasmaIdx::x_prev][ip]; arrdata_elec[PlasmaIdx::y_prev ][pidx] = arrdata_ion[PlasmaIdx::y_prev][ip]; - arrdata_elec[PlasmaIdx::ux_half_step ][pidx] = 0._rt; - arrdata_elec[PlasmaIdx::uy_half_step ][pidx] = 0._rt; - arrdata_elec[PlasmaIdx::psi_half_step][pidx] = 1._rt; + arrdata_elec[PlasmaIdx::ux_half_step ][pidx] = ux * phys_const.c; + arrdata_elec[PlasmaIdx::uy_half_step ][pidx] = uy * phys_const.c; + arrdata_elec[PlasmaIdx::psi_half_step][pidx] = std::sqrt(1._rt + ux*ux + uy*uy + uz*uz)-uz; #ifdef HIPACE_USE_AB5_PUSH #ifdef AMREX_USE_GPU #pragma unroll From 089343f8c4492ed28827cc6cb22e6b9970b49e80 Mon Sep 17 00:00:00 2001 From: Eya Dammak Date: Fri, 17 Jan 2025 14:48:03 +0100 Subject: [PATCH 03/97] style --- src/particles/plasma/PlasmaParticleContainerInit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainerInit.cpp b/src/particles/plasma/PlasmaParticleContainerInit.cpp index fcc94d0075..13a9061ab8 100644 --- a/src/particles/plasma/PlasmaParticleContainerInit.cpp +++ b/src/particles/plasma/PlasmaParticleContainerInit.cpp @@ -450,7 +450,7 @@ InitIonizationModule (const amrex::Geometry& geom, const amrex::Real background_ * std::pow(2*std::pow((Uion/UH),3./2.)*Ea,2*n_eff - 1); h_adk_exp_prefactor[i] = -2./3. * std::pow( Uion/UH,3./2.) * Ea; h_laser_adk_prefactor[i] = (3./MathConst::pi) * std::pow(Uion/UH, -3./2.) / Ea; - h_laser_dp_prefactor[i] = 3./2. * std::pow(Uion/UH, -3./2.) / Ea; + h_laser_dp_prefactor[i] = 3./2. * std::pow(Uion/UH, -3./2.) / Ea; } amrex::Gpu::copy(amrex::Gpu::hostToDevice, From a3ff98402fdd32a502d2451060dc3fd9fc120421 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 17 Jan 2025 14:49:23 +0100 Subject: [PATCH 04/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 2a8665142d..24c01c14bd 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -681,7 +681,7 @@ LaserIonization (const int islice, } if(p_ion_mask[ip] != 0) { - const long pid = amrex::Gpu::Atomic::Add( p_ip_elec, 1u ); + const long pid = amrex::Gpu::Atomic::Add( p_ip_elec, 1u ); // ensures thread-safe access when incrementing `p_ip_elec` const long pidx = pid + old_size; // Copy ion data to new electron amrex::ParticleIDWrapper{idcpu_elec[pidx]} = 2; // sets the ionized electron ID to 2 (valid/invalid) for the ionized electrons From 8436c64fd70ed41aed14496d7eed8130f962cf4c Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 17 Jan 2025 15:09:51 +0100 Subject: [PATCH 05/97] Update PlasmaParticleContainer.H --- src/particles/plasma/PlasmaParticleContainer.H | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/particles/plasma/PlasmaParticleContainer.H b/src/particles/plasma/PlasmaParticleContainer.H index 30b177d99f..dafeddbc40 100644 --- a/src/particles/plasma/PlasmaParticleContainer.H +++ b/src/particles/plasma/PlasmaParticleContainer.H @@ -212,6 +212,8 @@ public: amrex::Gpu::DeviceVector m_adk_power; /** to calculate laser Ionization probability with ADK formula */ amrex::Gpu::DeviceVector m_laser_adk_prefactor; + /** to calculate laser ionization momentum width for linear polarization */ + amrex::Gpu::DeviceVector m_laser_dp_prefactor; // plasma sorting/reordering: From b52344798baaa92696870f01b259a1103d4196df Mon Sep 17 00:00:00 2001 From: Eya Dammak Date: Fri, 17 Jan 2025 15:12:32 +0100 Subject: [PATCH 06/97] style --- src/particles/plasma/PlasmaParticleContainer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 24c01c14bd..5962aa543d 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -650,7 +650,7 @@ LaserIonization (const int islice, Complex A = 0; Complex A_dx = 0; Complex A_dzeta = 0; - + doLaserGatherShapeN(xp, yp, A, A_dx, A_dzeta, laser_arr, dx_inv, dy_inv, dzeta_inv, x_pos_offset, y_pos_offset); @@ -659,7 +659,7 @@ LaserIonization (const int islice, amrex::Real Ep = std::sqrt( amrex::abs(Et*Et) + amrex::abs(El*El) ); Ep *= phys_const.m_e * phys_const.c / phys_const.q_e; - Ep *= E0; + Ep *= E0; amrex::Real ux, uy, uz; const int ion_lev_loc = ion_lev[ip]; @@ -676,7 +676,7 @@ LaserIonization (const int islice, amrex::Real angle; angle = amrex::Random(engine) * 2 * MathConst::pi; ux = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::cos(angle); - uy = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::sin(angle); + uy = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::sin(angle); uz = amrex::abs(A*A) / 2.; } From c50df2d771233c1080e59753d60bbf70fbd4818a Mon Sep 17 00:00:00 2001 From: Eya Dammak Date: Fri, 17 Jan 2025 15:14:12 +0100 Subject: [PATCH 07/97] style --- src/particles/plasma/PlasmaParticleContainer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 5962aa543d..42ee551735 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -639,7 +639,7 @@ LaserIonization (const int islice, }, [=] AMREX_GPU_DEVICE (long ip, const amrex::RandomEngine& engine, auto depos_order_xy) { - + // Avoid temp slice const amrex::Real xp = x_prev[ip]; const amrex::Real yp = y_prev[ip]; @@ -650,7 +650,7 @@ LaserIonization (const int islice, Complex A = 0; Complex A_dx = 0; Complex A_dzeta = 0; - + doLaserGatherShapeN(xp, yp, A, A_dx, A_dzeta, laser_arr, dx_inv, dy_inv, dzeta_inv, x_pos_offset, y_pos_offset); @@ -663,15 +663,15 @@ LaserIonization (const int islice, amrex::Real ux, uy, uz; const int ion_lev_loc = ion_lev[ip]; - + if (linear_polarization) { amrex::Real width_p; amrex::Real p_pol; - width_p = std::sqrt(laser_dp_prefactor[ion_lev_loc] * Ep) * std::sqrt(amrex::abs(A*A)); // equation (4) art. Massimo + width_p = std::sqrt(laser_dp_prefactor[ion_lev_loc] * Ep) * std::sqrt(amrex::abs(A*A)); // equation (4) art. Massimo p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; uy = 0._rt; - uz = (amrex::abs(A * A) / 4. + p_pol * p_pol / 2.); + uz = (amrex::abs(A * A) / 4. + p_pol * p_pol / 2.); } else { amrex::Real angle; angle = amrex::Random(engine) * 2 * MathConst::pi; @@ -679,7 +679,7 @@ LaserIonization (const int islice, uy = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::sin(angle); uz = amrex::abs(A*A) / 2.; } - + if(p_ion_mask[ip] != 0) { const long pid = amrex::Gpu::Atomic::Add( p_ip_elec, 1u ); // ensures thread-safe access when incrementing `p_ip_elec` const long pidx = pid + old_size; From 37b39af7b9434be1f1ef26a318ebf5524ce9603c Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 17 Jan 2025 15:17:25 +0100 Subject: [PATCH 08/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 42ee551735..e6f96c0fc0 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -531,6 +531,7 @@ LaserIonization (const int islice, amrex::Real* AMREX_RESTRICT adk_exp_prefactor = m_adk_exp_prefactor.data(); amrex::Real* AMREX_RESTRICT adk_power = m_adk_power.data(); amrex::Real* AMREX_RESTRICT laser_adk_prefactor = m_laser_adk_prefactor.data(); + amrex::Real* AMREX_RESTRICT laser_dp_prefactor = m_laser_dp_prefactor.data(); long num_ions = ptile_ion.numParticles(); From af196e8f2d7196cb0dc506fc3e7fec57723058ac Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Sun, 19 Jan 2025 13:46:00 +0100 Subject: [PATCH 09/97] Update laser_ionization.1Rank.json --- .../laser_ionization.1Rank.json | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json index ac3026c928..0670f5cb42 100644 --- a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json +++ b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json @@ -1,24 +1,24 @@ { "lev=0": { - "Bx": 2.6828383569303, - "By": 2.7679232216354, - "Bz": 1.8909285687383, + "Bx": 3.5340402789953, + "By": 3.6836470841807, + "Bz": 1.6582714984418, "ExmBy": 0.0, "EypBx": 0.0, - "Ez": 2448530507.7321, + "Ez": 2563249985.0057, "Psi": 0.0, - "Sx": 174799612003.59, - "Sy": 165714923911.0, + "Sx": 150184435752.15, + "Sy": 156224678412.31, "aabs": 0.19201022247138, - "chi": 105640532321080.0, - "jx": 340889782577.97, + "chi": 98449630459446.0, + "jx": 415642771232.97, "jx_beam": 0.0, - "jy": 344102223375.08, + "jy": 418820342114.24, "jy_beam": 0.0, "jz_beam": 0.0, "laserEnvelope": 30.678508193173, - "rho_elec": 477708750.68105, - "rho_ion": 477712998.48921, + "rho_elec": 445191338.69561, + "rho_ion": 445188813.65856, "rhomjz": 0.0 } } From 78cd9de4bfc6181f8525451e7d80e604b7f61bd2 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Mon, 20 Jan 2025 16:23:41 +0100 Subject: [PATCH 10/97] Update PlasmaParticleContainerInit.cpp --- src/particles/plasma/PlasmaParticleContainerInit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainerInit.cpp b/src/particles/plasma/PlasmaParticleContainerInit.cpp index 13a9061ab8..ece1f890d8 100644 --- a/src/particles/plasma/PlasmaParticleContainerInit.cpp +++ b/src/particles/plasma/PlasmaParticleContainerInit.cpp @@ -411,7 +411,7 @@ InitIonizationModule (const amrex::Geometry& geom, const amrex::Real background_ // Compute ADK prefactors (See Chen, JCP 236 (2013), equation (2)) // For now, we assume l=0 and m=0. // The approximate expressions are used, - // without Gamma function + // without Gamma function. const PhysConst phys_const = make_constants_SI(); const amrex::Real alpha = 0.0072973525693_rt; const amrex::Real a3 = alpha * alpha * alpha; From c5746f9a8b7f2e713743894148f117546dcb97fe Mon Sep 17 00:00:00 2001 From: EyaDammak Date: Mon, 27 Jan 2025 15:42:13 +0100 Subject: [PATCH 11/97] update plasmaparticlecontainer --- .../plasma/PlasmaParticleContainer.cpp | 67 ++++++++++--------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index e6f96c0fc0..9dede3b0a4 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -641,47 +641,48 @@ LaserIonization (const int islice, [=] AMREX_GPU_DEVICE (long ip, const amrex::RandomEngine& engine, auto depos_order_xy) { - // Avoid temp slice - const amrex::Real xp = x_prev[ip]; - const amrex::Real yp = y_prev[ip]; + if(p_ion_mask[ip] != 0) { - if (amrex::ConstParticleIDWrapper(idcpup[ip]) < 0 || - !laser_bounds.contains(xp, yp)) return; + // Avoid temp slice + const amrex::Real xp = x_prev[ip]; + const amrex::Real yp = y_prev[ip]; - Complex A = 0; - Complex A_dx = 0; - Complex A_dzeta = 0; + if (amrex::ConstParticleIDWrapper(idcpup[ip]) < 0 || + !laser_bounds.contains(xp, yp)) return; - doLaserGatherShapeN(xp, yp, A, A_dx, A_dzeta, laser_arr, - dx_inv, dy_inv, dzeta_inv, x_pos_offset, y_pos_offset); + Complex A = 0; + Complex A_dx = 0; + Complex A_dzeta = 0; - const Complex Et = I * A * omega0 + A_dzeta * phys_const.c; // transverse component - const Complex El = - A_dx * phys_const.c; // longitudinal component + doLaserGatherShapeN(xp, yp, A, A_dx, A_dzeta, laser_arr, + dx_inv, dy_inv, dzeta_inv, x_pos_offset, y_pos_offset); - amrex::Real Ep = std::sqrt( amrex::abs(Et*Et) + amrex::abs(El*El) ); - Ep *= phys_const.m_e * phys_const.c / phys_const.q_e; - Ep *= E0; + const Complex Et = I * A * omega0 + A_dzeta * phys_const.c; // transverse component + const Complex El = - A_dx * phys_const.c; // longitudinal component - amrex::Real ux, uy, uz; - const int ion_lev_loc = ion_lev[ip]; + amrex::Real Ep = std::sqrt( amrex::abs(Et*Et) + amrex::abs(El*El) ); + Ep *= phys_const.m_e * phys_const.c / phys_const.q_e; + Ep *= E0; - if (linear_polarization) { - amrex::Real width_p; - amrex::Real p_pol; - width_p = std::sqrt(laser_dp_prefactor[ion_lev_loc] * Ep) * std::sqrt(amrex::abs(A*A)); // equation (4) art. Massimo - p_pol = amrex::RandomNormal(0.0, width_p, engine); - ux = p_pol; - uy = 0._rt; - uz = (amrex::abs(A * A) / 4. + p_pol * p_pol / 2.); - } else { - amrex::Real angle; - angle = amrex::Random(engine) * 2 * MathConst::pi; - ux = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::cos(angle); - uy = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::sin(angle); - uz = amrex::abs(A*A) / 2.; - } + amrex::Real ux, uy, uz; + const int ion_lev_loc = ion_lev[ip]; - if(p_ion_mask[ip] != 0) { + if (linear_polarization) { + amrex::Real width_p; + amrex::Real p_pol; + width_p = std::sqrt(laser_dp_prefactor[ion_lev_loc] * Ep) * std::sqrt(amrex::abs(A*A)); // equation (4) art. Massimo + p_pol = amrex::RandomNormal(0.0, width_p, engine); + ux = p_pol; + uy = 0._rt; + uz = (amrex::abs(A * A) / 4. + p_pol * p_pol / 2.); + } else { + amrex::Real angle; + angle = amrex::Random(engine) * 2 * MathConst::pi; + ux = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::cos(angle); + uy = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::sin(angle); + uz = amrex::abs(A*A) / 2.; + } + const long pid = amrex::Gpu::Atomic::Add( p_ip_elec, 1u ); // ensures thread-safe access when incrementing `p_ip_elec` const long pidx = pid + old_size; // Copy ion data to new electron From 4f95f95f5be5befc6f73937c58d5ecd113b92cbf Mon Sep 17 00:00:00 2001 From: EyaDammak Date: Mon, 27 Jan 2025 15:45:43 +0100 Subject: [PATCH 12/97] style --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 9dede3b0a4..9553fa8fa2 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -682,7 +682,7 @@ LaserIonization (const int islice, uy = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::sin(angle); uz = amrex::abs(A*A) / 2.; } - + const long pid = amrex::Gpu::Atomic::Add( p_ip_elec, 1u ); // ensures thread-safe access when incrementing `p_ip_elec` const long pidx = pid + old_size; // Copy ion data to new electron From 6c8d83b0ff5a223b722f9d6e12194cbe8f4e56e8 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Mon, 27 Jan 2025 16:10:59 +0100 Subject: [PATCH 13/97] Update laser_ionization.1Rank.json --- .../laser_ionization.1Rank.json | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json index 0670f5cb42..e6d1197cf5 100644 --- a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json +++ b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json @@ -1,24 +1,24 @@ { "lev=0": { - "Bx": 3.5340402789953, - "By": 3.6836470841807, - "Bz": 1.6582714984418, + "Bx": 3.6289326913652, + "By": 3.8848759208256, + "Bz": 1.6623540799087, "ExmBy": 0.0, "EypBx": 0.0, - "Ez": 2563249985.0057, + "Ez": 2705084383.7236, "Psi": 0.0, - "Sx": 150184435752.15, - "Sy": 156224678412.31, + "Sx": 176801264949.4, + "Sy": 163740521603.12, "aabs": 0.19201022247138, - "chi": 98449630459446.0, - "jx": 415642771232.97, + "chi": 104705826169570.0, + "jx": 455020279202.25, "jx_beam": 0.0, - "jy": 418820342114.24, + "jy": 431292339864.21, "jy_beam": 0.0, "jz_beam": 0.0, "laserEnvelope": 30.678508193173, - "rho_elec": 445191338.69561, - "rho_ion": 445188813.65856, + "rho_elec": 473481992.40286, + "rho_ion": 473479247.80813, "rhomjz": 0.0 } } From 8995bbee9f5a2f9724026413b25781457af2fa20 Mon Sep 17 00:00:00 2001 From: EyaDammak Date: Mon, 27 Jan 2025 23:26:54 +0100 Subject: [PATCH 14/97] minor changes --- src/particles/plasma/PlasmaParticleContainer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 9553fa8fa2..fe3eda5f8a 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -664,7 +664,9 @@ LaserIonization (const int islice, Ep *= phys_const.m_e * phys_const.c / phys_const.q_e; Ep *= E0; - amrex::Real ux, uy, uz; + amrex::Real ux; + amrex::Real uy; + amrex::Real uz; const int ion_lev_loc = ion_lev[ip]; if (linear_polarization) { @@ -679,7 +681,7 @@ LaserIonization (const int islice, amrex::Real angle; angle = amrex::Random(engine) * 2 * MathConst::pi; ux = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::cos(angle); - uy = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::sin(angle); + uy = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::sin(angle); uz = amrex::abs(A*A) / 2.; } From e9109433618cbd3130ac37a314942370e68a9c5f Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 4 Feb 2025 15:48:58 +0100 Subject: [PATCH 15/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index fe3eda5f8a..74496eea7b 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -672,7 +672,7 @@ LaserIonization (const int islice, if (linear_polarization) { amrex::Real width_p; amrex::Real p_pol; - width_p = std::sqrt(laser_dp_prefactor[ion_lev_loc] * Ep) * std::sqrt(amrex::abs(A*A)); // equation (4) art. Massimo + width_p = std::sqrt(laser_dp_prefactor[ion_lev_loc-1] * Ep) * std::sqrt(amrex::abs(A*A)); // equation (4) art. Massimo p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; uy = 0._rt; From 0f0faba4a24f24f07060fc1db4890f9e3aeeac66 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Wed, 5 Feb 2025 13:21:53 +0100 Subject: [PATCH 16/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 74496eea7b..7c7bff8e8a 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -672,7 +672,7 @@ LaserIonization (const int islice, if (linear_polarization) { amrex::Real width_p; amrex::Real p_pol; - width_p = std::sqrt(laser_dp_prefactor[ion_lev_loc-1] * Ep) * std::sqrt(amrex::abs(A*A)); // equation (4) art. Massimo + width_p = std::sqrt(laser_dp_prefactor[ion_lev_loc-1] * Ep) * std::sqrt(amrex::abs(A*A)); // equation (4) art. Massimo (2020) p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; uy = 0._rt; @@ -680,8 +680,9 @@ LaserIonization (const int islice, } else { amrex::Real angle; angle = amrex::Random(engine) * 2 * MathConst::pi; - ux = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::cos(angle); - uy = std::sqrt(amrex::abs(A*A)) / std::sqrt(2) * std::sin(angle); + // A_t = A (e_x +/- i e_y) in hipace in circular polarization + ux = std::sqrt(amrex::abs(A*A)) * std::cos(angle); + uy = std::sqrt(amrex::abs(A*A)) * std::sin(angle); uz = amrex::abs(A*A) / 2.; } From 8afebe5da9d7e972ec2607480a01d683118863e5 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Wed, 5 Feb 2025 13:24:38 +0100 Subject: [PATCH 17/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 7c7bff8e8a..ce43bcf576 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -680,7 +680,7 @@ LaserIonization (const int islice, } else { amrex::Real angle; angle = amrex::Random(engine) * 2 * MathConst::pi; - // A_t = A (e_x +/- i e_y) in hipace in circular polarization + // A_t = A (e_x +/- i e_y) in circular polarization ux = std::sqrt(amrex::abs(A*A)) * std::cos(angle); uy = std::sqrt(amrex::abs(A*A)) * std::sin(angle); uz = amrex::abs(A*A) / 2.; From 2f795aa6ffed8eae29156639cefdf2e303026558 Mon Sep 17 00:00:00 2001 From: Eya Dammak Date: Wed, 5 Feb 2025 13:28:05 +0100 Subject: [PATCH 18/97] style --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index ce43bcf576..3995205cda 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -680,7 +680,7 @@ LaserIonization (const int islice, } else { amrex::Real angle; angle = amrex::Random(engine) * 2 * MathConst::pi; - // A_t = A (e_x +/- i e_y) in circular polarization + // A_t = A (e_x +/- i e_y) in circular polarization ux = std::sqrt(amrex::abs(A*A)) * std::cos(angle); uy = std::sqrt(amrex::abs(A*A)) * std::sin(angle); uz = amrex::abs(A*A) / 2.; From 0da47ba3d55a8e71b8f6bd75c0b2e99420297ab3 Mon Sep 17 00:00:00 2001 From: Eya Dammak Date: Sat, 8 Feb 2025 23:43:37 +0100 Subject: [PATCH 19/97] expression of the standard deviation for linear polarization from Tomassini art. --- src/Hipace.cpp | 6 ++++-- src/particles/plasma/PlasmaParticleContainer.cpp | 7 ++++--- src/particles/plasma/PlasmaParticleContainerInit.cpp | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Hipace.cpp b/src/Hipace.cpp index 20700c02b9..744c81dc57 100644 --- a/src/Hipace.cpp +++ b/src/Hipace.cpp @@ -698,9 +698,11 @@ Hipace::SolveOneSlice (int islice, int step) // plasma laser ionization m_multi_plasma.DoLaserIonization(islice, m_multi_laser.GetLaserGeom(), m_multi_laser); - // Push plasma particles - for (int lev=0; lev Date: Sat, 8 Feb 2025 23:45:00 +0100 Subject: [PATCH 20/97] Update PlasmaParticleContainerInit.cpp --- src/particles/plasma/PlasmaParticleContainerInit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainerInit.cpp b/src/particles/plasma/PlasmaParticleContainerInit.cpp index 84a8889266..8dda6fc389 100644 --- a/src/particles/plasma/PlasmaParticleContainerInit.cpp +++ b/src/particles/plasma/PlasmaParticleContainerInit.cpp @@ -411,7 +411,7 @@ InitIonizationModule (const amrex::Geometry& geom, const amrex::Real background_ // Compute ADK prefactors (See Chen, JCP 236 (2013), equation (2)) // For now, we assume l=0 and m=0. // The approximate expressions are used, - // without Gamma function. + // without Gamma function const PhysConst phys_const = make_constants_SI(); const amrex::Real alpha = 0.0072973525693_rt; const amrex::Real a3 = alpha * alpha * alpha; From 3641c3dcf6304f8d1a52b382393f91bcb968fbff Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Sun, 9 Feb 2025 14:03:32 +0100 Subject: [PATCH 21/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 85e30d7940..24af4b024b 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -673,8 +673,8 @@ LaserIonization (const int islice, amrex::Real width_p; amrex::Real p_pol; //width_p = std::sqrt(laser_dp_prefactor[ion_lev_loc-1] * Ep) * std::sqrt(amrex::abs(A*A)); // equation (4) art. Massimo (2020) - width_p = std::pow(amrex::abs(A), 3./2.)*laser_dp_prefactor[ion_lev_loc-1]; - p_pol = amrex::RandomNormal(0.0, width_p, engine); + width_p = std::pow(amrex::abs(A), 3./2.)*laser_dp_prefactor[ion_lev_loc-1]/std::sqrt(lambda0); // equation from Tassimo art., ref [34] in Massimo's art + p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; uy = 0._rt; uz = (amrex::abs(A * A) / 4. + p_pol * p_pol / 2.); From 0e6145ac981e7975fbdfde90b99472a08179626d Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Sun, 9 Feb 2025 20:34:26 +0100 Subject: [PATCH 22/97] Update PlasmaParticleContainerInit.cpp --- src/particles/plasma/PlasmaParticleContainerInit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainerInit.cpp b/src/particles/plasma/PlasmaParticleContainerInit.cpp index 8dda6fc389..1ae0b5f10b 100644 --- a/src/particles/plasma/PlasmaParticleContainerInit.cpp +++ b/src/particles/plasma/PlasmaParticleContainerInit.cpp @@ -450,7 +450,7 @@ InitIonizationModule (const amrex::Geometry& geom, const amrex::Real background_ * std::pow(2*std::pow((Uion/UH),3./2.)*Ea,2*n_eff - 1); h_adk_exp_prefactor[i] = -2./3. * std::pow( Uion/UH,3./2.) * Ea; h_laser_adk_prefactor[i] = (3./MathConst::pi) * std::pow(Uion/UH, -3./2.) / Ea; - h_laser_dp_prefactor[i] = std::pow(UH/Uion, 3./4.)/std::sqrt(0.107); //3./2. * std::pow(Uion/UH, -3./2.) / Ea; + h_laser_dp_prefactor[i] = std::sqrt(3./2./Ea) * std::pow(UH/Uion, 3./2.); } amrex::Gpu::copy(amrex::Gpu::hostToDevice, From afeedc35f824c5085f354487caeb46a197c03184 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Sun, 9 Feb 2025 20:37:19 +0100 Subject: [PATCH 23/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 24af4b024b..d495b3a2a2 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -673,7 +673,7 @@ LaserIonization (const int islice, amrex::Real width_p; amrex::Real p_pol; //width_p = std::sqrt(laser_dp_prefactor[ion_lev_loc-1] * Ep) * std::sqrt(amrex::abs(A*A)); // equation (4) art. Massimo (2020) - width_p = std::pow(amrex::abs(A), 3./2.)*laser_dp_prefactor[ion_lev_loc-1]/std::sqrt(lambda0); // equation from Tassimo art., ref [34] in Massimo's art + width_p = amrex::abs(A) * std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc-1]; // equation from C. Shroder art. p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; uy = 0._rt; From d34737c95574664d704635049280d1d047b7104c Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Sun, 9 Feb 2025 20:38:20 +0100 Subject: [PATCH 24/97] Update PlasmaParticleContainerInit.cpp --- src/particles/plasma/PlasmaParticleContainerInit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainerInit.cpp b/src/particles/plasma/PlasmaParticleContainerInit.cpp index 1ae0b5f10b..d2d3ba3be0 100644 --- a/src/particles/plasma/PlasmaParticleContainerInit.cpp +++ b/src/particles/plasma/PlasmaParticleContainerInit.cpp @@ -450,7 +450,7 @@ InitIonizationModule (const amrex::Geometry& geom, const amrex::Real background_ * std::pow(2*std::pow((Uion/UH),3./2.)*Ea,2*n_eff - 1); h_adk_exp_prefactor[i] = -2./3. * std::pow( Uion/UH,3./2.) * Ea; h_laser_adk_prefactor[i] = (3./MathConst::pi) * std::pow(Uion/UH, -3./2.) / Ea; - h_laser_dp_prefactor[i] = std::sqrt(3./2./Ea) * std::pow(UH/Uion, 3./2.); + h_laser_dp_prefactor[i] = std::sqrt(3./2./Ea) * std::pow(UH/Uion, 3./4.); } amrex::Gpu::copy(amrex::Gpu::hostToDevice, From 04d48ce23479cdd2ef57d2afda5cb85658c17098 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Sun, 9 Feb 2025 20:57:44 +0100 Subject: [PATCH 25/97] Update Hipace.cpp --- src/Hipace.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Hipace.cpp b/src/Hipace.cpp index 30a977d6bf..4fdcacac78 100644 --- a/src/Hipace.cpp +++ b/src/Hipace.cpp @@ -698,11 +698,9 @@ Hipace::SolveOneSlice (int islice, int step) // plasma laser ionization m_multi_plasma.DoLaserIonization(islice, m_multi_laser.GetLaserGeom(), m_multi_laser); - if (false){ //temporary - // Push plasma particle - for (int lev=0; lev Date: Sun, 9 Feb 2025 20:59:56 +0100 Subject: [PATCH 26/97] Update Hipace.cpp --- src/Hipace.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Hipace.cpp b/src/Hipace.cpp index 4fdcacac78..3a767d76a2 100644 --- a/src/Hipace.cpp +++ b/src/Hipace.cpp @@ -699,8 +699,10 @@ Hipace::SolveOneSlice (int islice, int step) m_multi_plasma.DoLaserIonization(islice, m_multi_laser.GetLaserGeom(), m_multi_laser); // Push plasma particle - for (int lev=0; lev Date: Tue, 11 Feb 2025 15:20:09 +0100 Subject: [PATCH 27/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index d495b3a2a2..c14d554069 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -672,8 +672,10 @@ LaserIonization (const int islice, if (linear_polarization) { amrex::Real width_p; amrex::Real p_pol; + amrex::Real delta; //width_p = std::sqrt(laser_dp_prefactor[ion_lev_loc-1] * Ep) * std::sqrt(amrex::abs(A*A)); // equation (4) art. Massimo (2020) - width_p = amrex::abs(A) * std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc-1]; // equation from C. Shroder art. + delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc-1]; + width_p = amrex::abs(A) * delta; // equation from C. Shroder art. p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; uy = 0._rt; From 1b53df5e1425481262c935948d87388c0bbfdd28 Mon Sep 17 00:00:00 2001 From: Eya Dammak Date: Wed, 12 Feb 2025 17:06:28 +0100 Subject: [PATCH 28/97] right formula --- src/particles/plasma/PlasmaParticleContainer.H | 4 +++- src/particles/plasma/PlasmaParticleContainer.cpp | 13 ++++++------- .../plasma/PlasmaParticleContainerInit.cpp | 9 +++++++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.H b/src/particles/plasma/PlasmaParticleContainer.H index dafeddbc40..de31868eed 100644 --- a/src/particles/plasma/PlasmaParticleContainer.H +++ b/src/particles/plasma/PlasmaParticleContainer.H @@ -213,7 +213,9 @@ public: /** to calculate laser Ionization probability with ADK formula */ amrex::Gpu::DeviceVector m_laser_adk_prefactor; /** to calculate laser ionization momentum width for linear polarization */ - amrex::Gpu::DeviceVector m_laser_dp_prefactor; + amrex::Gpu::DeviceVector m_laser_dp_prefactor; + /** to calculate laser ionization momentum width at the second order for linear polarization */ + amrex::Gpu::DeviceVector m_laser_dp_second_prefactor; // plasma sorting/reordering: diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index c14d554069..3d1f8e3939 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -532,6 +532,7 @@ LaserIonization (const int islice, amrex::Real* AMREX_RESTRICT adk_power = m_adk_power.data(); amrex::Real* AMREX_RESTRICT laser_adk_prefactor = m_laser_adk_prefactor.data(); amrex::Real* AMREX_RESTRICT laser_dp_prefactor = m_laser_dp_prefactor.data(); + amrex::Real* AMREX_RESTRICT laser_dp_second_prefactor = m_laser_dp_second_prefactor.data(); long num_ions = ptile_ion.numParticles(); @@ -670,13 +671,11 @@ LaserIonization (const int islice, const int ion_lev_loc = ion_lev[ip]; if (linear_polarization) { - amrex::Real width_p; - amrex::Real p_pol; - amrex::Real delta; - //width_p = std::sqrt(laser_dp_prefactor[ion_lev_loc-1] * Ep) * std::sqrt(amrex::abs(A*A)); // equation (4) art. Massimo (2020) - delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc-1]; - width_p = amrex::abs(A) * delta; // equation from C. Shroder art. - p_pol = amrex::RandomNormal(0.0, width_p, engine); + amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc-1]; + amrex::Real delta2 = delta * delta; + std::cout << "delta: " << delta << "\n"; + amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc-1] * delta2); // equation from C. Schroeder art. + amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; uy = 0._rt; uz = (amrex::abs(A * A) / 4. + p_pol * p_pol / 2.); diff --git a/src/particles/plasma/PlasmaParticleContainerInit.cpp b/src/particles/plasma/PlasmaParticleContainerInit.cpp index d2d3ba3be0..3bdbbdfab1 100644 --- a/src/particles/plasma/PlasmaParticleContainerInit.cpp +++ b/src/particles/plasma/PlasmaParticleContainerInit.cpp @@ -432,13 +432,15 @@ InitIonizationModule (const amrex::Geometry& geom, const amrex::Real background_ m_adk_exp_prefactor.resize(ion_atomic_number); m_laser_adk_prefactor.resize(ion_atomic_number); m_laser_dp_prefactor.resize(ion_atomic_number); + m_laser_dp_second_prefactor.resize(ion_atomic_number); amrex::Gpu::PinnedVector h_adk_power(ion_atomic_number); amrex::Gpu::PinnedVector h_adk_prefactor(ion_atomic_number); amrex::Gpu::PinnedVector h_adk_exp_prefactor(ion_atomic_number); amrex::Gpu::PinnedVector h_laser_adk_prefactor(ion_atomic_number); amrex::Gpu::PinnedVector h_laser_dp_prefactor(ion_atomic_number); - + amrex::Gpu::PinnedVector h_laser_dp_second_prefactor(ion_atomic_number); + for (int i=0; i Date: Wed, 12 Feb 2025 17:15:27 +0100 Subject: [PATCH 29/97] Update Hipace.cpp --- src/Hipace.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Hipace.cpp b/src/Hipace.cpp index 3a767d76a2..5f50749413 100644 --- a/src/Hipace.cpp +++ b/src/Hipace.cpp @@ -699,11 +699,10 @@ Hipace::SolveOneSlice (int islice, int step) m_multi_plasma.DoLaserIonization(islice, m_multi_laser.GetLaserGeom(), m_multi_laser); // Push plasma particle - if (false){ // TEMPORARY - for (int lev=0; lev Date: Wed, 12 Feb 2025 17:16:39 +0100 Subject: [PATCH 30/97] Update Hipace.cpp --- src/Hipace.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Hipace.cpp b/src/Hipace.cpp index 5f50749413..f06fd9d473 100644 --- a/src/Hipace.cpp +++ b/src/Hipace.cpp @@ -698,11 +698,10 @@ Hipace::SolveOneSlice (int islice, int step) // plasma laser ionization m_multi_plasma.DoLaserIonization(islice, m_multi_laser.GetLaserGeom(), m_multi_laser); - // Push plasma particle + // Push plasma particles for (int lev=0; lev Date: Wed, 12 Feb 2025 17:23:26 +0100 Subject: [PATCH 31/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 3d1f8e3939..7b21b558d8 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -673,7 +673,6 @@ LaserIonization (const int islice, if (linear_polarization) { amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc-1]; amrex::Real delta2 = delta * delta; - std::cout << "delta: " << delta << "\n"; amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc-1] * delta2); // equation from C. Schroeder art. amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; From 41e278e44370fa4e9edd8c758c54e54a8a72e8bb Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Wed, 12 Feb 2025 17:27:24 +0100 Subject: [PATCH 32/97] Update inputs_laser_ionization --- examples/laser_ionization/inputs_laser_ionization | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/laser_ionization/inputs_laser_ionization b/examples/laser_ionization/inputs_laser_ionization index 74a49ed066..c870cce351 100644 --- a/examples/laser_ionization/inputs_laser_ionization +++ b/examples/laser_ionization/inputs_laser_ionization @@ -34,6 +34,7 @@ laser.tau = tau_fs*1.e-15 laser.focal_distance = 50.e-6 plasmas.names = elec ion +plasmas.do_push = false elec.density(x,y,z) = n0 elec.ppc = 0 0 From eaa7ce348fed867db9cdf0fb5bdc97d93d7467ba Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Wed, 12 Feb 2025 17:52:21 +0100 Subject: [PATCH 33/97] Update laser_ionization.1Rank.json --- .../laser_ionization.1Rank.json | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json index e6d1197cf5..37c98b1a2a 100644 --- a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json +++ b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json @@ -1,24 +1,24 @@ { "lev=0": { - "Bx": 3.6289326913652, - "By": 3.8848759208256, - "Bz": 1.6623540799087, + "Bx": 473.16542773922, + "By": 642.81856379697, + "Bz": 1314.3146623456, "ExmBy": 0.0, "EypBx": 0.0, - "Ez": 2705084383.7236, + "Ez": 336628250420.41, "Psi": 0.0, - "Sx": 176801264949.4, - "Sy": 163740521603.12, + "Sx": 22112618704000.0, + "Sy": 20076321717728.0, "aabs": 0.19201022247138, - "chi": 104705826169570.0, - "jx": 455020279202.25, + "chi": 104663510800110.0, + "jx": 241698526334840.0, "jx_beam": 0.0, - "jy": 431292339864.21, + "jy": 51620682815744.0, "jy_beam": 0.0, "jz_beam": 0.0, "laserEnvelope": 30.678508193173, - "rho_elec": 473481992.40286, - "rho_ion": 473479247.80813, + "rho_elec": 473292108.8649, + "rho_ion": 473479352.42234, "rhomjz": 0.0 } } From 2db08eba44f76291e5731e78ef1415cf6b3279d3 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 10:54:52 +0100 Subject: [PATCH 34/97] Update analysis_laser_ionization.py --- .../analysis_laser_ionization.py | 50 +++++++++++++++++-- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index 46b562a946..798b60571e 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -10,7 +10,11 @@ import math from openpmd_viewer import OpenPMDTimeSeries import statistics -from scipy.constants import e as qe +from scipy.constants import e scc + +import read_insitu_diagnostics as diag +from read_insitu_diagnostics import temperature_in_eV + parser = argparse.ArgumentParser( description='Script to analyze the equality of two simulations') parser.add_argument('--first', @@ -21,8 +25,19 @@ dest='second', required=True, help='Path to the directory containing output files') +parser.add_argument('--third', + dest='third', + required=True, + help='Path to the directory containing output files') +args = parser.parse_args() + +parser.add_argument('--fourth', + dest='fourth', + required=True, + help='Path to the directory containing output files') args = parser.parse_args() +# diagnostics for calculation of the fraction of ionization in linear and circular polarization ts_linear = OpenPMDTimeSeries(args.first) ts_circular = OpenPMDTimeSeries(args.second) @@ -37,12 +52,12 @@ rho_elec_linear, _ = ts_linear.get_field(field='rho_elec', coord='z', iteration=iteration) rho_elec_mean_linear = np.mean(rho_elec_linear, axis=(1, 2)) rho_average_linear = statistics.mean(rho_elec_mean_linear[0:10]) -fraction_linear = -rho_average_linear / qe / n0 +fraction_linear = -rho_average_linear / scc.e / n0 rho_elec_circular, _ = ts_circular.get_field(field='rho_elec', coord='z', iteration=iteration) rho_elec_mean_circular = np.mean(rho_elec_circular, axis=(1, 2)) rho_average_circular = statistics.mean(rho_elec_mean_circular[0:10]) #average over a thickness in the ionized region -fraction_circular = -rho_average_circular / qe / n0 +fraction_circular = -rho_average_circular / scc.e / n0 fraction_warpx_linear = 0.41014984 # result from WarpX simulation fraction_warpx_circular = 0.502250841 # result from WarpX simulation @@ -56,4 +71,31 @@ print(f"fraction_warpx_circular = {fraction_warpx_circular}") print(f"fraction_hipace_circular = {fraction_circular}") -assert ( (relative_diff_linear < tolerance) and (relative_diff_circular < tolerance) ), 'Test laser_ionization did not pass' +# in-situ diagnostics for calculation of the temperature in all directions in circular polarization +insitu_path_linear = f'./{args.third}/reduced_elec.0000.txt' +all_data_linear = diag.read_file(insitu_path_linear) +Tx2_l = all_data_linear['[ux^2]'][0,:]*scc.m_e*scc.c**2/scc.e +Ty2_l = all_data_linear['[uy^2]'][0,:]*scc.m_e*scc.c**2/scc.e +Tz2_l = all_data_linear['[uz^2]'][0,:]*scc.m_e*scc.c**2/scc.e +temp_eV_linear = 1./3*(Tx2_l+Ty2_l+Tz2_l) + +insitu_path_circular = f'./{args.fourth}/reduced_elec.0000.txt' +all_data_circular = diag.read_file(insitu_path_circular) +Tx2_c = all_data_circular['[ux^2]'][0,:]*scc.m_e*scc.c**2/scc.e +Ty2_c = all_data_circular['[uy^2]'][0,:]*scc.m_e*scc.c**2/scc.e +Tz2_c = all_data_circular['[uz^2]'][0,:]*scc.m_e*scc.c**2/scc.e +temp_eV_circular = 1./3*(Tx2_c+Ty2_c+Tz2_c) + +temp_eV_warpx_linear = 1.00286009 +temp_eV_warpx_circular = 9.68224535 + +print(f"temp_eV_warpx_linear = {temp_eV_warpx_linear}") +print(f"temp_eV_hipace_linear = {temp_eV_linear}") + +print(f"temp_eV_warpx_circular = {temp_eV_warpx_circular}") +print(f"temp_eV_hipace_circular = {temp_eV_circular}") + +relative_diff_temp_linear = np.abs( ( temp_eV_linear - temp_eV_warpx_linear ) / temp_eV_warpx_linear ) +relative_diff_temp_circular = np.abs( ( temp_eV_circular - temp_eV_warpx_circular ) / temp_eV_warpx_circular ) + +assert ( (relative_diff_linear < tolerance) and (relative_diff_circular < tolerance) and (relative_diff_temp_linear < tolerance) and (relative_diff_temp_circular < tolerance)), 'Test laser_ionization did not pass' From 65fd97e0212b20d82c1ec1d9d24db2d7a37c2121 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 11:02:01 +0100 Subject: [PATCH 35/97] Update laser_ionization.1Rank.sh --- tests/laser_ionization.1Rank.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/laser_ionization.1Rank.sh b/tests/laser_ionization.1Rank.sh index 8062dd9157..3108160b5d 100755 --- a/tests/laser_ionization.1Rank.sh +++ b/tests/laser_ionization.1Rank.sh @@ -28,15 +28,17 @@ rm -rf $TEST_NAME # Run the simulation mpiexec -n 1 $HIPACE_EXECUTABLE $HIPACE_EXAMPLE_DIR/inputs_laser_ionization \ my_constants.a0 = 0.00885126 \ - hipace.file_prefix=$TEST_NAME/linear + hipace.file_prefix=$TEST_NAME/linear \ + plasmas.insitu_file_prefix = $TEST_NAME/insitu_linear mpiexec -n 1 $HIPACE_EXECUTABLE $HIPACE_EXAMPLE_DIR/inputs_laser_ionization \ my_constants.a0 = 0.00787934 \ lasers.polarization = circular \ - hipace.file_prefix=$TEST_NAME/circular + hipace.file_prefix=$TEST_NAME/circular \ + plasmas.insitu_file_prefix = $TEST_NAME/insitu_circular # Compare the result with theory -$HIPACE_EXAMPLE_DIR/analysis_laser_ionization.py --first=$TEST_NAME/linear --second=$TEST_NAME/circular +$HIPACE_EXAMPLE_DIR/analysis_laser_ionization.py --first=$TEST_NAME/linear --second=$TEST_NAME/circular --third=$TEST_NAME/insitu_linear --fourth=$TEST_NAME/insitu_linear # Compare the results with checksum benchmark if it runs on CPU only From 3558ac872ce75cb3db5cfee5b3b6514969697372 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 11:02:36 +0100 Subject: [PATCH 36/97] Update inputs_laser_ionization --- examples/laser_ionization/inputs_laser_ionization | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/laser_ionization/inputs_laser_ionization b/examples/laser_ionization/inputs_laser_ionization index c870cce351..f672ff5886 100644 --- a/examples/laser_ionization/inputs_laser_ionization +++ b/examples/laser_ionization/inputs_laser_ionization @@ -35,6 +35,7 @@ laser.focal_distance = 50.e-6 plasmas.names = elec ion plasmas.do_push = false +plasmas.insitu_period = 1 elec.density(x,y,z) = n0 elec.ppc = 0 0 From 0479069d69ab6cf3beda63c2d46b0f2ff4165663 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 11:10:19 +0100 Subject: [PATCH 37/97] Update analysis_laser_ionization.py --- examples/laser_ionization/analysis_laser_ionization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index 798b60571e..e15a5ea843 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -10,7 +10,7 @@ import math from openpmd_viewer import OpenPMDTimeSeries import statistics -from scipy.constants import e scc +from scipy.constants import scc import read_insitu_diagnostics as diag from read_insitu_diagnostics import temperature_in_eV From 97f0914795c7d229ac55f43cf46ee32b9138ffd0 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 11:11:13 +0100 Subject: [PATCH 38/97] Update analysis_laser_ionization.py --- examples/laser_ionization/analysis_laser_ionization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index e15a5ea843..22a02ce187 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -10,7 +10,7 @@ import math from openpmd_viewer import OpenPMDTimeSeries import statistics -from scipy.constants import scc +import scipy.constants as scc import read_insitu_diagnostics as diag from read_insitu_diagnostics import temperature_in_eV From 9fac7c9c66ee54b11243dba05fd7d555b5841d88 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 12:44:32 +0100 Subject: [PATCH 39/97] Update inputs_laser_ionization --- examples/laser_ionization/inputs_laser_ionization | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/laser_ionization/inputs_laser_ionization b/examples/laser_ionization/inputs_laser_ionization index f672ff5886..3b504ffc3b 100644 --- a/examples/laser_ionization/inputs_laser_ionization +++ b/examples/laser_ionization/inputs_laser_ionization @@ -34,7 +34,7 @@ laser.tau = tau_fs*1.e-15 laser.focal_distance = 50.e-6 plasmas.names = elec ion -plasmas.do_push = false +plasmas.do_push = 0 plasmas.insitu_period = 1 elec.density(x,y,z) = n0 From 8a7173b8c3fd69e68951ae16d9bcf303f2ac0ffa Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 13:10:37 +0100 Subject: [PATCH 40/97] Update analysis_laser_ionization.py --- examples/laser_ionization/analysis_laser_ionization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index 22a02ce187..a9facf0d5e 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -12,7 +12,7 @@ import statistics import scipy.constants as scc -import read_insitu_diagnostics as diag +import ./../tools/read_insitu_diagnostics as diag from read_insitu_diagnostics import temperature_in_eV parser = argparse.ArgumentParser( From 073597f05d458d8dd36f6433dec6099a9b261496 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 13:17:44 +0100 Subject: [PATCH 41/97] Update analysis_laser_ionization.py --- examples/laser_ionization/analysis_laser_ionization.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index a9facf0d5e..1386de0c53 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -12,8 +12,8 @@ import statistics import scipy.constants as scc -import ./../tools/read_insitu_diagnostics as diag -from read_insitu_diagnostics import temperature_in_eV +import ./tools/read_insitu_diagnostics as diag + parser = argparse.ArgumentParser( description='Script to analyze the equality of two simulations') From d118da2211cca6c7c3b05a043a81bafd7a13788a Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 13:20:45 +0100 Subject: [PATCH 42/97] Update analysis_laser_ionization.py --- examples/laser_ionization/analysis_laser_ionization.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index 1386de0c53..8ce72d2cf0 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -12,7 +12,9 @@ import statistics import scipy.constants as scc -import ./tools/read_insitu_diagnostics as diag +import sys +sys.path.append("../../tools/") +import read_insitu_diagnostics as diag parser = argparse.ArgumentParser( From 081931ab54df25a7b82871a8435083e194ad9497 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 14:45:42 +0100 Subject: [PATCH 43/97] Update inputs_laser_ionization --- examples/laser_ionization/inputs_laser_ionization | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/laser_ionization/inputs_laser_ionization b/examples/laser_ionization/inputs_laser_ionization index 3b504ffc3b..98eec6c5b2 100644 --- a/examples/laser_ionization/inputs_laser_ionization +++ b/examples/laser_ionization/inputs_laser_ionization @@ -34,7 +34,7 @@ laser.tau = tau_fs*1.e-15 laser.focal_distance = 50.e-6 plasmas.names = elec ion -plasmas.do_push = 0 +#plasmas.do_push = 0 plasmas.insitu_period = 1 elec.density(x,y,z) = n0 @@ -42,6 +42,7 @@ elec.ppc = 0 0 elec.u_mean = 0.0 0.0 0.0 elec.element = electron elec.neutralize_background = false +elec.do_push = 0 ion.density(x,y,z) = n0 ion.ppc = 1 1 @@ -51,6 +52,7 @@ ion.mass_Da = 1.008 ion.initial_ion_level = 0 ion.can_laser_ionize = 1 ion.ionization_product = elec +ion.do_push = 0 amr.max_level = 0 From cf79775c3e9fab325f4deb2abdac78c336e3cb36 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:01:22 +0100 Subject: [PATCH 44/97] Update analysis_laser_ionization.py --- examples/laser_ionization/analysis_laser_ionization.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index 8ce72d2cf0..8cd8791bfe 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -31,8 +31,6 @@ dest='third', required=True, help='Path to the directory containing output files') -args = parser.parse_args() - parser.add_argument('--fourth', dest='fourth', required=True, From 51140ebd828db59622f4babefa5a1adbd7d459d9 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:08:59 +0100 Subject: [PATCH 45/97] Update analysis_laser_ionization.py --- .../laser_ionization/analysis_laser_ionization.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index 8cd8791bfe..2bd2f1f8dd 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -74,16 +74,16 @@ # in-situ diagnostics for calculation of the temperature in all directions in circular polarization insitu_path_linear = f'./{args.third}/reduced_elec.0000.txt' all_data_linear = diag.read_file(insitu_path_linear) -Tx2_l = all_data_linear['[ux^2]'][0,:]*scc.m_e*scc.c**2/scc.e -Ty2_l = all_data_linear['[uy^2]'][0,:]*scc.m_e*scc.c**2/scc.e -Tz2_l = all_data_linear['[uz^2]'][0,:]*scc.m_e*scc.c**2/scc.e +Tx2_l = all_data_linear['[ux^2]'][0,0]*scc.m_e*scc.c**2/scc.e +Ty2_l = all_data_linear['[uy^2]'][0,0]*scc.m_e*scc.c**2/scc.e +Tz2_l = all_data_linear['[uz^2]'][0,0]*scc.m_e*scc.c**2/scc.e temp_eV_linear = 1./3*(Tx2_l+Ty2_l+Tz2_l) insitu_path_circular = f'./{args.fourth}/reduced_elec.0000.txt' all_data_circular = diag.read_file(insitu_path_circular) -Tx2_c = all_data_circular['[ux^2]'][0,:]*scc.m_e*scc.c**2/scc.e -Ty2_c = all_data_circular['[uy^2]'][0,:]*scc.m_e*scc.c**2/scc.e -Tz2_c = all_data_circular['[uz^2]'][0,:]*scc.m_e*scc.c**2/scc.e +Tx2_c = all_data_circular['[ux^2]'][0,0]*scc.m_e*scc.c**2/scc.e +Ty2_c = all_data_circular['[uy^2]'][0,0]*scc.m_e*scc.c**2/scc.e +Tz2_c = all_data_circular['[uz^2]'][0,0]*scc.m_e*scc.c**2/scc.e temp_eV_circular = 1./3*(Tx2_c+Ty2_c+Tz2_c) temp_eV_warpx_linear = 1.00286009 From a03f3f89d59df397412549fc9346a4d6137bf10a Mon Sep 17 00:00:00 2001 From: EyaDammak Date: Thu, 13 Feb 2025 15:11:05 +0100 Subject: [PATCH 46/97] style --- src/particles/plasma/PlasmaParticleContainer.cpp | 10 +++++----- src/particles/plasma/PlasmaParticleContainerInit.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index be24d85e99..83b7d1350d 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -533,7 +533,7 @@ LaserIonization (const int islice, amrex::Real* AMREX_RESTRICT adk_power = m_adk_power.data(); amrex::Real* AMREX_RESTRICT laser_adk_prefactor = m_laser_adk_prefactor.data(); amrex::Real* AMREX_RESTRICT laser_dp_prefactor = m_laser_dp_prefactor.data(); - amrex::Real* AMREX_RESTRICT laser_dp_second_prefactor = m_laser_dp_second_prefactor.data(); + amrex::Real* AMREX_RESTRICT laser_dp_second_prefactor = m_laser_dp_second_prefactor.data(); long num_ions = ptile_ion.numParticles(); @@ -672,10 +672,10 @@ LaserIonization (const int islice, const int ion_lev_loc = ion_lev[ip]; if (linear_polarization) { - amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc-1]; - amrex::Real delta2 = delta * delta; - amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc-1] * delta2); // equation from C. Schroeder art. - amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); + amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc-1]; + amrex::Real delta2 = delta * delta; + amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc-1] * delta2); // equation from C. Schroeder art. + amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; uy = 0._rt; uz = (amrex::abs(A * A) / 4. + p_pol * p_pol / 2.); diff --git a/src/particles/plasma/PlasmaParticleContainerInit.cpp b/src/particles/plasma/PlasmaParticleContainerInit.cpp index 3bdbbdfab1..ca069396a5 100644 --- a/src/particles/plasma/PlasmaParticleContainerInit.cpp +++ b/src/particles/plasma/PlasmaParticleContainerInit.cpp @@ -452,8 +452,8 @@ InitIonizationModule (const amrex::Geometry& geom, const amrex::Real background_ * std::pow(2*std::pow((Uion/UH),3./2.)*Ea,2*n_eff - 1); h_adk_exp_prefactor[i] = -2./3. * std::pow( Uion/UH,3./2.) * Ea; h_laser_adk_prefactor[i] = (3./MathConst::pi) * std::pow(Uion/UH, -3./2.) / Ea; - h_laser_dp_prefactor[i] = std::sqrt(3./2./Ea) * std::pow(UH/Uion, 3./4.); - h_laser_dp_second_prefactor[i] = 2 * ion_atomic_number * std::sqrt(UH/Uion) - 1./2.; + h_laser_dp_prefactor[i] = std::sqrt(3./2./Ea) * std::pow(UH/Uion, 3./4.); + h_laser_dp_second_prefactor[i] = 2 * ion_atomic_number * std::sqrt(UH/Uion) - 1./2.; } amrex::Gpu::copy(amrex::Gpu::hostToDevice, From 1657d82a53a97b0b8adcf24a39c863b95c08c4f0 Mon Sep 17 00:00:00 2001 From: EyaDammak Date: Thu, 13 Feb 2025 15:12:11 +0100 Subject: [PATCH 47/97] style --- src/particles/plasma/PlasmaParticleContainerInit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainerInit.cpp b/src/particles/plasma/PlasmaParticleContainerInit.cpp index ca069396a5..9c8786aac1 100644 --- a/src/particles/plasma/PlasmaParticleContainerInit.cpp +++ b/src/particles/plasma/PlasmaParticleContainerInit.cpp @@ -440,7 +440,7 @@ InitIonizationModule (const amrex::Geometry& geom, const amrex::Real background_ amrex::Gpu::PinnedVector h_laser_adk_prefactor(ion_atomic_number); amrex::Gpu::PinnedVector h_laser_dp_prefactor(ion_atomic_number); amrex::Gpu::PinnedVector h_laser_dp_second_prefactor(ion_atomic_number); - + for (int i=0; i Date: Thu, 13 Feb 2025 15:45:18 +0100 Subject: [PATCH 48/97] Update laser_ionization.1Rank.sh --- tests/laser_ionization.1Rank.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/laser_ionization.1Rank.sh b/tests/laser_ionization.1Rank.sh index 3108160b5d..40641ee5a5 100755 --- a/tests/laser_ionization.1Rank.sh +++ b/tests/laser_ionization.1Rank.sh @@ -38,7 +38,7 @@ mpiexec -n 1 $HIPACE_EXECUTABLE $HIPACE_EXAMPLE_DIR/inputs_laser_ionization \ plasmas.insitu_file_prefix = $TEST_NAME/insitu_circular # Compare the result with theory -$HIPACE_EXAMPLE_DIR/analysis_laser_ionization.py --first=$TEST_NAME/linear --second=$TEST_NAME/circular --third=$TEST_NAME/insitu_linear --fourth=$TEST_NAME/insitu_linear +$HIPACE_EXAMPLE_DIR/analysis_laser_ionization.py --first=$TEST_NAME/linear --second=$TEST_NAME/circular --third=$TEST_NAME/insitu_linear --fourth=$TEST_NAME/insitu_circular # Compare the results with checksum benchmark if it runs on CPU only From 5d0a95c75aa71d79dcf2603f26c5afc34ea92fd2 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:57:51 +0100 Subject: [PATCH 49/97] Update laser_ionization.1Rank.json --- .../laser_ionization.1Rank.json | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json index 37c98b1a2a..51fb7ccf3a 100644 --- a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json +++ b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json @@ -1,24 +1,24 @@ { "lev=0": { - "Bx": 473.16542773922, - "By": 642.81856379697, - "Bz": 1314.3146623456, + "Bx": 7.1326713580851, + "By": 5.7271464341225, + "Bz": 1356.3543935485, "ExmBy": 0.0, "EypBx": 0.0, - "Ez": 336628250420.41, + "Ez": 410604299404.56, "Psi": 0.0, - "Sx": 22112618704000.0, - "Sy": 20076321717728.0, + "Sx": 304242697524.62, + "Sy": 370476266151.08, "aabs": 0.19201022247138, - "chi": 104663510800110.0, - "jx": 241698526334840.0, + "chi": 104707242244770.0, + "jx": 275354667930460.0, "jx_beam": 0.0, - "jy": 51620682815744.0, + "jy": 0.0, "jy_beam": 0.0, "jz_beam": 0.0, "laserEnvelope": 30.678508193173, - "rho_elec": 473292108.8649, - "rho_ion": 473479352.42234, + "rho_elec": 473489830.5354, + "rho_ion": 473479244.32132, "rhomjz": 0.0 } } From cb755acf66a14d1912eb4cb79bf0238ee73f975c Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 16:00:11 +0100 Subject: [PATCH 50/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 83b7d1350d..a081e8ee3f 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -533,7 +533,7 @@ LaserIonization (const int islice, amrex::Real* AMREX_RESTRICT adk_power = m_adk_power.data(); amrex::Real* AMREX_RESTRICT laser_adk_prefactor = m_laser_adk_prefactor.data(); amrex::Real* AMREX_RESTRICT laser_dp_prefactor = m_laser_dp_prefactor.data(); - amrex::Real* AMREX_RESTRICT laser_dp_second_prefactor = m_laser_dp_second_prefactor.data(); + amrex::Real* AMREX_RESTRICT laser_dp_second_prefactor = m_laser_dp_second_prefactor.data(); long num_ions = ptile_ion.numParticles(); From e7745eee8f93a7559b3f66b47e9c71278ad07de8 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 16:01:18 +0100 Subject: [PATCH 51/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index a081e8ee3f..fb6ee64e99 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -672,10 +672,10 @@ LaserIonization (const int islice, const int ion_lev_loc = ion_lev[ip]; if (linear_polarization) { - amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc-1]; - amrex::Real delta2 = delta * delta; - amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc-1] * delta2); // equation from C. Schroeder art. - amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); + amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc-1]; + amrex::Real delta2 = delta * delta; + amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc-1] * delta2); // equation (14) from C. Schroeder art. + amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; uy = 0._rt; uz = (amrex::abs(A * A) / 4. + p_pol * p_pol / 2.); From 5d3c3e67421de3ffe1f6eda2fde82c4b45a7a4cb Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 16:04:14 +0100 Subject: [PATCH 52/97] Update PlasmaParticleContainerInit.cpp --- src/particles/plasma/PlasmaParticleContainerInit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainerInit.cpp b/src/particles/plasma/PlasmaParticleContainerInit.cpp index 9c8786aac1..60be0acb8d 100644 --- a/src/particles/plasma/PlasmaParticleContainerInit.cpp +++ b/src/particles/plasma/PlasmaParticleContainerInit.cpp @@ -452,8 +452,8 @@ InitIonizationModule (const amrex::Geometry& geom, const amrex::Real background_ * std::pow(2*std::pow((Uion/UH),3./2.)*Ea,2*n_eff - 1); h_adk_exp_prefactor[i] = -2./3. * std::pow( Uion/UH,3./2.) * Ea; h_laser_adk_prefactor[i] = (3./MathConst::pi) * std::pow(Uion/UH, -3./2.) / Ea; - h_laser_dp_prefactor[i] = std::sqrt(3./2./Ea) * std::pow(UH/Uion, 3./4.); - h_laser_dp_second_prefactor[i] = 2 * ion_atomic_number * std::sqrt(UH/Uion) - 1./2.; + h_laser_dp_prefactor[i] = std::sqrt(3./2./Ea) * std::pow(UH/Uion, 3./4.); + h_laser_dp_second_prefactor[i] = 2 * ion_atomic_number * std::sqrt(UH/Uion) - 1./2.; } amrex::Gpu::copy(amrex::Gpu::hostToDevice, From 9847e4aa4f04834816b0849bc7cf78f27d24025f Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 16:05:08 +0100 Subject: [PATCH 53/97] Update inputs_laser_ionization --- examples/laser_ionization/inputs_laser_ionization | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/laser_ionization/inputs_laser_ionization b/examples/laser_ionization/inputs_laser_ionization index 98eec6c5b2..3b504ffc3b 100644 --- a/examples/laser_ionization/inputs_laser_ionization +++ b/examples/laser_ionization/inputs_laser_ionization @@ -34,7 +34,7 @@ laser.tau = tau_fs*1.e-15 laser.focal_distance = 50.e-6 plasmas.names = elec ion -#plasmas.do_push = 0 +plasmas.do_push = 0 plasmas.insitu_period = 1 elec.density(x,y,z) = n0 @@ -42,7 +42,6 @@ elec.ppc = 0 0 elec.u_mean = 0.0 0.0 0.0 elec.element = electron elec.neutralize_background = false -elec.do_push = 0 ion.density(x,y,z) = n0 ion.ppc = 1 1 @@ -52,7 +51,6 @@ ion.mass_Da = 1.008 ion.initial_ion_level = 0 ion.can_laser_ionize = 1 ion.ionization_product = elec -ion.do_push = 0 amr.max_level = 0 From c9936ec5ff08452963171859bba3701c401ef017 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 16:13:32 +0100 Subject: [PATCH 54/97] Update laser_ionization.1Rank.json --- .../laser_ionization.1Rank.json | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json index 51fb7ccf3a..37c98b1a2a 100644 --- a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json +++ b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json @@ -1,24 +1,24 @@ { "lev=0": { - "Bx": 7.1326713580851, - "By": 5.7271464341225, - "Bz": 1356.3543935485, + "Bx": 473.16542773922, + "By": 642.81856379697, + "Bz": 1314.3146623456, "ExmBy": 0.0, "EypBx": 0.0, - "Ez": 410604299404.56, + "Ez": 336628250420.41, "Psi": 0.0, - "Sx": 304242697524.62, - "Sy": 370476266151.08, + "Sx": 22112618704000.0, + "Sy": 20076321717728.0, "aabs": 0.19201022247138, - "chi": 104707242244770.0, - "jx": 275354667930460.0, + "chi": 104663510800110.0, + "jx": 241698526334840.0, "jx_beam": 0.0, - "jy": 0.0, + "jy": 51620682815744.0, "jy_beam": 0.0, "jz_beam": 0.0, "laserEnvelope": 30.678508193173, - "rho_elec": 473489830.5354, - "rho_ion": 473479244.32132, + "rho_elec": 473292108.8649, + "rho_ion": 473479352.42234, "rhomjz": 0.0 } } From 748f0af638fe1e29e1fb33b89d617978e2f84df9 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 16:26:49 +0100 Subject: [PATCH 55/97] Update inputs_laser_ionization --- examples/laser_ionization/inputs_laser_ionization | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/laser_ionization/inputs_laser_ionization b/examples/laser_ionization/inputs_laser_ionization index 3b504ffc3b..bdaf5cf4bc 100644 --- a/examples/laser_ionization/inputs_laser_ionization +++ b/examples/laser_ionization/inputs_laser_ionization @@ -2,7 +2,7 @@ max_step = 0 hipace.dt = 0 hipace.verbose = 3 -amr.n_cell = 32 32 50 +amr.n_cell = 64 64 100 my_constants.kp_inv = 10.e-6 From 366b28f8142bf86ed5753716eb75caf4e85bf30b Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 13 Feb 2025 16:31:31 +0100 Subject: [PATCH 56/97] Update laser_ionization.1Rank.json --- .../laser_ionization.1Rank.json | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json index 37c98b1a2a..4172139196 100644 --- a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json +++ b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json @@ -1,24 +1,24 @@ { "lev=0": { - "Bx": 473.16542773922, - "By": 642.81856379697, - "Bz": 1314.3146623456, + "Bx": 35.665114611702, + "By": 26.944044076532, + "Bz": 5859.6382236448, "ExmBy": 0.0, "EypBx": 0.0, - "Ez": 336628250420.41, + "Ez": 1818963947289.2, "Psi": 0.0, - "Sx": 22112618704000.0, - "Sy": 20076321717728.0, - "aabs": 0.19201022247138, - "chi": 104663510800110.0, - "jx": 241698526334840.0, + "Sx": 4382067902275.0, + "Sy": 6037085182533.7, + "aabs": 1.5360817327989, + "chi": 827141196847950.0, + "jx": 2275839479689800.0, "jx_beam": 0.0, - "jy": 51620682815744.0, + "jy": 0.0, "jy_beam": 0.0, "jz_beam": 0.0, - "laserEnvelope": 30.678508193173, - "rho_elec": 473292108.8649, - "rho_ion": 473479352.42234, + "laserEnvelope": 245.42806554539, + "rho_elec": 3740363078.6656, + "rho_ion": 3740281352.0736, "rhomjz": 0.0 } } From 78504df9283ed7f91a9346c2c4475d11c6d21fa2 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 08:59:14 +0100 Subject: [PATCH 57/97] Update analysis_laser_ionization.py --- examples/laser_ionization/analysis_laser_ionization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index 2bd2f1f8dd..81064b62bb 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -65,7 +65,7 @@ relative_diff_linear = np.abs( ( fraction_linear - fraction_warpx_linear ) / fraction_warpx_linear ) relative_diff_circular = np.abs( ( fraction_circular - fraction_warpx_circular ) / fraction_warpx_circular ) -tolerance = 0.25 +tolerance = 0.1 print(f"fraction_warpx_linear = {fraction_warpx_linear}") print(f"fraction_hipace_linear = {fraction_linear}") print(f"fraction_warpx_circular = {fraction_warpx_circular}") From 38ab9c6ed5ae585883ec32450ad05ec37542ef58 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:03:18 +0100 Subject: [PATCH 58/97] Update analysis_laser_ionization.py --- .../analysis_laser_ionization.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index 81064b62bb..e2b3e76b44 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -19,27 +19,27 @@ parser = argparse.ArgumentParser( description='Script to analyze the equality of two simulations') -parser.add_argument('--first', - dest='first', +parser.add_argument('--diags_linear', + dest='diags_linear', required=True, help='Path to the directory containing output files') -parser.add_argument('--second', - dest='second', +parser.add_argument('--diags_circular', + dest='diags_circular', required=True, help='Path to the directory containing output files') -parser.add_argument('--third', - dest='third', +parser.add_argument('--insitu_linear', + dest='insitu_linear', required=True, help='Path to the directory containing output files') -parser.add_argument('--fourth', - dest='fourth', +parser.add_argument('--insitu_circular', + dest='insitu_circular', required=True, help='Path to the directory containing output files') args = parser.parse_args() # diagnostics for calculation of the fraction of ionization in linear and circular polarization -ts_linear = OpenPMDTimeSeries(args.first) -ts_circular = OpenPMDTimeSeries(args.second) +ts_linear = OpenPMDTimeSeries(args.diags_linear) +ts_circular = OpenPMDTimeSeries(args.diags_circular) a0_linear = 0.00885126 a0_circular = 0.00787934 @@ -72,14 +72,14 @@ print(f"fraction_hipace_circular = {fraction_circular}") # in-situ diagnostics for calculation of the temperature in all directions in circular polarization -insitu_path_linear = f'./{args.third}/reduced_elec.0000.txt' +insitu_path_linear = f'./{args.insitu_linear}/reduced_elec.0000.txt' all_data_linear = diag.read_file(insitu_path_linear) Tx2_l = all_data_linear['[ux^2]'][0,0]*scc.m_e*scc.c**2/scc.e Ty2_l = all_data_linear['[uy^2]'][0,0]*scc.m_e*scc.c**2/scc.e Tz2_l = all_data_linear['[uz^2]'][0,0]*scc.m_e*scc.c**2/scc.e temp_eV_linear = 1./3*(Tx2_l+Ty2_l+Tz2_l) -insitu_path_circular = f'./{args.fourth}/reduced_elec.0000.txt' +insitu_path_circular = f'./{args.insitu_circular}/reduced_elec.0000.txt' all_data_circular = diag.read_file(insitu_path_circular) Tx2_c = all_data_circular['[ux^2]'][0,0]*scc.m_e*scc.c**2/scc.e Ty2_c = all_data_circular['[uy^2]'][0,0]*scc.m_e*scc.c**2/scc.e From bc3c882970dfc00e87f269cd2e730f1b3b6779fd Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:05:03 +0100 Subject: [PATCH 59/97] Update laser_ionization.1Rank.sh --- tests/laser_ionization.1Rank.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/laser_ionization.1Rank.sh b/tests/laser_ionization.1Rank.sh index 40641ee5a5..8abad15f46 100755 --- a/tests/laser_ionization.1Rank.sh +++ b/tests/laser_ionization.1Rank.sh @@ -38,7 +38,8 @@ mpiexec -n 1 $HIPACE_EXECUTABLE $HIPACE_EXAMPLE_DIR/inputs_laser_ionization \ plasmas.insitu_file_prefix = $TEST_NAME/insitu_circular # Compare the result with theory -$HIPACE_EXAMPLE_DIR/analysis_laser_ionization.py --first=$TEST_NAME/linear --second=$TEST_NAME/circular --third=$TEST_NAME/insitu_linear --fourth=$TEST_NAME/insitu_circular +$HIPACE_EXAMPLE_DIR/analysis_laser_ionization.py --diags_linear=$TEST_NAME/linear --diags_circular=$TEST_NAME/circular + --insitu_linear=$TEST_NAME/insitu_linear --insitu_circular=$TEST_NAME/insitu_circular # Compare the results with checksum benchmark if it runs on CPU only From de890ecb36c1af159e008235ab9c030299ce23d1 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:06:27 +0100 Subject: [PATCH 60/97] Update inputs_laser_ionization --- examples/laser_ionization/inputs_laser_ionization | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/laser_ionization/inputs_laser_ionization b/examples/laser_ionization/inputs_laser_ionization index bdaf5cf4bc..7461c43f77 100644 --- a/examples/laser_ionization/inputs_laser_ionization +++ b/examples/laser_ionization/inputs_laser_ionization @@ -2,7 +2,7 @@ max_step = 0 hipace.dt = 0 hipace.verbose = 3 -amr.n_cell = 64 64 100 +amr.n_cell = 50 50 50 my_constants.kp_inv = 10.e-6 From fae73ddee39d3d3268ee4983083ef668f52739df Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:10:27 +0100 Subject: [PATCH 61/97] Update src/particles/plasma/PlasmaParticleContainer.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maxence Thévenet --- src/particles/plasma/PlasmaParticleContainer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index fb6ee64e99..989c3a99ae 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -691,7 +691,8 @@ LaserIonization (const int islice, const long pid = amrex::Gpu::Atomic::Add( p_ip_elec, 1u ); // ensures thread-safe access when incrementing `p_ip_elec` const long pidx = pid + old_size; // Copy ion data to new electron - amrex::ParticleIDWrapper{idcpu_elec[pidx]} = 2; // sets the ionized electron ID to 2 (valid/invalid) for the ionized electrons + // set the ionized electron ID to 2 (valid/invalid) for the ionized electrons + amrex::ParticleIDWrapper{idcpu_elec[pidx]} = 2; amrex::ParticleCPUWrapper{idcpu_elec[pidx]} = amrex::ParticleCPUWrapper{idcpu_ion[pidx]}; // current level arrdata_elec[PlasmaIdx::x ][pidx] = arrdata_ion[PlasmaIdx::x ][ip]; From 220f499d82eb1775fc4e6140d402ff12a92153df Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:11:37 +0100 Subject: [PATCH 62/97] Update inputs_laser_ionization --- examples/laser_ionization/inputs_laser_ionization | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/laser_ionization/inputs_laser_ionization b/examples/laser_ionization/inputs_laser_ionization index 7461c43f77..5f524146f7 100644 --- a/examples/laser_ionization/inputs_laser_ionization +++ b/examples/laser_ionization/inputs_laser_ionization @@ -34,7 +34,6 @@ laser.tau = tau_fs*1.e-15 laser.focal_distance = 50.e-6 plasmas.names = elec ion -plasmas.do_push = 0 plasmas.insitu_period = 1 elec.density(x,y,z) = n0 From 7423b3430a616dbc24f5e9e50891956cab71dcc5 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:14:05 +0100 Subject: [PATCH 63/97] Update laser_ionization.1Rank.sh --- tests/laser_ionization.1Rank.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/laser_ionization.1Rank.sh b/tests/laser_ionization.1Rank.sh index 8abad15f46..501d7d4da0 100755 --- a/tests/laser_ionization.1Rank.sh +++ b/tests/laser_ionization.1Rank.sh @@ -27,11 +27,13 @@ rm -rf $TEST_NAME # Run the simulation mpiexec -n 1 $HIPACE_EXECUTABLE $HIPACE_EXAMPLE_DIR/inputs_laser_ionization \ + plasmas.do_push = 0 \ # disable field forces on particles my_constants.a0 = 0.00885126 \ hipace.file_prefix=$TEST_NAME/linear \ plasmas.insitu_file_prefix = $TEST_NAME/insitu_linear mpiexec -n 1 $HIPACE_EXECUTABLE $HIPACE_EXAMPLE_DIR/inputs_laser_ionization \ + plasmas.do_push = 0 \ # disable field forces on particles my_constants.a0 = 0.00787934 \ lasers.polarization = circular \ hipace.file_prefix=$TEST_NAME/circular \ From f38a7f47a5ffef9016f77a70edb449f4098c3b90 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:15:09 +0100 Subject: [PATCH 64/97] Update src/particles/plasma/PlasmaParticleContainer.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maxence Thévenet --- src/particles/plasma/PlasmaParticleContainer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 989c3a99ae..82d67de3d2 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -666,9 +666,9 @@ LaserIonization (const int islice, Ep *= phys_const.m_e * phys_const.c / phys_const.q_e; Ep *= E0; - amrex::Real ux; - amrex::Real uy; - amrex::Real uz; + amrex::Real ux = 0._rt; + amrex::Real uy = 0._rt; + amrex::Real uz = 0._rt; const int ion_lev_loc = ion_lev[ip]; if (linear_polarization) { From 9c1fbdd66acf99bf1ff6a9aff7ec40530a3ad272 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:21:35 +0100 Subject: [PATCH 65/97] Update PlasmaParticleContainer.cpp --- .../plasma/PlasmaParticleContainer.cpp | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 82d67de3d2..a7e0273320 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -626,11 +626,11 @@ LaserIonization (const int islice, amrex::Gpu::DeviceScalar ip_elec(0); uint32_t * AMREX_RESTRICT p_ip_elec = ip_elec.dataPtr(); - // This kernel supports multiple deposition orders (0, 1, 2, 3) at compile time - // and calculates the momentum of the ionized electron based on equations (B8) and (B9) - // from the Massimo, 2020 article. It computes the energy of the emitted electron - // and assigns the resulting properties (momentum, position, etc.) to the new electrons - // created in the plasma container. + // This kernel supports multiple deposition orders (0, 1, 2, 3) at compile time. + // It calculates the momentum of ionized electrons based on equations (B8) and (B9) + // from the Massimo (2020) article and equation (14) from the C. Schroeder (2014) article. + // Additionally, it computes the energy of emitted electrons and assigns their properties + // (momentum, position, etc.) to newly created electrons in the plasma container. amrex::AnyCTO( amrex::TypeList< amrex::CompileTimeOptions<0, 1, 2, 3> @@ -659,22 +659,20 @@ LaserIonization (const int islice, doLaserGatherShapeN(xp, yp, A, A_dx, A_dzeta, laser_arr, dx_inv, dy_inv, dzeta_inv, x_pos_offset, y_pos_offset); - const Complex Et = I * A * omega0 + A_dzeta * phys_const.c; // transverse component - const Complex El = - A_dx * phys_const.c; // longitudinal component - - amrex::Real Ep = std::sqrt( amrex::abs(Et*Et) + amrex::abs(El*El) ); - Ep *= phys_const.m_e * phys_const.c / phys_const.q_e; - Ep *= E0; - amrex::Real ux = 0._rt; amrex::Real uy = 0._rt; amrex::Real uz = 0._rt; - const int ion_lev_loc = ion_lev[ip]; + const int ion_lev_loc = ion_lev[ip]-1; if (linear_polarization) { - amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc-1]; + const Complex Et = I * A * omega0 + A_dzeta * phys_const.c; // transverse component + const Complex El = - A_dx * phys_const.c; // longitudinal component + amrex::Real Ep = std::sqrt( amrex::abs(Et*Et) + amrex::abs(El*El) ); + Ep *= phys_const.m_e * phys_const.c / phys_const.q_e; + Ep *= E0; + amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc]; amrex::Real delta2 = delta * delta; - amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc-1] * delta2); // equation (14) from C. Schroeder art. + amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc] * delta2); amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; uy = 0._rt; From d6e587023e5acce441263e5927790faa3f27937e Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:22:26 +0100 Subject: [PATCH 66/97] Update src/particles/plasma/PlasmaParticleContainer.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maxence Thévenet --- src/particles/plasma/PlasmaParticleContainer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index a7e0273320..fd6f2b99da 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -674,8 +674,7 @@ LaserIonization (const int islice, amrex::Real delta2 = delta * delta; amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc] * delta2); amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); - ux = p_pol; - uy = 0._rt; + ux = p_pol; // Linear polarization is assumed along x. uz = (amrex::abs(A * A) / 4. + p_pol * p_pol / 2.); } else { amrex::Real angle; From faabed63661e649df5a77a1642896e91e41b4930 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:22:55 +0100 Subject: [PATCH 67/97] Update src/particles/plasma/PlasmaParticleContainer.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maxence Thévenet --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index fd6f2b99da..f27a4008c0 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -675,7 +675,7 @@ LaserIonization (const int islice, amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc] * delta2); amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; // Linear polarization is assumed along x. - uz = (amrex::abs(A * A) / 4. + p_pol * p_pol / 2.); + uz = (amrex::abs(A * A) / 4._rt + p_pol * p_pol / 2._rt); } else { amrex::Real angle; angle = amrex::Random(engine) * 2 * MathConst::pi; From 7d0d77c5336f4dea36068c3cf20f1979a48a96d3 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:23:39 +0100 Subject: [PATCH 68/97] Update src/particles/plasma/PlasmaParticleContainer.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maxence Thévenet --- src/particles/plasma/PlasmaParticleContainer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index f27a4008c0..270994b10a 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -677,8 +677,7 @@ LaserIonization (const int islice, ux = p_pol; // Linear polarization is assumed along x. uz = (amrex::abs(A * A) / 4._rt + p_pol * p_pol / 2._rt); } else { - amrex::Real angle; - angle = amrex::Random(engine) * 2 * MathConst::pi; + amrex::Real const angle = amrex::Random(engine) * 2._rt * MathConst::pi; // A_t = A (e_x +/- i e_y) in circular polarization ux = std::sqrt(amrex::abs(A*A)) * std::cos(angle); uy = std::sqrt(amrex::abs(A*A)) * std::sin(angle); From 4778663a5d46acdaf700ff63cff3b81e15138f7b Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:24:03 +0100 Subject: [PATCH 69/97] Update src/particles/plasma/PlasmaParticleContainer.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maxence Thévenet --- src/particles/plasma/PlasmaParticleContainer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 270994b10a..811b1b7fc1 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -681,7 +681,9 @@ LaserIonization (const int islice, // A_t = A (e_x +/- i e_y) in circular polarization ux = std::sqrt(amrex::abs(A*A)) * std::cos(angle); uy = std::sqrt(amrex::abs(A*A)) * std::sin(angle); - uz = amrex::abs(A*A);// / 2.; + // uz differs from Massimo PRE 2020 by a factor of 2 due to different + // convention for linear vs. circular polarization. + uz = amrex::abs(A*A); } const long pid = amrex::Gpu::Atomic::Add( p_ip_elec, 1u ); // ensures thread-safe access when incrementing `p_ip_elec` From 7862de974aff3e6c17bcf0ff7d3a2c70f3067f3c Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:26:50 +0100 Subject: [PATCH 70/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 811b1b7fc1..3f35ba332a 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -678,7 +678,9 @@ LaserIonization (const int islice, uz = (amrex::abs(A * A) / 4._rt + p_pol * p_pol / 2._rt); } else { amrex::Real const angle = amrex::Random(engine) * 2._rt * MathConst::pi; - // A_t = A (e_x +/- i e_y) in circular polarization + // A_t = A (e_x +/- i e_y) in circular polarization. + // ux and uy differ from Massimo PRE 2020 by a factor of sqrt(2) due to different + // convention for linear vs. circular polarization. ux = std::sqrt(amrex::abs(A*A)) * std::cos(angle); uy = std::sqrt(amrex::abs(A*A)) * std::sin(angle); // uz differs from Massimo PRE 2020 by a factor of 2 due to different From d925c3b296c8aee545c9f826a01dabbc808dff13 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:30:31 +0100 Subject: [PATCH 71/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 3f35ba332a..3bb91989fd 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -427,7 +427,8 @@ IonizationModule (const int lev, const long pidx = pid + old_size; // Copy ion data to new electron - amrex::ParticleIDWrapper{idcpu_elec[pidx]} = 2; // sets the ionized electron ID to 2 (valid/invalid) for the ionized electrons + // Set the ionized electron ID to 2 (valid/invalid) for the ionized electrons + amrex::ParticleIDWrapper{idcpu_elec[pidx]} = 2; amrex::ParticleCPUWrapper{idcpu_elec[pidx]} = lev; // current level arrdata_elec[PlasmaIdx::x ][pidx] = arrdata_ion[PlasmaIdx::x ][ip]; arrdata_elec[PlasmaIdx::y ][pidx] = arrdata_ion[PlasmaIdx::y ][ip]; @@ -691,7 +692,7 @@ LaserIonization (const int islice, const long pid = amrex::Gpu::Atomic::Add( p_ip_elec, 1u ); // ensures thread-safe access when incrementing `p_ip_elec` const long pidx = pid + old_size; // Copy ion data to new electron - // set the ionized electron ID to 2 (valid/invalid) for the ionized electrons + // Set the ionized electron ID to 2 (valid/invalid) for the ionized electrons amrex::ParticleIDWrapper{idcpu_elec[pidx]} = 2; amrex::ParticleCPUWrapper{idcpu_elec[pidx]} = amrex::ParticleCPUWrapper{idcpu_ion[pidx]}; // current level From aa75022aad1b8832d1ff7324514a5194d4ee5886 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:33:43 +0100 Subject: [PATCH 72/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 3bb91989fd..620e4e0d5f 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -663,6 +663,8 @@ LaserIonization (const int islice, amrex::Real ux = 0._rt; amrex::Real uy = 0._rt; amrex::Real uz = 0._rt; + // Get the level from which the electron was ionized. + // The -1 is needed as this variable was incremented in the ionization kernel above. const int ion_lev_loc = ion_lev[ip]-1; if (linear_polarization) { From 2eed845689eb25a877a383766dddad303ccd9cfa Mon Sep 17 00:00:00 2001 From: EyaDammak Date: Fri, 14 Feb 2025 09:35:38 +0100 Subject: [PATCH 73/97] style --- src/particles/plasma/PlasmaParticleContainer.cpp | 4 ++-- tests/laser_ionization.1Rank.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 620e4e0d5f..6edb6e7057 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -630,7 +630,7 @@ LaserIonization (const int islice, // This kernel supports multiple deposition orders (0, 1, 2, 3) at compile time. // It calculates the momentum of ionized electrons based on equations (B8) and (B9) // from the Massimo (2020) article and equation (14) from the C. Schroeder (2014) article. - // Additionally, it computes the energy of emitted electrons and assigns their properties + // Additionally, it computes the energy of emitted electrons and assigns their properties // (momentum, position, etc.) to newly created electrons in the plasma container. amrex::AnyCTO( amrex::TypeList< @@ -675,7 +675,7 @@ LaserIonization (const int islice, Ep *= E0; amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc]; amrex::Real delta2 = delta * delta; - amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc] * delta2); + amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc] * delta2); amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; // Linear polarization is assumed along x. uz = (amrex::abs(A * A) / 4._rt + p_pol * p_pol / 2._rt); diff --git a/tests/laser_ionization.1Rank.sh b/tests/laser_ionization.1Rank.sh index 501d7d4da0..7bcd0f0033 100755 --- a/tests/laser_ionization.1Rank.sh +++ b/tests/laser_ionization.1Rank.sh @@ -40,7 +40,7 @@ mpiexec -n 1 $HIPACE_EXECUTABLE $HIPACE_EXAMPLE_DIR/inputs_laser_ionization \ plasmas.insitu_file_prefix = $TEST_NAME/insitu_circular # Compare the result with theory -$HIPACE_EXAMPLE_DIR/analysis_laser_ionization.py --diags_linear=$TEST_NAME/linear --diags_circular=$TEST_NAME/circular +$HIPACE_EXAMPLE_DIR/analysis_laser_ionization.py --diags_linear=$TEST_NAME/linear --diags_circular=$TEST_NAME/circular --insitu_linear=$TEST_NAME/insitu_linear --insitu_circular=$TEST_NAME/insitu_circular From cb0cb48b7b2d619fb4e9eb531892d95b194f796c Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:37:28 +0100 Subject: [PATCH 74/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 6edb6e7057..deb1fff426 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -677,7 +677,7 @@ LaserIonization (const int islice, amrex::Real delta2 = delta * delta; amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc] * delta2); amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); - ux = p_pol; // Linear polarization is assumed along x. + ux = p_pol; // linear polarization is assumed along x. uz = (amrex::abs(A * A) / 4._rt + p_pol * p_pol / 2._rt); } else { amrex::Real const angle = amrex::Random(engine) * 2._rt * MathConst::pi; From 77d6ade14263f3f0c05e3c4b08a5788442e1b8a9 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:43:44 +0100 Subject: [PATCH 75/97] Update laser_ionization.1Rank.sh --- tests/laser_ionization.1Rank.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/laser_ionization.1Rank.sh b/tests/laser_ionization.1Rank.sh index 7bcd0f0033..d25ec2405b 100755 --- a/tests/laser_ionization.1Rank.sh +++ b/tests/laser_ionization.1Rank.sh @@ -27,14 +27,14 @@ rm -rf $TEST_NAME # Run the simulation mpiexec -n 1 $HIPACE_EXECUTABLE $HIPACE_EXAMPLE_DIR/inputs_laser_ionization \ - plasmas.do_push = 0 \ # disable field forces on particles my_constants.a0 = 0.00885126 \ + plasmas.do_push = 0 \ # disable field forces on particles hipace.file_prefix=$TEST_NAME/linear \ plasmas.insitu_file_prefix = $TEST_NAME/insitu_linear mpiexec -n 1 $HIPACE_EXECUTABLE $HIPACE_EXAMPLE_DIR/inputs_laser_ionization \ - plasmas.do_push = 0 \ # disable field forces on particles my_constants.a0 = 0.00787934 \ + plasmas.do_push = 0 \ lasers.polarization = circular \ hipace.file_prefix=$TEST_NAME/circular \ plasmas.insitu_file_prefix = $TEST_NAME/insitu_circular From b33b32304ab831e3342b4a6eb3d90ed0f5cbf878 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:49:04 +0100 Subject: [PATCH 76/97] Update laser_ionization.1Rank.sh --- tests/laser_ionization.1Rank.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/laser_ionization.1Rank.sh b/tests/laser_ionization.1Rank.sh index d25ec2405b..76c5e7f753 100755 --- a/tests/laser_ionization.1Rank.sh +++ b/tests/laser_ionization.1Rank.sh @@ -28,14 +28,14 @@ rm -rf $TEST_NAME # Run the simulation mpiexec -n 1 $HIPACE_EXECUTABLE $HIPACE_EXAMPLE_DIR/inputs_laser_ionization \ my_constants.a0 = 0.00885126 \ - plasmas.do_push = 0 \ # disable field forces on particles + plasmas.do_push = 0 \ hipace.file_prefix=$TEST_NAME/linear \ plasmas.insitu_file_prefix = $TEST_NAME/insitu_linear mpiexec -n 1 $HIPACE_EXECUTABLE $HIPACE_EXAMPLE_DIR/inputs_laser_ionization \ my_constants.a0 = 0.00787934 \ - plasmas.do_push = 0 \ lasers.polarization = circular \ + plasmas.do_push = 0 \ hipace.file_prefix=$TEST_NAME/circular \ plasmas.insitu_file_prefix = $TEST_NAME/insitu_circular From 1c7356ef7608e2448e945f92859afe7e74de0843 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:55:34 +0100 Subject: [PATCH 77/97] Update analysis_laser_ionization.py --- .../analysis_laser_ionization.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index e2b3e76b44..b862d919db 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -20,26 +20,26 @@ parser = argparse.ArgumentParser( description='Script to analyze the equality of two simulations') parser.add_argument('--diags_linear', - dest='diags_linear', + dest='first', required=True, help='Path to the directory containing output files') parser.add_argument('--diags_circular', - dest='diags_circular', + dest='second', required=True, help='Path to the directory containing output files') parser.add_argument('--insitu_linear', - dest='insitu_linear', + dest='third', required=True, help='Path to the directory containing output files') parser.add_argument('--insitu_circular', - dest='insitu_circular', + dest='fourth', required=True, help='Path to the directory containing output files') args = parser.parse_args() # diagnostics for calculation of the fraction of ionization in linear and circular polarization -ts_linear = OpenPMDTimeSeries(args.diags_linear) -ts_circular = OpenPMDTimeSeries(args.diags_circular) +ts_linear = OpenPMDTimeSeries(args.first) +ts_circular = OpenPMDTimeSeries(args.second) a0_linear = 0.00885126 a0_circular = 0.00787934 @@ -72,14 +72,14 @@ print(f"fraction_hipace_circular = {fraction_circular}") # in-situ diagnostics for calculation of the temperature in all directions in circular polarization -insitu_path_linear = f'./{args.insitu_linear}/reduced_elec.0000.txt' +insitu_path_linear = f'./{args.third}/reduced_elec.0000.txt' all_data_linear = diag.read_file(insitu_path_linear) Tx2_l = all_data_linear['[ux^2]'][0,0]*scc.m_e*scc.c**2/scc.e Ty2_l = all_data_linear['[uy^2]'][0,0]*scc.m_e*scc.c**2/scc.e Tz2_l = all_data_linear['[uz^2]'][0,0]*scc.m_e*scc.c**2/scc.e temp_eV_linear = 1./3*(Tx2_l+Ty2_l+Tz2_l) -insitu_path_circular = f'./{args.insitu_circular}/reduced_elec.0000.txt' +insitu_path_circular = f'./{args.fourth}/reduced_elec.0000.txt' all_data_circular = diag.read_file(insitu_path_circular) Tx2_c = all_data_circular['[ux^2]'][0,0]*scc.m_e*scc.c**2/scc.e Ty2_c = all_data_circular['[uy^2]'][0,0]*scc.m_e*scc.c**2/scc.e From e07856dd41de6028ca662358c22fa321a42a97e2 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 10:03:35 +0100 Subject: [PATCH 78/97] Update laser_ionization.1Rank.sh --- tests/laser_ionization.1Rank.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/laser_ionization.1Rank.sh b/tests/laser_ionization.1Rank.sh index 76c5e7f753..eab7146909 100755 --- a/tests/laser_ionization.1Rank.sh +++ b/tests/laser_ionization.1Rank.sh @@ -40,7 +40,7 @@ mpiexec -n 1 $HIPACE_EXECUTABLE $HIPACE_EXAMPLE_DIR/inputs_laser_ionization \ plasmas.insitu_file_prefix = $TEST_NAME/insitu_circular # Compare the result with theory -$HIPACE_EXAMPLE_DIR/analysis_laser_ionization.py --diags_linear=$TEST_NAME/linear --diags_circular=$TEST_NAME/circular +$HIPACE_EXAMPLE_DIR/analysis_laser_ionization.py --diags_linear=$TEST_NAME/linear --diags_circular=$TEST_NAME/circular \ --insitu_linear=$TEST_NAME/insitu_linear --insitu_circular=$TEST_NAME/insitu_circular From b6cd3a27fe62616334ecdcd298c009539e173ffd Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 10:15:17 +0100 Subject: [PATCH 79/97] Update analysis_laser_ionization.py --- examples/laser_ionization/analysis_laser_ionization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index b862d919db..62af0ec074 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -65,7 +65,7 @@ relative_diff_linear = np.abs( ( fraction_linear - fraction_warpx_linear ) / fraction_warpx_linear ) relative_diff_circular = np.abs( ( fraction_circular - fraction_warpx_circular ) / fraction_warpx_circular ) -tolerance = 0.1 +tolerance = 0.15 print(f"fraction_warpx_linear = {fraction_warpx_linear}") print(f"fraction_hipace_linear = {fraction_linear}") print(f"fraction_warpx_circular = {fraction_warpx_circular}") From 0e5ed14f9fac7401e3b5bf5e7c0314de244544f8 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 10:26:01 +0100 Subject: [PATCH 80/97] Update laser_ionization.1Rank.json --- .../laser_ionization.1Rank.json | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json index 4172139196..b32e1976dd 100644 --- a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json +++ b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json @@ -1,24 +1,24 @@ { "lev=0": { - "Bx": 35.665114611702, - "By": 26.944044076532, - "Bz": 5859.6382236448, + "Bx": 13.149192792269, + "By": 9.6319466943698, + "Bz": 2214.7586533665, "ExmBy": 0.0, "EypBx": 0.0, - "Ez": 1818963947289.2, + "Ez": 779215198153.58, "Psi": 0.0, - "Sx": 4382067902275.0, - "Sy": 6037085182533.7, - "aabs": 1.5360817327989, - "chi": 827141196847950.0, - "jx": 2275839479689800.0, + "Sx": 1114892448780.4, + "Sy": 1516523075637.6, + "aabs": 0.46877495720552, + "chi": 265993671876340.0, + "jx": 704455285849490.0, "jx_beam": 0.0, "jy": 0.0, "jy_beam": 0.0, "jz_beam": 0.0, - "laserEnvelope": 245.42806554539, - "rho_elec": 3740363078.6656, - "rho_ion": 3740281352.0736, + "laserEnvelope": 74.898701643489, + "rho_elec": 1202832873.9999, + "rho_ion": 1202806069.8845, "rhomjz": 0.0 } } From 220b8f97b7c2faa6c9936f6de0624b14c3b5340c Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 10:39:18 +0100 Subject: [PATCH 81/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index deb1fff426..88f0cfcdea 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -663,11 +663,11 @@ LaserIonization (const int islice, amrex::Real ux = 0._rt; amrex::Real uy = 0._rt; amrex::Real uz = 0._rt; - // Get the level from which the electron was ionized. - // The -1 is needed as this variable was incremented in the ionization kernel above. - const int ion_lev_loc = ion_lev[ip]-1; if (linear_polarization) { + // Get the level from which the electron was ionized. + // The -1 is needed as this variable was incremented in the ionization kernel above. + const int ion_lev_loc = ion_lev[ip]-1; const Complex Et = I * A * omega0 + A_dzeta * phys_const.c; // transverse component const Complex El = - A_dx * phys_const.c; // longitudinal component amrex::Real Ep = std::sqrt( amrex::abs(Et*Et) + amrex::abs(El*El) ); From 2422be92e705470540a0a3a61c8521a91694dae7 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 14 Feb 2025 13:11:14 +0100 Subject: [PATCH 82/97] Update src/particles/plasma/PlasmaParticleContainer.cpp Co-authored-by: Alexander Sinn <64009254+AlexanderSinn@users.noreply.github.com> --- src/particles/plasma/PlasmaParticleContainer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 88f0cfcdea..6224192852 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -675,10 +675,11 @@ LaserIonization (const int islice, Ep *= E0; amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc]; amrex::Real delta2 = delta * delta; - amrex::Real width_p = amrex::abs(A) * delta * (1 - (3./4.) * delta2 - (3./2.) * delta2 + laser_dp_second_prefactor[ion_lev_loc] * delta2); + amrex::Real width_p = amrex::abs(A) * delta * (1._rt - (3._rt/4._rt) * delta2 + - (3._rt/2._rt) * delta2 + laser_dp_second_prefactor[ion_lev_loc] * delta2); amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; // linear polarization is assumed along x. - uz = (amrex::abs(A * A) / 4._rt + p_pol * p_pol / 2._rt); + uz = (amrex::abs(A * A) * 0.25_rt + p_pol * p_pol * 0.5_rt); } else { amrex::Real const angle = amrex::Random(engine) * 2._rt * MathConst::pi; // A_t = A (e_x +/- i e_y) in circular polarization. From a787ee78271f11d414be96950337dda80a22e36c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxence=20Th=C3=A9venet?= Date: Fri, 14 Feb 2025 13:29:44 +0100 Subject: [PATCH 83/97] Update examples/laser_ionization/analysis_laser_ionization.py --- examples/laser_ionization/analysis_laser_ionization.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index 62af0ec074..cac98cd528 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -98,4 +98,8 @@ relative_diff_temp_linear = np.abs( ( temp_eV_linear - temp_eV_warpx_linear ) / temp_eV_warpx_linear ) relative_diff_temp_circular = np.abs( ( temp_eV_circular - temp_eV_warpx_circular ) / temp_eV_warpx_circular ) -assert ( (relative_diff_linear < tolerance) and (relative_diff_circular < tolerance) and (relative_diff_temp_linear < tolerance) and (relative_diff_temp_circular < tolerance)), 'Test laser_ionization did not pass' +assert ( (relative_diff_linear < tolerance) and \ + (relative_diff_circular < tolerance) and \ + (relative_diff_temp_linear < tolerance) and \ + (relative_diff_temp_circular < tolerance)), + 'Test laser_ionization did not pass' From c45ac7c6f3dd91fc1670d0797327d86be986d901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxence=20Th=C3=A9venet?= Date: Fri, 14 Feb 2025 13:37:47 +0100 Subject: [PATCH 84/97] Update examples/laser_ionization/analysis_laser_ionization.py --- examples/laser_ionization/analysis_laser_ionization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/laser_ionization/analysis_laser_ionization.py b/examples/laser_ionization/analysis_laser_ionization.py index cac98cd528..8dacc661bb 100755 --- a/examples/laser_ionization/analysis_laser_ionization.py +++ b/examples/laser_ionization/analysis_laser_ionization.py @@ -101,5 +101,5 @@ assert ( (relative_diff_linear < tolerance) and \ (relative_diff_circular < tolerance) and \ (relative_diff_temp_linear < tolerance) and \ - (relative_diff_temp_circular < tolerance)), + (relative_diff_temp_circular < tolerance)), \ 'Test laser_ionization did not pass' From f5aa8083a4dd04523422f3aea98d98c434b12573 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 18 Feb 2025 13:43:37 +0100 Subject: [PATCH 85/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 3e9a2324dd..9c01411a08 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -675,8 +675,8 @@ LaserIonization (const int islice, Ep *= E0; amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc]; amrex::Real delta2 = delta * delta; - amrex::Real width_p = amrex::abs(A) * delta * (1._rt - (3._rt/4._rt) * delta2 - - (3._rt/2._rt) * delta2 + laser_dp_second_prefactor[ion_lev_loc] * delta2); + amrex::Real width_p = amrex::abs(A) * delta * (1._rt - (7._rt/4._rt) * delta2 + + laser_dp_second_prefactor[ion_lev_loc] * delta2); amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; // linear polarization is assumed along x. uz = (amrex::abs(A * A) * 0.25_rt + p_pol * p_pol * 0.5_rt); From 29aeab972db017dbadec1066fb852b3275f677a3 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 18 Feb 2025 13:49:47 +0100 Subject: [PATCH 86/97] Update PlasmaParticleContainerInit.cpp --- src/particles/plasma/PlasmaParticleContainerInit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainerInit.cpp b/src/particles/plasma/PlasmaParticleContainerInit.cpp index 60be0acb8d..ac9e87004d 100644 --- a/src/particles/plasma/PlasmaParticleContainerInit.cpp +++ b/src/particles/plasma/PlasmaParticleContainerInit.cpp @@ -453,7 +453,7 @@ InitIonizationModule (const amrex::Geometry& geom, const amrex::Real background_ h_adk_exp_prefactor[i] = -2./3. * std::pow( Uion/UH,3./2.) * Ea; h_laser_adk_prefactor[i] = (3./MathConst::pi) * std::pow(Uion/UH, -3./2.) / Ea; h_laser_dp_prefactor[i] = std::sqrt(3./2./Ea) * std::pow(UH/Uion, 3./4.); - h_laser_dp_second_prefactor[i] = 2 * ion_atomic_number * std::sqrt(UH/Uion) - 1./2.; + h_laser_dp_second_prefactor[i] = ion_atomic_number * std::sqrt(UH/Uion) - 1./2.; } amrex::Gpu::copy(amrex::Gpu::hostToDevice, From 37c6e4c3b809edd87338091922dded84e3401800 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:02:51 +0100 Subject: [PATCH 87/97] Update laser_ionization.1Rank.json --- .../laser_ionization.1Rank.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json index b32e1976dd..cab95ce13d 100644 --- a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json +++ b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json @@ -1,23 +1,23 @@ { "lev=0": { - "Bx": 13.149192792269, - "By": 9.6319466943698, - "Bz": 2214.7586533665, + "Bx": 12.895401136926, + "By": 9.7408143220707, + "Bz": 2091.4259740328, "ExmBy": 0.0, "EypBx": 0.0, - "Ez": 779215198153.58, + "Ez": 735839981397.02, "Psi": 0.0, - "Sx": 1114892448780.4, - "Sy": 1516523075637.6, + "Sx": 1120131620270.7, + "Sy": 1484350002437.1, "aabs": 0.46877495720552, - "chi": 265993671876340.0, - "jx": 704455285849490.0, + "chi": 265993671878070.0, + "jx": 665650594373930.0, "jx_beam": 0.0, "jy": 0.0, "jy_beam": 0.0, "jz_beam": 0.0, "laserEnvelope": 74.898701643489, - "rho_elec": 1202832873.9999, + "rho_elec": 1202832466.3739, "rho_ion": 1202806069.8845, "rhomjz": 0.0 } From 0241118ae85ec969e9f5433213f854fcf18b30b8 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:29:31 +0100 Subject: [PATCH 88/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 9c01411a08..d55bd3d5b4 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -629,7 +629,7 @@ LaserIonization (const int islice, // This kernel supports multiple deposition orders (0, 1, 2, 3) at compile time. // It calculates the momentum of ionized electrons based on equations (B8) and (B9) - // from the Massimo (2020) article and equation (14) from the C. Schroeder (2014) article. + // from the Massimo (2020) article and equation (12) from the P. Tomassini (2021) article. // Additionally, it computes the energy of emitted electrons and assigns their properties // (momentum, position, etc.) to newly created electrons in the plasma container. amrex::AnyCTO( From 39643a21e01401902f0da24e61f90d6e4e18439c Mon Sep 17 00:00:00 2001 From: Alexander Sinn <64009254+AlexanderSinn@users.noreply.github.com> Date: Wed, 19 Feb 2025 14:57:07 +0100 Subject: [PATCH 89/97] test CI --- tests/checksum/benchmarks_json/laser_ionization.1Rank.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json index cab95ce13d..f17cf7eaa5 100644 --- a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json +++ b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json @@ -19,6 +19,6 @@ "laserEnvelope": 74.898701643489, "rho_elec": 1202832466.3739, "rho_ion": 1202806069.8845, - "rhomjz": 0.0 + "rhomjz": 10000.0 } } From 510186f23525e15d7c4a3c6638787a368607f4a6 Mon Sep 17 00:00:00 2001 From: Alexander Sinn <64009254+AlexanderSinn@users.noreply.github.com> Date: Wed, 19 Feb 2025 14:59:09 +0100 Subject: [PATCH 90/97] undo test --- tests/checksum/benchmarks_json/laser_ionization.1Rank.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json index f17cf7eaa5..cab95ce13d 100644 --- a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json +++ b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json @@ -19,6 +19,6 @@ "laserEnvelope": 74.898701643489, "rho_elec": 1202832466.3739, "rho_ion": 1202806069.8845, - "rhomjz": 10000.0 + "rhomjz": 0.0 } } From 65ba36eb91b787c13d1003fe9034f1c3a9cbbffa Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Wed, 19 Feb 2025 19:51:58 +0100 Subject: [PATCH 91/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index d55bd3d5b4..ac3f458ba0 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -675,8 +675,11 @@ LaserIonization (const int islice, Ep *= E0; amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc]; amrex::Real delta2 = delta * delta; - amrex::Real width_p = amrex::abs(A) * delta * (1._rt - (7._rt/4._rt) * delta2 - + laser_dp_second_prefactor[ion_lev_loc] * delta2); + amrex::Real delta4 = delta2 * delta2; + amrex::Real alpha = laser_dp_alpha[ion_lev_loc]; + amrex::Real s1 = - (7._rt/4._rt) + alpha / 2._rt; + amrex::Real s2 = (1._rt/16._rt) * ( 8 * (alpha*alpha) - 68*alpha + 131 ); + amrex::Real width_p = amrex::abs(A) * delta * (1._rt + s1*delta2 + s2*delta4); amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; // linear polarization is assumed along x. uz = (amrex::abs(A * A) * 0.25_rt + p_pol * p_pol * 0.5_rt); From f75a93b92b1fcdb113b569dc7cb00f68c6ff3d4a Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Wed, 19 Feb 2025 19:53:18 +0100 Subject: [PATCH 92/97] Update PlasmaParticleContainerInit.cpp --- src/particles/plasma/PlasmaParticleContainerInit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainerInit.cpp b/src/particles/plasma/PlasmaParticleContainerInit.cpp index ac9e87004d..54b7140b0a 100644 --- a/src/particles/plasma/PlasmaParticleContainerInit.cpp +++ b/src/particles/plasma/PlasmaParticleContainerInit.cpp @@ -453,7 +453,7 @@ InitIonizationModule (const amrex::Geometry& geom, const amrex::Real background_ h_adk_exp_prefactor[i] = -2./3. * std::pow( Uion/UH,3./2.) * Ea; h_laser_adk_prefactor[i] = (3./MathConst::pi) * std::pow(Uion/UH, -3./2.) / Ea; h_laser_dp_prefactor[i] = std::sqrt(3./2./Ea) * std::pow(UH/Uion, 3./4.); - h_laser_dp_second_prefactor[i] = ion_atomic_number * std::sqrt(UH/Uion) - 1./2.; + h_laser_dp_second_prefactor[i] = 2.*ion_atomic_number * std::sqrt(UH/Uion) - 1.; } amrex::Gpu::copy(amrex::Gpu::hostToDevice, From 7c294068f84cdd0c1e461d313941fcc3b597d176 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Wed, 19 Feb 2025 19:56:49 +0100 Subject: [PATCH 93/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index ac3f458ba0..6c5bda36e9 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -676,7 +676,7 @@ LaserIonization (const int islice, amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc]; amrex::Real delta2 = delta * delta; amrex::Real delta4 = delta2 * delta2; - amrex::Real alpha = laser_dp_alpha[ion_lev_loc]; + amrex::Real alpha = laser_dp_second_prefactor[ion_lev_loc]; amrex::Real s1 = - (7._rt/4._rt) + alpha / 2._rt; amrex::Real s2 = (1._rt/16._rt) * ( 8 * (alpha*alpha) - 68*alpha + 131 ); amrex::Real width_p = amrex::abs(A) * delta * (1._rt + s1*delta2 + s2*delta4); From a301f7a2bdcb2929a14d68294d4b0f4165acb0e8 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Wed, 19 Feb 2025 20:09:56 +0100 Subject: [PATCH 94/97] Update laser_ionization.1Rank.json --- .../laser_ionization.1Rank.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json index cab95ce13d..264eb92ece 100644 --- a/tests/checksum/benchmarks_json/laser_ionization.1Rank.json +++ b/tests/checksum/benchmarks_json/laser_ionization.1Rank.json @@ -1,23 +1,23 @@ { "lev=0": { - "Bx": 12.895401136926, - "By": 9.7408143220707, - "Bz": 2091.4259740328, + "Bx": 13.128118563716, + "By": 9.6402246361225, + "Bz": 2204.1621631093, "ExmBy": 0.0, "EypBx": 0.0, - "Ez": 735839981397.02, + "Ez": 775483620764.12, "Psi": 0.0, - "Sx": 1120131620270.7, - "Sy": 1484350002437.1, + "Sx": 1115240346817.3, + "Sy": 1513788006780.0, "aabs": 0.46877495720552, - "chi": 265993671878070.0, - "jx": 665650594373930.0, + "chi": 265993671876490.0, + "jx": 700841379585790.0, "jx_beam": 0.0, "jy": 0.0, "jy_beam": 0.0, "jz_beam": 0.0, "laserEnvelope": 74.898701643489, - "rho_elec": 1202832466.3739, + "rho_elec": 1202832836.9171, "rho_ion": 1202806069.8845, "rhomjz": 0.0 } From 0092d65077ec08c52b8e917ba99e238d464c0e87 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Wed, 19 Feb 2025 20:15:40 +0100 Subject: [PATCH 95/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 6c5bda36e9..1a5f7ee4ed 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -629,7 +629,7 @@ LaserIonization (const int islice, // This kernel supports multiple deposition orders (0, 1, 2, 3) at compile time. // It calculates the momentum of ionized electrons based on equations (B8) and (B9) - // from the Massimo (2020) article and equation (12) from the P. Tomassini (2021) article. + // from the F. Massimo (2020) article and equation (12) from the P. Tomassini (2021) article. // Additionally, it computes the energy of emitted electrons and assigns their properties // (momentum, position, etc.) to newly created electrons in the plasma container. amrex::AnyCTO( From a44f2a605e726093c66bcb44849d3b905e530f70 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 21 Feb 2025 14:05:03 +0100 Subject: [PATCH 96/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 1a5f7ee4ed..6150301033 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -678,7 +678,7 @@ LaserIonization (const int islice, amrex::Real delta4 = delta2 * delta2; amrex::Real alpha = laser_dp_second_prefactor[ion_lev_loc]; amrex::Real s1 = - (7._rt/4._rt) + alpha / 2._rt; - amrex::Real s2 = (1._rt/16._rt) * ( 8 * (alpha*alpha) - 68*alpha + 131 ); + amrex::Real s2 = (1._rt/16._rt) * ( 8._rt * (alpha*alpha) - 68._rt*alpha + 131._rt ); amrex::Real width_p = amrex::abs(A) * delta * (1._rt + s1*delta2 + s2*delta4); amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; // linear polarization is assumed along x. From edbba28e6719d61b37dce1ba00689b22ebd22e18 Mon Sep 17 00:00:00 2001 From: "Eya D." <81635404+EyaDammak@users.noreply.github.com> Date: Mon, 24 Feb 2025 11:17:05 +0100 Subject: [PATCH 97/97] Update PlasmaParticleContainer.cpp --- src/particles/plasma/PlasmaParticleContainer.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/particles/plasma/PlasmaParticleContainer.cpp b/src/particles/plasma/PlasmaParticleContainer.cpp index 6150301033..69a06b49b9 100644 --- a/src/particles/plasma/PlasmaParticleContainer.cpp +++ b/src/particles/plasma/PlasmaParticleContainer.cpp @@ -673,13 +673,13 @@ LaserIonization (const int islice, amrex::Real Ep = std::sqrt( amrex::abs(Et*Et) + amrex::abs(El*El) ); Ep *= phys_const.m_e * phys_const.c / phys_const.q_e; Ep *= E0; - amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc]; - amrex::Real delta2 = delta * delta; - amrex::Real delta4 = delta2 * delta2; - amrex::Real alpha = laser_dp_second_prefactor[ion_lev_loc]; - amrex::Real s1 = - (7._rt/4._rt) + alpha / 2._rt; - amrex::Real s2 = (1._rt/16._rt) * ( 8._rt * (alpha*alpha) - 68._rt*alpha + 131._rt ); - amrex::Real width_p = amrex::abs(A) * delta * (1._rt + s1*delta2 + s2*delta4); + const amrex::Real delta = std::sqrt(Ep) * laser_dp_prefactor[ion_lev_loc]; + const amrex::Real delta2 = delta * delta; + const amrex::Real delta4 = delta2 * delta2; + const amrex::Real alpha = laser_dp_second_prefactor[ion_lev_loc]; + const amrex::Real s1 = - (7._rt/4._rt) + alpha / 2._rt; + const amrex::Real s2 = (1._rt/16._rt) * ( 8._rt * (alpha*alpha) - 68._rt*alpha + 131._rt ); + const amrex::Real width_p = amrex::abs(A) * delta * (1._rt + s1*delta2 + s2*delta4); amrex::Real p_pol = amrex::RandomNormal(0.0, width_p, engine); ux = p_pol; // linear polarization is assumed along x. uz = (amrex::abs(A * A) * 0.25_rt + p_pol * p_pol * 0.5_rt);