Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
15 changes: 7 additions & 8 deletions src/common/m_boundary_common.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,23 +171,22 @@ contains
subroutine s_finalize_boundary_common_module()

if (bc_io) then
deallocate (bc_buffers(1, 1)%sf)
deallocate (bc_buffers(1, 2)%sf)
@:DEALLOCATE(bc_buffers(1, 1)%sf)
@:DEALLOCATE(bc_buffers(1, 2)%sf)
#:if not MFC_CASE_OPTIMIZATION or num_dims > 1
if (n > 0) then
deallocate (bc_buffers(2, 1)%sf)
deallocate (bc_buffers(2, 2)%sf)
@:DEALLOCATE(bc_buffers(2, 1)%sf)
@:DEALLOCATE(bc_buffers(2, 2)%sf)
#:if not MFC_CASE_OPTIMIZATION or num_dims > 2
if (p > 0) then
deallocate (bc_buffers(3, 1)%sf)
deallocate (bc_buffers(3, 2)%sf)
@:DEALLOCATE(bc_buffers(3, 1)%sf)
@:DEALLOCATE(bc_buffers(3, 2)%sf)
end if
#:endif
end if
#:endif
end if

deallocate (bc_buffers)
@:DEALLOCATE(bc_buffers)

end subroutine s_finalize_boundary_common_module

Expand Down
2 changes: 2 additions & 0 deletions src/common/m_helper.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ contains
impure subroutine s_initialize_bubbles_model()

! Allocate memory
! NOTE: weight, pb0, Re_trans_T are program-lifetime allocations;
! no s_finalize_bubbles_model or s_finalize_* subroutine exists for this module.
if (bubbles_euler) then
@:ALLOCATE(weight(nb), R0(nb))
if (.not. polytropic) then
Expand Down
3 changes: 3 additions & 0 deletions src/common/m_model.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,9 @@ contains
end if
end do

! NOTE: gpu_ntrs, gpu_trs_v, gpu_trs_n, gpu_boundary_edge_count, gpu_total_vertices, gpu_boundary_v are program-lifetime
! allocations;
! no s_finalize_* subroutine exists for this module.
if (max_ntrs > 0) then
@:ALLOCATE(gpu_ntrs(1:num_stl_models))
@:ALLOCATE(gpu_trs_v(1:3, 1:3, 1:max_ntrs, 1:num_stl_models))
Expand Down
5 changes: 5 additions & 0 deletions src/common/m_mpi_common.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,12 @@ contains
impure subroutine s_finalize_mpi_common_module

#ifdef MFC_MPI
#ifndef __NVCOMPILER_GPU_UNIFIED_MEM
@:DEALLOCATE(buff_send, buff_recv)
#else
$:GPU_EXIT_DATA(delete='[buff_send, buff_recv]')
deallocate (buff_send, buff_recv)
#endif
#endif

end subroutine s_finalize_mpi_common_module
Expand Down
3 changes: 3 additions & 0 deletions src/common/m_variables_conversion.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,9 @@ contains
if (bubbles_euler) then
@:DEALLOCATE(bubrs_vc)
end if
if (viscous) then
@:DEALLOCATE(Res_vc)
end if
#else
@:DEALLOCATE(gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps, Gs_vc)
if (bubbles_euler) then
Expand Down
4 changes: 4 additions & 0 deletions src/post_process/m_start_up.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,10 @@ contains
Nf = max(Nx, Ny, Nz)
! NOTE: data_in, data_out, data_cmplx, data_cmplx_y, data_cmplx_z,
! En_real, En are program-lifetime allocations; no s_finalize_start_up_module exists.
@:ALLOCATE(data_in(Nx*Nyloc*Nzloc))
@:ALLOCATE(data_in(Nx*Nyloc*Nzloc))
@:ALLOCATE(data_out(Nx*Nyloc*Nzloc))
Expand Down
4 changes: 4 additions & 0 deletions src/simulation/m_acoustic_src.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ contains

