Skip to content

Commit

Permalink
Merge pull request #54 from gustavo-marques/deallocate_diabatic
Browse files Browse the repository at this point in the history
Comment deallocation of diabatic-related arrays
  • Loading branch information
gustavo-marques authored Apr 20, 2018
2 parents dab30b6 + 165a5eb commit 4b21263
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2901,6 +2901,7 @@ subroutine MOM_end(CS)
call tracer_registry_end(CS%tracer_Reg)
call tracer_flow_control_end(CS%tracer_flow_CSp)

! GMM, the following is commented because it fails on Travis.
!if (associated(CS%diabatic_CSp)) call diabatic_driver_end(CS%diabatic_CSp)

if (CS%offline_tracer_mode) call offline_transport_end(CS%offline_CSp)
Expand Down
32 changes: 18 additions & 14 deletions src/parameterizations/vertical/MOM_diabatic_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ module MOM_diabatic_driver
real :: evap_CFL_limit = 0.8 !< The largest fraction of a layer that can be
!! evaporated in one time-step (non-dim).

logical :: useKPP !< use CVmix/KPP diffusivities and non-local transport
logical :: useKPP = .false. !< use CVmix/KPP diffusivities and non-local transport
logical :: salt_reject_below_ML !< If true, add salt below mixed layer (layer mode only)
logical :: KPPisPassive !< If true, KPP is in passive mode, not changing answers.
logical :: debug !< If true, write verbose checksums for debugging purposes.
Expand Down Expand Up @@ -2425,18 +2425,16 @@ subroutine diabatic_driver_end(CS)
call entrain_diffusive_end(CS%entrain_diffusive_CSp)
call set_diffusivity_end(CS%set_diff_CSp)

! GMM, commeting the following because it fails on Travis (gfortran)

! if (CS%useKPP) then
! if (allocated(CS%KPP_buoy_flux)) deallocate( CS%KPP_buoy_flux )
! if (allocated(CS%KPP_temp_flux)) deallocate( CS%KPP_temp_flux )
! if (allocated(CS%KPP_salt_flux)) deallocate( CS%KPP_salt_flux )
! endif
! if (CS%useKPP) then
! if (allocated(CS%KPP_NLTheat)) deallocate( CS%KPP_NLTheat )
! if (allocated(CS%KPP_NLTscalar)) deallocate( CS%KPP_NLTscalar )
! call KPP_end(CS%KPP_CSp)
! endif
if (CS%useKPP) then
deallocate( CS%KPP_buoy_flux )
deallocate( CS%KPP_temp_flux )
deallocate( CS%KPP_salt_flux )
endif
if (CS%useKPP) then
deallocate( CS%KPP_NLTheat )
deallocate( CS%KPP_NLTscalar )
call KPP_end(CS%KPP_CSp)
endif

if (CS%use_tidal_mixing) call tidal_mixing_end(CS%tidal_mixing_CSp)

Expand All @@ -2452,9 +2450,15 @@ subroutine diabatic_driver_end(CS)
deallocate(CS%optics)
endif

call diag_grid_storage_end(CS%diag_grids_prev)
! GMM, the following is commented out because arrays in
! CS%diag_grids_prev are neither pointers or allocatables
! and, therefore, cannot be deallocated.

!call diag_grid_storage_end(CS%diag_grids_prev)

if (associated(CS)) deallocate(CS)


end subroutine diabatic_driver_end


Expand Down
2 changes: 2 additions & 0 deletions src/parameterizations/vertical/MOM_tidal_mixing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,8 @@ end subroutine read_tidal_energy
subroutine tidal_mixing_end(CS)
type(tidal_mixing_cs), pointer :: CS ! This module's control structure

if (.not.associated(CS)) return

!TODO deallocate all the dynamically allocated members here ...
if (allocated(CS%tidal_qe_2d)) deallocate(CS%tidal_qe_2d)
deallocate(CS%dd)
Expand Down

0 comments on commit 4b21263

Please sign in to comment.