New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
icbstp.F90 in NEMO/branches/2020/tickets_icb_1900/src/OCE/ICB – NEMO

source: NEMO/branches/2020/tickets_icb_1900/src/OCE/ICB/icbstp.F90 @ 13359

Last change on this file since 13359 was 13359, checked in by mathiot, 4 years ago

ticket #1900: add subroutine icb_utl_zavg, fix issue in icb_utl_getkb, add subroutine test_icb_utl_getkb to test awkward cases (will be removed after the review), simplify icbdyn.F90 icbthm.F90 according to the new routine created.

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