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/UKMO/NEMO4_beta_mirror/src/OCE/ICB – NEMO

source: NEMO/branches/UKMO/NEMO4_beta_mirror/src/OCE/ICB/icbstp.F90 @ 10321

Last change on this file since 10321 was 10321, checked in by davestorkey, 5 years ago

UKMO/NEMO4_beta_mirror: Update to version 10279 of the trunk.

File size: 7.6 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 )
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      !
64      LOGICAL ::   ll_sample_traj, ll_budget, ll_verbose   ! local logical
65      !!----------------------------------------------------------------------
66      !
67      IF( ln_timing )   CALL timing_start('icb_stp')
68
69      !                       !==  start of timestep housekeeping  ==!
70      !
71      nktberg = kt
72      !
73      IF( nn_test_icebergs < 0 .OR. ln_use_calving ) THEN !* read calving data
74         !
75         CALL fld_read ( kt, 1, sf_icb )
76         src_calving     (:,:) = sf_icb(1)%fnow(:,:,1)    ! calving in km^3/year (water equivalent)
77         src_calving_hflx(:,:) = 0._wp                    ! NO heat flux for now
78         !
79      ENDIF
80      !
81      berg_grid%floating_melt(:,:) = 0._wp
82      !
83      !                                   !* anything that needs to be reset to zero each timestep
84      CALL icb_dia_step()                 !  for budgets is dealt with here
85      !
86      !                                   !* write out time
87      ll_verbose = .FALSE.
88      IF( nn_verbose_write > 0 .AND. MOD( kt-1 , nn_verbose_write ) == 0 )   ll_verbose = ( nn_verbose_level >= 0 )
89      !
90      IF( ll_verbose )   WRITE(numicb,9100) nktberg, ndastp, nsec_day
91 9100 FORMAT('kt= ',i8, ' day= ',i8,' secs=',i8)
92      !
93      !                                   !* copy nemo forcing arrays into iceberg versions with extra halo
94      CALL icb_utl_copy()                 ! only necessary for variables not on T points
95      !
96      !
97      !                       !==  process icebergs  ==!
98      !                              !
99                                     CALL icb_clv_flx( kt )   ! Accumulate ice from calving
100      !                              !
101                                     CALL icb_clv( kt )       ! Calve excess stored ice into icebergs
102      !                              !
103      !
104      !                       !==  For each berg, evolve  ==!
105      !
106      IF( ASSOCIATED(first_berg) )   CALL icb_dyn( kt )       ! ice berg dynamics
107
108      IF( lk_mpp ) THEN   ;          CALL icb_lbc_mpp()       ! Send bergs to other PEs
109      ELSE                ;          CALL icb_lbc()           ! Deal with any cyclic boundaries in non-mpp case
110      ENDIF
111
112      IF( ASSOCIATED(first_berg) )   CALL icb_thm( kt )       ! Ice berg thermodynamics (melting) + rolling
113      !
114      !
115      !                       !==  diagnostics and output  ==!
116      !
117      !                                   !* For each berg, record trajectory (when needed)
118      ll_sample_traj = .FALSE.
119      IF( nn_sample_rate > 0 .AND. MOD(kt-1,nn_sample_rate) == 0 )   ll_sample_traj = .TRUE.
120      IF( ll_sample_traj .AND. ASSOCIATED(first_berg) )   CALL icb_trj_write( kt )
121
122      !                                   !* Gridded diagnostics
123      !                                   !  To get these iom_put's and those preceding to actually do something
124      !                                   !  use key_iomput in cpp file and create content for XML file
125      !
126      CALL iom_put( "calving"           , berg_grid%calving      (:,:)   )  ! 'calving mass input'
127      CALL iom_put( "berg_floating_melt", berg_grid%floating_melt(:,:)   )  ! 'Melt rate of icebergs + bits' , 'kg/m2/s'
128      CALL iom_put( "berg_stored_ice"   , berg_grid%stored_ice   (:,:,:) )  ! 'Accumulated ice mass by class', 'kg'
129      !
130      CALL icb_dia_put()                  !* store mean budgets
131      !
132      !                                   !*  Dump icebergs to screen
133      IF( nn_verbose_level >= 2 )   CALL icb_utl_print( 'icb_stp, status', kt )
134      !
135      !                                   !* Diagnose budgets
136      ll_budget = .FALSE.
137      IF( nn_verbose_write > 0 .AND. MOD(kt-1,nn_verbose_write) == 0 )   ll_budget = ln_bergdia
138      CALL icb_dia( ll_budget )
139      !
140      IF( lrst_oce ) THEN    !* restart
141         CALL icb_rst_write( kt )
142         IF( nn_sample_rate > 0 )   CALL icb_trj_sync()
143      ENDIF
144      !
145      IF( ln_timing )   CALL timing_stop('icb_stp')
146      !
147   END SUBROUTINE icb_stp
148
149
150   SUBROUTINE icb_end( kt )
151      !!----------------------------------------------------------------------
152      !!                  ***  ROUTINE icb_end  ***
153      !!
154      !! ** Purpose :   close iceberg files
155      !!
156      !!----------------------------------------------------------------------
157      INTEGER, INTENT( in )  ::   kt   ! model time-step index
158      !!----------------------------------------------------------------------
159      !
160      ! finish with trajectories if they were written
161      IF( nn_sample_rate > 0 )   CALL icb_trj_end()
162
163      IF(lwp) WRITE(numout,'(a,i6)') 'icebergs: icb_end complete', narea
164      !
165      CALL flush( numicb )
166      CLOSE( numicb )
167      !
168   END SUBROUTINE icb_end
169
170   !!======================================================================
171END MODULE icbstp
Note: See TracBrowser for help on using the repository browser.