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.
isfstp.F90 in NEMO/branches/2019/ENHANCE-02_ISF_nemo/tests/ISOMIP+/MY_SRC – NEMO

source: NEMO/branches/2019/ENHANCE-02_ISF_nemo/tests/ISOMIP+/MY_SRC/isfstp.F90 @ 11889

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

ENHANCE-02_ISF_nemo: add ISOMIP+ test case configuration

File size: 13.5 KB
Line 
1MODULE isfstp
2   !!======================================================================
3   !!                       ***  MODULE  isfstp  ***
4   !! Surface module :  compute iceshelf load, melt and heat flux
5   !!======================================================================
6   !! History :  3.2  !  2011-02  (C.Harris  ) Original code isf cav
7   !!            X.X  !  2006-02  (C. Wang   ) Original code bg03
8   !!            3.4  !  2013-03  (P. Mathiot) Merging + parametrization
9   !!            4.1  !  2019-09  (P. Mathiot) Split param/explicit ice shelf and re-organisation
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   isfstp       : compute iceshelf melt and heat flux
14   !!----------------------------------------------------------------------
15   !
16   USE isf            ! isf variables
17   USE isfload, ONLY: isf_load                      ! ice shelf load
18   USE isftbl , ONLY: isf_tbl_lvl                   ! ice shelf boundary layer
19   USE isfpar , ONLY: isf_par, isf_par_init         ! ice shelf parametrisation
20   USE isfcav , ONLY: isf_cav, isf_cav_init         ! ice shelf cavity
21   USE isfcpl , ONLY: isfcpl_rst_write, isfcpl_init ! isf variables
22
23   USE dom_oce, ONLY: ht_n, e3t_n, ln_isfcav, ln_linssh ! ocean space and time domain
24   USE domvvl,  ONLY: ln_vvl_zstar                      ! zstar logical
25   USE zdfdrg,  ONLY: r_Cdmin_top, r_ke0_top            ! vertical physics: top/bottom drag coef.
26   !
27   USE lib_mpp, ONLY: ctl_stop, ctl_nam
28   USE in_out_manager ! I/O manager
29   USE timing
30
31   IMPLICIT NONE
32
33   PRIVATE
34
35   PUBLIC   isf_stp, isf_init, isf_nam  ! routine called in sbcmod and divhor
36
37   !!----------------------------------------------------------------------
38   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
39   !! $Id: isfstp.F90 11876 2019-11-08 11:26:42Z mathiot $
40   !! Software governed by the CeCILL license (see ./LICENSE)
41   !!----------------------------------------------------------------------
42CONTAINS
43 
44  SUBROUTINE isf_stp( kt )
45      !!---------------------------------------------------------------------
46      !!                  ***  ROUTINE isf_stp  ***
47      !!
48      !! ** Purpose : compute total heat flux and total fwf due to ice shelf melt
49      !!
50      !! ** Method  : For each case (parametrisation or explicity cavity) :
51      !!              - define the before fields
52      !!              - compute top boundary layer properties
53      !!                (in case of parametrisation, this is the
54      !!                 depth range model array used to compute mean far fields properties)
55      !!              - compute fluxes
56      !!              - write restart variables
57      !!
58      !!----------------------------------------------------------------------
59      INTEGER, INTENT(in) ::   kt   ! ocean time step
60      !!---------------------------------------------------------------------
61      !
62      IF( ln_timing )   CALL timing_start('isf')
63      !
64      IF ( ln_isfcav_mlt ) THEN
65         !
66         ! before time step
67         IF ( kt /= nit000 ) THEN
68            risf_cav_tsc_b (:,:,:) = risf_cav_tsc (:,:,:)
69            fwfisf_cav_b(:,:)      = fwfisf_cav(:,:)
70         END IF
71         !
72         ! compute misfkb, rhisf_tbl, rfrac (deepest level, thickness, fraction of deepest cell affected by tbl)
73         rhisf_tbl_cav(:,:) = rn_htbl * mskisf_cav(:,:)
74         CALL isf_tbl_lvl(ht_n, e3t_n, misfkt_cav, misfkb_cav, rhisf_tbl_cav, rfrac_tbl_cav)
75         !
76         ! compute ice shelf melt
77         CALL isf_cav( kt, risf_cav_tsc, fwfisf_cav)
78         !
79      END IF
80      !
81      IF ( ln_isfpar_mlt ) THEN
82         !
83         ! before time step
84         IF ( kt /= nit000 ) THEN
85            risf_par_tsc_b(:,:,:) = risf_par_tsc(:,:,:)
86            fwfisf_par_b  (:,:)   = fwfisf_par  (:,:)
87         END IF
88         !
89         ! compute misfkb, rhisf_tbl, rfrac (deepest level, thickness, fraction of deepest cell affected by tbl)
90         ! by simplicity, we assume the top level where param applied do not change with time
91         rhisf_tbl_par(:,:) = rhisf0_tbl_par(:,:)
92         CALL isf_tbl_lvl(ht_n, e3t_n, misfkt_par, misfkb_par, rhisf_tbl_par, rfrac_tbl_par)
93         !
94         ! compute ice shelf melt
95         CALL isf_par( kt, risf_par_tsc, fwfisf_par)
96         !
97      END IF
98      !
99      IF ( ln_isfcpl .AND. lrst_oce ) CALL isfcpl_rst_write(kt)
100      !
101      IF( ln_timing )   CALL timing_stop('isf')
102      !
103   END SUBROUTINE isf_stp
104
105   SUBROUTINE isf_init
106      !!---------------------------------------------------------------------
107      !!                  ***  ROUTINE isfstp_init  ***
108      !!
109      !! ** Purpose :   Initialisation of the ice shelf public variables
110      !!
111      !! ** Method  :   Read the namisf namelist, check option compatibility and set derived parameters
112      !!
113      !! ** Action  : - read namisf parameters
114      !!              - allocate memory
115      !!              - output print
116      !!              - ckeck option compatibility
117      !!              - call cav/param/isfcpl init routine
118      !!----------------------------------------------------------------------
119      !
120      ! constrain: l_isfoasis need to be known
121      !
122      ! Read namelist
123      CALL isf_nam()
124      !
125      ! Allocate public array
126      CALL isf_alloc()
127      !
128      ! check option compatibility
129      CALL isf_ctl()
130      !
131      ! compute ice shelf load
132      IF ( ln_isfcav ) CALL isf_load( risfload )
133      !
134      ! terminate routine now if no ice shelf melt formulation specify
135      IF ( ln_isf ) THEN
136         !
137         !---------------------------------------------------------------------------------------------------------------------
138         ! initialisation melt in the cavity
139         IF ( ln_isfcav_mlt ) CALL isf_cav_init()
140         !
141         !---------------------------------------------------------------------------------------------------------------------
142         ! initialisation parametrised melt
143         IF ( ln_isfpar_mlt ) CALL isf_par_init()
144         !
145         !---------------------------------------------------------------------------------------------------------------------
146         ! initialisation ice sheet coupling
147         IF( ln_isfcpl ) CALL isfcpl_init()
148         !
149      END IF
150         
151  END SUBROUTINE isf_init
152
153  SUBROUTINE isf_ctl()
154      !!---------------------------------------------------------------------
155      !!                  ***  ROUTINE isf_ctl  ***
156      !!
157      !! ** Purpose :   output print and option compatibility check
158      !!
159      !!----------------------------------------------------------------------
160      IF (lwp) THEN
161         WRITE(numout,*)
162         WRITE(numout,*) 'isf_init : ice shelf initialisation'
163         WRITE(numout,*) '~~~~~~~~~~~~'
164         WRITE(numout,*) '   Namelist namisf :'
165         !
166         WRITE(numout,*) '   ice shelf cavity (open or parametrised)  ln_isf = ', ln_isf
167         WRITE(numout,*)
168         !
169         IF ( ln_isf ) THEN
170            WRITE(numout,*) '      Add debug print in isf module           ln_isfdebug     = ', ln_isfdebug
171            WRITE(numout,*)
172            WRITE(numout,*) '      melt inside the cavity                  ln_isfcav_mlt   = ', ln_isfcav_mlt
173            IF ( ln_isfcav_mlt) THEN
174               WRITE(numout,*) '         melt formulation                        cn_isfcav_mlt   = ', TRIM(cn_isfcav_mlt)
175               WRITE(numout,*) '         thickness of the top boundary layer     rn_htbl     = ', rn_htbl
176               WRITE(numout,*) '         gamma formulation                       cn_gammablk = ', TRIM(cn_gammablk) 
177               IF ( TRIM(cn_gammablk) .NE. 'spe' ) THEN
178                  WRITE(numout,*) '         gammat coefficient                       rn_gammat0  = ', rn_gammat0 
179                  WRITE(numout,*) '         gammas coefficient                       rn_gammas0  = ', rn_gammas0 
180                  WRITE(numout,*) '         top background ke used (from namdrg_top) rn_vtide**2 = ', rn_vtide**2
181                  WRITE(numout,*) '         top drag coef.    used (from namdrg_top) rn_Cd0      = ', r_Cdmin_top
182               END IF
183            END IF
184            WRITE(numout,*) ''
185            !
186            WRITE(numout,*) '      ice shelf melt parametrisation          ln_isfpar_mlt   = ', ln_isfpar_mlt
187            IF ( ln_isfpar_mlt ) THEN
188               WRITE(numout,*) '         isf parametrisation formulation         cn_isfpar_mlt   = ', TRIM(cn_isfpar_mlt)
189            END IF
190            WRITE(numout,*) ''
191            !
192            WRITE(numout,*) '      Coupling to an ice sheet model          ln_isfcpl       = ', ln_isfcpl
193            IF ( ln_isfcpl ) THEN
194               WRITE(numout,*) '         conservation activated ln_isfcpl_cons     = ', ln_isfcpl_cons
195               WRITE(numout,*) '         number of call of the extrapolation loop  = ', nn_drown
196            ENDIF
197            WRITE(numout,*) ''
198            !
199         ELSE
200            !
201            IF ( ln_isfcav ) THEN
202               WRITE(numout,*) ''
203               WRITE(numout,*) '   W A R N I N G: ice shelf cavities are open BUT no melt will be computed or read from file !'
204               WRITE(numout,*) ''
205            END IF
206            !
207         END IF
208
209         IF (ln_isfcav) WRITE(numout,*) '      Ice shelf load method                   cn_isfload        = ', TRIM(cn_isfload)
210         WRITE(numout,*) ''
211
212      END IF
213      !
214
215      !---------------------------------------------------------------------------------------------------------------------
216      ! sanity check  ! issue ln_isfcav not yet known as well as l_isfoasis  => move this call in isf_stp ?
217      ! melt in the cavity without cavity
218      IF ( ln_isfcav_mlt .AND. (.NOT. ln_isfcav) ) &
219          &   CALL ctl_stop('ice shelf melt in the cavity activated (ln_isfcav_mlt) but no cavity detected in domcfg (ln_isfcav), STOP' )
220      !
221      ! ice sheet coupling without cavity
222      IF ( ln_isfcpl .AND. (.NOT. ln_isfcav) ) &
223         &   CALL ctl_stop('coupling with an ice sheet model detected (ln_isfcpl) but no cavity detected in domcfg (ln_isfcav), STOP' )
224      !
225      IF ( ln_isfcpl .AND. ln_isfcpl_cons .AND. ln_linssh ) &
226         &   CALL ctl_stop( 'The coupling between NEMO and an ice sheet model with the conservation option does not work with the linssh option' )
227      !
228      IF ( l_isfoasis .AND. .NOT. ln_isf ) CALL ctl_stop( ' OASIS send ice shelf fluxes to NEMO but NEMO does not have the isf module activated' )
229      !
230      IF ( l_isfoasis .AND. ln_isf ) THEN
231         !
232         CALL ctl_stop( ' ln_ctl and ice shelf not tested' )
233         !
234         ! NEMO coupled to ATMO model with isf cavity need oasis method for melt computation
235         IF ( ln_isfcav_mlt .AND. TRIM(cn_isfcav_mlt) /= 'oasis' ) CALL ctl_stop( 'cn_isfcav_mlt = oasis is the only option availble if fwf send by oasis' )
236         IF ( ln_isfpar_mlt .AND. TRIM(cn_isfpar_mlt) /= 'oasis' ) CALL ctl_stop( 'cn_isfpar_mlt = oasis is the only option availble if fwf send by oasis' )
237         !
238         ! oasis melt computation not tested (coded but not tested)
239         IF ( ln_isfcav_mlt .OR. ln_isfpar_mlt ) THEN
240            IF ( TRIM(cn_isfcav_mlt) == 'oasis' ) CALL ctl_stop( 'cn_isfcav_mlt = oasis not tested' )
241            IF ( TRIM(cn_isfpar_mlt) == 'oasis' ) CALL ctl_stop( 'cn_isfpar_mlt = oasis not tested' )
242         END IF
243         !
244         ! oasis melt computation with cavity open and cavity parametrised (not coded)
245         IF ( ln_isfcav_mlt .AND. ln_isfpar_mlt ) THEN
246            IF ( TRIM(cn_isfpar_mlt) == 'oasis' .AND. TRIM(cn_isfcav_mlt) == 'oasis' ) CALL ctl_stop( 'cn_isfpar_mlt = oasis and cn_isfcav_mlt = oasis not coded' )
247         END IF
248         !
249         ! compatibility ice shelf and vvl
250         IF( .NOT. ln_vvl_zstar .AND. ln_isf ) CALL ctl_stop( 'Only vvl_zstar has been tested with ice shelf cavity' )
251         !
252      END IF
253   END SUBROUTINE isf_ctl
254   !
255   SUBROUTINE isf_nam
256      !!---------------------------------------------------------------------
257      !!                  ***  ROUTINE isf_nam  ***
258      !!
259      !! ** Purpose :   Read ice shelf namelist cfg and ref
260      !!
261      !!----------------------------------------------------------------------
262      INTEGER               :: ios                  ! Local integer output status for namelist read
263      !!----------------------------------------------------------------------
264      NAMELIST/namisf/ ln_isf       ,                                                                               & 
265         &             ln_isfcav_mlt, cn_isfcav_mlt, cn_gammablk, rn_gammat0, rn_gammas0, rn_htbl, sn_isfcav_fwf,   &
266         &             ln_isfpar_mlt, cn_isfpar_mlt, sn_isfpar_fwf, sn_isfpar_zmin, sn_isfpar_zmax, sn_isfpar_Leff, &
267         &             ln_isfcpl    , nn_drown, ln_isfcpl_cons, ln_isfdebug, rn_vtide,                              &
268         &             cn_isfload   , cn_isfdir
269      !!----------------------------------------------------------------------
270      !
271      REWIND( numnam_ref )              ! Namelist namsbc_rnf in reference namelist : Runoffs
272      READ  ( numnam_ref, namisf, IOSTAT = ios, ERR = 901)
273901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namisf in reference namelist', lwp )
274      !
275      REWIND( numnam_cfg )              ! Namelist namsbc_rnf in configuration namelist : Runoffs
276      READ  ( numnam_cfg, namisf, IOSTAT = ios, ERR = 902 )
277902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namisf in configuration namelist', lwp )
278      IF(lwm) WRITE ( numond, namisf )
279
280   END SUBROUTINE isf_nam
281   !!
282   !!======================================================================
283END MODULE isfstp
Note: See TracBrowser for help on using the repository browser.