Skip to content
Open
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
17 changes: 17 additions & 0 deletions datm/atm_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ module cdeps_datm_comp
use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_config, shr_strdata_advance
use dshr_strdata_mod , only : shr_strdata_get_stream_pointer, shr_strdata_setOrbs
use dshr_strdata_mod , only : shr_strdata_finalize
use dshr_mod , only : dshr_model_initphase, dshr_init, dshr_restart_write
use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance
use dshr_mod , only : dshr_mesh_init, dshr_check_restart_alarm, dshr_restart_read
use dshr_mod , only : dshr_mesh_finalize, dshr_destroy_clock_alarms
use dshr_mod , only : dshr_orbital_init, dshr_orbital_update
use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize

Expand Down Expand Up @@ -858,9 +860,24 @@ end function getNextRadCDay
subroutine ModelFinalize(gcomp, rc)
type(ESMF_GridComp) :: gcomp
integer, intent(out) :: rc

! local variables
!-------------------------------------------------------------------------------

rc = ESMF_SUCCESS

! finalize sdat
call shr_strdata_finalize(sdat, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! destroy model mesh using dshr_mesh_finalize routine
call dshr_mesh_finalize(gcomp, logunit, 'ATM', model_mesh, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! destroy alarms associated with model's clock
call dshr_destroy_clock_alarms(gcomp, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (my_task == main_task) then
write(logunit,*)
write(logunit,*) 'datm : end of main integration loop'
Expand Down
52 changes: 36 additions & 16 deletions datm/datm_datamode_core2_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ module datm_datamode_core2_mod
use ESMF , only : ESMF_State, ESMF_StateGet, ESMF_Field, ESMF_FieldBundle
use ESMF , only : ESMF_DistGrid, ESMF_RouteHandle, ESMF_MeshCreate
use ESMF , only : ESMF_Mesh, ESMF_MeshGet, ESMF_MeshCreate
use ESMF , only : ESMF_FieldDestroy, ESMF_FieldBundleDestroy, ESMF_MeshDestroy
use ESMF , only : ESMF_SUCCESS, ESMF_LogWrite, ESMF_FILEFORMAT_ESMFMESH
use ESMF , only : ESMF_StateItem_Flag, ESMF_STATEITEM_NOTFOUND, operator(/=)
use ESMF , only : ESMF_FieldBundleCreate, ESMF_FieldCreate, ESMF_MESHLOC_ELEMENT
use ESMF , only : ESMF_FieldBundleAdd, ESMF_LOGMSG_INFO, ESMF_TYPEKIND_R8
use ESMF , only : ESMF_RouteHandleDestroy, ESMF_EXTRAPMETHOD_NEAREST_STOD
use ESMF , only : ESMF_POLEMETHOD_ALLAVG, ESMF_REGRIDMETHOD_BILINEAR
use ESMF , only : ESMF_DistGridGet, ESMF_FieldRegridStore, ESMF_FieldRedistStore
use ESMF , only : ESMF_FieldRegridRelease, ESMF_FieldRedistRelease
use pio , only : Var_Desc_t, file_desc_t, io_desc_t, pio_read_darray, pio_freedecomp
use pio , only : pio_openfile, PIO_NOWRITE, pio_seterrorhandling, PIO_BCAST_ERROR
use pio , only : pio_initdecomp, pio_inq_dimlen, pio_inq_varid
Expand Down Expand Up @@ -422,8 +424,8 @@ subroutine datm_get_adjustment_factors(sdat, fileName_mesh, fileName_data, windF
type(ESMF_FieldBundle) :: fldbun_src
type(ESMF_FieldBundle) :: fldbun_dst
type(ESMF_RouteHandle) :: route_handle
type(ESMF_Field) :: field_src
type(ESMF_Field) :: field_dst
type(ESMF_Field) :: field_src_1, field_src_2, field_src_3
type(ESMF_Field) :: field_dst_1, field_dst_2, field_dst_3
integer :: lsize
integer, pointer :: gindex(:) ! domain decomposition of data
integer :: ndims ! number of dims
Expand All @@ -446,37 +448,37 @@ subroutine datm_get_adjustment_factors(sdat, fileName_mesh, fileName_data, windF

! Create input and output field bundles
fldbun_src = ESMF_FieldBundleCreate(rc=rc) ! input field bundle
field_src = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name='windFactor', &
field_src_1 = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name='windFactor', &
meshloc=ESMF_MESHLOC_ELEMENT, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldBundleAdd(fldbun_src, (/field_src/), rc=rc)
call ESMF_FieldBundleAdd(fldbun_src, (/field_src_1/), rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
field_src = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name='winddFactor', &
field_src_2 = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name='winddFactor', &
meshloc=ESMF_MESHLOC_ELEMENT, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldBundleAdd(fldbun_src, (/field_src/), rc=rc)
call ESMF_FieldBundleAdd(fldbun_src, (/field_src_2/), rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
field_src = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name='qsatFactor', &
field_src_3 = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name='qsatFactor', &
meshloc=ESMF_MESHLOC_ELEMENT, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldBundleAdd(fldbun_src, (/field_src/), rc=rc)
call ESMF_FieldBundleAdd(fldbun_src, (/field_src_3/), rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

fldbun_dst = ESMF_FieldBundleCreate(rc=rc) ! output field bundle
field_dst = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_R8, name='windFactor', &
field_dst_1 = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_R8, name='windFactor', &
meshloc=ESMF_MESHLOC_ELEMENT, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldBundleAdd(fldbun_dst, (/field_dst/), rc=rc)
call ESMF_FieldBundleAdd(fldbun_dst, (/field_dst_1/), rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
field_dst = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_R8, name='winddFactor', &
field_dst_2 = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_R8, name='winddFactor', &
meshloc=ESMF_MESHLOC_ELEMENT, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldBundleAdd(fldbun_dst, (/field_dst/), rc=rc)
call ESMF_FieldBundleAdd(fldbun_dst, (/field_dst_2/), rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
field_dst = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_R8, name='qsatFactor', &
field_dst_3 = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_R8, name='qsatFactor', &
meshloc=ESMF_MESHLOC_ELEMENT, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldBundleAdd(fldbun_dst, (/field_dst/), rc=rc)
call ESMF_FieldBundleAdd(fldbun_dst, (/field_dst_3/), rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

! Get mesh info
Expand Down Expand Up @@ -520,15 +522,15 @@ subroutine datm_get_adjustment_factors(sdat, fileName_mesh, fileName_data, windF
if (nxg*nyg /= sdat%model_gsize) then
! TODO: this needs a mask that needs to be read in to have the mapping be accurate
! create bilinear route handle -
call ESMF_FieldRegridStore(field_src, field_dst, routehandle=route_handle, &
call ESMF_FieldRegridStore(field_src_3, field_dst_3, routehandle=route_handle, &
regridmethod=ESMF_REGRIDMETHOD_BILINEAR, &
polemethod=ESMF_POLEMETHOD_ALLAVG, &
extrapMethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, &
srcTermProcessing=srcTermProcessing_Value, &
ignoreDegenerate=.true., rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
else
call ESMF_FieldRedistStore(field_src, field_dst, routehandle=route_handle, &
call ESMF_FieldRedistStore(field_src_3, field_dst_3, routehandle=route_handle, &
ignoreUnmatchedIndices=.true., rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
end if
Expand All @@ -549,6 +551,24 @@ subroutine datm_get_adjustment_factors(sdat, fileName_mesh, fileName_data, windF
call pio_freedecomp(sdat%pio_subsystem, pio_iodesc)
call ESMF_RouteHandleDestroy(route_handle, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldBundleDestroy(fldbun_dst, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldBundleDestroy(fldbun_src, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldDestroy(field_dst_1, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldDestroy(field_dst_2, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldDestroy(field_dst_3, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldDestroy(field_src_1, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldDestroy(field_src_2, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldDestroy(field_src_3, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_MeshDestroy(mesh, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

end subroutine datm_get_adjustment_factors

Expand Down
20 changes: 15 additions & 5 deletions dglc/dglc_datamode_noevolve_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module dglc_datamode_noevolve_mod
use ESMF , only : ESMF_Mesh, ESMF_DistGrid, ESMF_FieldBundle, ESMF_Field
use ESMF , only : ESMF_FieldBundleCreate, ESMF_FieldCreate, ESMF_MeshLoc_Element
use ESMF , only : ESMF_FieldBundleAdd, ESMF_MeshGet, ESMF_DistGridGet, ESMF_Typekind_R8
use ESMF , only : ESMF_FieldBundleDestroy, ESMF_FieldDestroy
use ESMF , only : ESMF_GridComp
use ESMF , only : ESMF_VM, ESMF_VMGetCurrent, ESMF_VMBroadCast
use NUOPC , only : NUOPC_Advertise, NUOPC_IsConnected
Expand Down Expand Up @@ -238,7 +239,8 @@ subroutine dglc_datamode_noevolve_advance(gcomp, pio_subsystem, io_type, io_form
! local variables
type(ESMF_FieldBundle) :: fldbun_noevolve
type(ESMF_DistGrid) :: distgrid
type(ESMF_Field) :: field_noevolve
type(ESMF_Field) :: field_thk
type(ESMF_Field) :: field_topg
type(file_desc_t) :: pioid
type(io_desc_t) :: pio_iodesc
integer :: ns ! ice sheet index
Expand Down Expand Up @@ -296,17 +298,17 @@ subroutine dglc_datamode_noevolve_advance(gcomp, pio_subsystem, io_type, io_form
fldbun_noevolve = ESMF_FieldBundleCreate(rc=rc) ! input field bundle

! "ice thickness" ;
field_noevolve = ESMF_FieldCreate(model_meshes(ns), ESMF_TYPEKIND_R8, &
field_thk = ESMF_FieldCreate(model_meshes(ns), ESMF_TYPEKIND_R8, &
name='thk', meshloc=ESMF_MESHLOC_ELEMENT, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldBundleAdd(fldbun_noevolve, (/field_noevolve/), rc=rc)
call ESMF_FieldBundleAdd(fldbun_noevolve, (/field_thk/), rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

! "bed topography" ;
field_noevolve = ESMF_FieldCreate(model_meshes(ns), ESMF_TYPEKIND_R8, &
field_topg = ESMF_FieldCreate(model_meshes(ns), ESMF_TYPEKIND_R8, &
name='topg', meshloc=ESMF_MESHLOC_ELEMENT, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldBundleAdd(fldbun_noevolve, (/field_noevolve/), rc=rc)
call ESMF_FieldBundleAdd(fldbun_noevolve, (/field_topg/), rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

! Create pioid and pio_iodesc at the module level
Expand Down Expand Up @@ -386,6 +388,14 @@ subroutine dglc_datamode_noevolve_advance(gcomp, pio_subsystem, io_type, io_form
call pio_closefile(pioid)
call pio_freedecomp(pio_subsystem, pio_iodesc)

nullify(topog, thck)
call ESMF_FieldBundleDestroy(fldbun_noevolve, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldDestroy(field_thk, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldDestroy(field_topg, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

end do ! end loop over ice sheets

end if
Expand Down
27 changes: 27 additions & 0 deletions dglc/glc_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ module cdeps_dglc_comp
#endif
use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_init_from_config
use dshr_strdata_mod , only : shr_strdata_finalize
use dshr_mod , only : dshr_model_initphase, dshr_init, dshr_mesh_init
use dshr_mod , only : dshr_mesh_finalize, dshr_destroy_clock_alarms
use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_check_restart_alarm
use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_realize
use nuopc_shr_methods, only : shr_get_rpointer_name, alarmInit
Expand Down Expand Up @@ -764,8 +766,33 @@ end subroutine ModelSetRunClock
subroutine ModelFinalize(gcomp, rc)
type(ESMF_GridComp) :: gcomp
integer, intent(out) :: rc

! local variables
integer :: i
!-------------------------------------------------------------------------------

rc = ESMF_SUCCESS

! finalize sdat
if (allocated(sdat)) then
do i=1, size(sdat)
call shr_strdata_finalize(sdat(i), rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end do
end if

! destroy model meshes using dshr_mesh_finalize routine
if (allocated(model_meshes)) then
do i=1, size(model_meshes)
call dshr_mesh_finalize(gcomp, logunit, 'GLC', model_meshes(i), rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end do
end if

! destroy alarms associated with model's clock
call dshr_destroy_clock_alarms(gcomp, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (my_task == main_task) then
write(logunit,*)
write(logunit,*) 'dglc : end of main integration loop'
Expand Down
17 changes: 17 additions & 0 deletions dice/ice_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ module cdeps_dice_comp
use shr_log_mod , only : shr_log_setLogUnit, shr_log_error
use shr_cal_mod , only : shr_cal_ymd2date, shr_cal_ymd2julian
use dshr_mod , only : dshr_model_initphase, dshr_init, dshr_mesh_init, dshr_check_restart_alarm
use dshr_mod , only : dshr_mesh_finalize, dshr_destroy_clock_alarms
use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance
use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_config, shr_strdata_advance
use dshr_strdata_mod , only : shr_strdata_finalize
use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize

use dice_datamode_ssmi_mod , only : dice_datamode_ssmi_advertise
Expand Down Expand Up @@ -581,9 +583,24 @@ end subroutine dice_comp_run
subroutine ModelFinalize(gcomp, rc)
type(ESMF_GridComp) :: gcomp
integer, intent(out) :: rc

! local variables
!-------------------------------------------------------------------------------

rc = ESMF_SUCCESS

! finalize sdat
call shr_strdata_finalize(sdat, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! destroy model mesh using dshr_mesh_finalize routine
call dshr_mesh_finalize(gcomp, logunit, 'ICE', model_mesh, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! destroy alarms associated with model's clock
call dshr_destroy_clock_alarms(gcomp, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (mainproc) then
write(logunit,*)
write(logunit,*) 'dice : end of main integration loop'
Expand Down
15 changes: 15 additions & 0 deletions dlnd/lnd_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ module cdeps_dlnd_comp
use shr_log_mod , only : shr_log_setLogUnit, shr_log_error
use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_init_from_config
use dshr_strdata_mod , only : shr_strdata_finalize
use dshr_mod , only : dshr_model_initphase, dshr_init, dshr_check_restart_alarm
use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance
use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init
use dshr_mod , only : dshr_mesh_finalize, dshr_destroy_clock_alarms
use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize

! Datamode specialized modules
Expand Down Expand Up @@ -419,6 +421,19 @@ subroutine ModelFinalize(gcomp, rc)
!-------------------------------------------------------------------------------

rc = ESMF_SUCCESS

! finalize sdat
call shr_strdata_finalize(sdat, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! destroy model mesh using dshr_mesh_finalize routine
call dshr_mesh_finalize(gcomp, logunit, 'LND', model_mesh, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! destroy alarms associated with model's clock
call dshr_destroy_clock_alarms(gcomp, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO)
if (my_task == main_task) then
write(logunit,F91)
Expand Down
17 changes: 17 additions & 0 deletions docn/ocn_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ module cdeps_docn_comp
use shr_log_mod , only : shr_log_setLogUnit, shr_log_error
use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_init_from_config
use dshr_strdata_mod , only : shr_strdata_finalize
use dshr_mod , only : dshr_model_initphase, dshr_init, dshr_mesh_init, dshr_restart_read
use dshr_mod , only : dshr_mesh_finalize, dshr_destroy_clock_alarms
use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_check_restart_alarm
use dshr_mod , only : dshr_restart_write
use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_realize
Expand Down Expand Up @@ -673,8 +675,23 @@ end subroutine docn_comp_run
subroutine ModelFinalize(gcomp, rc)
type(ESMF_GridComp) :: gcomp
integer, intent(out) :: rc

! local variables
!-------------------------------------------------------------------------------
rc = ESMF_SUCCESS

! finalize sdat
call shr_strdata_finalize(sdat, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! destroy model mesh using dshr_mesh_finalize routine
call dshr_mesh_finalize(gcomp, logunit, 'OCN', model_mesh, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! destroy alarms associated with model's clock
call dshr_destroy_clock_alarms(gcomp, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (mainproc) then
write(logunit,*)
write(logunit,*) 'docn : end of main integration loop'
Expand Down
17 changes: 17 additions & 0 deletions drof/rof_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ module cdeps_drof_comp
use shr_log_mod , only : shr_log_setLogUnit, shr_log_error
use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_init_from_config
use dshr_strdata_mod , only : shr_strdata_finalize
use dshr_mod , only : dshr_model_initphase, dshr_init
use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_check_restart_alarm
use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init
use dshr_mod , only : dshr_mesh_finalize, dshr_destroy_clock_alarms
use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_realize
use nuopc_shr_methods, only : shr_get_rpointer_name

Expand Down Expand Up @@ -478,9 +480,24 @@ subroutine ModelFinalize(gcomp, rc)

type(ESMF_GridComp) :: gcomp
integer, intent(out) :: rc

! local variables
!--------------------------------

rc = ESMF_SUCCESS

! finalize sdat
call shr_strdata_finalize(sdat, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! destroy model mesh using dshr_mesh_finalize routine
call dshr_mesh_finalize(gcomp, logunit, 'ROF', model_mesh, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! destroy alarms associated with model's clock
call dshr_destroy_clock_alarms(gcomp, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (mainproc) then
write(logunit,*)
write(logunit,*) 'drof : end of main integration loop'
Expand Down
Loading
Loading