icbstp.F90 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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
  22. USE in_out_manager ! nemo IO
  23. USE lib_mpp
  24. USE iom
  25. USE fldread
  26. USE timing ! timing
  27. USE icb_oce ! define iceberg arrays
  28. USE icbini ! iceberg initialisation routines
  29. USE icbutl ! iceberg utility routines
  30. USE icbrst ! iceberg restart routines
  31. USE icbdyn ! iceberg dynamics (ie advection) routines
  32. USE icbclv ! iceberg calving routines
  33. USE icbthm ! iceberg thermodynamics routines
  34. USE icblbc ! iceberg lateral boundary routines (including mpp)
  35. USE icbtrj ! iceberg trajectory I/O routines
  36. USE icbdia ! iceberg budget
  37. IMPLICIT NONE
  38. PRIVATE
  39. PUBLIC icb_stp ! routine called in sbcmod.F90 module
  40. PUBLIC icb_end ! routine called in nemogcm.F90 module
  41. !!----------------------------------------------------------------------
  42. !! NEMO/OPA 3.3 , NEMO Consortium (2011)
  43. !! $Id: icbstp.F90 2355 2015-05-20 07:11:50Z ufla $
  44. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  45. !!----------------------------------------------------------------------
  46. CONTAINS
  47. SUBROUTINE icb_stp( kt )
  48. !!----------------------------------------------------------------------
  49. !! *** ROUTINE icb_stp ***
  50. !!
  51. !! ** Purpose : iceberg time stepping.
  52. !!
  53. !! ** Method : - top level routine to do things in the correct order
  54. !!----------------------------------------------------------------------
  55. INTEGER, INTENT(in) :: kt ! time step index
  56. !
  57. LOGICAL :: ll_sample_traj, ll_budget, ll_verbose ! local logical
  58. !!----------------------------------------------------------------------
  59. !
  60. IF( nn_timing == 1 ) CALL timing_start('icb_stp')
  61. !! start of timestep housekeeping
  62. nktberg = kt
  63. IF( nn_test_icebergs < 0 ) THEN ! read calving data
  64. !
  65. CALL fld_read ( kt, 1, sf_icb )
  66. src_calving(:,:) = sf_icb(1)%fnow(:,:,1) ! calving in km^3/year (water equivalent)
  67. src_calving_hflx(:,:) = 0._wp ! NO heat flux for now
  68. !
  69. ENDIF
  70. berg_grid%floating_melt(:,:) = 0._wp
  71. ! anything that needs to be reset to zero each timestep for budgets is dealt with here
  72. CALL icb_dia_step()
  73. ll_verbose = .FALSE.
  74. IF( nn_verbose_write > 0 .AND. &
  75. MOD(kt-1,nn_verbose_write ) == 0 ) ll_verbose = nn_verbose_level >= 0
  76. ! write out time
  77. IF( ll_verbose ) WRITE(numicb,9100) nktberg, ndastp, nsec_day
  78. 9100 FORMAT('kt= ',i8, ' day= ',i8,' secs=',i8)
  79. ! copy nemo forcing arrays into iceberg versions with extra halo
  80. ! only necessary for variables not on T points
  81. CALL icb_utl_copy()
  82. !!----------------------------------------------------------------------
  83. !! process icebergs
  84. CALL icb_clv_flx( kt ) ! Accumulate ice from calving
  85. CALL icb_clv() ! Calve excess stored ice into icebergs
  86. ! !== For each berg, evolve ==!
  87. !
  88. IF( ASSOCIATED(first_berg) ) CALL icb_dyn( kt ) ! ice berg dynamics
  89. IF( lk_mpp ) THEN ; CALL icb_lbc_mpp() ! Send bergs to other PEs
  90. ELSE ; CALL icb_lbc() ! Deal with any cyclic boundaries in non-mpp case
  91. ENDIF
  92. IF( ASSOCIATED(first_berg) ) CALL icb_thm( kt ) ! Ice berg thermodynamics (melting) + rolling
  93. !!----------------------------------------------------------------------
  94. !! end of timestep housekeeping
  95. ll_sample_traj = .FALSE.
  96. IF( nn_sample_rate > 0 .AND. MOD(kt-1,nn_sample_rate) == 0 ) ll_sample_traj = .TRUE.
  97. IF( ll_sample_traj .AND. &
  98. ASSOCIATED(first_berg) ) CALL icb_trj_write( kt ) ! For each berg, record trajectory
  99. ! Gridded diagnostics
  100. ! To get these iom_put's and those preceding to actually do something
  101. ! use key_iomput in cpp file and create content for XML file
  102. CALL iom_put( "calving" , berg_grid%calving (:,:) ) ! 'calving mass input'
  103. CALL iom_put( "berg_floating_melt", berg_grid%floating_melt(:,:) ) ! 'Melt rate of icebergs + bits' , 'kg/m2/s'
  104. CALL iom_put( "berg_stored_ice" , berg_grid%stored_ice (:,:,:) ) ! 'Accumulated ice mass by class', 'kg'
  105. ! store mean budgets
  106. CALL icb_dia_put()
  107. ! Dump icebergs to screen
  108. if ( nn_verbose_level >= 2 ) CALL icb_utl_print( 'icb_stp, status', kt )
  109. ! Diagnose budgets
  110. ll_budget = .FALSE.
  111. IF( nn_verbose_write > 0 .AND. MOD(kt-1,nn_verbose_write) == 0 ) ll_budget = ln_bergdia
  112. CALL icb_dia( ll_budget )
  113. IF( MOD(kt,nn_stock) == 0 ) THEN
  114. CALL icb_rst_write( kt )
  115. IF( nn_sample_rate > 0 ) CALL icb_trj_sync()
  116. ENDIF
  117. IF( nn_timing == 1 ) CALL timing_stop('icb_stp')
  118. !
  119. END SUBROUTINE icb_stp
  120. SUBROUTINE icb_end( kt )
  121. !!----------------------------------------------------------------------
  122. !! *** ROUTINE icb_end ***
  123. !!
  124. !! ** Purpose : close iceberg files
  125. !!
  126. !!----------------------------------------------------------------------
  127. INTEGER, INTENT( in ) :: kt
  128. !!----------------------------------------------------------------------
  129. ! only write a restart if not done in icb_stp
  130. IF( MOD(kt,nn_stock) .NE. 0 ) CALL icb_rst_write( kt )
  131. ! finish with trajectories if they were written
  132. IF( nn_sample_rate .GT. 0 ) CALL icb_trj_end()
  133. IF(lwp) WRITE(numout,'(a,i6)') 'icebergs: icb_end complete', narea
  134. CALL flush( numicb )
  135. CLOSE( numicb )
  136. !
  137. END SUBROUTINE icb_end
  138. !!-------------------------------------------------------------------------
  139. END MODULE icbstp