Skip to content

Avoiding issues when propagating a laser with dt=0 #1219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/run/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ Time step
* ``hipace.max_time`` (`float`) optional (default `infinity`)
Maximum physical time of the simulation. The ``dt`` of the last time step may be reduced so that ``t + dt = max_time``, both for the adaptive and a fixed time step.

* ``hipace.dt`` (`float` or `string`) optional (default `0.`)
* ``hipace.dt`` (`float` or `string`)
Time step to advance the particle beam. For adaptive time step, use ``"adaptive"``.

* ``hipace.dt_max`` (`float`) optional (default `inf`)
Expand Down
2 changes: 1 addition & 1 deletion examples/laser_ionization/inputs_laser_ionization
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
max_step = 0
hipace.dt = 0
hipace.dt = 10.e-6/clight
hipace.verbose = 3

amr.n_cell = 50 50 50
Expand Down
4 changes: 2 additions & 2 deletions src/Hipace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ Hipace::Hipace () :
amrex::ParmParse pph("hipace");

std::string str_dt {""};
queryWithParser(pph, "dt", str_dt);
getWithParser(pph, "dt", str_dt);
if (str_dt != "adaptive") {
queryWithParser(pph, "dt", m_dt);
getWithParser(pph, "dt", m_dt);
m_max_time = std::copysign(m_max_time, m_dt);
}
queryWithParser(pph, "max_time", m_max_time);
Expand Down
2 changes: 2 additions & 0 deletions src/laser/MultiLaser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ MultiLaser::AdvanceSlice (const int islice, const Fields& fields, amrex::Real dt

if (!UseLaser(islice)) return;

AMREX_ALWAYS_ASSERT_WITH_MESSAGE(dt!=0, "cannot use dt=0 with Laser");

Hipace::m_num_laser_cells_updated += m_slice_box.d_numPts();

InterpolateChi(fields, geom_field_lev0);
Expand Down
Loading