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 branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/OPA_SRC/ICB – NEMO

source: branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/OPA_SRC/ICB/icbstp.F90 @ 11101

Last change on this file since 11101 was 11101, checked in by frrh, 5 years ago

Merge changes from Met Office GMED ticket 450 to reduce unnecessary
text output from NEMO.
This output, which is typically not switchable, is rarely of interest
in normal (non-debugging) runs and simply redunantley consumes extra
file space.
Further, the presence of this text output has been shown to
significantly degrade performance of models which are run during
Met Office HPC RAID (disk) checks.
The new code introduces switches which are configurable via the
changes made in the associated Met Office MOCI ticket 399.

File size: 7.1 KB
Line 
1MODULE icbstp
2
3   !!======================================================================
4   !!                       ***  MODULE  icbstp  ***
5   !! Icebergs:  initialise variables for iceberg tracking
6   !!======================================================================
7   !! History : 3.3.1 !  2010-01  (Martin&Adcroft) Original code
8   !!            -    !  2011-03  (Madec)          Part conversion to NEMO form
9   !!            -    !                            Removal of mapping from another grid
10   !!            -    !  2011-04  (Alderson)       Split into separate modules
11   !!            -    !                            Move budgets to icbdia routine
12   !!            -    !  2011-05  (Alderson)       Add call to copy forcing arrays
13   !!            -    !                            into icb copies with haloes
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
23   USE in_out_manager ! nemo IO
24   USE lib_mpp
25   USE iom
26   USE fldread
27   USE timing         ! timing
28
29   USE icb_oce        ! define iceberg arrays
30   USE icbini         ! iceberg initialisation routines
31   USE icbutl         ! iceberg utility routines
32   USE icbrst         ! iceberg restart routines
33   USE icbdyn         ! iceberg dynamics (ie advection) routines
34   USE icbclv         ! iceberg calving routines
35   USE icbthm         ! iceberg thermodynamics routines
36   USE icblbc         ! iceberg lateral boundary routines (including mpp)
37   USE icbtrj         ! iceberg trajectory I/O routines
38   USE icbdia         ! iceberg budget
39
40   IMPLICIT NONE
41   PRIVATE
42
43   PUBLIC   icb_stp        ! routine called in sbcmod.F90 module
44   PUBLIC   icb_end        ! routine called in nemogcm.F90 module
45
46   !!----------------------------------------------------------------------
47   !! NEMO/OPA 3.3 , NEMO Consortium (2011)
48   !! $Id$
49   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
50   !!----------------------------------------------------------------------
51CONTAINS
52
53   SUBROUTINE icb_stp( kt )
54      !!----------------------------------------------------------------------
55      !!                  ***  ROUTINE icb_stp  ***
56      !!
57      !! ** Purpose :   iceberg time stepping.
58      !!
59      !! ** Method  : - top level routine to do things in the correct order
60      !!----------------------------------------------------------------------
61      INTEGER, INTENT(in) ::   kt   ! time step index
62      !
63      LOGICAL ::   ll_sample_traj, ll_budget, ll_verbose   ! local logical
64      !!----------------------------------------------------------------------
65      !
66      IF( nn_timing == 1 ) CALL timing_start('icb_stp')
67
68      !! start of timestep housekeeping
69
70      nktberg = kt
71
72      IF( nn_test_icebergs < 0 ) THEN      ! read calving data
73         !
74         CALL fld_read ( kt, 1, sf_icb )
75         src_calving(:,:)      = sf_icb(1)%fnow(:,:,1)    ! calving in km^3/year (water equivalent)
76         src_calving_hflx(:,:) = 0._wp                    ! NO heat flux for now
77         !
78      ENDIF
79
80      berg_grid%floating_melt(:,:) = 0._wp
81
82      ! anything that needs to be reset to zero each timestep for budgets is dealt with here
83      CALL icb_dia_step()
84
85      ll_verbose = .FALSE.
86      IF( nn_verbose_write > 0 .AND. &
87          MOD(kt-1,nn_verbose_write ) == 0 )   ll_verbose = nn_verbose_level >= 0
88
89      ! write out time
90      IF( ll_verbose .AND. numicb.NE.-1) 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      ! only necessary for variables not on T points
95      CALL icb_utl_copy()
96
97      !!----------------------------------------------------------------------
98      !! process icebergs
99
100                                     CALL icb_clv_flx( kt )   ! Accumulate ice from calving
101
102                                     CALL icb_clv()           ! Calve excess stored ice into icebergs
103
104
105!                               !==  For each berg, evolve  ==!
106      !
107      IF( ASSOCIATED(first_berg) )   CALL icb_dyn( kt )       ! ice berg dynamics
108
109      IF( lk_mpp ) THEN          ;   CALL icb_lbc_mpp()       ! Send bergs to other PEs
110      ELSE                       ;   CALL icb_lbc()           ! Deal with any cyclic boundaries in non-mpp case
111      ENDIF
112
113      IF( ASSOCIATED(first_berg) )   CALL icb_thm( kt )       ! Ice berg thermodynamics (melting) + rolling
114
115      !!----------------------------------------------------------------------
116      !! end of timestep housekeeping
117
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.   &
121          ASSOCIATED(first_berg) )   CALL icb_trj_write( kt )  ! For each berg, record trajectory
122
123      ! Gridded diagnostics
124      ! To get these iom_put's and those preceding to actually do something
125      ! use key_iomput 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      ! store mean budgets
132      CALL icb_dia_put()
133
134      ! Dump icebergs to screen
135      if ( nn_verbose_level >= 2 )   CALL icb_utl_print( 'icb_stp, status', kt )
136
137      ! Diagnose budgets
138      ll_budget = .FALSE.
139      IF( nn_verbose_write > 0 .AND. MOD(kt-1,nn_verbose_write) == 0 )   ll_budget = ln_bergdia
140      CALL icb_dia( ll_budget )
141
142      IF( MOD(kt,nn_stock) == 0 ) THEN
143         CALL icb_rst_write( kt )
144         IF( nn_sample_rate > 0 )   CALL icb_trj_sync()
145      ENDIF
146
147      IF( nn_timing == 1 ) CALL timing_stop('icb_stp')
148      !
149   END SUBROUTINE icb_stp
150
151
152   SUBROUTINE icb_end( kt )
153      !!----------------------------------------------------------------------
154      !!                  ***  ROUTINE icb_end  ***
155      !!
156      !! ** Purpose :   close iceberg files
157      !!
158      !!----------------------------------------------------------------------
159      INTEGER, INTENT( in )  :: kt
160      !!----------------------------------------------------------------------
161
162      ! only write a restart if not done in icb_stp
163      IF( MOD(kt,nn_stock) .NE. 0 ) CALL icb_rst_write( kt )
164
165      ! finish with trajectories if they were written
166      IF( nn_sample_rate .GT. 0 ) CALL icb_trj_end()
167
168      IF(lwp .AND. nprint>3)   WRITE(numout,'(a,i6)') 'icebergs: icb_end complete', narea
169      IF(numicb.NE.-1) THEN
170         CALL flush( numicb )
171         CLOSE( numicb )
172      ENDIF
173      !
174   END SUBROUTINE icb_end
175
176   !!-------------------------------------------------------------------------
177
178END MODULE icbstp
Note: See TracBrowser for help on using the repository browser.