diff --git a/docs/source/run/parameters.rst b/docs/source/run/parameters.rst index 799bce4c8e..bd1dee2386 100644 --- a/docs/source/run/parameters.rst +++ b/docs/source/run/parameters.rst @@ -646,6 +646,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. +``.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. @@ -959,10 +963,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 ``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. + 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. diff --git a/src/laser/MultiLaser.cpp b/src/laser/MultiLaser.cpp index f408a0138e..14d72cdea3 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"); + AMREX_ALWAYS_ASSERT(m_solver_type == "multigrid" || m_solver_type == "fft" || + m_solver_type == "off"); queryWithParser(pp, "interp_order", m_interp_order); AMREX_ALWAYS_ASSERT(m_interp_order <= 3 && m_interp_order >= 0); @@ -463,8 +464,21 @@ MultiLaser::AdvanceSlice (const int islice, const Fields& fields, amrex::Real dt AdvanceSliceMG(dt, is_first_step); } else if (m_solver_type == "fft") { 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); + 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 or multigrid"); + amrex::Abort("laser.solver_type must be fft, multigrid or off"); } } diff --git a/src/particles/beam/BeamParticleContainer.H b/src/particles/beam/BeamParticleContainer.H index 62b9575ed9..3ef5ae6142 100644 --- a/src/particles/beam/BeamParticleContainer.H +++ b/src/particles/beam/BeamParticleContainer.H @@ -245,6 +245,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_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++){ @@ -218,7 +217,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;