Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deallocate diabatic #54

Merged
merged 6 commits into from
Apr 20, 2018
Merged
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
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