From e687299d3c28e3ec6549e31626fef26571463823 Mon Sep 17 00:00:00 2001 From: SVS87 Date: Mon, 1 Jun 2026 03:16:41 -0400 Subject: [PATCH] fix: add missing @:DEALLOCATE in simulation modules Add matching @:DEALLOCATE calls in: - m_derived_variables - m_global_parameters - m_hyperelastic - m_rhs - m_riemann_solvers - m_time_steppers Remaining files not yet addressed: - src/common/m_boundary_common.fpp, m_helper.fpp, m_model.fpp, m_mpi_common.fpp, m_variables_conversion.fpp - src/post_process/m_start_up.fpp - src/simulation/m_acoustic_src.fpp, m_bubbles_EE.fpp, m_ibm.fpp (pending PR #1378), m_qbmm.fpp Part of #1459 --- src/simulation/m_derived_variables.fpp | 20 +++++++++++--------- src/simulation/m_global_parameters.fpp | 1 + src/simulation/m_hyperelastic.fpp | 1 + src/simulation/m_rhs.fpp | 23 +++++++++++++++++++++-- src/simulation/m_riemann_solvers.fpp | 4 ++++ src/simulation/m_time_steppers.fpp | 23 +++++++++++++++++++++++ 6 files changed, 61 insertions(+), 11 deletions(-) diff --git a/src/simulation/m_derived_variables.fpp b/src/simulation/m_derived_variables.fpp index 22c0477065..4efd5774fb 100644 --- a/src/simulation/m_derived_variables.fpp +++ b/src/simulation/m_derived_variables.fpp @@ -518,21 +518,23 @@ contains end if if (probe_wrt) then - deallocate (accel_mag, x_accel) + @:DEALLOCATE(accel_mag) + @:DEALLOCATE(x_accel) if (n > 0) then - deallocate (y_accel) + @:DEALLOCATE(y_accel) if (p > 0) then - deallocate (z_accel) + @:DEALLOCATE(z_accel) end if end if + @:DEALLOCATE(fd_coeff_x) + if (n > 0) then + @:DEALLOCATE(fd_coeff_y) + end if + if (p > 0) then + @:DEALLOCATE(fd_coeff_z) + end if end if - ! Deallocating the variables that might have been used to bookkeep the finite-difference coefficients in the x-, y- and - ! z-directions - if (allocated(fd_coeff_x)) deallocate (fd_coeff_x) - if (allocated(fd_coeff_y)) deallocate (fd_coeff_y) - if (allocated(fd_coeff_z)) deallocate (fd_coeff_z) - end subroutine s_finalize_derived_variables_module end module m_derived_variables diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index e807dece0a..f789e50449 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -1196,6 +1196,7 @@ contains end if if (bubbles_euler) then + @:DEALLOCATE(ptil) @:DEALLOCATE(qbmm_idx%rs, qbmm_idx%vs, qbmm_idx%ps, qbmm_idx%ms) if (qbmm) then @:DEALLOCATE(qbmm_idx%moms) diff --git a/src/simulation/m_hyperelastic.fpp b/src/simulation/m_hyperelastic.fpp index 90e78d04df..e0017a3685 100644 --- a/src/simulation/m_hyperelastic.fpp +++ b/src/simulation/m_hyperelastic.fpp @@ -256,6 +256,7 @@ contains do i = 1, b_size @:DEALLOCATE(btensor%vf(i)%sf) end do + @:DEALLOCATE(Gs_hyper) @:DEALLOCATE(fd_coeff_x_hyper) if (n > 0) then @:DEALLOCATE(fd_coeff_y_hyper) diff --git a/src/simulation/m_rhs.fpp b/src/simulation/m_rhs.fpp index 6975729c3f..f38cfc9e55 100644 --- a/src/simulation/m_rhs.fpp +++ b/src/simulation/m_rhs.fpp @@ -1794,8 +1794,7 @@ contains end if if (mpp_lim .and. bubbles_euler) then - $:GPU_EXIT_DATA(delete='[alf_sum%sf]') - deallocate (alf_sum%sf) + @:DEALLOCATE(alf_sum%sf) end if if (.not. igr) then @@ -1839,6 +1838,26 @@ contains end do @:DEALLOCATE(flux_n, flux_src_n, flux_gsrc_n) + @:DEALLOCATE(qL_prim) + @:DEALLOCATE(qR_prim) + end if + + if (alt_soundspeed) then + @:DEALLOCATE(blkmod1) + end if + + if (qbmm) then + do i = 0, 2 + do j = 0, 2 + do l = 1, nb + @:DEALLOCATE(mom_3d(i, j, l)%sf) + end do + end do + end do + do i = 1, nmomsp + @:DEALLOCATE(mom_sp(i)%sf) + end do + @:DEALLOCATE(mom_sp, mom_3d) end if end subroutine s_finalize_rhs_module diff --git a/src/simulation/m_riemann_solvers.fpp b/src/simulation/m_riemann_solvers.fpp index 0a8bc32212..c9b3487016 100644 --- a/src/simulation/m_riemann_solvers.fpp +++ b/src/simulation/m_riemann_solvers.fpp @@ -4596,6 +4596,10 @@ contains if (qbmm) then @:DEALLOCATE(mom_sp_rsx_vf) end if + @:DEALLOCATE(Gs_rs) + if (viscous) then + @:DEALLOCATE(Res_gs) + end if end subroutine s_finalize_riemann_solvers_module diff --git a/src/simulation/m_time_steppers.fpp b/src/simulation/m_time_steppers.fpp index 4d142eca55..4b139a4570 100644 --- a/src/simulation/m_time_steppers.fpp +++ b/src/simulation/m_time_steppers.fpp @@ -968,6 +968,29 @@ contains call s_close_run_time_information_file() end if + if (chemistry) then + @:DEALLOCATE(q_T_sf%sf) + end if + @:DEALLOCATE(pb_ts(1)%sf) + @:DEALLOCATE(pb_ts(2)%sf) + @:DEALLOCATE(rhs_pb) + @:DEALLOCATE(pb_ts) + @:DEALLOCATE(mv_ts(1)%sf) + @:DEALLOCATE(mv_ts(2)%sf) + @:DEALLOCATE(rhs_mv) + @:DEALLOCATE(mv_ts) + if (cfl_dt) then + @:DEALLOCATE(max_dt) + end if + do i = 1, num_dims + @:DEALLOCATE(bc_type(i,1)%sf) + @:DEALLOCATE(bc_type(i,2)%sf) + end do + @:DEALLOCATE(bc_type) + if (any(time_stepper == (/1, 2, 3/))) then + @:DEALLOCATE(rk_coef) + end if + end subroutine s_finalize_time_steppers_module end module m_time_steppers