Skip to content

Commit fd4c314

Browse files
committed
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
1 parent 751db87 commit fd4c314

6 files changed

Lines changed: 61 additions & 11 deletions

File tree

src/simulation/m_derived_variables.fpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -518,21 +518,23 @@ contains
518518
end if
519519

520520
if (probe_wrt) then
521-
deallocate (accel_mag, x_accel)
521+
@:DEALLOCATE(accel_mag)
522+
@:DEALLOCATE(x_accel)
522523
if (n > 0) then
523-
deallocate (y_accel)
524+
@:DEALLOCATE(y_accel)
524525
if (p > 0) then
525-
deallocate (z_accel)
526+
@:DEALLOCATE(z_accel)
526527
end if
527528
end if
529+
@:DEALLOCATE(fd_coeff_x)
530+
if (n > 0) then
531+
@:DEALLOCATE(fd_coeff_y)
532+
end if
533+
if (p > 0) then
534+
@:DEALLOCATE(fd_coeff_z)
535+
end if
528536
end if
529537

530-
! Deallocating the variables that might have been used to bookkeep the finite-difference coefficients in the x-, y- and
531-
! z-directions
532-
if (allocated(fd_coeff_x)) deallocate (fd_coeff_x)
533-
if (allocated(fd_coeff_y)) deallocate (fd_coeff_y)
534-
if (allocated(fd_coeff_z)) deallocate (fd_coeff_z)
535-
536538
end subroutine s_finalize_derived_variables_module
537539

538540
end module m_derived_variables

src/simulation/m_global_parameters.fpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ contains
933933
@:DEALLOCATE(fluid_inv_re)
934934

935935
if (bubbles_euler) then
936+
@:DEALLOCATE(ptil)
936937
@:DEALLOCATE(qbmm_idx%rs, qbmm_idx%vs, qbmm_idx%ps, qbmm_idx%ms)
937938
if (qbmm) then
938939
@:DEALLOCATE(qbmm_idx%moms)

src/simulation/m_hyperelastic.fpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ contains
256256
do i = 1, b_size
257257
@:DEALLOCATE(btensor%vf(i)%sf)
258258
end do
259+
@:DEALLOCATE(Gs_hyper)
259260
@:DEALLOCATE(fd_coeff_x_hyper)
260261
if (n > 0) then
261262
@:DEALLOCATE(fd_coeff_y_hyper)

src/simulation/m_rhs.fpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,8 +1796,7 @@ contains
17961796
end if
17971797
17981798
if (mpp_lim .and. bubbles_euler) then
1799-
$:GPU_EXIT_DATA(delete='[alf_sum%sf]')
1800-
deallocate (alf_sum%sf)
1799+
@:DEALLOCATE(alf_sum%sf)
18011800
end if
18021801
18031802
if (.not. igr) then
@@ -1841,6 +1840,26 @@ contains
18411840
end do
18421841
18431842
@:DEALLOCATE(flux_n, flux_src_n, flux_gsrc_n)
1843+
@:DEALLOCATE(qL_prim)
1844+
@:DEALLOCATE(qR_prim)
1845+
end if
1846+
1847+
if (alt_soundspeed) then
1848+
@:DEALLOCATE(blkmod1)
1849+
end if
1850+
1851+
if (qbmm) then
1852+
do i = 0, 2
1853+
do j = 0, 2
1854+
do l = 1, nb
1855+
@:DEALLOCATE(mom_3d(i, j, l)%sf)
1856+
end do
1857+
end do
1858+
end do
1859+
do i = 1, nmomsp
1860+
@:DEALLOCATE(mom_sp(i)%sf)
1861+
end do
1862+
@:DEALLOCATE(mom_sp, mom_3d)
18441863
end if
18451864
18461865
end subroutine s_finalize_rhs_module

src/simulation/m_riemann_solvers.fpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ contains
110110
if (qbmm) then
111111
@:DEALLOCATE(mom_sp_rsx_vf)
112112
end if
113+
@:DEALLOCATE(Gs_rs)
114+
if (viscous) then
115+
@:DEALLOCATE(Res_gs)
116+
end if
113117

114118
end subroutine s_finalize_riemann_solvers_module
115119

src/simulation/m_time_steppers.fpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,29 @@ contains
977977
call s_close_run_time_information_file()
978978
end if
979979

980+
if (chemistry) then
981+
@:DEALLOCATE(q_T_sf%sf)
982+
end if
983+
@:DEALLOCATE(pb_ts(1)%sf)
984+
@:DEALLOCATE(pb_ts(2)%sf)
985+
@:DEALLOCATE(rhs_pb)
986+
@:DEALLOCATE(pb_ts)
987+
@:DEALLOCATE(mv_ts(1)%sf)
988+
@:DEALLOCATE(mv_ts(2)%sf)
989+
@:DEALLOCATE(rhs_mv)
990+
@:DEALLOCATE(mv_ts)
991+
if (cfl_dt) then
992+
@:DEALLOCATE(max_dt)
993+
end if
994+
do i = 1, num_dims
995+
@:DEALLOCATE(bc_type(i,1)%sf)
996+
@:DEALLOCATE(bc_type(i,2)%sf)
997+
end do
998+
@:DEALLOCATE(bc_type)
999+
if (any(time_stepper == (/1, 2, 3/))) then
1000+
@:DEALLOCATE(rk_coef)
1001+
end if
1002+
9801003
end subroutine s_finalize_time_steppers_module
9811004

9821005
end module m_time_steppers

0 commit comments

Comments
 (0)