icbstp.F90 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. MODULE icbstp
  2. !!======================================================================
  3. !! *** MODULE icbstp ***
  4. !! Icebergs: initialise variables for iceberg tracking
  5. !!======================================================================
  6. !! History : 3.3.1 ! 2010-01 (Martin&Adcroft) Original code
  7. !! - ! 2011-03 (Madec) Part conversion to NEMO form
  8. !! - ! Removal of mapping from another grid
  9. !! - ! 2011-04 (Alderson) Split into separate modules
  10. !! - ! Move budgets to icbdia routine
  11. !! - ! 2011-05 (Alderson) Add call to copy forcing arrays
  12. !! - ! into icb copies with haloes
  13. !!----------------------------------------------------------------------
  14. !!----------------------------------------------------------------------
  15. !! icb_stp : start iceberg tracking
  16. !! icb_end : end iceberg tracking
  17. !!----------------------------------------------------------------------
  18. USE par_oce ! nemo parameters
  19. USE dom_oce ! ocean domain
  20. USE sbc_oce ! ocean surface forcing
  21. USE phycst ! physical constants
  22. !
  23. USE icb_oce ! iceberg: define arrays
  24. USE icbini ! iceberg: initialisation routines
  25. USE icbutl ! iceberg: utility routines
  26. USE icbrst ! iceberg: restart routines
  27. USE icbdyn ! iceberg: dynamics (ie advection) routines
  28. USE icbclv ! iceberg: calving routines
  29. USE icbthm ! iceberg: thermodynamics routines
  30. USE icblbc ! iceberg: lateral boundary routines (including mpp)
  31. USE icbtrj ! iceberg: trajectory I/O routines
  32. USE icbdia ! iceberg: budget
  33. !
  34. USE in_out_manager ! nemo IO
  35. USE lib_mpp ! massively parallel library
  36. USE iom ! I/O manager
  37. USE fldread ! field read
  38. USE timing ! timing
  39. IMPLICIT NONE
  40. PRIVATE
  41. PUBLIC icb_stp ! routine called in sbcmod.F90 module
  42. PUBLIC icb_end ! routine called in nemogcm.F90 module
  43. !!----------------------------------------------------------------------
  44. !! NEMO/OCE 4.0 , NEMO Consortium (2018)
  45. !! $Id: icbstp.F90 14239 2020-12-23 08:57:16Z smasson $
  46. !! Software governed by the CeCILL license (see ./LICENSE)
  47. !!----------------------------------------------------------------------
  48. CONTAINS
  49. SUBROUTINE icb_stp( kt, Kmm )
  50. !!----------------------------------------------------------------------
  51. !! *** ROUTINE icb_stp ***
  52. !!
  53. !! ** Purpose : iceberg time stepping.
  54. !!
  55. !! ** Method : - top level routine to do things in the correct order
  56. !!----------------------------------------------------------------------
  57. INTEGER, INTENT(in) :: kt ! time step index
  58. INTEGER, INTENT(in) :: Kmm ! ocean time level index
  59. !
  60. LOGICAL :: ll_sample_traj, ll_budget, ll_verbose ! local logical
  61. !!----------------------------------------------------------------------
  62. !
  63. IF( ln_timing ) CALL timing_start('icb_stp')
  64. ! !== start of timestep housekeeping ==!
  65. !
  66. nktberg = kt
  67. !
  68. !CALL test_icb_utl_getkb
  69. !CALL ctl_stop('end test icb')
  70. !
  71. IF( nn_test_icebergs < 0 .OR. ln_use_calving ) THEN !* read calving data
  72. !
  73. CALL fld_read ( kt, 1, sf_icb )
  74. src_calving (:,:) = sf_icb(1)%fnow(:,:,1) ! calving in km^3/year (water equivalent)
  75. src_calving_hflx(:,:) = 0._wp ! NO heat flux for now
  76. !
  77. ENDIF
  78. !
  79. berg_grid%floating_melt(:,:) = 0._wp
  80. !
  81. ! !* anything that needs to be reset to zero each timestep
  82. CALL icb_dia_step() ! for budgets is dealt with here
  83. !
  84. ! !* write out time
  85. ll_verbose = .FALSE.
  86. IF( nn_verbose_write > 0 .AND. MOD( kt-1 , nn_verbose_write ) == 0 ) ll_verbose = ( nn_verbose_level > 0 )
  87. !
  88. IF( ll_verbose ) WRITE(numicb,9100) nktberg, ndastp, nsec_day
  89. 9100 FORMAT('kt= ',i8, ' day= ',i8,' secs=',i8)
  90. !
  91. ! !* copy nemo forcing arrays into iceberg versions with extra halo
  92. CALL icb_utl_copy( Kmm ) ! only necessary for variables not on T points
  93. !
  94. !
  95. ! !== process icebergs ==!
  96. ! !
  97. CALL icb_clv_flx( kt ) ! Accumulate ice from calving
  98. ! !
  99. CALL icb_clv( kt ) ! Calve excess stored ice into icebergs
  100. ! !
  101. !
  102. ! !== For each berg, evolve ==!
  103. !
  104. IF( ASSOCIATED(first_berg) ) CALL icb_dyn( kt ) ! ice berg dynamics
  105. IF( lk_mpp ) THEN ; CALL icb_lbc_mpp() ! Send bergs to other PEs
  106. ELSE ; CALL icb_lbc() ! Deal with any cyclic boundaries in non-mpp case
  107. ENDIF
  108. !
  109. ! reset virtual area to 0 here
  110. virtual_area = 0._wp
  111. IF( ASSOCIATED(first_berg) ) CALL icb_thm( kt ) ! Ice berg thermodynamics (melting) + rolling
  112. virtual_area_e(1:jpi,1:jpj)=virtual_area(:,:)
  113. CALL lbc_lnk_icb( 'icbthm', virtual_area_e, 'T', +1._wp, 1, 1 )
  114. !
  115. !
  116. !
  117. ! !== diagnostics and output ==!
  118. !
  119. ! !* For each berg, record trajectory (when needed)
  120. ll_sample_traj = .FALSE.
  121. IF( nn_sample_rate > 0 .AND. MOD(kt-1,nn_sample_rate) == 0 ) ll_sample_traj = .TRUE.
  122. IF( ll_sample_traj .AND. ASSOCIATED(first_berg) ) CALL icb_trj_write( kt )
  123. ! !* Gridded diagnostics
  124. ! ! To get these iom_put's and those preceding to actually do something
  125. ! ! use key_xios in cpp file and create content for XML file
  126. !
  127. CALL iom_put( "calving" , berg_grid%calving (:,:) ) ! 'calving mass input'
  128. CALL iom_put( "berg_floating_melt", berg_grid%floating_melt(:,:) ) ! 'Melt rate of icebergs + bits' , 'kg/m2/s'
  129. CALL iom_put( "berg_stored_ice" , berg_grid%stored_ice (:,:,:) ) ! 'Accumulated ice mass by class', 'kg'
  130. !
  131. CALL icb_dia_put() !* store mean budgets
  132. !
  133. ! !* Dump icebergs to screen
  134. IF( nn_verbose_level >= 2 ) CALL icb_utl_print( 'icb_stp, status', kt )
  135. !
  136. ! !* Diagnose budgets
  137. ll_budget = .FALSE.
  138. IF( nn_verbose_write > 0 .AND. MOD(kt-1,nn_verbose_write) == 0 ) ll_budget = ln_bergdia
  139. CALL icb_dia( ll_budget )
  140. !
  141. IF( lrst_oce ) THEN !* restart
  142. CALL icb_rst_write( kt )
  143. IF( nn_sample_rate > 0 ) CALL icb_trj_sync()
  144. ENDIF
  145. !
  146. IF( ln_timing ) CALL timing_stop('icb_stp')
  147. !
  148. END SUBROUTINE icb_stp
  149. SUBROUTINE icb_end( kt )
  150. !!----------------------------------------------------------------------
  151. !! *** ROUTINE icb_end ***
  152. !!
  153. !! ** Purpose : close iceberg files
  154. !!
  155. !!----------------------------------------------------------------------
  156. INTEGER, INTENT( in ) :: kt ! model time-step index
  157. !!----------------------------------------------------------------------
  158. !
  159. ! finish with trajectories if they were written
  160. IF( nn_sample_rate > 0 ) CALL icb_trj_end()
  161. IF(lwp) WRITE(numout,'(a,i6)') 'icebergs: icb_end complete', narea
  162. !
  163. IF( nn_verbose_level > 0 ) THEN
  164. CALL flush( numicb )
  165. CLOSE( numicb )
  166. ENDIF
  167. !
  168. END SUBROUTINE icb_end
  169. !!======================================================================
  170. END MODULE icbstp