Skip to content

Commit

Permalink
Evolve: Reorder py_afterstep and cur_time break (#2213)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterscherpelz authored Aug 23, 2021
1 parent b27c1f4 commit c2a7ce7
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Source/Evolve/WarpXEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,15 @@ WarpX::Evolve (int numsteps)
ComputeSpaceChargeField( reset_fields );
}

// sync up time
for (int i = 0; i <= max_level; ++i) {
t_new[i] = cur_time;
}

// warpx_py_afterstep runs with the updated global time. It is included
// in the evolve timing.
if (warpx_py_afterstep) warpx_py_afterstep();

Real evolve_time_end_step = amrex::second();
evolve_time += evolve_time_end_step - evolve_time_beg_step;

Expand All @@ -316,10 +325,6 @@ WarpX::Evolve (int numsteps)
<< " s; This step = " << evolve_time_end_step-evolve_time_beg_step
<< " s; Avg. per step = " << evolve_time/(step+1) << " s\n";
}
// sync up time
for (int i = 0; i <= max_level; ++i) {
t_new[i] = cur_time;
}

/// reduced diags
if (reduced_diags->m_plot_rd != 0)
Expand All @@ -329,19 +334,17 @@ WarpX::Evolve (int numsteps)
}
multi_diags->FilterComputePackFlush( step );

if (cur_time >= stop_time - 1.e-3*dt[0]) {
break;
}

if (warpx_py_afterstep) warpx_py_afterstep();

// inputs: unused parameters (e.g. typos) check after step 1 has finished
if (!early_params_checked) {
amrex::Print() << "\n"; // better: conditional \n based on return value
amrex::ParmParse().QueryUnusedInputs();
early_params_checked = true;
}

if (cur_time >= stop_time - 1.e-3*dt[0]) {
break;
}

// End loop on time steps
}

Expand Down

0 comments on commit c2a7ce7

Please sign in to comment.