Line data Source code
1 : !======================================================================= 2 : ! 3 : ! This module contains routines for the final exit of the CICE model, 4 : ! including final output and clean exit from any message passing 5 : ! environments and frameworks. 6 : ! 7 : ! authors: Philip W. Jones, LANL 8 : ! 2006: Converted to free source form (F90) by Elizabeth Hunke 9 : ! 2008: E. Hunke moved ESMF code to its own driver 10 : 11 : module CICE_FinalMod 12 : 13 : use ice_kinds_mod 14 : use ice_communicate, only: my_task, master_task 15 : use ice_exit, only: end_run, abort_ice 16 : use ice_fileunits, only: nu_diag, release_all_fileunits 17 : use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted 18 : 19 : implicit none 20 : private 21 : public :: CICE_Finalize 22 : 23 : !======================================================================= 24 : 25 : contains 26 : 27 : !======================================================================= 28 : ! 29 : ! This routine shuts down CICE by exiting all relevent environments. 30 : 31 37 : subroutine CICE_Finalize 32 : 33 : use ice_timers, only: ice_timer_stop, ice_timer_print_all, timer_total, & 34 : timer_stats 35 : 36 : character(len=*), parameter :: subname = '(CICE_Finalize)' 37 : 38 : !------------------------------------------------------------------- 39 : ! stop timers and print timer info 40 : !------------------------------------------------------------------- 41 : 42 37 : call ice_timer_stop(timer_total) ! stop timing entire run 43 37 : call ice_timer_print_all(stats=timer_stats) ! print timing information 44 : 45 37 : call icepack_warnings_flush(nu_diag) 46 37 : if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & 47 0 : file=__FILE__,line= __LINE__) 48 : 49 37 : if (my_task == master_task) then 50 7 : write(nu_diag, *) " " 51 7 : write(nu_diag, *) "CICE COMPLETED SUCCESSFULLY " 52 7 : write(nu_diag, *) " " 53 : endif 54 : 55 : !echmod if (nu_diag /= 6) close (nu_diag) ! diagnostic output 56 37 : call release_all_fileunits 57 : 58 : !------------------------------------------------------------------- 59 : ! quit MPI 60 : !------------------------------------------------------------------- 61 : 62 37 : call end_run ! quit MPI 63 : 64 37 : end subroutine CICE_Finalize 65 : 66 : !======================================================================= 67 : 68 : end module CICE_FinalMod 69 : 70 : !=======================================================================