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 @ 15606

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

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

File size: 16.8 KB
RevLine 
[11395]1MODULE isfcavmlt
2   !!======================================================================
[11541]3   !!                       ***  MODULE  isfcavmlt  ***
[11395]4   !! ice shelf module :  update surface ocean boundary condition under ice
[11931]5   !!                   shelves
[11395]6   !!======================================================================
7   !! History :  4.0  !  2019-09  (P. Mathiot) Original code
8   !!----------------------------------------------------------------------
9
10   !!----------------------------------------------------------------------
[11931]11   !!   isfcav_mlt    : compute or read ice shelf fwf/heat fluxes in the ice shelf cavity
[11395]12   !!----------------------------------------------------------------------
13
[12077]14   USE isf_oce                  ! ice shelf
[11852]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
[12489]19   USE phycst , ONLY: rcp, rho0, rho0_rcp ! physical constants
[11852]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
[11931]24   USE fldread    , ONLY: fld_read, FLD, FLD_N !
[11852]25   USE lib_fortran, ONLY: glob_sum !
26   USE lib_mpp    , ONLY: ctl_stop !
27
[11395]28   IMPLICIT NONE
29   PRIVATE
30
31   PUBLIC   isfcav_mlt
32
[12340]33   !! * Substitutions
[15540]34#  include "single_precision_substitute.h90"
[12340]35#  include "do_loop_substitute.h90"
[11395]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
[11403]47   SUBROUTINE isfcav_mlt(kt, pgt, pgs , pttbl, pstbl, &
48      &                           pqhc, pqoce, pqfwf  )
[11395]49      !!----------------------------------------------------------------------
50      !!
[11541]51      !!                          ***  ROUTINE isfcav_mlt  ***
52      !!
[11494]53      !! ** Purpose    : compute or read ice shelf fwf/heat fluxes in the ice shelf cavity
[11403]54      !!
[11395]55      !!-------------------------- OUT -------------------------------------
[15540]56      REAL(dp), DIMENSION(jpi,jpj), INTENT(  out) :: pqhc, pqoce, pqfwf  ! heat and fwf fluxes
[11395]57      !!-------------------------- IN  -------------------------------------
58      INTEGER, INTENT(in) :: kt
[15540]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
[11395]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
[11425]66         CALL isfcav_mlt_spe( kt, pstbl,               &
[11403]67            &                  pqhc, pqoce, pqfwf  )
[11395]68      CASE ( '2eq' )   !  ISOMIP  formulation (2 equations) for volume flux (Hunter et al., 2006)
[11425]69         CALL isfcav_mlt_2eq( pgt, pttbl, pstbl,       &
[11403]70            &                  pqhc , pqoce, pqfwf )
[11395]71      CASE ( '3eq' )   ! ISOMIP+ formulation (3 equations) for volume flux (Asay-Davis et al., 2015)
[11425]72         CALL isfcav_mlt_3eq( pgt, pgs , pttbl, pstbl, &
[11403]73            &                  pqhc, pqoce, pqfwf  )
[11395]74      CASE ( 'oasis' ) ! fwf pass trough oasis
[11425]75         CALL isfcav_mlt_oasis( kt, pstbl,              &
[11403]76            &                   pqhc, pqoce, pqfwf  )
[11395]77      CASE DEFAULT
78         CALL ctl_stop('STOP', 'unknown isf melt formulation : cn_isfcav (should not see this)')
79      END SELECT
80      !
[11844]81      IF (ln_isfdebug) THEN
[12077]82         CALL debug( 'isfcav_mlt qhc  :', pqhc (:,:) )
83         CALL debug( 'isfcav_mlt qoce :', pqoce(:,:) )
84         CALL debug( 'isfcav_mlt qfwf :', pqfwf(:,:) )
[11844]85      END IF
86      !
[11395]87   END SUBROUTINE isfcav_mlt
88
89! -------------------------------------------------------------------------------------------------------
90! -------------------------------- PRIVATE SUBROUTINE ---------------------------------------------------
91! -------------------------------------------------------------------------------------------------------
92
[11541]93   SUBROUTINE isfcav_mlt_spe(kt, pstbl,          &  ! <<== in
[11403]94      &                      pqhc , pqoce, pqfwf )  ! ==>> out
[11395]95      !!----------------------------------------------------------------------
[11541]96      !!
97      !!                          ***  ROUTINE isfcav_mlt_spe  ***
98      !!
[11403]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
[11395]102      !!---------------------------------------------------------------------
103      !!-------------------------- OUT -------------------------------------
[15540]104      REAL(dp), DIMENSION(jpi,jpj), INTENT(  out) :: pqhc, pqoce, pqfwf  ! heat content, latent heat and fwf fluxes
[11395]105      !!-------------------------- IN  -------------------------------------
[11403]106      INTEGER                     , INTENT(in   ) :: kt                  ! current time step
[15540]107      REAL(dp), DIMENSION(jpi,jpj), INTENT(in   ) :: pstbl               ! salinity in tbl
[11395]108      !!--------------------------------------------------------------------
[15540]109      REAL(dp), DIMENSION(jpi,jpj) :: ztfrz                              ! tbl freezing temperature
[11395]110      !!--------------------------------------------------------------------
111      !
[11931]112      ! Compute freezing temperature
[15540]113      CALL eos_fzp( pstbl(:,:), ztfrz(:,:), CASTDP(risfdep(:,:)) )
[11395]114      !
115      ! read input file
[11852]116      CALL fld_read ( kt, 1, sf_isfcav_fwf )
[11395]117      !
118      ! define fwf and qoce
119      ! ocean heat flux is assume to be equal to the latent heat
[11403]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)
[11395]123      !
[11876]124      ! output freezing point at the interface
125      CALL iom_put('isftfrz_cav', ztfrz )
126      !
[11425]127   END SUBROUTINE isfcav_mlt_spe
[11395]128
[11541]129   SUBROUTINE isfcav_mlt_2eq(pgt , pttbl, pstbl, &  ! <<== in
130      &                      pqhc, pqoce, pqfwf  )  ! ==>> out
[11395]131      !!----------------------------------------------------------------------
[11541]132      !!
[11931]133      !!                          ***  ROUTINE isfcav_mlt_2eq  ***
[11541]134      !!
[11403]135      !! ** Purpose    : Compute ice shelf fwf/heqt fluxes using ISOMIP formulation (Hunter et al., 2006)
[11395]136      !!
[11403]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 :
[13472]139      !!                   qfwf  = Gammat * rho0 * Cp * ( Tw - Tfrz ) / Lf
[11403]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.
[11931]146      !!
[11395]147      !!-------------------------- OUT -------------------------------------
[15540]148      REAL(dp), DIMENSION(jpi,jpj), INTENT(  out) :: pqhc, pqoce, pqfwf  ! hean content, ocean-ice heat and fwf fluxes
[11395]149      !!-------------------------- IN  -------------------------------------
[15540]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
[11395]152      !!--------------------------------------------------------------------
[15540]153      REAL(dp), DIMENSION(jpi,jpj) :: ztfrz         ! freezing temperature
154      REAL(dp), DIMENSION(jpi,jpj) :: zthd          ! thermal driving
[11395]155      !!--------------------------------------------------------------------
156      !
157      ! Calculate freezing temperature
[15540]158      CALL eos_fzp( pstbl(:,:), ztfrz(:,:), CASTDP(risfdep(:,:)) )
[11395]159      !
[11403]160      ! thermal driving
[11488]161      zthd (:,:) = ( pttbl(:,:) - ztfrz(:,:) ) * mskisf_cav(:,:)
[11403]162      !
[11395]163      ! compute ocean-ice heat flux and then derive fwf assuming that ocean heat flux equal latent heat
[12489]164      pqfwf(:,:) = - pgt(:,:) * rho0_rcp * zthd(:,:) / rLfusisf    ! fresh water flux  ( > 0 out )
[11403]165      pqoce(:,:) = - pqfwf(:,:) * rLfusisf                         ! ocea-ice flux     ( > 0 out )
166      pqhc (:,:) =   pqfwf(:,:) * ztfrz(:,:) * rcp                 ! heat content flux ( > 0 out )
[11395]167      !
[11876]168      ! output thermal driving and freezinpoint at the ice shelf interface
[11403]169      CALL iom_put('isfthermald_cav', zthd )
[11876]170      CALL iom_put('isftfrz_cav'    , ztfrz )
[11395]171      !
[11425]172   END SUBROUTINE isfcav_mlt_2eq
[11395]173
[11541]174   SUBROUTINE isfcav_mlt_3eq(pgt, pgs , pttbl, pstbl, &  ! <<== in
175      &                           pqhc, pqoce, pqfwf  )  ! ==>> out
[11395]176      !!----------------------------------------------------------------------
[11541]177      !!
178      !!                          ***  ROUTINE isfcav_mlt_3eq  ***
179      !!
[11403]180      !! ** Purpose    : Compute ice shelf fwf/heqt fluxes using the 3 equation formulation
[11395]181      !!
[11403]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.
[11931]194      !!
[11395]195      !!-------------------------- OUT -------------------------------------
[15540]196      REAL(dp), DIMENSION(jpi,jpj), INTENT(  out) :: pqhc, pqoce, pqfwf  ! latent heat and fwf fluxes
[11395]197      !!-------------------------- IN  -------------------------------------
[15540]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
[11395]200      !!--------------------------------------------------------------------
[15540]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
[11395]207      !
208      INTEGER  ::   ji, jj     ! dummy loop indices
209      !!--------------------------------------------------------------------
210      !
211      ! compute upward heat flux zhtflx and upward water flux zwflx
[11403]212      ! Resolution of a 3d equation from equation 24, 25 and 26 (note conduction through the ice has been added to Eq 24)
[13295]213      DO_2D( 1, 1, 1, 1 )
[12340]214         !
215         ! compute coeficient to solve the 2nd order equation
[12489]216         zeps1 = rho0_rcp * pgt(ji,jj)
217         zeps2 = rLfusisf * rho0 * pgs(ji,jj)
[12340]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)
[12489]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)
[12340]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
[11395]248      !
249      ! output conductive heat flux through the ice
[11488]250      CALL iom_put('qconisf', zqcon(:,:) * mskisf_cav(:,:) )
[11395]251      !
[11876]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(:,:) )
[11395]255      !
[11425]256   END SUBROUTINE isfcav_mlt_3eq
[11395]257
[11541]258   SUBROUTINE isfcav_mlt_oasis(kt, pstbl,          &  ! <<== in
[11403]259      &                        pqhc , pqoce, pqfwf )  ! ==>> out
260      !!----------------------------------------------------------------------
[11541]261      !!                          ***  ROUTINE isfcav_mlt_oasis  ***
[11403]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 -------------------------------------
[15540]271      REAL(dp), DIMENSION(jpi,jpj), INTENT(  out) :: pqhc, pqoce, pqfwf  ! heat content, latent heat and fwf fluxes
[11403]272      !!-------------------------- IN  -------------------------------------
273      INTEGER                     , INTENT(in   ) :: kt                  ! current time step
[15540]274      REAL(dp), DIMENSION(jpi,jpj), INTENT(in   ) :: pstbl               ! salinity in tbl
[11403]275      !!--------------------------------------------------------------------
[15540]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
[11403]279      !!--------------------------------------------------------------------
280      !
281      ! Calculate freezing temperature
[15540]282      CALL eos_fzp( pstbl(:,:), ztfrz(:,:), CASTDP(risfdep(:,:)) )
[11403]283      !
284      ! read input file
[11852]285      CALL fld_read ( kt, 1, sf_isfcav_fwf )
[11403]286      !
287      ! ice shelf 2d map
288      zfwf(:,:) = - sf_isfcav_fwf(1)%fnow(:,:,1)
289      !
290      ! compute glob sum from input file
[11425]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(:,:))
[11403]293      !
294      ! compute glob sum from atm->oce ice shelf fwf
[11425]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(:,:))
[11403]297      !
298      ! scale fwf
[11423]299      zfwf(:,:) = zfwf(:,:) * zfwf_oasis / zfwf_fld
[11403]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      !
[11876]307      CALL iom_put('isftfrz_cav', ztfrz * mskisf_cav(:,:) )
[11931]308      !
[11425]309   END SUBROUTINE isfcav_mlt_oasis
[11403]310
[11395]311END MODULE isfcavmlt
Note: See TracBrowser for help on using the repository browser.