integer :: i, j !< generic loop variables

! NOTE: loc_acoustic, mass_src, mom_src, E_src, source_spatials, source_spatials_num_points are program-lifetime
! allocations;
! no s_finalize_acoustic_src subroutine exists for this module.

@:ALLOCATE(loc_acoustic(1:3, 1:num_source), mag(1:num_source), dipole(1:num_source), support(1:num_source), &
& length(1:num_source), height(1:num_source), wavelength(1:num_source), frequency(1:num_source), &
& gauss_sigma_dist(1:num_source), gauss_sigma_time(1:num_source), foc_length(1:num_source), &
Expand Down
3 changes: 3 additions & 0 deletions src/simulation/m_bubbles_EE.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ contains

integer :: l

! NOTE: rs, vs, ps, ms, divu%sf, bub_adv_src, bub_r_src, bub_v_src, bub_p_src, bub_m_src are program-lifetime allocations;
! no s_finalize_bubbles_EE_module subroutine exists.

@:ALLOCATE(rs(1:nb))
@:ALLOCATE(vs(1:nb))
@:ALLOCATE(ps(1:nb))
Expand Down
20 changes: 11 additions & 9 deletions src/simulation/m_derived_variables.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions src/simulation/m_global_parameters.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,7 @@ contains
@:DEALLOCATE(fluid_inv_re)

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)
Expand Down
1 change: 1 addition & 0 deletions src/simulation/m_hyperelastic.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 5 additions & 9 deletions src/simulation/m_ibm.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1542,21 +1542,17 @@ contains
@:DEALLOCATE(ib_airfoil_grids(i)%lower)
end if
end do

if (allocated(models)) then
if (size(models) > 0) then
@:DEALLOCATE(models)
else
deallocate (models)
end if
@:DEALLOCATE(models)
end if
if (allocated(ghost_points)) then
@:DEALLOCATE(ghost_points)
end if

if (collision_model > 0) call s_finalize_collisions_module()

#ifdef MFC_MPI
if (num_procs > 1) then
@:DEALLOCATE(send_ids, send_ft)
deallocate (recv_forces_snap, recv_torques_snap, recv_ids, recv_ft)
@:DEALLOCATE(recv_forces_snap, recv_torques_snap, recv_ids, recv_ft)
end if
#endif

Expand Down
2 changes: 2 additions & 0 deletions src/simulation/m_qbmm.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ contains
$:GPU_UPDATE(device='[nterms]')
#:endif

! NOTE: momrhs is a program-lifetime allocation; no s_finalize_* subroutine exists for this module.
@:ALLOCATE(momrhs(1:3, 0:2, 0:2, 1:nterms, 1:nb))
momrhs = 0._wp

Expand Down Expand Up @@ -383,6 +384,7 @@ contains

$:GPU_UPDATE(device='[momrhs]')

! NOTE: bubmoms is a program-lifetime allocation; no s_finalize_* subroutine exists for this module.
@:ALLOCATE(bubmoms(1:nb, 1:nmom))

do j = 1, nmom
Expand Down
29 changes: 27 additions & 2 deletions src/simulation/m_rhs.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1796,8 +1796,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
Expand Down Expand Up @@ -1841,6 +1840,32 @@ contains
end do

@:DEALLOCATE(flux_n, flux_src_n, flux_gsrc_n)
do i = 1, num_dims
do l = eqn_idx%mom%beg, eqn_idx%mom%end
@:DEALLOCATE(qL_prim(i)%vf(l)%sf)
@:DEALLOCATE(qR_prim(i)%vf(l)%sf)
end do
@:DEALLOCATE(qL_prim(i)%vf, qR_prim(i)%vf)
end do
@:DEALLOCATE(qL_prim, 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
Expand Down
4 changes: 4 additions & 0 deletions src/simulation/m_riemann_solvers.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,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

Expand Down
23 changes: 23 additions & 0 deletions src/simulation/m_time_steppers.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,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
Loading
Loading