From c3c86ffc42fdbd66b206293a2833a4108e8e8146 Mon Sep 17 00:00:00 2001 From: huixingjian Date: Mon, 8 Dec 2025 22:05:21 +0100 Subject: [PATCH 01/35] add flag to diable laser evolution --- src/Hipace.H | 3 ++- src/Hipace.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Hipace.H b/src/Hipace.H index 240e357775..fea0f83e12 100644 --- a/src/Hipace.H +++ b/src/Hipace.H @@ -283,7 +283,8 @@ public: /** openPMD writer instance */ OpenPMDWriter m_openpmd_writer; #endif - + /** Disable laser evolution */ + Bool m_disable_laser_solver = False; // Performance Counters /** total number of plasma particle pushes for performance printout */ diff --git a/src/Hipace.cpp b/src/Hipace.cpp index 5d551e7dab..cc9f3fc00c 100644 --- a/src/Hipace.cpp +++ b/src/Hipace.cpp @@ -243,7 +243,7 @@ Hipace::ReadParameters () m_multi_laser.MakeLaserGeometry(m_3D_geom[0]); m_use_laser = m_multi_laser.UseLaser(); - + queryWithParser(pph, "disable_laser_solver", m_disable_laser_solver); queryWithParser(pph, "collisions", m_collision_names); /** Initialize the collision objects */ m_ncollisions = m_collision_names.size(); @@ -731,8 +731,9 @@ Hipace::SolveOneSlice (int islice, int step) // Advance laser slice by 1 step using chi // no MR for laser + if (!m_disable_laser_solver){ m_multi_laser.AdvanceSlice(islice, m_fields, m_dt, step, m_3D_geom[0]); - + } if (islice-1 >= m_3D_geom[0].Domain().smallEnd(2)) { m_multi_buffer.get_data(islice-1, m_multi_beam, m_multi_laser, WhichBeamSlice::Next); m_multi_beam.ReorderParticles( WhichBeamSlice::Next, step, m_slice_geom[0]); From 740eccbef7521b838f41c8ae4e18fde889c051f4 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Tue, 9 Dec 2025 11:18:13 +0100 Subject: [PATCH 02/35] Update src/Hipace.H Co-authored-by: Alexander Sinn <64009254+AlexanderSinn@users.noreply.github.com> --- src/Hipace.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Hipace.H b/src/Hipace.H index fea0f83e12..9a81662239 100644 --- a/src/Hipace.H +++ b/src/Hipace.H @@ -284,7 +284,7 @@ public: OpenPMDWriter m_openpmd_writer; #endif /** Disable laser evolution */ - Bool m_disable_laser_solver = False; + bool m_disable_laser_solver = false; // Performance Counters /** total number of plasma particle pushes for performance printout */ From 3a7d04de4694624c99a1cb430c8cb6290547e7b1 Mon Sep 17 00:00:00 2001 From: huixingjian Date: Tue, 9 Dec 2025 13:47:08 +0100 Subject: [PATCH 03/35] add disable uz push --- src/particles/beam/BeamParticleContainer.H | 1 + src/particles/beam/BeamParticleContainer.cpp | 1 + src/particles/pusher/BeamParticleAdvance.cpp | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/particles/beam/BeamParticleContainer.H b/src/particles/beam/BeamParticleContainer.H index 58842a19f1..2a1bd09076 100644 --- a/src/particles/beam/BeamParticleContainer.H +++ b/src/particles/beam/BeamParticleContainer.H @@ -296,6 +296,7 @@ private: /** Array for the z position of all beam particles */ amrex::PODVector> m_z_array {}; + bool m_do_uz_push = true; /** Date: Tue, 9 Dec 2025 13:53:39 +0100 Subject: [PATCH 04/35] fix several typos and bug --- src/particles/beam/BeamParticleContainer.H | 2 +- src/particles/pusher/BeamParticleAdvance.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/particles/beam/BeamParticleContainer.H b/src/particles/beam/BeamParticleContainer.H index 2a1bd09076..705979c6fe 100644 --- a/src/particles/beam/BeamParticleContainer.H +++ b/src/particles/beam/BeamParticleContainer.H @@ -243,6 +243,7 @@ public: amrex::Real m_spin_anom = 0.00115965218128; /** ratio of beam particles that are written to the openPMD output */ int m_output_ratio = 1; + bool m_do_uz_push = true; /**> m_z_array {}; - bool m_do_uz_push = true; /** Date: Tue, 9 Dec 2025 15:02:15 +0100 Subject: [PATCH 05/35] add 'disable' in laser solver type --- src/Hipace.H | 2 -- src/Hipace.cpp | 3 --- src/laser/MultiLaser.cpp | 4 +++- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Hipace.H b/src/Hipace.H index 9a81662239..55a4b621d2 100644 --- a/src/Hipace.H +++ b/src/Hipace.H @@ -283,8 +283,6 @@ public: /** openPMD writer instance */ OpenPMDWriter m_openpmd_writer; #endif - /** Disable laser evolution */ - bool m_disable_laser_solver = false; // Performance Counters /** total number of plasma particle pushes for performance printout */ diff --git a/src/Hipace.cpp b/src/Hipace.cpp index cc9f3fc00c..154d17861e 100644 --- a/src/Hipace.cpp +++ b/src/Hipace.cpp @@ -243,7 +243,6 @@ Hipace::ReadParameters () m_multi_laser.MakeLaserGeometry(m_3D_geom[0]); m_use_laser = m_multi_laser.UseLaser(); - queryWithParser(pph, "disable_laser_solver", m_disable_laser_solver); queryWithParser(pph, "collisions", m_collision_names); /** Initialize the collision objects */ m_ncollisions = m_collision_names.size(); @@ -731,9 +730,7 @@ Hipace::SolveOneSlice (int islice, int step) // Advance laser slice by 1 step using chi // no MR for laser - if (!m_disable_laser_solver){ m_multi_laser.AdvanceSlice(islice, m_fields, m_dt, step, m_3D_geom[0]); - } if (islice-1 >= m_3D_geom[0].Domain().smallEnd(2)) { m_multi_buffer.get_data(islice-1, m_multi_beam, m_multi_laser, WhichBeamSlice::Next); m_multi_beam.ReorderParticles( WhichBeamSlice::Next, step, m_slice_geom[0]); diff --git a/src/laser/MultiLaser.cpp b/src/laser/MultiLaser.cpp index 7f5cea1a1e..420234b226 100644 --- a/src/laser/MultiLaser.cpp +++ b/src/laser/MultiLaser.cpp @@ -453,7 +453,9 @@ MultiLaser::AdvanceSlice (const int islice, const Fields& fields, amrex::Real dt AdvanceSliceMG(dt, step); } else if (m_solver_type == "fft") { AdvanceSliceFFT(dt, step); - } else { + } else if (m_solver_type == "disable") return; + else + { amrex::Abort("laser.solver_type must be fft or multigrid"); } } From 7541c59bf94ac69662e7b24c187f24fc2ec6223c Mon Sep 17 00:00:00 2001 From: huixingjian Date: Tue, 9 Dec 2025 16:40:56 +0100 Subject: [PATCH 06/35] add on more condition in assert --- src/laser/MultiLaser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/laser/MultiLaser.cpp b/src/laser/MultiLaser.cpp index 420234b226..b0fe5f4f1e 100644 --- a/src/laser/MultiLaser.cpp +++ b/src/laser/MultiLaser.cpp @@ -39,7 +39,7 @@ MultiLaser::ReadParameters () m_linear_polarization = polarization == "linear"; queryWithParser(pp, "use_phase", m_use_phase); queryWithParser(pp, "solver_type", m_solver_type); - AMREX_ALWAYS_ASSERT(m_solver_type == "multigrid" || m_solver_type == "fft"); + AMREX_ALWAYS_ASSERT(m_solver_type == "multigrid" || m_solver_type == "fft" || m_solver_type == "disable"); queryWithParser(pp, "interp_order", m_interp_order); AMREX_ALWAYS_ASSERT(m_interp_order <= 3 && m_interp_order >= 0); From b5361539dacd2f7d25d65058e47d8f3b713fd4fe Mon Sep 17 00:00:00 2001 From: huixingjian Date: Wed, 10 Dec 2025 11:22:08 +0100 Subject: [PATCH 07/35] init data every slice --- src/laser/MultiLaser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/laser/MultiLaser.cpp b/src/laser/MultiLaser.cpp index b0fe5f4f1e..a9465994b6 100644 --- a/src/laser/MultiLaser.cpp +++ b/src/laser/MultiLaser.cpp @@ -453,7 +453,9 @@ MultiLaser::AdvanceSlice (const int islice, const Fields& fields, amrex::Real dt AdvanceSliceMG(dt, step); } else if (m_solver_type == "fft") { AdvanceSliceFFT(dt, step); - } else if (m_solver_type == "disable") return; + } else if (m_solver_type == "disable"){ + InitData (); + } else { amrex::Abort("laser.solver_type must be fft or multigrid"); From 2d3a71c991f1f7186cdc57c3d256945532b7053b Mon Sep 17 00:00:00 2001 From: huixingjian Date: Wed, 10 Dec 2025 11:40:57 +0100 Subject: [PATCH 08/35] try the other function --- src/laser/MultiLaser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/laser/MultiLaser.cpp b/src/laser/MultiLaser.cpp index a9465994b6..8af0b69283 100644 --- a/src/laser/MultiLaser.cpp +++ b/src/laser/MultiLaser.cpp @@ -454,7 +454,7 @@ MultiLaser::AdvanceSlice (const int islice, const Fields& fields, amrex::Real dt } else if (m_solver_type == "fft") { AdvanceSliceFFT(dt, step); } else if (m_solver_type == "disable"){ - InitData (); + InitSliceEnvelope(islice, WhichSlice::This); } else { From fb173b9614f4ad9b934621dde3a7237ef1e399ff Mon Sep 17 00:00:00 2001 From: huixingjian Date: Wed, 10 Dec 2025 11:55:52 +0100 Subject: [PATCH 09/35] comment out laser slice --- src/Hipace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Hipace.cpp b/src/Hipace.cpp index 154d17861e..4d9be88dc9 100644 --- a/src/Hipace.cpp +++ b/src/Hipace.cpp @@ -730,7 +730,7 @@ Hipace::SolveOneSlice (int islice, int step) // Advance laser slice by 1 step using chi // no MR for laser - m_multi_laser.AdvanceSlice(islice, m_fields, m_dt, step, m_3D_geom[0]); + //m_multi_laser.AdvanceSlice(islice, m_fields, m_dt, step, m_3D_geom[0]); if (islice-1 >= m_3D_geom[0].Domain().smallEnd(2)) { m_multi_buffer.get_data(islice-1, m_multi_beam, m_multi_laser, WhichBeamSlice::Next); m_multi_beam.ReorderParticles( WhichBeamSlice::Next, step, m_slice_geom[0]); From 7fdb033dc847899868b9ae255372c897993bac9d Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Wed, 10 Dec 2025 12:02:21 +0100 Subject: [PATCH 10/35] Update Hipace.cpp --- src/Hipace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Hipace.cpp b/src/Hipace.cpp index 4d9be88dc9..154d17861e 100644 --- a/src/Hipace.cpp +++ b/src/Hipace.cpp @@ -730,7 +730,7 @@ Hipace::SolveOneSlice (int islice, int step) // Advance laser slice by 1 step using chi // no MR for laser - //m_multi_laser.AdvanceSlice(islice, m_fields, m_dt, step, m_3D_geom[0]); + m_multi_laser.AdvanceSlice(islice, m_fields, m_dt, step, m_3D_geom[0]); if (islice-1 >= m_3D_geom[0].Domain().smallEnd(2)) { m_multi_buffer.get_data(islice-1, m_multi_beam, m_multi_laser, WhichBeamSlice::Next); m_multi_beam.ReorderParticles( WhichBeamSlice::Next, step, m_slice_geom[0]); From 1dd6726076ce8d56d897cd61ab31010726852fea Mon Sep 17 00:00:00 2001 From: Alexander Sinn Date: Wed, 10 Dec 2025 13:14:13 +0100 Subject: [PATCH 11/35] copy laser to next step --- src/Hipace.cpp | 2 ++ src/laser/MultiLaser.cpp | 24 +++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Hipace.cpp b/src/Hipace.cpp index 154d17861e..5d551e7dab 100644 --- a/src/Hipace.cpp +++ b/src/Hipace.cpp @@ -243,6 +243,7 @@ Hipace::ReadParameters () m_multi_laser.MakeLaserGeometry(m_3D_geom[0]); m_use_laser = m_multi_laser.UseLaser(); + queryWithParser(pph, "collisions", m_collision_names); /** Initialize the collision objects */ m_ncollisions = m_collision_names.size(); @@ -731,6 +732,7 @@ Hipace::SolveOneSlice (int islice, int step) // Advance laser slice by 1 step using chi // no MR for laser m_multi_laser.AdvanceSlice(islice, m_fields, m_dt, step, m_3D_geom[0]); + if (islice-1 >= m_3D_geom[0].Domain().smallEnd(2)) { m_multi_buffer.get_data(islice-1, m_multi_beam, m_multi_laser, WhichBeamSlice::Next); m_multi_beam.ReorderParticles( WhichBeamSlice::Next, step, m_slice_geom[0]); diff --git a/src/laser/MultiLaser.cpp b/src/laser/MultiLaser.cpp index 8af0b69283..fd42e9c1d7 100644 --- a/src/laser/MultiLaser.cpp +++ b/src/laser/MultiLaser.cpp @@ -39,7 +39,8 @@ MultiLaser::ReadParameters () m_linear_polarization = polarization == "linear"; queryWithParser(pp, "use_phase", m_use_phase); queryWithParser(pp, "solver_type", m_solver_type); - AMREX_ALWAYS_ASSERT(m_solver_type == "multigrid" || m_solver_type == "fft" || m_solver_type == "disable"); + AMREX_ALWAYS_ASSERT(m_solver_type == "multigrid" || m_solver_type == "fft" || + m_solver_type == "disable"); queryWithParser(pp, "interp_order", m_interp_order); AMREX_ALWAYS_ASSERT(m_interp_order <= 3 && m_interp_order >= 0); @@ -453,12 +454,21 @@ MultiLaser::AdvanceSlice (const int islice, const Fields& fields, amrex::Real dt AdvanceSliceMG(dt, step); } else if (m_solver_type == "fft") { AdvanceSliceFFT(dt, step); - } else if (m_solver_type == "disable"){ - InitSliceEnvelope(islice, WhichSlice::This); - } - else - { - amrex::Abort("laser.solver_type must be fft or multigrid"); + } else if (m_solver_type == "disable") { + for ( amrex::MFIter mfi(m_slices, DfltMfi); mfi.isValid(); ++mfi ){ + Array3 arr = m_slices.array(mfi); + amrex::ParallelFor( + to2D(mfi.tilebox()), + [=] AMREX_GPU_DEVICE (int i, int j) { + using namespace WhichLaserSlice; + // copy current laser to slice of the next time step + arr(i, j, np1j00_r) = arr(i, j, n00j00_r); + arr(i, j, np1j00_i) = arr(i, j, n00j00_i); + } + ); + } + } else { + amrex::Abort("laser.solver_type must be fft, multigrid or disable"); } } From 6118a4051493c65b5d391372f0ea6b687c8b27e8 Mon Sep 17 00:00:00 2001 From: huixingjian Date: Wed, 10 Dec 2025 16:44:08 +0100 Subject: [PATCH 12/35] add instruction in the document --- docs/source/run/parameters.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/source/run/parameters.rst b/docs/source/run/parameters.rst index a23541c2c0..dc9a010cc2 100644 --- a/docs/source/run/parameters.rst +++ b/docs/source/run/parameters.rst @@ -624,6 +624,10 @@ which are valid only for certain beam types, are introduced further below under Whether the beam particles are pushed along the z-axis. The momentum is still fully updated. Note: using ``do_z_push = 0`` results in unphysical behavior. +``.do_uz_push`` (`bool`) optional (default `1`) + Whether the beam particles are accelerated. The transverse momentum is still fully updated. + Note: using ``do_uz_push = 0`` results in unphysical behavior. + * `` or beams.do_push`` (`bool`) optional (default `1`) When set to `0`, disables the beam particle pusher. @@ -937,11 +941,11 @@ Parameters starting with ``lasers.`` apply to all laser pulses, parameters start the field to laser interpolation of chi. Currently, `0,1,2,3` are implemented. * ``lasers.solver_type`` (`string`) optional (default `multigrid`) - Type of solver for the laser envelope solver, either ``fft`` or ``multigrid``. + Type of solver for the laser envelope solver, either ``fft``, ``multigrid`` or ``disable``. Currently, the approximation that the phase is evaluated on-axis only is made with both solvers. With the multigrid solver, we could drop this assumption. For now, the fft solver should be faster, more accurate and more stable, so only use the multigrid one with care. - + If set ``disable``, the laser will not evolve and remain as the initial profile through the simulation. * ``lasers.MG_tolerance_rel`` (`float`) optional (default `1e-4`) Relative error tolerance of the multigrid solver used for the laser pulse. From 769145284260e93c1a49f60b84456f9c690694bc Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Wed, 10 Dec 2025 16:46:50 +0100 Subject: [PATCH 13/35] Update parameters.rst --- docs/source/run/parameters.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/run/parameters.rst b/docs/source/run/parameters.rst index dc9a010cc2..af1e6160e8 100644 --- a/docs/source/run/parameters.rst +++ b/docs/source/run/parameters.rst @@ -946,6 +946,7 @@ Parameters starting with ``lasers.`` apply to all laser pulses, parameters start With the multigrid solver, we could drop this assumption. For now, the fft solver should be faster, more accurate and more stable, so only use the multigrid one with care. If set ``disable``, the laser will not evolve and remain as the initial profile through the simulation. + * ``lasers.MG_tolerance_rel`` (`float`) optional (default `1e-4`) Relative error tolerance of the multigrid solver used for the laser pulse. From 2d1bf0b134fb42e79f9e2fff859bcee9cf37d9c0 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Wed, 10 Dec 2025 16:47:16 +0100 Subject: [PATCH 14/35] Update Hipace.H --- src/Hipace.H | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Hipace.H b/src/Hipace.H index 55a4b621d2..240e357775 100644 --- a/src/Hipace.H +++ b/src/Hipace.H @@ -283,6 +283,7 @@ public: /** openPMD writer instance */ OpenPMDWriter m_openpmd_writer; #endif + // Performance Counters /** total number of plasma particle pushes for performance printout */ From 6d8cc58502445856f96350fc551eff3503b6414b Mon Sep 17 00:00:00 2001 From: Xingjian Hui Date: Tue, 20 Jan 2026 12:52:07 +0100 Subject: [PATCH 15/35] change Ezp =0 --- src/particles/pusher/BeamParticleAdvance.cpp | 30 +++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/particles/pusher/BeamParticleAdvance.cpp b/src/particles/pusher/BeamParticleAdvance.cpp index 0276ed2ada..d938dec764 100644 --- a/src/particles/pusher/BeamParticleAdvance.cpp +++ b/src/particles/pusher/BeamParticleAdvance.cpp @@ -200,22 +200,24 @@ AdvanceBeamParticlesSlice ( compute_single_shape_factor(zmid, 2); auto [shape_n, ncell] = compute_single_shape_factor(zmid, 0); - - Ezp *= (1._rt - shape_p - shape_n); - - // Gather Ez field on particle from grid - for (int iy=0; iy<=depos_order.value; iy++){ - for (int ix=0; ix<=depos_order.value; ix++){ - // Compute shape factors - auto [shape_y, jcell] = - compute_single_shape_factor(ymid, iy); - auto [shape_x, icell] = - compute_single_shape_factor(xmid, ix); - - Ezp += shape_p * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_prev); - Ezp += shape_n * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_next); + if (do_uz_push){ + Ezp *= (1._rt - shape_p - shape_n); + + // Gather Ez field on particle from grid + for (int iy=0; iy<=depos_order.value; iy++){ + for (int ix=0; ix<=depos_order.value; ix++){ + // Compute shape factors + auto [shape_y, jcell] = + compute_single_shape_factor(ymid, iy); + auto [shape_x, icell] = + compute_single_shape_factor(xmid, ix); + + Ezp += shape_p * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_prev); + Ezp += shape_n * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_next); + } } } + else Ezp = 0; } if (c_use_external_fields.value) { From dd6c47772a01d2b7a2fbf9e4dc98aedfc2a0cf9d Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Tue, 20 Jan 2026 14:09:04 +0100 Subject: [PATCH 16/35] update uz --- src/particles/pusher/BeamParticleAdvance.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/pusher/BeamParticleAdvance.cpp b/src/particles/pusher/BeamParticleAdvance.cpp index d938dec764..07ae9f8f76 100644 --- a/src/particles/pusher/BeamParticleAdvance.cpp +++ b/src/particles/pusher/BeamParticleAdvance.cpp @@ -325,7 +325,7 @@ AdvanceBeamParticlesSlice ( if (do_z_push) zp += dt * clight * ( uz_next * gamma_next_inv - 1._rt ); ux = ux_next; uy = uy_next; - if (do_uz_push) uz = uz_next; + uz = uz_next; } // end for loop over n_subcycles if (enforceBC(ptd, ip, xp, yp, ux, uy, BeamIdx::w)) return; ptd.pos(0, ip) = xp; From 2b3f03c520009c312fc3078937b37a2ddb9a7b89 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Thu, 29 Jan 2026 13:44:40 +0100 Subject: [PATCH 17/35] Update parameters.rst --- docs/source/run/parameters.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/run/parameters.rst b/docs/source/run/parameters.rst index 4df39c2a9b..bb63b4e0fc 100644 --- a/docs/source/run/parameters.rst +++ b/docs/source/run/parameters.rst @@ -628,9 +628,9 @@ which are valid only for certain beam types, are introduced further below under Whether the beam particles are pushed along the z-axis. The momentum is still fully updated. Note: using ``do_z_push = 0`` results in unphysical behavior. -``.do_uz_push`` (`bool`) optional (default `1`) +``.accelerate`` (`bool`) optional (default `1`) Whether the beam particles are accelerated. The transverse momentum is still fully updated. - Note: using ``do_uz_push = 0`` results in unphysical behavior. + Note: using ``accelerate = 0`` results in unphysical behavior. * `` or beams.do_push`` (`bool`) optional (default `1`) When set to `0`, disables the beam particle pusher. From ea503b5e87425d80b8ce5b388d83a368a4dce071 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Thu, 29 Jan 2026 13:45:40 +0100 Subject: [PATCH 18/35] Update BeamParticleContainer.cpp --- src/particles/beam/BeamParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/beam/BeamParticleContainer.cpp b/src/particles/beam/BeamParticleContainer.cpp index 5cedfba6dc..cbd1d49507 100644 --- a/src/particles/beam/BeamParticleContainer.cpp +++ b/src/particles/beam/BeamParticleContainer.cpp @@ -57,7 +57,7 @@ BeamParticleContainer::ReadParameters () getWithParser(pp, "injection_type", m_injection_type); queryWithParser(pp, "duz_per_uz0_dzeta", m_duz_per_uz0_dzeta); queryWithParser(pp, "do_z_push", m_do_z_push); - queryWithParser(pp, "do_uz_push", m_do_uz_push); + queryWithParser(pp, "accelerate", m_acc_z); queryWithParserAlt(pp, "do_push", m_do_push, pp_alt); queryWithParserAlt(pp, "do_radiation_reaction", m_do_radiation_reaction, pp_alt); queryWithParserAlt(pp, "insitu_period", m_insitu_period, pp_alt); From 954c47d13652534d7e376ede7b6d727010b536bb Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Thu, 29 Jan 2026 13:46:15 +0100 Subject: [PATCH 19/35] Update BeamParticleContainer.H --- src/particles/beam/BeamParticleContainer.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/beam/BeamParticleContainer.H b/src/particles/beam/BeamParticleContainer.H index b5939e503c..b559e25d9d 100644 --- a/src/particles/beam/BeamParticleContainer.H +++ b/src/particles/beam/BeamParticleContainer.H @@ -244,7 +244,7 @@ public: amrex::Real m_spin_anom = 0.00115965218128; /** ratio of beam particles that are written to the openPMD output */ int m_output_ratio = 1; - bool m_do_uz_push = true; /** Date: Thu, 29 Jan 2026 13:48:32 +0100 Subject: [PATCH 20/35] Update BeamParticleAdvance.cpp --- src/particles/pusher/BeamParticleAdvance.cpp | 27 ++++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/particles/pusher/BeamParticleAdvance.cpp b/src/particles/pusher/BeamParticleAdvance.cpp index 07ae9f8f76..540a4a8a70 100644 --- a/src/particles/pusher/BeamParticleAdvance.cpp +++ b/src/particles/pusher/BeamParticleAdvance.cpp @@ -25,7 +25,7 @@ AdvanceBeamParticlesSlice ( using namespace amrex::literals; const PhysConst phys_const = get_phys_const(); - const bool do_uz_push = beam.m_do_uz_push; + const bool acc_z = beam.m_acc_z; const bool do_z_push = beam.m_do_z_push; const int n_subcycles = beam.m_n_subcycles; const bool radiation_reaction = beam.m_do_radiation_reaction; @@ -200,24 +200,23 @@ AdvanceBeamParticlesSlice ( compute_single_shape_factor(zmid, 2); auto [shape_n, ncell] = compute_single_shape_factor(zmid, 0); - if (do_uz_push){ - Ezp *= (1._rt - shape_p - shape_n); + Ezp *= (1._rt - shape_p - shape_n); // Gather Ez field on particle from grid - for (int iy=0; iy<=depos_order.value; iy++){ - for (int ix=0; ix<=depos_order.value; ix++){ + for (int iy=0; iy<=depos_order.value; iy++){ + for (int ix=0; ix<=depos_order.value; ix++){ // Compute shape factors - auto [shape_y, jcell] = - compute_single_shape_factor(ymid, iy); - auto [shape_x, icell] = - compute_single_shape_factor(xmid, ix); - - Ezp += shape_p * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_prev); - Ezp += shape_n * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_next); - } + auto [shape_y, jcell] = + compute_single_shape_factor(ymid, iy); + auto [shape_x, icell] = + compute_single_shape_factor(xmid, ix); + + Ezp += shape_p * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_prev); + Ezp += shape_n * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_next); } } - else Ezp = 0; + } + if(!acc_z) Ezp = 0; } if (c_use_external_fields.value) { From c6b285d22625402167382e039adc95c0aa135c4b Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Thu, 29 Jan 2026 13:51:32 +0100 Subject: [PATCH 21/35] Update BeamParticleAdvance.cpp --- src/particles/pusher/BeamParticleAdvance.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/particles/pusher/BeamParticleAdvance.cpp b/src/particles/pusher/BeamParticleAdvance.cpp index 540a4a8a70..212ddc4aea 100644 --- a/src/particles/pusher/BeamParticleAdvance.cpp +++ b/src/particles/pusher/BeamParticleAdvance.cpp @@ -202,10 +202,10 @@ AdvanceBeamParticlesSlice ( compute_single_shape_factor(zmid, 0); Ezp *= (1._rt - shape_p - shape_n); - // Gather Ez field on particle from grid + // Gather Ez field on particle from grid for (int iy=0; iy<=depos_order.value; iy++){ for (int ix=0; ix<=depos_order.value; ix++){ - // Compute shape factors + // Compute shape factors auto [shape_y, jcell] = compute_single_shape_factor(ymid, iy); auto [shape_x, icell] = From 9ebf2460c660de742cb3e009f20e9e024610eec5 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Tue, 3 Feb 2026 13:11:33 +0100 Subject: [PATCH 22/35] Update BeamParticleAdvance.cpp --- src/particles/pusher/BeamParticleAdvance.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/particles/pusher/BeamParticleAdvance.cpp b/src/particles/pusher/BeamParticleAdvance.cpp index 212ddc4aea..e09be489f7 100644 --- a/src/particles/pusher/BeamParticleAdvance.cpp +++ b/src/particles/pusher/BeamParticleAdvance.cpp @@ -200,8 +200,9 @@ AdvanceBeamParticlesSlice ( compute_single_shape_factor(zmid, 2); auto [shape_n, ncell] = compute_single_shape_factor(zmid, 0); + Ezp *= (1._rt - shape_p - shape_n); - + if(!acc_z) Ezp = 0; // Gather Ez field on particle from grid for (int iy=0; iy<=depos_order.value; iy++){ for (int ix=0; ix<=depos_order.value; ix++){ @@ -213,11 +214,10 @@ AdvanceBeamParticlesSlice ( Ezp += shape_p * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_prev); Ezp += shape_n * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_next); + } } } } - if(!acc_z) Ezp = 0; - } if (c_use_external_fields.value) { ApplyExternalField(xp, yp, zp, time, clight, ExmByp, EypBxp, Ezp, Bxp, Byp, Bzp, From 6adb9ca69fc99650df9b35ffc7e946f2a834da74 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Tue, 3 Feb 2026 13:12:33 +0100 Subject: [PATCH 23/35] Update BeamParticleAdvance.cpp --- src/particles/pusher/BeamParticleAdvance.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/particles/pusher/BeamParticleAdvance.cpp b/src/particles/pusher/BeamParticleAdvance.cpp index e09be489f7..d25185b5ad 100644 --- a/src/particles/pusher/BeamParticleAdvance.cpp +++ b/src/particles/pusher/BeamParticleAdvance.cpp @@ -214,11 +214,11 @@ AdvanceBeamParticlesSlice ( Ezp += shape_p * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_prev); Ezp += shape_n * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_next); - } } } } + if (c_use_external_fields.value) { ApplyExternalField(xp, yp, zp, time, clight, ExmByp, EypBxp, Ezp, Bxp, Byp, Bzp, external_fields); From adaf64915fa2a4453496ff564b68bb759839801a Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Tue, 3 Feb 2026 13:13:34 +0100 Subject: [PATCH 24/35] Update BeamParticleAdvance.cpp From 0e3d0ec4f820ea365699bd72a063e07874c83186 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Tue, 3 Feb 2026 13:15:00 +0100 Subject: [PATCH 25/35] Update BeamParticleAdvance.cpp --- src/particles/pusher/BeamParticleAdvance.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/particles/pusher/BeamParticleAdvance.cpp b/src/particles/pusher/BeamParticleAdvance.cpp index d25185b5ad..46ef0ea3f5 100644 --- a/src/particles/pusher/BeamParticleAdvance.cpp +++ b/src/particles/pusher/BeamParticleAdvance.cpp @@ -218,7 +218,6 @@ AdvanceBeamParticlesSlice ( } } - if (c_use_external_fields.value) { ApplyExternalField(xp, yp, zp, time, clight, ExmByp, EypBxp, Ezp, Bxp, Byp, Bzp, external_fields); From da9d45e603c0a3b3c6b96b875c39dc007c862272 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Tue, 3 Feb 2026 13:16:56 +0100 Subject: [PATCH 26/35] Update BeamParticleAdvance.cpp --- src/particles/pusher/BeamParticleAdvance.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/particles/pusher/BeamParticleAdvance.cpp b/src/particles/pusher/BeamParticleAdvance.cpp index 46ef0ea3f5..0a591e73d8 100644 --- a/src/particles/pusher/BeamParticleAdvance.cpp +++ b/src/particles/pusher/BeamParticleAdvance.cpp @@ -200,9 +200,7 @@ AdvanceBeamParticlesSlice ( compute_single_shape_factor(zmid, 2); auto [shape_n, ncell] = compute_single_shape_factor(zmid, 0); - Ezp *= (1._rt - shape_p - shape_n); - if(!acc_z) Ezp = 0; // Gather Ez field on particle from grid for (int iy=0; iy<=depos_order.value; iy++){ for (int ix=0; ix<=depos_order.value; ix++){ @@ -216,6 +214,7 @@ AdvanceBeamParticlesSlice ( Ezp += shape_n * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_next); } } + if(!acc_z) Ezp = 0; } if (c_use_external_fields.value) { From 70b8d8123d9f3c6b7992a085e1a1df882b7c9018 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Fri, 6 Feb 2026 15:24:48 +0100 Subject: [PATCH 27/35] Update BeamParticleAdvance.cpp --- src/particles/pusher/BeamParticleAdvance.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/particles/pusher/BeamParticleAdvance.cpp b/src/particles/pusher/BeamParticleAdvance.cpp index 0a591e73d8..5a763aa705 100644 --- a/src/particles/pusher/BeamParticleAdvance.cpp +++ b/src/particles/pusher/BeamParticleAdvance.cpp @@ -214,14 +214,13 @@ AdvanceBeamParticlesSlice ( Ezp += shape_n * shape_y * shape_x * slice_arr(icell, jcell, ez_comp_next); } } - if(!acc_z) Ezp = 0; } if (c_use_external_fields.value) { ApplyExternalField(xp, yp, zp, time, clight, ExmByp, EypBxp, Ezp, Bxp, Byp, Bzp, external_fields); } - + if(!acc_z) Ezp = 0; ExmByp *= inv_clight; EypBxp *= inv_clight; Ezp *= inv_clight; From 765fdfb70dbaeb516d6f6aa9f6c064c02dacb878 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:50:10 +0200 Subject: [PATCH 28/35] Update docs/source/run/parameters.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maxence Thévenet --- docs/source/run/parameters.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/run/parameters.rst b/docs/source/run/parameters.rst index bb63b4e0fc..782020c5b8 100644 --- a/docs/source/run/parameters.rst +++ b/docs/source/run/parameters.rst @@ -945,7 +945,7 @@ Parameters starting with ``lasers.`` apply to all laser pulses, parameters start the field to laser interpolation of chi. Currently, `0,1,2,3` are implemented. * ``lasers.solver_type`` (`string`) optional (default `multigrid`) - Type of solver for the laser envelope solver, either ``fft``, ``multigrid`` or ``disable``. + Type of solver for the laser envelope solver, either ``fft``, ``multigrid`` or ``off``. Currently, the approximation that the phase is evaluated on-axis only is made with both solvers. With the multigrid solver, we could drop this assumption. For now, the fft solver should be faster, more accurate and more stable, so only use the multigrid one with care. From c7e2736137eb4eea2fe114a0dd628d5d9fc2a866 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:51:11 +0200 Subject: [PATCH 29/35] Update MultiLaser.cpp --- src/laser/MultiLaser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/laser/MultiLaser.cpp b/src/laser/MultiLaser.cpp index 3997c6c1b1..c03b600c32 100644 --- a/src/laser/MultiLaser.cpp +++ b/src/laser/MultiLaser.cpp @@ -40,7 +40,7 @@ MultiLaser::ReadParameters () queryWithParser(pp, "use_phase", m_use_phase); queryWithParser(pp, "solver_type", m_solver_type); AMREX_ALWAYS_ASSERT(m_solver_type == "multigrid" || m_solver_type == "fft" || - m_solver_type == "disable"); + m_solver_type == "off"); queryWithParser(pp, "interp_order", m_interp_order); AMREX_ALWAYS_ASSERT(m_interp_order <= 3 && m_interp_order >= 0); From c85e5edd2513e0a42ea0f50cbf595287d6ade963 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:51:46 +0200 Subject: [PATCH 30/35] Update MultiLaser.cpp --- src/laser/MultiLaser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/laser/MultiLaser.cpp b/src/laser/MultiLaser.cpp index c03b600c32..0951ae1dea 100644 --- a/src/laser/MultiLaser.cpp +++ b/src/laser/MultiLaser.cpp @@ -454,7 +454,7 @@ MultiLaser::AdvanceSlice (const int islice, const Fields& fields, amrex::Real dt AdvanceSliceMG(dt, step); } else if (m_solver_type == "fft") { AdvanceSliceFFT(dt, step); - } else if (m_solver_type == "disable") { + } else if (m_solver_type == "off") { for ( amrex::MFIter mfi(m_slices, DfltMfi); mfi.isValid(); ++mfi ){ Array3 arr = m_slices.array(mfi); amrex::ParallelFor( @@ -468,7 +468,7 @@ MultiLaser::AdvanceSlice (const int islice, const Fields& fields, amrex::Real dt ); } } else { - amrex::Abort("laser.solver_type must be fft, multigrid or disable"); + amrex::Abort("laser.solver_type must be fft, multigrid or off"); } } From e29b09a597403fa9740aa0c06c9f0542ee3fab6f Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:52:41 +0200 Subject: [PATCH 31/35] Update parameters.rst --- docs/source/run/parameters.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/run/parameters.rst b/docs/source/run/parameters.rst index 782020c5b8..b1597c51e5 100644 --- a/docs/source/run/parameters.rst +++ b/docs/source/run/parameters.rst @@ -949,7 +949,7 @@ Parameters starting with ``lasers.`` apply to all laser pulses, parameters start Currently, the approximation that the phase is evaluated on-axis only is made with both solvers. With the multigrid solver, we could drop this assumption. For now, the fft solver should be faster, more accurate and more stable, so only use the multigrid one with care. - If set ``disable``, the laser will not evolve and remain as the initial profile through the simulation. + If set ``off``, the laser will not evolve and remain as the initial profile through the simulation. * ``lasers.MG_tolerance_rel`` (`float`) optional (default `1e-4`) Relative error tolerance of the multigrid solver used for the laser pulse. From 7bf1fe0d1ae084f0a258d7328d858acf0e23e33f Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Thu, 9 Apr 2026 16:08:13 +0200 Subject: [PATCH 32/35] Update BeamParticleAdvance.cpp --- src/particles/pusher/BeamParticleAdvance.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/particles/pusher/BeamParticleAdvance.cpp b/src/particles/pusher/BeamParticleAdvance.cpp index c84c1410e0..2e2080fc0d 100644 --- a/src/particles/pusher/BeamParticleAdvance.cpp +++ b/src/particles/pusher/BeamParticleAdvance.cpp @@ -196,10 +196,6 @@ AdvanceBeamParticlesSlice ( const amrex::Real ymid = (yp-y_pos_offset)*dy_inv; const amrex::Real zmid = (zp-min_z)*dz_inv-0.5_rt; - auto [shape_p, pcell] = - compute_single_shape_factor(zmid, 2); - auto [shape_n, ncell] = - compute_single_shape_factor(zmid, 0); auto [shape_p, pcell] = shape_factor<2>(zmid, 2); auto [shape_n, ncell] = shape_factor<2>(zmid, 0); From 7f5ad580b798262ab7b47d9348ce74814926a4f6 Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Thu, 9 Apr 2026 16:27:10 +0200 Subject: [PATCH 33/35] Update MultiLaser.cpp --- src/laser/MultiLaser.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/laser/MultiLaser.cpp b/src/laser/MultiLaser.cpp index 859ffefede..14d72cdea3 100644 --- a/src/laser/MultiLaser.cpp +++ b/src/laser/MultiLaser.cpp @@ -463,7 +463,7 @@ MultiLaser::AdvanceSlice (const int islice, const Fields& fields, amrex::Real dt if (m_solver_type == "multigrid") { AdvanceSliceMG(dt, is_first_step); } else if (m_solver_type == "fft") { - AdvanceSliceFFT(dt, step); + AdvanceSliceFFT(dt, is_first_step); } else if (m_solver_type == "off") { for ( amrex::MFIter mfi(m_slices, DfltMfi); mfi.isValid(); ++mfi ){ Array3 arr = m_slices.array(mfi); @@ -477,7 +477,6 @@ MultiLaser::AdvanceSlice (const int islice, const Fields& fields, amrex::Real dt } ); } - AdvanceSliceFFT(dt, is_first_step); } else { amrex::Abort("laser.solver_type must be fft, multigrid or off"); } From f9ad32f94e3ef527577a3b667daf13cc9b590795 Mon Sep 17 00:00:00 2001 From: Xingjian Hui Date: Tue, 2 Jun 2026 14:44:22 +0200 Subject: [PATCH 34/35] remove set Ez=0 --- docs/source/run/parameters.rst | 4 ---- src/particles/beam/BeamParticleContainer.H | 1 - src/particles/beam/BeamParticleContainer.cpp | 1 - src/particles/pusher/BeamParticleAdvance.cpp | 5 +++-- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/docs/source/run/parameters.rst b/docs/source/run/parameters.rst index dd4000da53..5fc37dd660 100644 --- a/docs/source/run/parameters.rst +++ b/docs/source/run/parameters.rst @@ -650,10 +650,6 @@ which are valid only for certain beam types, are introduced further below under Whether the beam particles are pushed along the z-axis. The momentum is still fully updated. Note: using ``do_z_push = 0`` results in unphysical behavior. -``.accelerate`` (`bool`) optional (default `1`) - Whether the beam particles are accelerated. The transverse momentum is still fully updated. - Note: using ``accelerate = 0`` results in unphysical behavior. - * `` or beams.do_push`` (`bool`) optional (default `1`) When set to `0`, disables the beam particle pusher. diff --git a/src/particles/beam/BeamParticleContainer.H b/src/particles/beam/BeamParticleContainer.H index 3ef5ae6142..62b9575ed9 100644 --- a/src/particles/beam/BeamParticleContainer.H +++ b/src/particles/beam/BeamParticleContainer.H @@ -245,7 +245,6 @@ public: amrex::Real m_spin_anom = 0.00115965218128; /** ratio of beam particles that are written to the openPMD output */ int m_output_ratio = 1; - bool m_acc_z = true; /**(zmid, 0); Ezp *= (1._rt - shape_p - shape_n); + // Gather Ez field on particle from grid for (int iy=0; iy<=depos_order.value; iy++){ for (int ix=0; ix<=depos_order.value; ix++){ @@ -217,7 +218,7 @@ AdvanceBeamParticlesSlice ( ApplyExternalField(xp, yp, zp, time, clight, ExmByp, EypBxp, Ezp, Bxp, Byp, Bzp, external_fields); } - if(!acc_z) Ezp = 0; + ExmByp *= inv_clight; EypBxp *= inv_clight; Ezp *= inv_clight; From b5011342c8729eacce8196d06b62868014b5476a Mon Sep 17 00:00:00 2001 From: Xingjian Hui <151739545+huixingjian@users.noreply.github.com> Date: Tue, 2 Jun 2026 14:48:21 +0200 Subject: [PATCH 35/35] remove a blank line --- src/laser/MultiLaser.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/laser/MultiLaser.cpp b/src/laser/MultiLaser.cpp index faa1eb5b39..ab6c4a0d33 100644 --- a/src/laser/MultiLaser.cpp +++ b/src/laser/MultiLaser.cpp @@ -478,7 +478,6 @@ MultiLaser::AdvanceSlice (const int islice, const Fields& fields, amrex::Real dt } ); } - } else { amrex::Abort("laser.solver_type must be fft, multigrid or off"); }