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.
isfcavmlt.F90 in NEMO/branches/2021/dev_r14116_HPC-10_mcastril_Mixed_Precision_implementation/src/OCE/ISF – NEMO

source: NEMO/branches/2021/dev_r14116_HPC-10_mcastril_Mixed_Precision_implementation/src/OCE/ISF/isfcavmlt.F90 @ 15660

Last change on this file since 15660 was 15540, checked in by sparonuz, 3 years ago

Mixed precision version, tested up to 30 years on ORCA2.

File size: 16.8 KB
Line 
1MODULE isfcavmlt
2   !!======================================================================
3   !!                       ***  MODULE  isfcavmlt  ***
4   !! ice shelf module :  update surface ocean boundary condition under ice
5   !!                   shelves
6   !!======================================================================
7   !! History :  4.0  !  2019-09  (P. Mathiot) Original code
8   !!----------------------------------------------------------------------
9
10   !!----------------------------------------------------------------------
11   !!   isfcav_mlt    : compute or read ice shelf fwf/heat fluxes in the ice shelf cavity
12   !!----------------------------------------------------------------------
13
14   USE isf_oce                  ! ice shelf
15   USE isftbl , ONLY: isf_tbl   ! ice shelf depth average
16   USE isfutils,ONLY: debug     ! debug subroutine
17
18   USE dom_oce                            ! ocean space and time domain
19   USE phycst , ONLY: rcp, rho0, rho0_rcp ! physical constants
20   USE eosbn2 , ONLY: eos_fzp             ! equation of state
21
22   USE in_out_manager              ! I/O manager
23   USE iom        , ONLY: iom_put  ! I/O library
24   USE fldread    , ONLY: fld_read, FLD, FLD_N !
25   USE lib_fortran, ONLY: glob_sum !
26   USE lib_mpp    , ONLY: ctl_stop !
27
28   IMPLICIT NONE
29   PRIVATE
30
31   PUBLIC   isfcav_mlt
32
33   !! * Substitutions
34#  include "single_precision_substitute.h90"
35#  include "do_loop_substitute.h90"
36   !!----------------------------------------------------------------------
37   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
38   !! $Id: sbcisf.F90 10536 2019-01-16 19:21:09Z mathiot $
39   !! Software governed by the CeCILL license (see ./LICENSE)
40   !!----------------------------------------------------------------------
41CONTAINS
42
43! -------------------------------------------------------------------------------------------------------
44! -------------------------------- PUBLIC SUBROUTINE ----------------------------------------------------
45! -------------------------------------------------------------------------------------------------------
46
47   SUBROUTINE isfcav_mlt(kt, pgt, pgs , pttbl, pstbl, &
48      &                           pqhc, pqoce, pqfwf  )
49      !!----------------------------------------------------------------------
50      !!
51      !!                          ***  ROUTINE isfcav_mlt  ***
52      !!
53      !! ** Purpose    : compute or read ice shelf fwf/heat fluxes in the ice shelf cavity
54      !!
55      !!-------------------------- OUT -------------------------------------
56      REAL(dp), DIMENSION(jpi,jpj), INTENT(  out) :: pqhc, pqoce, pqfwf  ! heat and fwf fluxes
57      !!-------------------------- IN  -------------------------------------
58      INTEGER, INTENT(in) :: kt
59      REAL(dp), DIMENSION(jpi,jpj), INTENT(in   ) :: pgt  , pgs    ! gamma t and gamma s
60      REAL(dp), DIMENSION(jpi,jpj), INTENT(in   ) :: pttbl, pstbl  ! top boundary layer tracer
61      !!---------------------------------------------------------------------
62      !
63      ! compute latent heat and melt (2d)
64      SELECT CASE ( cn_isfcav_mlt )
65      CASE ( 'spe' )   ! ice shelf melt specified (read input file, and heat fluxes derived from
66         CALL isfcav_mlt_spe( kt, pstbl,               &
67            &                  pqhc, pqoce, pqfwf  )
68      CASE ( '2eq' )   !  ISOMIP  formulation (2 equations) for volume flux (Hunter et al., 2006)
69         CALL isfcav_mlt_2eq( pgt, pttbl, pstbl,       &
70            &                  pqhc , pqoce, pqfwf )
71      CASE ( '3eq' )   ! ISOMIP+ formulation (3 equations) for volume flux (Asay-Davis et al., 2015)
72         CALL isfcav_mlt_3eq( pgt, pgs , pttbl, pstbl, &
73            &                  pqhc, pqoce, pqfwf  )
74      CASE ( 'oasis' ) ! fwf pass trough oasis
75         CALL isfcav_mlt_oasis( kt, pstbl,              &
76            &                   pqhc, pqoce, pqfwf  )
77      CASE DEFAULT
78         CALL ctl_stop('STOP', 'unknown isf melt formulation : cn_isfcav (should not see this)')
79      END SELECT
80      !
81      IF (ln_isfdebug) THEN
82         CALL debug( 'isfcav_mlt qhc  :', pqhc (:,:) )
83         CALL debug( 'isfcav_mlt qoce :', pqoce(:,:) )
84         CALL debug( 'isfcav_mlt qfwf :', pqfwf(:,:) )
85      END IF
86      !
87   END SUBROUTINE isfcav_mlt
88
89! -------------------------------------------------------------------------------------------------------
90! -------------------------------- PRIVATE SUBROUTINE ---------------------------------------------------
91! -------------------------------------------------------------------------------------------------------
92
93   SUBROUTINE isfcav_mlt_spe(kt, pstbl,          &  ! <<== in
94      &                      pqhc , pqoce, pqfwf )  ! ==>> out
95      !!----------------------------------------------------------------------
96      !!
97      !!                          ***  ROUTINE isfcav_mlt_spe  ***
98      !!
99      !! ** Purpose    : - read ice shelf melt from forcing file
100      !!                 - compute ocea-ice heat flux (assuming it is equal to latent heat)
101      !!                 - compute heat content flux
102      !!---------------------------------------------------------------------
103      !!-------------------------- OUT -------------------------------------
104      REAL(dp), DIMENSION(jpi,jpj), INTENT(  out) :: pqhc, pqoce, pqfwf  ! heat content, latent heat and fwf fluxes
105      !!-------------------------- IN  -------------------------------------
106      INTEGER                     , INTENT(in   ) :: kt                  ! current time step
107      REAL(dp), DIMENSION(jpi,jpj), INTENT(in   ) :: pstbl               ! salinity in tbl
108      !!--------------------------------------------------------------------
109      REAL(dp), DIMENSION(jpi,jpj) :: ztfrz                              ! tbl freezing temperature
110      !!--------------------------------------------------------------------
111      !
112      ! Compute freezing temperature
113      CALL eos_fzp( pstbl(:,:), ztfrz(:,:), CASTDP(risfdep(:,:)) )
114      !
115      ! read input file
116      CALL fld_read ( kt, 1, sf_isfcav_fwf )
117      !
118      ! define fwf and qoce
119      ! ocean heat flux is assume to be equal to the latent heat
120      pqfwf(:,:) = - sf_isfcav_fwf(1)%fnow(:,:,1)      ! fwf                ( >0 out)
121      pqoce(:,:) = - pqfwf(:,:) * rLfusisf             ! ocean heat flux    ( >0 out)
122      pqhc (:,:) =   pqfwf(:,:) * ztfrz(:,:) * rcp     ! heat content flux  ( >0 out)
123      !
124      ! output freezing point at the interface
125      CALL iom_put('isftfrz_cav', ztfrz )
126      !
127   END SUBROUTINE isfcav_mlt_spe
128
129   SUBROUTINE isfcav_mlt_2eq(pgt , pttbl, pstbl, &  ! <<== in
130      &                      pqhc, pqoce, pqfwf  )  ! ==>> out
131      !!----------------------------------------------------------------------
132      !!
133      !!                          ***  ROUTINE isfcav_mlt_2eq  ***
134      !!
135      !! ** Purpose    : Compute ice shelf fwf/heqt fluxes using ISOMIP formulation (Hunter et al., 2006)
136      !!
137      !! ** Method     : The ice shelf melt latent heat is defined as being equal to the ocean/ice heat flux.
138      !!                 From this we can derived the fwf, ocean/ice heat flux and the heat content flux as being :
139      !!                   qfwf  = Gammat * rho0 * Cp * ( Tw - Tfrz ) / Lf
140      !!                   qhoce = qlat
141      !!                   qhc   = qfwf * Cp * Tfrz
142      !!
143      !! ** Reference  : Hunter,  J.  R.:  Specification  for  test  models  of  ice  shelf  cavities, 
144      !!                 Tech.  Rep.  June,  Antarctic  Climate  &  Ecosystems  Cooperative  Research  Centre,  available  at: 
145      !!                 http://staff.acecrc.org.au/~bkgalton/ISOMIP/test_cavities.pdf (last access: 21 July 2016), 2006.
146      !!
147      !!-------------------------- OUT -------------------------------------
148      REAL(dp), DIMENSION(jpi,jpj), INTENT(  out) :: pqhc, pqoce, pqfwf  ! hean content, ocean-ice heat and fwf fluxes
149      !!-------------------------- IN  -------------------------------------
150      REAL(dp), DIMENSION(jpi,jpj), INTENT(in   ) :: pgt           ! temperature exchange coeficient
151      REAL(dp), DIMENSION(jpi,jpj), INTENT(in   ) :: pttbl, pstbl  ! temperature and salinity in top boundary layer
152      !!--------------------------------------------------------------------
153      REAL(dp), DIMENSION(jpi,jpj) :: ztfrz         ! freezing temperature
154      REAL(dp), DIMENSION(jpi,jpj) :: zthd          ! thermal driving
155      !!--------------------------------------------------------------------
156      !
157      ! Calculate freezing temperature
158      CALL eos_fzp( pstbl(:,:), ztfrz(:,:), CASTDP(risfdep(:,:)) )
159      !
160      ! thermal driving
161      zthd (:,:) = ( pttbl(:,:) - ztfrz(:,:) ) * mskisf_cav(:,:)
162      !
163      ! compute ocean-ice heat flux and then derive fwf assuming that ocean heat flux equal latent heat
164      pqfwf(:,:) = - pgt(:,:) * rho0_rcp * zthd(:,:) / rLfusisf    ! fresh water flux  ( > 0 out )
165      pqoce(:,:) = - pqfwf(:,:) * rLfusisf                         ! ocea-ice flux     ( > 0 out )
166      pqhc (:,:) =   pqfwf(:,:) * ztfrz(:,:) * rcp                 ! heat content flux ( > 0 out )
167      !
168      ! output thermal driving and freezinpoint at the ice shelf interface
169      CALL iom_put('isfthermald_cav', zthd )
170      CALL iom_put('isftfrz_cav'    , ztfrz )
171      !
172   END SUBROUTINE isfcav_mlt_2eq
173
174   SUBROUTINE isfcav_mlt_3eq(pgt, pgs , pttbl, pstbl, &  ! <<== in
175      &                           pqhc, pqoce, pqfwf  )  ! ==>> out
176      !!----------------------------------------------------------------------
177      !!
178      !!                          ***  ROUTINE isfcav_mlt_3eq  ***
179      !!
180      !! ** Purpose    : Compute ice shelf fwf/heqt fluxes using the 3 equation formulation
181      !!
182      !! ** Method     : The melt rate is determined considering the heat balance, the salt balance
183      !!                 at the phase change interface and a linearisation of the equation of state.
184      !!
185      !! ** Reference  : - Holland, D. M. and Jenkins, A.,
186      !!                   Modeling Thermodynamic Ice-Ocean Interactions at the Base of an Ice Shelf,
187      !!                   J. Phys. Oceanogr., 29, 1999.
188      !!                 - Asay-Davis, X. S., Cornford, S. L., Durand, G., Galton-Fenzi, B. K., Gladstone,
189      !!                   R. M., Gudmundsson, G. H., Hattermann, T., Holland, D. M., Holland, D., Holland,
190      !!                   P. R., Martin, D. F., Mathiot, P., Pattyn, F., and Seroussi, H.:
191      !!                   Experimental design for three interrelated marine ice sheet and ocean model intercomparison projects:
192      !!                   MISMIP v. 3 (MISMIP +), ISOMIP v. 2 (ISOMIP +) and MISOMIP v. 1 (MISOMIP1),
193      !!                   Geosci. Model Dev., 9, 2471-2497, https://doi.org/10.5194/gmd-9-2471-2016, 2016.
194      !!
195      !!-------------------------- OUT -------------------------------------
196      REAL(dp), DIMENSION(jpi,jpj), INTENT(  out) :: pqhc, pqoce, pqfwf  ! latent heat and fwf fluxes
197      !!-------------------------- IN  -------------------------------------
198      REAL(dp), DIMENSION(jpi,jpj), INTENT(in   ) :: pgt  , pgs          ! heat/salt exchange coeficient
199      REAL(dp), DIMENSION(jpi,jpj), INTENT(in   ) :: pttbl, pstbl        ! mean temperature and salinity in top boundary layer
200      !!--------------------------------------------------------------------
201      REAL(dp) :: zeps1,zeps2,zeps3,zeps4,zeps6,zeps7       ! dummy local scalar for quadratic equation resolution
202      REAL(dp) :: zaqe,zbqe,zcqe,zaqer,zdis,zsfrz,zcfac     ! dummy local scalar for quadratic equation resolution
203      REAL(dp) :: zeps = 1.e-20
204      REAL(dp), DIMENSION(jpi,jpj) :: ztfrz         ! freezing point
205      REAL(dp), DIMENSION(jpi,jpj) :: zqcon         ! conductive flux through the ice shelf
206      REAL(dp), DIMENSION(jpi,jpj) :: zthd          ! thermal driving
207      !
208      INTEGER  ::   ji, jj     ! dummy loop indices
209      !!--------------------------------------------------------------------
210      !
211      ! compute upward heat flux zhtflx and upward water flux zwflx
212      ! Resolution of a 3d equation from equation 24, 25 and 26 (note conduction through the ice has been added to Eq 24)
213      DO_2D( 1, 1, 1, 1 )
214         !
215         ! compute coeficient to solve the 2nd order equation
216         zeps1 = rho0_rcp * pgt(ji,jj)
217         zeps2 = rLfusisf * rho0 * pgs(ji,jj)
218         zeps3 = rhoisf * rcpisf * rkappa / MAX(risfdep(ji,jj),zeps)
219         zeps4 = risf_lamb2 + risf_lamb3 * risfdep(ji,jj)
220         zeps6 = zeps4 - pttbl(ji,jj)
221         zeps7 = zeps4 - rtsurf
222         !
223         ! solve the 2nd order equation to find zsfrz
224         zaqe  = risf_lamb1 * (zeps1 + zeps3)
225         zaqer = 0.5_wp / MIN(zaqe,-zeps)
226         zbqe  = zeps1 * zeps6 + zeps3 * zeps7 - zeps2
227         zcqe  = zeps2 * pstbl(ji,jj)
228         zdis  = zbqe * zbqe - 4.0_wp * zaqe * zcqe               
229         !
230         ! Presumably zdis can never be negative because gammas is very small compared to gammat
231         zsfrz=(-zbqe - SQRT(zdis)) * zaqer
232         IF ( zsfrz < 0.0_wp ) zsfrz=(-zbqe + SQRT(zdis)) * zaqer  ! check this if this if is needed
233         !
234         ! compute t freeze (eq. 25)
235         ztfrz(ji,jj) = zeps4 + risf_lamb1 * zsfrz
236         !
237         ! thermal driving
238         zthd(ji,jj) = ( pttbl(ji,jj) - ztfrz(ji,jj) )
239         !
240         ! compute the upward water and heat flux (eq. 24 and eq. 26)
241         pqfwf(ji,jj) = rho0     * pgs(ji,jj) * ( zsfrz - pstbl(ji,jj) ) / MAX(zsfrz,zeps) ! fresh water flux    (> 0 out)
242         pqoce(ji,jj) = rho0_rcp * pgt(ji,jj) * zthd (ji,jj)                               ! ocean-ice heat flux (> 0 out)
243         pqhc (ji,jj) = rcp      * pqfwf(ji,jj) * ztfrz(ji,jj)                             ! heat content   flux (> 0 out)
244         !
245         zqcon(ji,jj) = zeps3 * ( ztfrz(ji,jj) - rtsurf )
246         !
247      END_2D
248      !
249      ! output conductive heat flux through the ice
250      CALL iom_put('qconisf', zqcon(:,:) * mskisf_cav(:,:) )
251      !
252      ! output thermal driving and freezing point at the interface
253      CALL iom_put('isfthermald_cav', zthd (:,:) * mskisf_cav(:,:) )
254      CALL iom_put('isftfrz_cav'    , ztfrz(:,:) * mskisf_cav(:,:) )
255      !
256   END SUBROUTINE isfcav_mlt_3eq
257
258   SUBROUTINE isfcav_mlt_oasis(kt, pstbl,          &  ! <<== in
259      &                        pqhc , pqoce, pqfwf )  ! ==>> out
260      !!----------------------------------------------------------------------
261      !!                          ***  ROUTINE isfcav_mlt_oasis  ***
262      !!
263      !! ** Purpose    : scale the fwf read from input file by the total amount received by the sbccpl interface
264      !!
265      !! ** Purpose    : - read ice shelf melt from forcing file => pattern
266      !!                 - total amount of fwf is given by sbccpl (fwfisf_cpl)
267      !!                 - scale fwf and compute heat fluxes
268      !!
269      !!---------------------------------------------------------------------
270      !!-------------------------- OUT -------------------------------------
271      REAL(dp), DIMENSION(jpi,jpj), INTENT(  out) :: pqhc, pqoce, pqfwf  ! heat content, latent heat and fwf fluxes
272      !!-------------------------- IN  -------------------------------------
273      INTEGER                     , INTENT(in   ) :: kt                  ! current time step
274      REAL(dp), DIMENSION(jpi,jpj), INTENT(in   ) :: pstbl               ! salinity in tbl
275      !!--------------------------------------------------------------------
276      REAL(dp)                     :: zfwf_fld, zfwf_oasis               ! total fwf in the forcing fields (pattern) and from the oasis interface (amount)
277      REAL(dp), DIMENSION(jpi,jpj) :: ztfrz                              ! tbl freezing temperature
278      REAL(dp), DIMENSION(jpi,jpj) :: zfwf                               ! 2d fwf map after scaling
279      !!--------------------------------------------------------------------
280      !
281      ! Calculate freezing temperature
282      CALL eos_fzp( pstbl(:,:), ztfrz(:,:), CASTDP(risfdep(:,:)) )
283      !
284      ! read input file
285      CALL fld_read ( kt, 1, sf_isfcav_fwf )
286      !
287      ! ice shelf 2d map
288      zfwf(:,:) = - sf_isfcav_fwf(1)%fnow(:,:,1)
289      !
290      ! compute glob sum from input file
291      ! (PM) should consider delay sum as in fwb (1 time step offset if I well understood)
292      zfwf_fld = glob_sum('isfcav_mlt', e1e2t(:,:) * zfwf(:,:))
293      !
294      ! compute glob sum from atm->oce ice shelf fwf
295      ! (PM) should consider delay sum as in fwb (1 time step offset if I well understood)
296      zfwf_oasis = glob_sum('isfcav_mlt', e1e2t(:,:) * fwfisf_oasis(:,:))
297      !
298      ! scale fwf
299      zfwf(:,:) = zfwf(:,:) * zfwf_oasis / zfwf_fld
300      !
301      ! define fwf and qoce
302      ! ocean heat flux is assume to be equal to the latent heat
303      pqfwf(:,:) =   zfwf(:,:)                         ! fwf                ( >0 out)
304      pqoce(:,:) = - pqfwf(:,:) * rLfusisf             ! ocean heat flux    ( >0 out)
305      pqhc (:,:) =   pqfwf(:,:) * ztfrz(:,:) * rcp     ! heat content flux  ( >0 out)
306      !
307      CALL iom_put('isftfrz_cav', ztfrz * mskisf_cav(:,:) )
308      !
309   END SUBROUTINE isfcav_mlt_oasis
310
311END MODULE isfcavmlt
Note: See TracBrowser for help on using the repository browser.