Update terminal output and add limiting factor to adaptive output - #1757
Update terminal output and add limiting factor to adaptive output#1757wilfonba wants to merge 2 commits into
Conversation
| dt_cfl_glb = (/icfl_dt_local, vcfl_dt_local, ccfl_dt_local/) | ||
| else | ||
| call s_mpi_allreduce_min(dt_local, dt) | ||
| call s_mpi_allreduce_min_vec((/icfl_dt_local, vcfl_dt_local, ccfl_dt_local/), dt_cfl_glb) |
There was a problem hiding this comment.
the kind of notation that could get expensive on amd compilers. did you do any testing
There was a problem hiding this comment.
I did not... I'll make this a constant size array rather than a constructed array in the subroutine call
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
This PR refines simulation runtime terminal output formatting and adds visibility into which CFL criterion (inviscid/viscous/capillary) is limiting the adaptive time step.
Changes:
- Track per-criterion CFL candidate time steps and select the global limiting criterion.
- Add an MPI helper to allreduce elementwise minima for small real vectors.
- Update printed progress lines to be shorter and (for adaptive CFL) include the limiting criterion tag.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/simulation/m_time_steppers.fpp | Computes per-criterion dt candidates, reduces globally, and records which criterion limits dt. |
| src/simulation/m_start_up.fpp | Updates progress/ETA print formatting and appends limiter tag for adaptive dt runs. |
| src/simulation/m_sim_helpers.fpp | Exposes dt_limiter state and expands CFL helper to return 3 candidate dts. |
| src/common/m_mpi_common.fpp | Adds s_mpi_allreduce_min_vec for elementwise global minima of real vectors. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| impure subroutine s_mpi_allreduce_min_vec(var_loc, var_glb) | ||
|
|
||
| real(wp), dimension(:), intent(in) :: var_loc | ||
| real(wp), dimension(:), intent(out) :: var_glb | ||
|
|
||
| #ifdef MFC_MPI | ||
| integer :: ierr !< Generic flag used to identify and report MPI errors | ||
|
|
||
| call MPI_ALLREDUCE(var_loc, var_glb, size(var_loc), mpi_p, MPI_MIN, MPI_COMM_WORLD, ierr) | ||
| #else | ||
| var_glb = var_loc | ||
| #endif |
| private; public :: s_compute_enthalpy, s_compute_stability_from_dt, s_compute_dt_from_cfl, dt_limiter, dt_limiter_names | ||
|
|
||
| !> Stability criterion currently limiting the adaptive time step (ICFL, VCFL, or CCFL) | ||
| character(len=4) :: dt_limiter = 'none' | ||
| character(len=4), dimension(3), parameter :: dt_limiter_names = (/'ICFL', 'VCFL', 'CCFL'/) |
| real(wp), dimension(num_vels), intent(in) :: vel | ||
| real(wp), intent(in) :: c, rho | ||
| real(wp), intent(inout) :: max_dt | ||
| real(wp), dimension(3), intent(inout) :: max_dt |
| dt_cfl_glb = (/icfl_dt_local, vcfl_dt_local, ccfl_dt_local/) | ||
| else | ||
| call s_mpi_allreduce_min(dt_local, dt) | ||
| call s_mpi_allreduce_min_vec((/icfl_dt_local, vcfl_dt_local, ccfl_dt_local/), dt_cfl_glb) |
Lines of Code
|
This PR improves the runtime terminal output for simulations. The terminal output width is reduced. The following shows a before and after for a constant delta t simulation
The output for a
cfl_const_dtis identical since the delta t is constant. The following shows the before and after for acfl_adap_dtsimulationContribution Policy
We do not accept pull requests generated primarily by AI without genuine understanding or real-world usage context.
All contributions are expected to demonstrate:
If these expectations are not met, we would prefer to implement the changes ourselves rather than spend time reviewing low-effort submissions.
Acknowledgement
PR template credit: junegunn