Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ABL/ablrst.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ABL/ablrst.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ABL/ablrst.F90	(revision 14219)
@@ -105,6 +105,6 @@
       ! ------------------ 
       !                                                                        ! calendar control
-      CALL iom_rstput( iter, nitrst, numraw, 'nn_fsbc', REAL( nn_fsbc, wp ) )      ! time-step 
-      CALL iom_rstput( iter, nitrst, numraw, 'kt_abl' , REAL( iter   , wp ) )      ! date
+      CALL iom_rstput( iter, nitrst, numraw, 'nn_fsbc', REAL( nn_fsbc, dp ) )      ! time-step 
+      CALL iom_rstput( iter, nitrst, numraw, 'kt_abl' , REAL( iter   , dp ) )      ! date
       CALL iom_delay_rst( 'WRITE', 'ABL', numraw )   ! save only abl delayed global communication variables
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icectl.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icectl.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icectl.F90	(revision 14219)
@@ -60,4 +60,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/ICE 4.0 , NEMO Consortium (2018)
@@ -705,5 +706,5 @@
       CALL prt_ctl_info(' - Cell values : ')
       CALL prt_ctl_info('   ~~~~~~~~~~~~~ ')
-      CALL prt_ctl(tab2d_1=e1e2t      , clinfo1=' cell area   :')
+      CALL prt_ctl(tab2d_1=CASTWP(e1e2t)      , clinfo1=' cell area   :')
       CALL prt_ctl(tab2d_1=at_i       , clinfo1=' at_i        :')
       CALL prt_ctl(tab2d_1=ato_i      , clinfo1=' ato_i       :')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icedyn_adv_umx.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icedyn_adv_umx.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icedyn_adv_umx.F90	(revision 14219)
@@ -1140,6 +1140,6 @@
       REAL(wp), DIMENSION(jpi,jpj,jpl) :: zbetup, zbetdo, zti_ups, ztj_ups
       !!----------------------------------------------------------------------
-      zbig = 1.e+40_wp
-
+      zbig = HUGE(1._wp)
+      
       ! antidiffusive flux : high order minus low order
       ! --------------------------------------------------
@@ -1681,2 +1681,3 @@
    !!======================================================================
 END MODULE icedyn_adv_umx
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icedyn_rhg_vp.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icedyn_rhg_vp.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icedyn_rhg_vp.F90	(revision 14219)
@@ -460,5 +460,5 @@
          END DO
 
-         CALL lbc_lnk( 'icedyn_rhg_vp', zds, 'F', 1. ) ! MV TEST could be un-necessary according to Gurvan
+         CALL lbc_lnk( 'icedyn_rhg_vp', zds, 'F', 1._wp ) ! MV TEST could be un-necessary according to Gurvan
          CALL iom_put( 'zds'        , zds      )   ! MV DEBUG
 
@@ -506,5 +506,5 @@
          END DO
          
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zp_deltastar_t , 'T', 1. , zzt , 'T', 1., zet, 'T', 1. )
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zp_deltastar_t , 'T', 1._wp , zzt , 'T', 1._wp, zet, 'T', 1._wp )
 
          CALL iom_put( 'zzt'        , zzt      )   ! MV DEBUG
@@ -526,5 +526,5 @@
          END DO
          
-         CALL lbc_lnk( 'icedyn_rhg_vp', zef, 'F', 1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zef, 'F', 1._wp )
          CALL iom_put( 'zef'           , zef            ) ! MV DEBUG
          IF( lwp )   WRITE(numout,*) ' outer loop  1c i_out : ', i_out
@@ -567,6 +567,6 @@
          IF( lwp )   WRITE(numout,*) ' outer loop  1d i_out : ', i_out
          
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zCwU ,  'U', -1., zCwV, 'V', -1. )
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zCorU,  'U', -1., zCorV, 'V', -1. )
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zCwU ,  'U', -1._wp, zCwV, 'V', -1._wp )
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zCorU,  'U', -1._wp, zCorV, 'V', -1._wp )
 
          CALL iom_put( 'zCwU'          , zCwU           ) ! MV DEBUG
@@ -628,6 +628,6 @@
          END DO
 
-         CALL lbc_lnk( 'icedyn_rhg_vp', zs12_rhsu, 'F', 1. )
-         CALL lbc_lnk( 'icedyn_rhg_vp', zs12_rhsv, 'F', 1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zs12_rhsu, 'F', 1._wp )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zs12_rhsv, 'F', 1._wp )
 
          CALL iom_put( 'zs12_rhsu'     , zs12_rhsu      ) ! MV DEBUG
@@ -674,7 +674,7 @@
          END DO
          
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zrhsu, 'U', -1., zrhsv, 'V',  -1.)
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zmU_t, 'U', -1., zmV_t, 'V',  -1.)
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', ztaux_oi_rhsu, 'U', -1., ztauy_oi_rhsv, 'V',  -1.)
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zrhsu, 'U', -1._wp, zrhsv, 'V',  -1._wp)
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zmU_t, 'U', -1._wp, zmV_t, 'V',  -1._wp)
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', ztaux_oi_rhsu, 'U', -1._wp, ztauy_oi_rhsv, 'V',  -1._wp)
 
          CALL iom_put( 'zmU_t'         , zmU_t          ) ! MV DEBUG
@@ -779,9 +779,9 @@
          END DO
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zAU  , 'U', 1., zAV  , 'V',  1. )
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zBU  , 'U', 1., zBV  , 'V',  1. )
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zCU  , 'U', 1., zCV  , 'V',  1. )
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zDU  , 'U', 1., zDV  , 'V',  1. )
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zEU  , 'U', 1., zEV  , 'V',  1. )
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zAU  , 'U', 1._wp, zAV  , 'V',  1._wp )
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zBU  , 'U', 1._wp, zBV  , 'V',  1._wp )
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zCU  , 'U', 1._wp, zCV  , 'V',  1._wp )
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zDU  , 'U', 1._wp, zDV  , 'V',  1._wp )
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zEU  , 'U', 1._wp, zEV  , 'V',  1._wp )
                
          CALL iom_put( 'zAU'           , zAU            ) ! MV DEBUG
@@ -867,5 +867,5 @@
                      END DO
                      
-                     CALL lbc_lnk( 'icedyn_rhg_vp', zFU, 'U',  1. )
+                     CALL lbc_lnk( 'icedyn_rhg_vp', zFU, 'U',  1._wp )
                      
                      !---------------
@@ -885,5 +885,5 @@
                      END DO
 
-                     CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFU_prime, 'U',  1., zBU_prime, 'U', 1. )
+                     CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFU_prime, 'U',  1._wp, zBU_prime, 'U', 1._wp )
  
                      !-----------------------------
@@ -965,5 +965,5 @@
                      END DO
 
-                     CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFV, 'V',  1.)
+                     CALL lbc_lnk( 'icedyn_rhg_vp', zFV, 'V',  1._wp)
                      
                      !---------------
@@ -983,5 +983,5 @@
                      END DO
 
-                     CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFV_prime, 'V',  1., zBV_prime, 'V', 1. )
+                     CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFV_prime, 'V',  1._wp, zBV_prime, 'V', 1._wp )
                      
                      !-----------------------------
@@ -1020,5 +1020,5 @@
                ENDIF !   ll_v_iterate
 
-               CALL lbc_lnk_multi( 'icedyn_rhg_vp', u_ice, 'U', -1., v_ice, 'V', -1. )
+               CALL lbc_lnk_multi( 'icedyn_rhg_vp', u_ice, 'U', -1._wp, v_ice, 'V', -1._wp )
                               
                !--------------------------------------------------------------------------------------
@@ -1110,8 +1110,8 @@
       IF ( lwp ) WRITE(numout,*) ' We are out of outer loop '
 
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFU  , 'U',  1., zFV  , 'V',  1. )
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', zBU_prime  , 'U',  1., zBV_prime  , 'V',  1. )
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFU_prime  , 'U',  1., zFV_prime  , 'V',  1. )
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', zCU_prime  , 'U',  1., zCV_prime  , 'V',  1. )
+      CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFU  , 'U',  1._wp, zFV  , 'V',  1._wp )
+      CALL lbc_lnk_multi( 'icedyn_rhg_vp', zBU_prime  , 'U',  1._wp, zBV_prime  , 'V',  1._wp )
+      CALL lbc_lnk_multi( 'icedyn_rhg_vp', zFU_prime  , 'U',  1._wp, zFV_prime  , 'V',  1._wp )
+      CALL lbc_lnk_multi( 'icedyn_rhg_vp', zCU_prime  , 'U',  1._wp, zCV_prime  , 'V',  1._wp )
 
       CALL iom_put( 'zFU'           , zFU            ) ! MV DEBUG
@@ -1125,5 +1125,5 @@
       CALL iom_put( 'zFV_prime'     , zFV_prime      ) ! MV DEBUG
 
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', u_ice, 'U', -1., v_ice, 'V', -1. )
+      CALL lbc_lnk_multi( 'icedyn_rhg_vp', u_ice, 'U', -1._wp, v_ice, 'V', -1._wp )
 
       IF ( lwp ) WRITE(numout,*) ' We are about to output uice_dbg '
@@ -1161,5 +1161,5 @@
       END DO
 
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', u_ice, 'U', -1., v_ice, 'V', -1. )
+      CALL lbc_lnk_multi( 'icedyn_rhg_vp', u_ice, 'U', -1._wp, v_ice, 'V', -1._wp )
 
       IF ( lwp ) WRITE(numout,*) ' Velocity replaced '
@@ -1222,5 +1222,5 @@
       IF ( lwp ) WRITE(numout,*) ' Deformation recalculated '
       
-      CALL lbc_lnk_multi( 'icedyn_rhg_vp', pshear_i, 'T', 1., pdivu_i, 'T', 1., pdelta_i, 'T', 1. )
+      CALL lbc_lnk_multi( 'icedyn_rhg_vp', pshear_i, 'T', 1._wp, pdivu_i, 'T', 1._wp, pdelta_i, 'T', 1._wp )
       
       !------------------------------------------------------------------------------!
@@ -1249,5 +1249,5 @@
          END DO
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zs1, 'T', 1., zs2, 'T', 1., zs12, 'T', 1. )
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zs1, 'T', 1._wp, zs2, 'T', 1._wp, zs12, 'T', 1._wp )
       
       ENDIF
@@ -1268,5 +1268,5 @@
          END DO
 
-         CALL lbc_lnk( 'icedyn_rhg_vp', zs12f, 'F', 1. )
+         CALL lbc_lnk( 'icedyn_rhg_vp', zs12f, 'F', 1._wp )
          
       ENDIF
@@ -1307,5 +1307,5 @@
          
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', ztaux_oi, 'U', -1., ztauy_oi, 'V', -1., ztaux_ai, 'U', -1., ztauy_ai, 'V', -1. ) !, &
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', ztaux_oi, 'U', -1._wp, ztauy_oi, 'V', -1._wp, ztaux_ai, 'U', -1._wp, ztauy_ai, 'V', -1._wp ) !, &
 !            &                                 ztaux_bi, 'U', -1., ztauy_bi, 'V', -1. )
          !
@@ -1348,5 +1348,5 @@
          END DO
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zsig_I, 'T', 1., zsig_II, 'T', 1.)
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zsig_I, 'T', 1._wp, zsig_II, 'T', 1._wp)
          
          IF( iom_use('normstr') )   CALL iom_put( 'normstr' ,   zsig_I(:,:)  * zmsk00(:,:) ) ! Normal stress
@@ -1393,5 +1393,5 @@
          IF ( lwp ) WRITE(numout,*) 'Some shitty stress work done'
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zsig1_p, 'T', 1., zsig2_p, 'T', 1.)
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zsig1_p, 'T', 1._wp, zsig2_p, 'T', 1._wp)
          !      
          IF ( lwp ) WRITE(numout,*) ' Beauaaaarflblbllll '
@@ -1423,6 +1423,6 @@
          END DO
          !
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zspgU, 'U', -1., zspgV, 'V', -1., &
-            &                                 zCorU, 'U', -1., zCorV, 'V', -1. )
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zspgU, 'U', -1._wp, zspgV, 'V', -1._wp, &
+            &                                 zCorU, 'U', -1._wp, zCorV, 'V', -1._wp )
          !
          CALL iom_put( 'dssh_dx' , zspgU * zmsk00 )   ! Sea-surface tilt term in force balance (x)
@@ -1453,5 +1453,5 @@
          END DO
             
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zfU, 'U', -1., zfV, 'V', -1. )
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zfU, 'U', -1._wp, zfV, 'V', -1._wp )
          
          CALL iom_put( 'intstrx' , zfU   * zmsk00 )   ! Internal force term in force balance (x)
@@ -1485,7 +1485,7 @@
          END DO
 
-         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zdiag_xmtrp_ice, 'U', -1., zdiag_ymtrp_ice, 'V', -1., &
-            &                                 zdiag_xmtrp_snw, 'U', -1., zdiag_ymtrp_snw, 'V', -1., &
-            &                                 zdiag_xatrp    , 'U', -1., zdiag_yatrp    , 'V', -1. )
+         CALL lbc_lnk_multi( 'icedyn_rhg_vp', zdiag_xmtrp_ice, 'U', -1._wp, zdiag_ymtrp_ice, 'V', -1._wp, &
+            &                                 zdiag_xmtrp_snw, 'U', -1._wp, zdiag_ymtrp_snw, 'V', -1._wp, &
+            &                                 zdiag_xatrp    , 'U', -1._wp, zdiag_yatrp    , 'V', -1._wp )
 
          CALL iom_put( 'xmtrpice' , zdiag_xmtrp_ice )   ! X-component of sea-ice mass transport (kg/s)
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icerst.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icerst.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icerst.F90	(revision 14219)
@@ -37,4 +37,5 @@
    PUBLIC   ice_rst_read    ! called by ice_init
 
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/ICE 4.0 , NEMO Consortium (2018)
@@ -138,6 +139,6 @@
       ! ------------------
       !                                                                        ! calendar control
-      CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp ) )      ! time-step
-      CALL iom_rstput( iter, nitrst, numriw, 'kt_ice' , REAL( iter   , wp ) )      ! date
+      CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, dp ) )      ! time-step
+      CALL iom_rstput( iter, nitrst, numriw, 'kt_ice' , REAL( iter   , dp ) )      ! date
 
       IF(.NOT.lwxios) CALL iom_delay_rst( 'WRITE', 'ICE', numriw )   ! save only ice delayed global communication variables
@@ -329,5 +330,5 @@
             !
             IF(lwp) WRITE(numout,*) '  SAS: default initialisation of ss[st]_m arrays used in ice_istate'
-            IF( l_useCT )  THEN    ;   sst_m(:,:) = eos_pt_from_ct( ts(:,:,1,jp_tem, Kmm), ts(:,:,1,jp_sal, Kmm) )
+            IF( l_useCT )  THEN    ;   sst_m(:,:) = eos_pt_from_ct( CASTWP(ts(:,:,1,jp_tem, Kmm)), CASTWP(ts(:,:,1,jp_sal, Kmm)) )
             ELSE                   ;   sst_m(:,:) = ts(:,:,1,jp_tem, Kmm)
             ENDIF
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icestp.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icestp.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/ICE/icestp.F90	(revision 14219)
@@ -87,4 +87,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/ICE 4.0 , NEMO Consortium (2018)
@@ -212,5 +213,5 @@
       ! --- Ocean time step --- !
       !-------------------------!
-      CALL ice_update_tau( kt, uu(:,:,1,Kbb), vv(:,:,1,Kbb) )         ! -- update surface ocean stresses
+      CALL ice_update_tau( kt, CASTWP(uu(:,:,1,Kbb)), CASTWP(vv(:,:,1,Kbb)) )         ! -- update surface ocean stresses
 !!gm   remark, the ocean-ice stress is not saved in ice diag call above .....  find a solution!!!
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ASM/asminc.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ASM/asminc.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ASM/asminc.F90	(revision 14219)
@@ -97,4 +97,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -516,5 +517,5 @@
       INTEGER                                  , INTENT(in   ) :: kt             ! Current time step
       INTEGER                                  , INTENT(in   ) :: Kbb, Kmm, Krhs ! Time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts            ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts            ! active tracers and RHS of tracer equation
       !
       INTEGER  :: ji, jj, jk
@@ -528,5 +529,5 @@
       IF( ln_temnofreeze ) THEN
          DO jk = 1, jpkm1
-           CALL eos_fzp( pts(:,:,jk,jp_sal,Kmm), fzptnz(:,:,jk), gdept(:,:,jk,Kmm) )
+           CALL eos_fzp( CASTWP(pts(:,:,jk,jp_sal,Kmm)), fzptnz(:,:,jk), CASTWP(gdept(:,:,jk,Kmm)) )
          END DO
       ENDIF
@@ -619,5 +620,5 @@
             END_3D
 
-            CALL eos( pts(:,:,:,:,Kbb), rhd, rhop, gdept_0(:,:,:) )  ! Before potential and in situ densities
+            CALL eos( CASTWP(pts(:,:,:,:,Kbb)), rhd, rhop, gdept_0(:,:,:) )  ! Before potential and in situ densities
 !!gm  fabien
 !            CALL eos( pts(:,:,:,:,Kbb), rhd, rhop )                ! Before potential and in situ densities
@@ -667,5 +668,5 @@
       INTEGER                             , INTENT( in )  ::  kt             ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kbb, Kmm, Krhs ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv       ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv       ! ocean velocities and RHS of momentum equation
       !
       INTEGER :: jk
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdydyn.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdydyn.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdydyn.F90	(revision 14219)
@@ -32,4 +32,5 @@
    !! * Substitutions
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -48,5 +49,5 @@
       INTEGER                             , INTENT(in)    ::   kt           ! Main time step counter
       INTEGER                             , INTENT(in)    ::   Kbb, Kaa     ! Ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::   puu, pvv     ! Ocean velocities (to be updated at open boundaries)
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::   puu, pvv     ! Ocean velocities (to be updated at open boundaries)
       LOGICAL, OPTIONAL                   , INTENT(in)    ::   dyn3d_only   ! T => only update baroclinic velocities
       !
@@ -101,5 +102,5 @@
       !-------------------------------------------------------
 
-      IF( ll_dyn2d )   CALL bdy_dyn2d( kt, zua2d, zva2d, uu_b(:,:,Kbb), vv_b(:,:,Kbb), r1_hu(:,:,Kaa), r1_hv(:,:,Kaa), ssh(:,:,Kaa) )
+      IF( ll_dyn2d )   CALL bdy_dyn2d( kt, zua2d, zva2d, uu_b(:,:,Kbb), vv_b(:,:,Kbb), r1_hu(:,:,Kaa), r1_hv(:,:,Kaa), CASTWP(ssh(:,:,Kaa)) )
 
       IF( ll_dyn3d )   CALL bdy_dyn3d( kt, Kbb, puu, pvv, Kaa )
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdydyn2d.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdydyn2d.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdydyn2d.F90	(revision 14219)
@@ -304,5 +304,5 @@
       !!
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj,1), INTENT(inout) ::   zssh ! Sea level, need 3 dimensions to be used by bdy_nmn
+      REAL(dp), DIMENSION(jpi,jpj,1), INTENT(inout) ::   zssh ! Sea level, need 3 dimensions to be used by bdy_nmn
       !!
       INTEGER ::   ib_bdy, ir      ! bdy index, rim index
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdydyn3d.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdydyn3d.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdydyn3d.F90	(revision 14219)
@@ -26,4 +26,5 @@
    PUBLIC   bdy_dyn3d_dmp ! routine called by step
 
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -42,5 +43,5 @@
       INTEGER                             , INTENT( in    ) ::   kt        ! Main time step counter
       INTEGER                             , INTENT( in    ) ::   Kbb, Kaa  ! Time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
       !
       INTEGER  ::   ib_bdy, ir     ! BDY set index, rim index
@@ -118,5 +119,5 @@
       !!----------------------------------------------------------------------
       INTEGER                             , INTENT( in    ) ::   Kaa       ! Time level index
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
       TYPE(OBC_INDEX)                     , INTENT( in    ) ::   idx       ! OBC indices
       TYPE(OBC_DATA)                      , INTENT( in    ) ::   dta       ! OBC external data
@@ -157,5 +158,5 @@
       !!----------------------------------------------------------------------
       INTEGER                             , INTENT( in    ) ::   Kaa       ! Time level index
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
       TYPE(OBC_INDEX)                     , INTENT( in    ) ::   idx       ! OBC indices
       TYPE(OBC_DATA)                      , INTENT( in    ) ::   dta       ! OBC external data
@@ -222,5 +223,5 @@
       INTEGER                             , INTENT( in    ) ::   kt        ! time step index
       INTEGER                             , INTENT( in    ) ::   Kaa       ! Time level index
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
       TYPE(OBC_INDEX)                     , INTENT( in    ) ::   idx       ! OBC indices
       TYPE(OBC_DATA)                      , INTENT( in    ) ::   dta       ! OBC external data
@@ -265,5 +266,5 @@
       INTEGER                             , INTENT( in    ) ::   kt        ! time step index
       INTEGER                             , INTENT( in    ) ::   Kaa       ! Time level index
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
       TYPE(OBC_INDEX)                     , INTENT( in    ) ::   idx       ! OBC indices
       TYPE(OBC_DATA)                      , INTENT( in    ) ::   dta       ! OBC external data
@@ -309,5 +310,5 @@
       !!----------------------------------------------------------------------
       INTEGER                             , INTENT( in    ) ::   Kbb, Kaa  ! Time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
       TYPE(OBC_INDEX)                     , INTENT( in    ) ::   idx       ! OBC indices
       TYPE(OBC_DATA)                      , INTENT( in    ) ::   dta       ! OBC external data
@@ -323,9 +324,9 @@
       igrd = 2      ! Orlanski bc on u-velocity; 
       !            
-      CALL bdy_orlanski_3d( idx, igrd, puu(:,:,:,Kbb), puu(:,:,:,Kaa), dta%u3d, ll_npo, llrim0 )
+      CALL bdy_orlanski_3d( idx, igrd, CASTWP(puu(:,:,:,Kbb)), puu(:,:,:,Kaa), dta%u3d, ll_npo, llrim0 )
 
       igrd = 3      ! Orlanski bc on v-velocity
       !  
-      CALL bdy_orlanski_3d( idx, igrd, pvv(:,:,:,Kbb), pvv(:,:,:,Kaa), dta%v3d, ll_npo, llrim0 )
+      CALL bdy_orlanski_3d( idx, igrd, CASTWP(pvv(:,:,:,Kbb)), pvv(:,:,:,Kaa), dta%v3d, ll_npo, llrim0 )
       !
    END SUBROUTINE bdy_dyn3d_orlanski
@@ -341,5 +342,5 @@
       INTEGER                             , INTENT( in    ) ::   kt        ! time step
       INTEGER                             , INTENT( in    ) ::   Kbb, Krhs ! Time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities and trends (to be updated at open boundaries)
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities and trends (to be updated at open boundaries)
       !
       INTEGER  ::   jb, jk         ! dummy loop indices
@@ -392,5 +393,5 @@
       !!----------------------------------------------------------------------
       INTEGER                             , INTENT( in    ) ::   Kaa       ! Time level index
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT( inout ) ::   puu, pvv  ! Ocean velocities (to be updated at open boundaries)
       TYPE(OBC_INDEX)                     , INTENT( in    ) ::   idx       ! OBC indices
       INTEGER                             , INTENT( in    ) ::   ib_bdy    ! BDY set index
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdyini.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdyini.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdyini.F90	(revision 14219)
@@ -1801,2 +1801,3 @@
    !!=================================================================================
 END MODULE bdyini
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdylib.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdylib.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdylib.F90	(revision 14219)
@@ -45,5 +45,5 @@
       TYPE(OBC_INDEX),                     INTENT(in) ::   idx  ! OBC indices
       REAL(wp), DIMENSION(:,:), POINTER,   INTENT(in) ::   dta  ! OBC external data
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   phia  ! tracer trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   phia  ! tracer trend
       !!
       REAL(wp) ::   zwgt           ! boundary weight
@@ -74,5 +74,5 @@
       TYPE(OBC_INDEX),                     INTENT(in) ::   idx  ! OBC indices
       REAL(wp), DIMENSION(:,:), POINTER,   INTENT(in) ::   dta  ! OBC external data
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   phia  ! tracer trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   phia  ! tracer trend
       !!
       INTEGER  ::   ib, ik, igrd   ! dummy loop indices
@@ -102,6 +102,6 @@
       TYPE(OBC_INDEX),                   INTENT(in   ) ::   idx  ! OBC indices
       REAL(wp), DIMENSION(:,:), POINTER, INTENT(in   ) ::   dta  ! OBC external data
-      REAL(wp), DIMENSION(jpi,jpj,jpk),  INTENT(inout) ::   phib  ! before tracer field
-      REAL(wp), DIMENSION(jpi,jpj,jpk),  INTENT(inout) ::   phia  ! tracer trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk),  INTENT(inout) ::   phib  ! before tracer field
+      REAL(dp), DIMENSION(jpi,jpj,jpk),  INTENT(inout) ::   phia  ! tracer trend
       LOGICAL ,                          INTENT(in   ) ::   lrim0   ! indicate if rim 0 is treated
       LOGICAL ,                          INTENT(in   ) ::   ll_npo  ! switch for NPO version
@@ -112,5 +112,5 @@
       igrd = 1                       ! Everything is at T-points here
       !
-      CALL bdy_orlanski_3d( idx, igrd, phib(:,:,:), phia(:,:,:), dta, lrim0, ll_npo )
+CALL bdy_orlanski_3d( idx, igrd, REAL(phib(:,:,:), wp), phia(:,:,:), dta, lrim0, ll_npo )
       !
    END SUBROUTINE bdy_orl
@@ -152,6 +152,6 @@
       REAL(wp), POINTER, DIMENSION(:,:)          :: zmask_xdif ! land/sea mask for x-derivatives
       REAL(wp), POINTER, DIMENSION(:,:)          :: zmask_ydif ! land/sea mask for y-derivatives
-      REAL(wp), POINTER, DIMENSION(:,:)          :: pe_xdif    ! scale factors for x-derivatives
-      REAL(wp), POINTER, DIMENSION(:,:)          :: pe_ydif    ! scale factors for y-derivatives
+      REAL(dp), POINTER, DIMENSION(:,:)          :: pe_xdif    ! scale factors for x-derivatives
+      REAL(dp), POINTER, DIMENSION(:,:)          :: pe_ydif    ! scale factors for y-derivatives
       !!----------------------------------------------------------------------
       !
@@ -293,5 +293,5 @@
       INTEGER ,                            INTENT(in   ) ::   igrd     ! grid index
       REAL(wp), DIMENSION(:,:,:),          INTENT(in   ) ::   phib     ! model before 3D field
-      REAL(wp), DIMENSION(:,:,:),          INTENT(inout) ::   phia     ! model after 3D field (to be updated)
+      REAL(dp), DIMENSION(:,:,:),          INTENT(inout) ::   phia     ! model after 3D field (to be updated)
       REAL(wp), DIMENSION(:,:  ), POINTER, INTENT(in   ) ::   phi_ext  ! external forcing data
       LOGICAL ,                            INTENT(in   ) ::   lrim0    ! indicate if rim 0 is treated
@@ -314,6 +314,6 @@
       REAL(wp), POINTER, DIMENSION(:,:,:)        :: zmask_xdif ! land/sea mask for x-derivatives
       REAL(wp), POINTER, DIMENSION(:,:,:)        :: zmask_ydif ! land/sea mask for y-derivatives
-      REAL(wp), POINTER, DIMENSION(:,:)          :: pe_xdif    ! scale factors for x-derivatives
-      REAL(wp), POINTER, DIMENSION(:,:)          :: pe_ydif    ! scale factors for y-derivatives
+      REAL(dp), POINTER, DIMENSION(:,:)          :: pe_xdif    ! scale factors for x-derivatives
+      REAL(dp), POINTER, DIMENSION(:,:)          :: pe_ydif    ! scale factors for y-derivatives
       !!----------------------------------------------------------------------
       !
@@ -458,5 +458,5 @@
       !!----------------------------------------------------------------------
       INTEGER,                    INTENT(in   )  ::   igrd     ! grid index
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout)  ::   phia     ! model after 3D field (to be updated), must be masked
+      REAL(dp), DIMENSION(:,:,:), INTENT(inout)  ::   phia     ! model after 3D field (to be updated), must be masked
       TYPE(OBC_INDEX),            INTENT(in   )  ::   idx      ! OBC indices
       LOGICAL ,                   INTENT(in   )  ::   lrim0    ! indicate if rim 0 is treated
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdytides.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdytides.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdytides.F90	(revision 14219)
@@ -162,11 +162,11 @@
                !
                ! SSH fields
-               clfile = TRIM(filtide)//'_grid_T.nc'
-               CALL iom_open( clfile , inum ) 
-               igrd = 1                       ! Everything is at T-points here
-               DO itide = 1, nb_harmo
-                  CALL iom_get( inum, jpdom_auto, TRIM(tide_harmonics(itide)%cname_tide)//'_z1', ztr(:,:) )
-                  CALL iom_get( inum, jpdom_auto, TRIM(tide_harmonics(itide)%cname_tide)//'_z2', zti(:,:) ) 
-                  IF( ASSOCIATED(dta%ssh) ) THEN   ! we use bdy ssh on this mpi subdomain
+               IF( ASSOCIATED(dta%ssh) ) THEN   ! we use bdy ssh on this mpi subdomain
+                  clfile = TRIM(filtide)//'_grid_T.nc'
+                  CALL iom_open( clfile , inum ) 
+                  igrd = 1                       ! Everything is at T-points here
+                  DO itide = 1, nb_harmo
+                     CALL iom_get( inum, jpdom_auto, TRIM(tide_harmonics(itide)%cname_tide)//'_z1', ztr(:,:) )
+                     CALL iom_get( inum, jpdom_auto, TRIM(tide_harmonics(itide)%cname_tide)//'_z2', zti(:,:) ) 
                      DO ib = 1, SIZE(dta%ssh)
                         ii = idx_bdy(ib_bdy)%nbi(ib,igrd)
@@ -175,16 +175,16 @@
                         td%ssh0(ib,itide,2) = zti(ii,ij)
                      END DO
-                  ENDIF
-               END DO
-               CALL iom_close( inum )
+                  END DO
+                  CALL iom_close( inum )
+               ENDIF
                !
                ! U fields
-               clfile = TRIM(filtide)//'_grid_U.nc'
-               CALL iom_open( clfile , inum ) 
-               igrd = 2                       ! Everything is at U-points here
-               DO itide = 1, nb_harmo
-                  CALL iom_get(inum, jpdom_auto, TRIM(tide_harmonics(itide)%cname_tide)//'_u1', ztr(:,:),cd_type='U',psgn=-1._wp)
-                  CALL iom_get(inum, jpdom_auto, TRIM(tide_harmonics(itide)%cname_tide)//'_u2', zti(:,:),cd_type='U',psgn=-1._wp)
-                  IF( ASSOCIATED(dta%u2d) ) THEN   ! we use bdy u2d on this mpi subdomain
+               IF( ASSOCIATED(dta%u2d) ) THEN   ! we use bdy u2d on this mpi subdomain
+                  clfile = TRIM(filtide)//'_grid_U.nc'
+                  CALL iom_open( clfile , inum ) 
+                  igrd = 2                       ! Everything is at U-points here
+                  DO itide = 1, nb_harmo
+                     CALL iom_get(inum, jpdom_auto, TRIM(tide_harmonics(itide)%cname_tide)//'_u1', ztr(:,:),cd_type='U',psgn=-1._wp)
+                     CALL iom_get(inum, jpdom_auto, TRIM(tide_harmonics(itide)%cname_tide)//'_u2', zti(:,:),cd_type='U',psgn=-1._wp)
                      DO ib = 1, SIZE(dta%u2d)
                         ii = idx_bdy(ib_bdy)%nbi(ib,igrd)
@@ -193,16 +193,16 @@
                         td%u0(ib,itide,2) = zti(ii,ij)
                      END DO
-                  ENDIF 
-               END DO 
-               CALL iom_close( inum )
+                  END DO
+                  CALL iom_close( inum )
+               ENDIF
                !
                ! V fields
-               clfile = TRIM(filtide)//'_grid_V.nc'
-               CALL iom_open( clfile , inum ) 
-               igrd = 3                       ! Everything is at V-points here
-               DO itide = 1, nb_harmo
-                  CALL iom_get(inum, jpdom_auto, TRIM(tide_harmonics(itide)%cname_tide)//'_v1', ztr(:,:),cd_type='V',psgn=-1._wp)
-                  CALL iom_get(inum, jpdom_auto, TRIM(tide_harmonics(itide)%cname_tide)//'_v2', zti(:,:),cd_type='V',psgn=-1._wp)
-                  IF( ASSOCIATED(dta%v2d) ) THEN   ! we use bdy v2d on this mpi subdomain
+               IF( ASSOCIATED(dta%v2d) ) THEN   ! we use bdy v2d on this mpi subdomain
+                  clfile = TRIM(filtide)//'_grid_V.nc'
+                  CALL iom_open( clfile , inum ) 
+                  igrd = 3                       ! Everything is at V-points here
+                  DO itide = 1, nb_harmo
+                     CALL iom_get(inum, jpdom_auto, TRIM(tide_harmonics(itide)%cname_tide)//'_v1', ztr(:,:),cd_type='V',psgn=-1._wp)
+                     CALL iom_get(inum, jpdom_auto, TRIM(tide_harmonics(itide)%cname_tide)//'_v2', zti(:,:),cd_type='V',psgn=-1._wp)
                      DO ib = 1, SIZE(dta%v2d)
                         ii = idx_bdy(ib_bdy)%nbi(ib,igrd)
@@ -211,7 +211,7 @@
                         td%v0(ib,itide,2) = zti(ii,ij)
                      END DO
-                  ENDIF 
-               END DO
-               CALL iom_close( inum )
+                  END DO
+                  CALL iom_close( inum )
+               ENDIF
                !
                DEALLOCATE( ztr, zti ) 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdytra.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdytra.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/BDY/bdytra.F90	(revision 14219)
@@ -49,5 +49,5 @@
       INTEGER                                  , INTENT(in)    :: kt        ! Main time step counter
       INTEGER                                  , INTENT(in)    :: Kbb, Kaa  ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts       ! tracer fields
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts       ! tracer fields
       !
       INTEGER                        :: ib_bdy, jn, igrd, ir   ! Loop indeces
@@ -118,5 +118,5 @@
       !!----------------------------------------------------------------------
       TYPE(OBC_INDEX),                     INTENT(in) ::   idx      ! OBC indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pt       ! tracer trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pt       ! tracer trend
       INTEGER,                             INTENT(in) ::   jpa      ! TRA index
       LOGICAL,                             INTENT(in) ::   llrim0   ! indicate if rim 0 is treated
@@ -149,5 +149,5 @@
       INTEGER                                  , INTENT(in)    :: kt        ! time step
       INTEGER                                  , INTENT(in)    :: Kbb, Krhs ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts       ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts       ! active tracers and RHS of tracer equation
       !
       REAL(wp) ::   zwgt           ! boundary weight
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/CRS/crsfld.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/CRS/crsfld.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/CRS/crsfld.F90	(revision 14219)
@@ -34,4 +34,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -101,5 +102,5 @@
       !  Temperature
       zt(:,:,:) = ts(:,:,:,jp_tem,Kmm)  ;      zt_crs(:,:,:) = 0._wp
-      CALL crs_dom_ope( zt, 'VOL', 'T', tmask, zt_crs, p_e12=e1e2t, p_e3=ze3t, psgn=1.0_wp )
+      CALL crs_dom_ope( zt, 'VOL', 'T', tmask, zt_crs, p_e12=CASTWP(e1e2t), p_e3=ze3t, psgn=1.0_wp )
       tsn_crs(:,:,:,jp_tem) = zt_crs(:,:,:)
 
@@ -110,5 +111,5 @@
       !  Salinity
       zs(:,:,:) = ts(:,:,:,jp_sal,Kmm)  ;      zs_crs(:,:,:) = 0._wp
-      CALL crs_dom_ope( zs, 'VOL', 'T', tmask, zs_crs, p_e12=e1e2t, p_e3=ze3t, psgn=1.0_wp )
+      CALL crs_dom_ope( zs, 'VOL', 'T', tmask, zs_crs, p_e12=CASTWP(e1e2t), p_e3=ze3t, psgn=1.0_wp )
       tsn_crs(:,:,:,jp_sal) = zt_crs(:,:,:)
 
@@ -117,5 +118,5 @@
 
       !  U-velocity
-      CALL crs_dom_ope( uu(:,:,:,Kmm), 'SUM', 'U', umask, un_crs, p_e12=e2u, p_e3=ze3u, p_surf_crs=e2e3u_msk, psgn=-1.0_wp )
+      CALL crs_dom_ope( CASTWP(uu(:,:,:,Kmm)), 'SUM', 'U', umask, un_crs, p_e12=CASTWP(e2u), p_e3=ze3u, p_surf_crs=e2e3u_msk, psgn=-1.0_wp )
       !
       zt(:,:,:) = 0._wp     ;    zs(:,:,:) = 0._wp  ;   zt_crs(:,:,:) = 0._wp   ;    zs_crs(:,:,:) = 0._wp
@@ -132,5 +133,5 @@
 
       !  V-velocity
-      CALL crs_dom_ope( vv(:,:,:,Kmm), 'SUM', 'V', vmask, vn_crs, p_e12=e1v, p_e3=ze3v, p_surf_crs=e1e3v_msk, psgn=-1.0_wp )
+      CALL crs_dom_ope( CASTWP(vv(:,:,:,Kmm)), 'SUM', 'V', vmask, vn_crs, p_e12=CASTWP(e1v), p_e3=ze3v, p_surf_crs=e1e3v_msk, psgn=-1.0_wp )
       !                                                                                 
       zt(:,:,:) = 0._wp     ;    zs(:,:,:) = 0._wp  ;   zt_crs(:,:,:) = 0._wp   ;    zs_crs(:,:,:) = 0._wp
@@ -158,5 +159,5 @@
          CALL lbc_lnk( 'crsfld', z3d, 'T', 1.0_wp )
          !
-         CALL crs_dom_ope( z3d, 'VOL', 'T', tmask, zt_crs, p_e12=e1e2t, p_e3=ze3t, psgn=1.0_wp )
+         CALL crs_dom_ope( z3d, 'VOL', 'T', tmask, zt_crs, p_e12=CASTWP(e1e2t), p_e3=ze3t, psgn=1.0_wp )
          CALL iom_put( "ke", zt_crs )
       ENDIF
@@ -183,5 +184,5 @@
       !  W-velocity
       IF( ln_crs_wn ) THEN
-         CALL crs_dom_ope( ww, 'SUM', 'W', tmask, wn_crs, p_e12=e1e2t, p_surf_crs=e1e2w_msk, psgn=1.0_wp )
+         CALL crs_dom_ope( ww, 'SUM', 'W', tmask, wn_crs, p_e12=CASTWP(e1e2t), p_surf_crs=e1e2w_msk, psgn=1.0_wp )
        !  CALL crs_dom_ope( ww, 'VOL', 'W', tmask, wn_crs, p_e12=e1e2t, p_e3=ze3w )
       ELSE
@@ -197,12 +198,12 @@
       SELECT CASE ( nn_crs_kz )
          CASE ( 0 )
-            CALL crs_dom_ope( avt, 'VOL', 'W', tmask, avt_crs, p_e12=e1e2t, p_e3=ze3w, psgn=1.0_wp )
-            CALL crs_dom_ope( avs, 'VOL', 'W', tmask, avs_crs, p_e12=e1e2t, p_e3=ze3w, psgn=1.0_wp )
+            CALL crs_dom_ope( avt, 'VOL', 'W', tmask, avt_crs, p_e12=CASTWP(e1e2t), p_e3=ze3w, psgn=1.0_wp )
+            CALL crs_dom_ope( avs, 'VOL', 'W', tmask, avs_crs, p_e12=CASTWP(e1e2t), p_e3=ze3w, psgn=1.0_wp )
          CASE ( 1 )
-            CALL crs_dom_ope( avt, 'MAX', 'W', tmask, avt_crs, p_e12=e1e2t, p_e3=ze3w, psgn=1.0_wp )
-            CALL crs_dom_ope( avs, 'MAX', 'W', tmask, avs_crs, p_e12=e1e2t, p_e3=ze3w, psgn=1.0_wp )
+            CALL crs_dom_ope( avt, 'MAX', 'W', tmask, avt_crs, p_e12=CASTWP(e1e2t), p_e3=ze3w, psgn=1.0_wp )
+            CALL crs_dom_ope( avs, 'MAX', 'W', tmask, avs_crs, p_e12=CASTWP(e1e2t), p_e3=ze3w, psgn=1.0_wp )
          CASE ( 2 )
-            CALL crs_dom_ope( avt, 'MIN', 'W', tmask, avt_crs, p_e12=e1e2t, p_e3=ze3w, psgn=1.0_wp )
-            CALL crs_dom_ope( avs, 'MIN', 'W', tmask, avs_crs, p_e12=e1e2t, p_e3=ze3w, psgn=1.0_wp )
+            CALL crs_dom_ope( avt, 'MIN', 'W', tmask, avt_crs, p_e12=CASTWP(e1e2t), p_e3=ze3w, psgn=1.0_wp )
+            CALL crs_dom_ope( avs, 'MIN', 'W', tmask, avs_crs, p_e12=CASTWP(e1e2t), p_e3=ze3w, psgn=1.0_wp )
       END SELECT
       !
@@ -211,14 +212,14 @@
       
       !  sbc fields  
-      CALL crs_dom_ope( ssh(:,:,Kmm) , 'VOL', 'T', tmask, sshn_crs , p_e12=e1e2t, p_e3=ze3t           , psgn=1.0_wp )  
+      CALL crs_dom_ope( CASTWP(ssh(:,:,Kmm)) , 'VOL', 'T', tmask, sshn_crs , p_e12=CASTWP(e1e2t), p_e3=ze3t           , psgn=1.0_wp )  
       CALL crs_dom_ope( utau , 'SUM', 'U', umask, utau_crs , p_e12=e2u  , p_surf_crs=e2u_crs  , psgn=1.0_wp )
       CALL crs_dom_ope( vtau , 'SUM', 'V', vmask, vtau_crs , p_e12=e1v  , p_surf_crs=e1v_crs  , psgn=1.0_wp )
-      CALL crs_dom_ope( wndm , 'SUM', 'T', tmask, wndm_crs , p_e12=e1e2t, p_surf_crs=e1e2t_crs, psgn=1.0_wp )
+      CALL crs_dom_ope( wndm , 'SUM', 'T', tmask, wndm_crs , p_e12=CASTWP(e1e2t), p_surf_crs=e1e2t_crs, psgn=1.0_wp )
       CALL crs_dom_ope( rnf  , 'MAX', 'T', tmask, rnf_crs                                     , psgn=1.0_wp )
-      CALL crs_dom_ope( qsr  , 'SUM', 'T', tmask, qsr_crs  , p_e12=e1e2t, p_surf_crs=e1e2t_crs, psgn=1.0_wp )
-      CALL crs_dom_ope( emp_b, 'SUM', 'T', tmask, emp_b_crs, p_e12=e1e2t, p_surf_crs=e1e2t_crs, psgn=1.0_wp )
-      CALL crs_dom_ope( emp  , 'SUM', 'T', tmask, emp_crs  , p_e12=e1e2t, p_surf_crs=e1e2t_crs, psgn=1.0_wp )
-      CALL crs_dom_ope( sfx  , 'SUM', 'T', tmask, sfx_crs  , p_e12=e1e2t, p_surf_crs=e1e2t_crs, psgn=1.0_wp )
-      CALL crs_dom_ope( fr_i , 'SUM', 'T', tmask, fr_i_crs , p_e12=e1e2t, p_surf_crs=e1e2t_crs, psgn=1.0_wp )
+      CALL crs_dom_ope( qsr  , 'SUM', 'T', tmask, qsr_crs  , p_e12=CASTWP(e1e2t), p_surf_crs=e1e2t_crs, psgn=1.0_wp )
+      CALL crs_dom_ope( emp_b, 'SUM', 'T', tmask, emp_b_crs, p_e12=CASTWP(e1e2t), p_surf_crs=e1e2t_crs, psgn=1.0_wp )
+      CALL crs_dom_ope( emp  , 'SUM', 'T', tmask, emp_crs  , p_e12=CASTWP(e1e2t), p_surf_crs=e1e2t_crs, psgn=1.0_wp )
+      CALL crs_dom_ope( sfx  , 'SUM', 'T', tmask, sfx_crs  , p_e12=CASTWP(e1e2t), p_surf_crs=e1e2t_crs, psgn=1.0_wp )
+      CALL crs_dom_ope( fr_i , 'SUM', 'T', tmask, fr_i_crs , p_e12=CASTWP(e1e2t), p_surf_crs=e1e2t_crs, psgn=1.0_wp )
 
       CALL iom_put( "ssh"      , sshn_crs )   ! ssh output 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/CRS/crsini.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/CRS/crsini.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/CRS/crsini.F90	(revision 14219)
@@ -30,4 +30,5 @@
    !! * Substitutions
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -127,23 +128,23 @@
      !      
      IF ( nresty /= 0 .AND. nrestx /= 0 ) THEN
-        CALL crs_dom_coordinates( gphit, glamt, 'T', gphit_crs, glamt_crs ) 
+        CALL crs_dom_coordinates( CASTWP(gphit), CASTWP(glamt), 'T', gphit_crs, glamt_crs ) 
         CALL crs_dom_coordinates( gphiu, glamu, 'U', gphiu_crs, glamu_crs )       
         CALL crs_dom_coordinates( gphiv, glamv, 'V', gphiv_crs, glamv_crs ) 
-        CALL crs_dom_coordinates( gphif, glamf, 'F', gphif_crs, glamf_crs ) 
+        CALL crs_dom_coordinates( CASTWP(gphif), CASTWP(glamf), 'F', gphif_crs, glamf_crs ) 
      ELSEIF ( nresty /= 0 .AND. nrestx == 0 ) THEN
         CALL crs_dom_coordinates( gphiu, glamu, 'T', gphit_crs, glamt_crs )
         CALL crs_dom_coordinates( gphiu, glamu, 'U', gphiu_crs, glamu_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'V', gphiv_crs, glamv_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'F', gphif_crs, glamf_crs )
+        CALL crs_dom_coordinates( CASTWP(gphif), CASTWP(glamf), 'V', gphiv_crs, glamv_crs )
+        CALL crs_dom_coordinates( CASTWP(gphif), CASTWP(glamf), 'F', gphif_crs, glamf_crs )
      ELSEIF ( nresty == 0 .AND. nrestx /= 0 ) THEN
         CALL crs_dom_coordinates( gphiv, glamv, 'T', gphit_crs, glamt_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'U', gphiu_crs, glamu_crs )
+        CALL crs_dom_coordinates( CASTWP(gphif), CASTWP(glamf), 'U', gphiu_crs, glamu_crs )
         CALL crs_dom_coordinates( gphiv, glamv, 'V', gphiv_crs, glamv_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'F', gphif_crs, glamf_crs )
+        CALL crs_dom_coordinates( CASTWP(gphif), CASTWP(glamf), 'F', gphif_crs, glamf_crs )
      ELSE 
-        CALL crs_dom_coordinates( gphif, glamf, 'T', gphit_crs, glamt_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'U', gphiu_crs, glamu_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'V', gphiv_crs, glamv_crs )
-        CALL crs_dom_coordinates( gphif, glamf, 'F', gphif_crs, glamf_crs )
+        CALL crs_dom_coordinates(CASTWP(gphif),CASTWP(glamf), 'T', gphit_crs, glamt_crs )
+        CALL crs_dom_coordinates(CASTWP(gphif),CASTWP(glamf), 'U', gphiu_crs, glamu_crs )
+        CALL crs_dom_coordinates(CASTWP(gphif),CASTWP(glamf), 'V', gphiv_crs, glamv_crs )
+        CALL crs_dom_coordinates(CASTWP(gphif),CASTWP(glamf), 'F', gphif_crs, glamf_crs )
      ENDIF
 
@@ -153,8 +154,8 @@
      !      3.c.1 Horizontal scale factors
 
-     CALL crs_dom_hgr( e1t, e2t, 'T', e1t_crs, e2t_crs )
-     CALL crs_dom_hgr( e1u, e2u, 'U', e1u_crs, e2u_crs )
-     CALL crs_dom_hgr( e1v, e2v, 'V', e1v_crs, e2v_crs )
-     CALL crs_dom_hgr( e1f, e2f, 'F', e1f_crs, e2f_crs )
+     CALL crs_dom_hgr( CASTWP(e1t), CASTWP(e2t), 'T', e1t_crs, e2t_crs )
+     CALL crs_dom_hgr( CASTWP(e1u), e2u, 'U', e1u_crs, e2u_crs )
+     CALL crs_dom_hgr( e1v, CASTWP(e2v), 'V', e1v_crs, e2v_crs )
+     CALL crs_dom_hgr( CASTWP(e1f), CASTWP(e2f), 'F', e1f_crs, e2f_crs )
 
      e1e2t_crs(:,:) = e1t_crs(:,:) * e2t_crs(:,:)
@@ -184,5 +185,5 @@
 
      !    3.d.2   Surfaces 
-     CALL crs_dom_sfc( tmask, 'W', e1e2w_crs, e1e2w_msk, p_e1=e1t, p_e2=e2t  )
+     CALL crs_dom_sfc( tmask, 'W', e1e2w_crs, e1e2w_msk, p_e1=CASTWP(e1t), p_e2=CASTWP(e2t)  )
      CALL crs_dom_sfc( umask, 'U', e2e3u_crs, e2e3u_msk, p_e2=e2u, p_e3=ze3u )
      CALL crs_dom_sfc( vmask, 'V', e1e3v_crs, e1e3v_msk, p_e1=e1v, p_e3=ze3v )
@@ -193,8 +194,8 @@
      !    3.d.3   Vertical scale factors
      !
-     CALL crs_dom_e3( e1t, e2t, ze3t, e1e2w_crs, 'T', tmask, e3t_crs, e3t_max_crs)
-     CALL crs_dom_e3( e1u, e2u, ze3u, e2e3u_crs, 'U', umask, e3u_crs, e3u_max_crs)
-     CALL crs_dom_e3( e1v, e2v, ze3v, e1e3v_crs, 'V', vmask, e3v_crs, e3v_max_crs)
-     CALL crs_dom_e3( e1t, e2t, ze3w, e1e2w_crs, 'W', tmask, e3w_crs, e3w_max_crs)
+     CALL crs_dom_e3( CASTWP(e1t), CASTWP(e2t), ze3t, e1e2w_crs, 'T', tmask, e3t_crs, e3t_max_crs)
+     CALL crs_dom_e3( CASTWP(e1u), e2u, ze3u, e2e3u_crs, 'U', umask, e3u_crs, e3u_max_crs)
+     CALL crs_dom_e3( e1v, CASTWP(e2v), ze3v, e1e3v_crs, 'V', vmask, e3v_crs, e3v_max_crs)
+     CALL crs_dom_e3( CASTWP(e1t), CASTWP(e2t), ze3w, e1e2w_crs, 'W', tmask, e3w_crs, e3w_max_crs)
 
      ! Replace 0 by e3t_0 or e3w_0
@@ -219,5 +220,5 @@
      !---------------------------------------------------------
      ! 4.a. Ocean volume or area unmasked and masked
-     CALL crs_dom_facvol( tmask, 'T', e1t, e2t, ze3t, ocean_volume_crs_t, facvol_t )
+     CALL crs_dom_facvol( tmask, 'T', CASTWP(e1t), CASTWP(e2t), ze3t, ocean_volume_crs_t, facvol_t )
      !
      bt_crs(:,:,:) = ocean_volume_crs_t(:,:,:) * facvol_t(:,:,:)
@@ -226,5 +227,5 @@
      WHERE( bt_crs /= 0._wp ) r1_bt_crs(:,:,:) = 1._wp / bt_crs(:,:,:)
 
-     CALL crs_dom_facvol( tmask, 'W', e1t, e2t, ze3w, ocean_volume_crs_w, facvol_w )
+     CALL crs_dom_facvol( tmask, 'W', CASTWP(e1t), CASTWP(e2t), ze3w, ocean_volume_crs_w, facvol_w )
      !
      !---------------------------------------------------------
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diaar5.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diaar5.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diaar5.F90	(revision 14219)
@@ -41,4 +41,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -233,5 +234,5 @@
             ztpot(:,:,jpk) = 0._wp
             DO jk = 1, jpkm1
-               ztpot(:,:,jk) = eos_pt_from_ct( ts(:,:,jk,jp_tem,Kmm), ts(:,:,jk,jp_sal,Kmm) )
+               ztpot(:,:,jk) = eos_pt_from_ct( CASTWP(ts(:,:,jk,jp_tem,Kmm)), CASTWP(ts(:,:,jk,jp_sal,Kmm)) )
             END DO
             !
@@ -269,5 +270,5 @@
       ENDIF
 
-      IF( iom_use( 'tnpeo' )) THEN
+      IF( iom_use( 'tnpeo' )) THEN    
         ! Work done against stratification by vertical mixing
         ! Exclude points where rn2 is negative as convection kicks in here and
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diadct.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diadct.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diadct.F90	(revision 14219)
@@ -92,4 +92,5 @@
    !! * Substitutions
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -679,5 +680,5 @@
                   zsn   = interp(Kmm,k%I,k%J,jk,'V',ts(:,:,:,jp_sal,Kmm) ) 
                   zrhop = interp(Kmm,k%I,k%J,jk,'V',rhop) 
-                  zrhoi = interp(Kmm,k%I,k%J,jk,'V',rhd*rho0+rho0) 
+                  zrhoi = interp(Kmm,k%I,k%J,jk,'V',CASTDP(rhd*rho0+rho0)) 
                   zsshn =  0.5*( ssh(k%I,k%J,Kmm) + ssh(k%I,k%J+1,Kmm)    ) * vmask(k%I,k%J,1) 
                CASE(2,3) 
@@ -685,5 +686,5 @@
                   zsn   = interp(Kmm,k%I,k%J,jk,'U',ts(:,:,:,jp_sal,Kmm) ) 
                   zrhop = interp(Kmm,k%I,k%J,jk,'U',rhop) 
-                  zrhoi = interp(Kmm,k%I,k%J,jk,'U',rhd*rho0+rho0) 
+                  zrhoi = interp(Kmm,k%I,k%J,jk,'U',CASTDP(rhd*rho0+rho0)) 
                   zsshn =  0.5*( ssh(k%I,k%J,Kmm) + ssh(k%I+1,k%J,Kmm)    ) * umask(k%I,k%J,1)  
                END SELECT 
@@ -852,5 +853,5 @@
                  zsn   = interp(Kmm,k%I,k%J,jk,'V',ts(:,:,:,jp_sal,Kmm) ) 
                  zrhop = interp(Kmm,k%I,k%J,jk,'V',rhop) 
-                 zrhoi = interp(Kmm,k%I,k%J,jk,'V',rhd*rho0+rho0) 
+                 zrhoi = interp(Kmm,k%I,k%J,jk,'V',CASTDP(rhd*rho0+rho0))
 
               CASE(2,3) 
@@ -858,5 +859,5 @@
                  zsn   = interp(Kmm,k%I,k%J,jk,'U',ts(:,:,:,jp_sal,Kmm) ) 
                  zrhop = interp(Kmm,k%I,k%J,jk,'U',rhop) 
-                 zrhoi = interp(Kmm,k%I,k%J,jk,'U',rhd*rho0+rho0) 
+                 zrhoi = interp(Kmm,k%I,k%J,jk,'U',CASTDP(rhd*rho0+rho0)) 
                  zsshn =  0.5*( ssh(k%I,k%J,Kmm)    + ssh(k%I+1,k%J,Kmm)    ) * umask(k%I,k%J,1)  
               END SELECT 
@@ -1169,5 +1170,5 @@
   INTEGER, INTENT(IN)                          :: ki, kj, kk   ! coordinate of point
   CHARACTER(len=1), INTENT(IN)                 :: cd_point     ! type of point (U, V)
-  REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(IN) :: ptab         ! variable to compute at (ki, kj, kk )
+  REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(IN) :: ptab         ! variable to compute at (ki, kj, kk )
   REAL(wp)                                     :: interp       ! interpolated variable 
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diadetide.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diadetide.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diadetide.F90	(revision 14219)
@@ -6,5 +6,5 @@
    !! History :       !  2019  (S. Mueller)
    !!----------------------------------------------------------------------
-   USE par_oce        , ONLY :   wp, jpi, jpj
+   USE par_oce        , ONLY :   jpi, jpj
    USE in_out_manager , ONLY :   lwp, numout
    USE iom            , ONLY :   iom_put
@@ -12,4 +12,5 @@
    USE phycst         , ONLY :   rpi
    USE tide_mod
+   USE par_kind
 #if defined key_iomput
    USE xios
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diahsb.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diahsb.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diahsb.F90	(revision 14219)
@@ -44,8 +44,10 @@
    REAL(wp) ::   frc_wn_t, frc_wn_s    ! global forcing trends
    !
-   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   surf
-   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   surf_ini      , ssh_ini          !
+   REAL(dp), DIMENSION(:,:)  , ALLOCATABLE ::   surf 
+   REAL(dp), DIMENSION(:,:)  , ALLOCATABLE  :: surf_ini
+   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE :: ssh_ini                            !
    REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   ssh_hc_loc_ini, ssh_sc_loc_ini   !
-   REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   hc_loc_ini, sc_loc_ini, e3t_ini  !
+   REAL(dp), DIMENSION(:,:,:), ALLOCATABLE  :: sc_loc_ini, e3t_ini               !
+   REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   hc_loc_ini                       !
    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   tmask_ini
 
@@ -75,14 +77,15 @@
       INTEGER    ::   ji, jj, jk                  ! dummy loop indice
       REAL(wp)   ::   zdiff_hc    , zdiff_sc      ! heat and salt content variations
-      REAL(wp)   ::   zdiff_hc1   , zdiff_sc1     !  -         -     -        -
-      REAL(wp)   ::   zdiff_v1    , zdiff_v2      ! volume variation
+      REAL(wp)   ::   zdiff_hc1   , zdiff_sc1     !  -         -     -        - 
+      REAL(wp)   ::   zdiff_v1          ! volume variation
+      REAL(dp)   ::   zdiff_v2
       REAL(wp)   ::   zerr_hc1    , zerr_sc1      ! heat and salt content misfit
       REAL(wp)   ::   zvol_tot                    ! volume
       REAL(wp)   ::   z_frc_trd_t , z_frc_trd_s   !    -     -
-      REAL(wp)   ::   z_frc_trd_v                 !    -     -
+      REAL(dp)   ::   z_frc_trd_v                 !    -     -
       REAL(wp)   ::   z_wn_trd_t , z_wn_trd_s     !    -     -
       REAL(wp)   ::   z_ssh_hc , z_ssh_sc         !    -     -
       REAL(wp), DIMENSION(jpi,jpj)       ::   z2d0, z2d1   ! 2D workspace
-      REAL(wp), DIMENSION(jpi,jpj,jpkm1) ::   zwrk         ! 3D workspace
+      REAL(dp), DIMENSION(jpi,jpj,jpkm1) ::   zwrk         ! 3D workspace
       !!---------------------------------------------------------------------------
       IF( ln_timing )   CALL timing_start('dia_hsb')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diahth.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diahth.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diahth.F90	(revision 14219)
@@ -43,4 +43,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -261,5 +262,5 @@
          IF( iom_use ('hc300') ) THEN  
             zzdep = 300.
-            CALL  dia_hth_htc( Kmm, zzdep, ts(:,:,:,jp_tem,Kmm), htc3 )
+            CALL  dia_hth_htc( Kmm, zzdep, CASTWP(ts(:,:,:,jp_tem,Kmm)), htc3 )
             CALL iom_put( 'hc300', rho0_rcp * htc3 )  ! vertically integrated heat content (J/m2)
          ENDIF
@@ -270,5 +271,5 @@
          IF( iom_use ('hc700') ) THEN  
             zzdep = 700.
-            CALL  dia_hth_htc( Kmm, zzdep, ts(:,:,:,jp_tem,Kmm), htc7 )
+            CALL  dia_hth_htc( Kmm, zzdep, CASTWP(ts(:,:,:,jp_tem,Kmm)), htc7 )
             CALL iom_put( 'hc700', rho0_rcp * htc7 )  ! vertically integrated heat content (J/m2)
   
@@ -280,5 +281,5 @@
          IF( iom_use ('hc2000') ) THEN  
             zzdep = 2000.
-            CALL  dia_hth_htc( Kmm, zzdep, ts(:,:,:,jp_tem,Kmm), htc20 )
+            CALL  dia_hth_htc( Kmm, zzdep, CASTWP(ts(:,:,:,jp_tem,Kmm)), htc20 )
             CALL iom_put( 'hc2000', rho0_rcp * htc20 )  ! vertically integrated heat content (J/m2)  
          ENDIF
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diamlr.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diamlr.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diamlr.F90	(revision 14219)
@@ -7,5 +7,5 @@
    !!----------------------------------------------------------------------
 
-   USE par_oce        , ONLY :   wp, jpi, jpj
+   USE par_oce        , ONLY :   jpi, jpj
    USE phycst         , ONLY :   rpi
    USE dom_oce        , ONLY :   adatrj
@@ -15,4 +15,5 @@
    USE iom            , ONLY :   iom_put, iom_use, iom_update_file_name
    USE timing         , ONLY :   timing_start, timing_stop
+   USE par_kind
 #if defined key_iomput
    USE xios
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/dianam.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/dianam.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/dianam.F90	(revision 14219)
@@ -61,6 +61,7 @@
       INTEGER            ::   iyyss, iddss, ihhss, immss       ! number of seconds in 1 year, 1 day, 1 hour and 1 minute
       INTEGER            ::   iyymo                            ! number of months in 1 year
-      REAL(wp)           ::   zsec1, zsec2                     ! not used
-      REAL(wp)           ::   zdrun, zjul                      ! temporary scalars
+      REAL(dp)           ::   zsec1, zsec2                     ! not used
+      REAL(dp)           ::          zjul                      ! temporary scalars
+      REAL(wp)           ::   zdrun                      ! temporary scalars
       !!----------------------------------------------------------------------
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diawri.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diawri.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIA/diawri.F90	(revision 14219)
@@ -1124,16 +1124,16 @@
             CALL iom_rstput( 0, 0, inum, 'rhisf_cav_tbl', rhisf_tbl_cav    )    ! now k-velocity
             CALL iom_rstput( 0, 0, inum, 'rfrac_cav_tbl', rfrac_tbl_cav    )    ! now k-velocity
-            CALL iom_rstput( 0, 0, inum, 'misfkb_cav', REAL(misfkb_cav,wp) )    ! now k-velocity
-            CALL iom_rstput( 0, 0, inum, 'misfkt_cav', REAL(misfkt_cav,wp) )    ! now k-velocity
-            CALL iom_rstput( 0, 0, inum, 'mskisf_cav', REAL(mskisf_cav,wp), ktype = jp_i1 )
+            CALL iom_rstput( 0, 0, inum, 'misfkb_cav', REAL(misfkb_cav,dp) )    ! now k-velocity
+            CALL iom_rstput( 0, 0, inum, 'misfkt_cav', REAL(misfkt_cav,dp) )    ! now k-velocity
+            CALL iom_rstput( 0, 0, inum, 'mskisf_cav', REAL(mskisf_cav,dp), ktype = jp_i1 )
          END IF
          IF (ln_isfpar_mlt) THEN
-            CALL iom_rstput( 0, 0, inum, 'isfmsk_par', REAL(mskisf_par,wp) )    ! now k-velocity
+            CALL iom_rstput( 0, 0, inum, 'isfmsk_par', REAL(mskisf_par,dp) )    ! now k-velocity
             CALL iom_rstput( 0, 0, inum, 'fwfisf_par', fwfisf_par          )    ! now k-velocity
             CALL iom_rstput( 0, 0, inum, 'rhisf_par_tbl', rhisf_tbl_par    )    ! now k-velocity
             CALL iom_rstput( 0, 0, inum, 'rfrac_par_tbl', rfrac_tbl_par    )    ! now k-velocity
-            CALL iom_rstput( 0, 0, inum, 'misfkb_par', REAL(misfkb_par,wp) )    ! now k-velocity
-            CALL iom_rstput( 0, 0, inum, 'misfkt_par', REAL(misfkt_par,wp) )    ! now k-velocity
-            CALL iom_rstput( 0, 0, inum, 'mskisf_par', REAL(mskisf_par,wp), ktype = jp_i1 )
+            CALL iom_rstput( 0, 0, inum, 'misfkb_par', REAL(misfkb_par,dp) )    ! now k-velocity
+            CALL iom_rstput( 0, 0, inum, 'misfkt_par', REAL(misfkt_par,dp) )    ! now k-velocity
+            CALL iom_rstput( 0, 0, inum, 'mskisf_par', REAL(mskisf_par,dp), ktype = jp_i1 )
          END IF
       END IF
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIU/diu_bulk.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIU/diu_bulk.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIU/diu_bulk.F90	(revision 14219)
@@ -97,6 +97,6 @@
       REAL(wp), DIMENSION(jpi,jpj)          , INTENT(in) ::   pqflux         ! heat (non-solar) flux (Watts)
       REAL(wp), DIMENSION(jpi,jpj)          , INTENT(in) ::   ptauflux       ! wind stress  (kg/ m s^2)
-      REAL(wp), DIMENSION(jpi,jpj)          , INTENT(in) ::   prho           ! water density  (kg/m^3)
-      REAL(wp)                              , INTENT(in) ::   p_rdt          ! time-step
+      REAL(dp), DIMENSION(jpi,jpj)          , INTENT(in) ::   prho           ! water density  (kg/m^3)
+      REAL(dp)                              , INTENT(in) ::   p_rdt          ! time-step
       REAL(wp), DIMENSION(jpi,jpj), OPTIONAL, INTENT(in) ::   pLa            ! Langmuir number
       REAL(wp), DIMENSION(jpi,jpj), OPTIONAL, INTENT(in) ::   pthick         ! warm layer thickness (m)
@@ -180,5 +180,5 @@
       ! Dummy variables
       REAL(wp), DIMENSION(jpi,jpj), INTENT(IN) :: p_dsst     ! Delta SST
-      REAL(wp), INTENT(IN)                     :: p_rdt      ! Time-step
+      REAL(dp), INTENT(IN)                     :: p_rdt      ! Time-step
       REAL(wp), DIMENSION(jpi,jpj), INTENT(IN) :: p_abflux   ! Heat forcing
       REAL(wp), DIMENSION(jpi,jpj), INTENT(IN) :: p_fvel     ! Friction velocity
@@ -186,5 +186,5 @@
       REAL(wp), DIMENSION(jpi,jpj), INTENT(IN) :: pmu        ! Structure parameter
       REAL(wp), DIMENSION(jpi,jpj), INTENT(IN) :: pthick     ! Layer thickness
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(IN) :: prho       ! Water density
+      REAL(dp), DIMENSION(jpi,jpj), INTENT(IN) :: prho       ! Water density
    
       ! Local variables
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIU/diu_coolskin.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIU/diu_coolskin.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DIU/diu_coolskin.F90	(revision 14219)
@@ -80,6 +80,6 @@
       REAL(wp), INTENT(IN), DIMENSION(jpi,jpj) :: psqflux     ! Heat (non-solar)(Watts)
       REAL(wp), INTENT(IN), DIMENSION(jpi,jpj) :: pstauflux   ! Wind stress (kg/ m s^2)
-      REAL(wp), INTENT(IN), DIMENSION(jpi,jpj) :: psrho       ! Water density (kg/m^3)
-      REAL(wp), INTENT(IN) :: pDt                             ! Time-step
+      REAL(dp), INTENT(IN), DIMENSION(jpi,jpj) :: psrho       ! Water density (kg/m^3)
+      REAL(dp), INTENT(IN) :: pDt                             ! Time-step
 
       ! Local variables
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/daymod.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/daymod.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/daymod.F90	(revision 14219)
@@ -69,5 +69,5 @@
       !!----------------------------------------------------------------------
       INTEGER  ::   inbday, imonday, isecrst   ! local integers
-      REAL(wp) ::   zjul             ! local scalar
+      REAL(dp) ::   zjul             ! local scalar
       !!----------------------------------------------------------------------
       !
@@ -94,5 +94,5 @@
       isecrst = ( nhour * NINT(rhhmm) + nminute ) * NINT(rmmss)
 
-      CALL ymds2ju( nyear, nmonth, nday, REAL(isecrst,wp), fjulday )
+      CALL ymds2ju( nyear, nmonth, nday, REAL(isecrst,dp), fjulday )  
       IF( ABS(fjulday - REAL(NINT(fjulday),wp)) < 0.1 / rday )   fjulday = REAL(NINT(fjulday),wp)   ! avoid truncation error
       IF( nhour*NINT(rhhmm*rmmss) + nminute*NINT(rmmss) - ndt05 .LT. 0 ) fjulday = fjulday+1.       ! move back to the day at nit000 (and not at nit000 - 1)
@@ -116,5 +116,5 @@
 
       !compute number of days between last Monday and today
-      CALL ymds2ju( 1900, 01, 01, 0.0_wp, zjul )     ! compute julian day value of 01.01.1900 (our reference that was a Monday)
+      CALL ymds2ju( 1900, 01, 01, 0.0_dp, zjul )     ! compute julian day value of 01.01.1900 (our reference that was a Monday)
       inbday = FLOOR(fjulday - zjul)              ! compute nb day between  01.01.1900 and start of current day
       imonday = MOD(inbday, 7)                    ! compute nb day between last monday and current day
@@ -260,5 +260,5 @@
          !
          !compute first day of the year in julian days
-         CALL ymds2ju( nyear, 01, 01, 0.0_wp, fjulstartyear )
+         CALL ymds2ju( nyear, 01, 01, 0.0_dp, fjulstartyear )
          !
          IF(lwp) WRITE(numout,'(a,i8,a,i4.4,a,i2.2,a,i2.2,a,i3.3)') '======>> time-step =', kt,   &
@@ -401,9 +401,9 @@
          ENDIF
          ! calendar control
-         CALL iom_rstput( kt, nitrst, numrow, 'kt'     , REAL( kt    , wp)   )   ! time-step
-         CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, wp)   )   ! date
+         CALL iom_rstput( kt, nitrst, numrow, 'kt'     , REAL( kt    , dp)   )   ! time-step
+         CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, dp)   )   ! date
          CALL iom_rstput( kt, nitrst, numrow, 'adatrj' , adatrj              )   ! number of elapsed days since
          !                                                                                                   ! the begining of the run [s]
-         CALL iom_rstput( kt, nitrst, numrow, 'ntime'  , REAL( nn_time0, wp) ) ! time
+         CALL iom_rstput( kt, nitrst, numrow, 'ntime'  , REAL( nn_time0, dp) ) ! time
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/dom_oce.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/dom_oce.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/dom_oce.F90	(revision 14219)
@@ -34,6 +34,6 @@
    LOGICAL , PUBLIC ::   ln_linssh      !: =T  linear free surface ==>> model level are fixed in time
    LOGICAL , PUBLIC ::   ln_meshmask    !: =T  create a mesh-mask file (mesh_mask.nc)
-   REAL(wp), PUBLIC ::   rn_Dt          !: time step for the dynamics and tracer
-   REAL(wp), PUBLIC ::   rn_atfp        !: asselin time filter parameter
+   REAL(dp), PUBLIC ::   rn_Dt          !: time step for the dynamics and tracer
+   REAL(dp), PUBLIC ::   rn_atfp        !: asselin time filter parameter
    LOGICAL , PUBLIC ::   ln_1st_euler   !: =T start with forward time step or not (=F)
    LOGICAL , PUBLIC ::   ln_crs         !: Apply grid coarsening to dynamical model output or online passive tracers
@@ -123,14 +123,22 @@
    !! horizontal curvilinear coordinate and scale factors
    !! ---------------------------------------------------------------------
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   glamt , glamu, glamv , glamf    !: longitude at t, u, v, f-points [degree]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   gphit , gphiu, gphiv , gphif    !: latitude  at t, u, v, f-points [degree]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   e1t   , e2t  , r1_e1t, r1_e2t   !: t-point horizontal scale factors    [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   e1u   , e2u  , r1_e1u, r1_e2u   !: horizontal scale factors at u-point [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   e1v   , e2v  , r1_e1v, r1_e2v   !: horizontal scale factors at v-point [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   e1f   , e2f  , r1_e1f, r1_e2f   !: horizontal scale factors at f-point [m]
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   glamt , glamf
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   glamu , glamv     !: longitude at t, u, v, f-points [degree]
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   gphit , gphif
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   gphiu , gphiv     !: latitude  at t, u, v, f-points [degree]
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   e1t   , e2t
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   r1_e1t, r1_e2t   !: t-point horizontal scale factors    [m]
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   e1u
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   e2u  , r1_e1u, r1_e2u   !: horizontal scale factors at u-point [m]
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   e2v
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   e1v   , r1_e1v, r1_e2v   !: horizontal scale factors at v-point [m]
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   e1f
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   e2f
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, TARGET, DIMENSION(:,:) ::   r1_e1f, r1_e2f   !: horizontal scale factors at f-point [m]
    !
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2t , r1_e1e2t                !: associated metrics at t-point
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2u , r1_e1e2u , e2_e1u       !: associated metrics at u-point
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2v , r1_e1e2v , e1_e2v       !: associated metrics at v-point
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2t
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   r1_e1e2t                !: associated metrics at t-point
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2u , e2_e1u, r1_e1e2u        !: associated metrics at u-point
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2v , e1_e2v, r1_e1e2v        !: associated metrics at v-point
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE        , DIMENSION(:,:) ::   e1e2f , r1_e1e2f                !: associated metrics at f-point
    !
@@ -155,5 +163,5 @@
    LOGICAL, PUBLIC ::   ln_isfcav    !: presence of ISF
    !                                                        !  reference scale factors
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3t_0   !: t- vert. scale factor [m]
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3t_0   !: t- vert. scale factor [m]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3u_0   !: u- vert. scale factor [m]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::     e3v_0   !: v- vert. scale factor [m]
@@ -162,7 +170,7 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::    e3uw_0   !: uw-vert. scale factor [m]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::    e3vw_0   !: vw-vert. scale factor [m]
-
-   !                                                        !  time-dependent scale factors     (domvvl)
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   e3t, e3u, e3v, e3w, e3uw, e3vw  !: vert. scale factor [m]
+   !                                                        !  time-dependent scale factors
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   e3t
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   e3u, e3v, e3w, e3uw, e3vw  !: vert. scale factor [m]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   e3f                             !: F-point vert. scale factor [m]
 
@@ -173,14 +181,15 @@
 
    !                                                        !  reference depths of cells
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   gdept_0  !: t- depth              [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   gdepw_0  !: w- depth              [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   gde3w_0  !: w- depth (sum of e3w) [m]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   gdept_0  !: t- depth              [m]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   gdepw_0  !: w- depth              [m]
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   gde3w_0  !: w- depth (sum of e3w) [m]
+   !                                                        !  time-dependent depths of cells
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  gdept
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  gdepw  
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  gde3w  
    
-   !                                                        !  time-dependent depths of cells   (domvvl)
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  gdept, gdepw
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  gde3w
-
    !                                                        !  reference heights of ocean water column and its inverse
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::   ht_0, r1_ht_0   !: t-depth        [m] and [1/m]
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::   ht_0
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::   r1_ht_0   !: t-depth        [m] and [1/m]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::   hu_0, r1_hu_0   !: u-depth        [m] and [1/m]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::   hv_0, r1_hv_0   !: v-depth        [m] and [1/m]
@@ -234,6 +243,6 @@
    INTEGER , PUBLIC ::   nsec_monday   !: seconds between 00h         of the last Monday   and half of the current time step
    INTEGER , PUBLIC ::   nsec_day      !: seconds between 00h         of the current   day and half of the current time step
-   REAL(wp), PUBLIC ::   fjulday       !: current julian day
-   REAL(wp), PUBLIC ::   fjulstartyear !: first day of the current year in julian days
+   REAL(dp), PUBLIC ::   fjulday       !: current julian day 
+   REAL(dp), PUBLIC ::   fjulstartyear !: first day of the current year in julian days
    REAL(wp), PUBLIC ::   adatrj        !: number of elapsed days since the begining of the whole simulation
    !                                   !: (cumulative duration of previous runs that may have used different time-step size)
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domain.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domain.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domain.F90	(revision 14219)
@@ -597,5 +597,5 @@
       LOGICAL, DIMENSION(jpi,jpj) ::   llmsk
       INTEGER, DIMENSION(2)       ::   imil, imip, imi1, imi2, imal, imap, ima1, ima2
-      REAL(wp)                    ::   zglmin, zglmax, zgpmin, zgpmax, ze1min, ze1max, ze2min, ze2max
+      REAL(dp)                    ::   zglmin, zglmax, zgpmin, zgpmax, ze1min, ze1max, ze2min, ze2max
       !!----------------------------------------------------------------------
       !
@@ -739,13 +739,13 @@
       !
       !                                   ! lateral boundary of the global domain
-      CALL iom_rstput( 0, 0, inum, 'jperio', REAL( jperio, wp), ktype = jp_i4 )
+      CALL iom_rstput( 0, 0, inum, 'jperio', REAL( jperio, dp), ktype = jp_i4 )
       !
       !                                   ! type of vertical coordinate
-      CALL iom_rstput( 0, 0, inum, 'ln_zco', REAL(COUNT((/ln_zco/)), wp), ktype = jp_i4 )
-      CALL iom_rstput( 0, 0, inum, 'ln_zps', REAL(COUNT((/ln_zps/)), wp), ktype = jp_i4 )
-      CALL iom_rstput( 0, 0, inum, 'ln_sco', REAL(COUNT((/ln_sco/)), wp), ktype = jp_i4 )
+      CALL iom_rstput( 0, 0, inum, 'ln_zco', REAL(COUNT((/ln_zco/)), dp), ktype = jp_i4 )
+      CALL iom_rstput( 0, 0, inum, 'ln_zps', REAL(COUNT((/ln_zps/)), dp), ktype = jp_i4 )
+      CALL iom_rstput( 0, 0, inum, 'ln_sco', REAL(COUNT((/ln_sco/)), dp), ktype = jp_i4 )
       !
       !                                   ! ocean cavities under iceshelves
-      CALL iom_rstput( 0, 0, inum, 'ln_isfcav', REAL(COUNT((/ln_isfcav/)), wp), ktype = jp_i4 )
+      CALL iom_rstput( 0, 0, inum, 'ln_isfcav', REAL(COUNT((/ln_isfcav/)), dp), ktype = jp_i4 )
       !
       !                             !==  horizontal mesh  !
@@ -789,6 +789,6 @@
       !                             !==  wet top and bottom level  ==!   (caution: multiplied by ssmask)
       !
-      CALL iom_rstput( 0, 0, inum, 'top_level'    , REAL( mikt, wp )*ssmask , ktype = jp_i4 )   ! nb of ocean T-points (ISF)
-      CALL iom_rstput( 0, 0, inum, 'bottom_level' , REAL( mbkt, wp )*ssmask , ktype = jp_i4 )   ! nb of ocean T-points
+      CALL iom_rstput( 0, 0, inum, 'top_level'    , REAL( mikt, dp )*ssmask , ktype = jp_i4 )   ! nb of ocean T-points (ISF)
+      CALL iom_rstput( 0, 0, inum, 'bottom_level' , REAL( mbkt, dp )*ssmask , ktype = jp_i4 )   ! nb of ocean T-points
       !
       IF( ln_sco ) THEN             ! s-coordinate: store grid stiffness ratio  (Not required anyway)
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domhgr.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domhgr.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domhgr.F90	(revision 14219)
@@ -167,10 +167,14 @@
       !!
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(:,:), INTENT(out) ::   plamt, plamu, plamv, plamf   ! longitude outputs 
-      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pphit, pphiu, pphiv, pphif   ! latitude outputs
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: plamt, plamf
+      REAL(wp), DIMENSION(:,:), INTENT(out) :: plamu, plamv   ! longitude outputs 
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: pphit, pphif
+      REAL(wp), DIMENSION(:,:), INTENT(out) :: pphiu, pphiv   ! latitude outputs
       INTEGER                 , INTENT(out) ::   kff                          ! =1 Coriolis parameter read here, =0 otherwise
       REAL(wp), DIMENSION(:,:), INTENT(out) ::   pff_f, pff_t                 ! Coriolis factor at f-point (if found in file)
-      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1t, pe1u, pe1v, pe1f       ! i-scale factors 
-      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe2t, pe2u, pe2v, pe2f       ! j-scale factors
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: pe1t, pe1u, pe1f 
+      REAL(wp), DIMENSION(:,:), INTENT(out) :: pe1v       ! i-scale factors 
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: pe2t, pe2v, pe2f
+      REAL(wp), DIMENSION(:,:), INTENT(out) :: pe2u       ! j-scale factors
       INTEGER                 , INTENT(out) ::   ke1e2u_v                     ! =1 u- & v-surfaces read here, =0 otherwise 
       REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1e2u, pe1e2v              ! u- & v-surfaces (if found in file)
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domqco.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domqco.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domqco.F90	(revision 14219)
@@ -57,4 +57,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -117,9 +118,9 @@
       !                                ! Horizontal interpolation of e3t
 #if defined key_RK3
-      CALL dom_qco_r3c( ssh(:,:,Kbb), r3t(:,:,Kbb), r3u(:,:,Kbb), r3v(:,:,Kbb), r3f(:,:) )
-      CALL dom_qco_r3c( ssh(:,:,Kmm), r3t(:,:,Kmm), r3u(:,:,Kmm), r3v(:,:,Kmm)           )
+      CALL dom_qco_r3c( CASTWP(ssh(:,:,Kbb)), r3t(:,:,Kbb), r3u(:,:,Kbb), r3v(:,:,Kbb), r3f(:,:) )
+      CALL dom_qco_r3c( CASTWP(ssh(:,:,Kmm)), r3t(:,:,Kmm), r3u(:,:,Kmm), r3v(:,:,Kmm)           )
 #else
-      CALL dom_qco_r3c( ssh(:,:,Kbb), r3t(:,:,Kbb), r3u(:,:,Kbb), r3v(:,:,Kbb)           )
-      CALL dom_qco_r3c( ssh(:,:,Kmm), r3t(:,:,Kmm), r3u(:,:,Kmm), r3v(:,:,Kmm), r3f(:,:) )
+      CALL dom_qco_r3c( CASTWP(ssh(:,:,Kbb)), r3t(:,:,Kbb), r3u(:,:,Kbb), r3v(:,:,Kbb)           )
+      CALL dom_qco_r3c( CASTWP(ssh(:,:,Kmm)), r3t(:,:,Kmm), r3u(:,:,Kmm), r3v(:,:,Kmm), r3f(:,:) )
 #endif
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domutl.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domutl.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domutl.F90	(revision 14219)
@@ -22,5 +22,6 @@
 
    INTERFACE is_tile
-      MODULE PROCEDURE is_tile_2d, is_tile_3d, is_tile_4d
+      MODULE PROCEDURE is_tile_2d_sp, is_tile_3d_sp, is_tile_4d_sp
+      MODULE PROCEDURE is_tile_2d_dp, is_tile_3d_dp, is_tile_4d_dp
    END INTERFACE is_tile
 
@@ -108,5 +109,5 @@
       !
       puniq(:,:) = ztstref(:,:)                    ! default definition
-      CALL lbc_lnk( 'domwri', puniq, cdgrd, 1. )   ! apply boundary conditions
+      CALL lbc_lnk( 'domwri', puniq, cdgrd, 1._wp )   ! apply boundary conditions
       lluniq(:,:,1) = puniq(:,:) == ztstref(:,:)   ! check which values have not been changed
       !
@@ -116,41 +117,80 @@
 
 
-   FUNCTION is_tile_2d( pt )
+   FUNCTION is_tile_2d_sp( pt )
       !!
-      REAL(wp), DIMENSION(:,:), INTENT(in) ::   pt
-      INTEGER :: is_tile_2d
+      REAL(sp), DIMENSION(:,:), INTENT(in) ::   pt
+      INTEGER :: is_tile_2d_sp
       !!
       IF( ln_tile .AND. (SIZE(pt, 1) < jpi .OR. SIZE(pt, 2) < jpj) ) THEN
-         is_tile_2d = 1
+         is_tile_2d_sp = 1
       ELSE
-         is_tile_2d = 0
+         is_tile_2d_sp = 0
       ENDIF
-   END FUNCTION is_tile_2d
+   END FUNCTION is_tile_2d_sp
 
 
-   FUNCTION is_tile_3d( pt )
+   FUNCTION is_tile_3d_sp( pt )
       !!
-      REAL(wp), DIMENSION(:,:,:), INTENT(in) ::   pt
-      INTEGER :: is_tile_3d
+      REAL(sp), DIMENSION(:,:,:), INTENT(in) ::   pt
+      INTEGER :: is_tile_3d_sp
       !!
       IF( ln_tile .AND. (SIZE(pt, 1) < jpi .OR. SIZE(pt, 2) < jpj) ) THEN
-         is_tile_3d = 1
+         is_tile_3d_sp = 1
       ELSE
-         is_tile_3d = 0
+         is_tile_3d_sp = 0
       ENDIF
-   END FUNCTION is_tile_3d
+   END FUNCTION is_tile_3d_sp
 
 
-   FUNCTION is_tile_4d( pt )
+   FUNCTION is_tile_4d_sp( pt )
       !!
-      REAL(wp), DIMENSION(:,:,:,:), INTENT(in) ::   pt
-      INTEGER :: is_tile_4d
+      REAL(sp), DIMENSION(:,:,:,:), INTENT(in) ::   pt
+      INTEGER :: is_tile_4d_sp
       !!
       IF( ln_tile .AND. (SIZE(pt, 1) < jpi .OR. SIZE(pt, 2) < jpj) ) THEN
-         is_tile_4d = 1
+         is_tile_4d_sp = 1
       ELSE
-         is_tile_4d = 0
+         is_tile_4d_sp = 0
       ENDIF
-   END FUNCTION is_tile_4d
+   END FUNCTION is_tile_4d_sp
+
+   FUNCTION is_tile_2d_dp( pt )
+      !!
+      REAL(dp), DIMENSION(:,:), INTENT(in) ::   pt
+      INTEGER :: is_tile_2d_dp
+      !!
+      IF( ln_tile .AND. (SIZE(pt, 1) < jpi .OR. SIZE(pt, 2) < jpj) ) THEN
+         is_tile_2d_dp = 1
+      ELSE
+         is_tile_2d_dp = 0
+      ENDIF
+   END FUNCTION is_tile_2d_dp
+
+
+   FUNCTION is_tile_3d_dp( pt )
+      !!
+      REAL(dp), DIMENSION(:,:,:), INTENT(in) ::   pt
+      INTEGER :: is_tile_3d_dp
+      !!
+      IF( ln_tile .AND. (SIZE(pt, 1) < jpi .OR. SIZE(pt, 2) < jpj) ) THEN
+         is_tile_3d_dp = 1
+      ELSE
+         is_tile_3d_dp = 0
+      ENDIF
+   END FUNCTION is_tile_3d_dp
+
+
+   FUNCTION is_tile_4d_dp( pt )
+      !!
+      REAL(dp), DIMENSION(:,:,:,:), INTENT(in) ::   pt
+      INTEGER :: is_tile_4d_dp
+      !!
+      IF( ln_tile .AND. (SIZE(pt, 1) < jpi .OR. SIZE(pt, 2) < jpj) ) THEN
+         is_tile_4d_dp = 1
+      ELSE
+         is_tile_4d_dp = 0
+      ENDIF
+   END FUNCTION is_tile_4d_dp
+
 
    !!======================================================================
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domvvl.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domvvl.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domvvl.F90	(revision 14219)
@@ -78,4 +78,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -180,12 +181,12 @@
       !                    !== Set of all other vertical scale factors  ==!  (now and before)
       !                                ! Horizontal interpolation of e3t
-      CALL dom_vvl_interpol( e3t(:,:,:,Kbb), e3u(:,:,:,Kbb), 'U' )    ! from T to U
-      CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3u(:,:,:,Kmm), 'U' )
-      CALL dom_vvl_interpol( e3t(:,:,:,Kbb), e3v(:,:,:,Kbb), 'V' )    ! from T to V
-      CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3v(:,:,:,Kmm), 'V' )
+      CALL dom_vvl_interpol( CASTWP(e3t(:,:,:,Kbb)), e3u(:,:,:,Kbb), 'U' )    ! from T to U
+      CALL dom_vvl_interpol( CASTWP(e3t(:,:,:,Kmm)), e3u(:,:,:,Kmm), 'U' )
+      CALL dom_vvl_interpol( CASTWP(e3t(:,:,:,Kbb)), e3v(:,:,:,Kbb), 'V' )    ! from T to V
+      CALL dom_vvl_interpol( CASTWP(e3t(:,:,:,Kmm)), e3v(:,:,:,Kmm), 'V' )
       CALL dom_vvl_interpol( e3u(:,:,:,Kmm), e3f(:,:,:), 'F' )    ! from U to F
       !                                ! Vertical interpolation of e3t,u,v
-      CALL dom_vvl_interpol( e3t(:,:,:,Kmm), e3w (:,:,:,Kmm), 'W'  )  ! from T to W
-      CALL dom_vvl_interpol( e3t(:,:,:,Kbb), e3w (:,:,:,Kbb), 'W'  )
+      CALL dom_vvl_interpol( CASTWP(e3t(:,:,:,Kmm)), e3w (:,:,:,Kmm), 'W'  )  ! from T to W
+      CALL dom_vvl_interpol( CASTWP(e3t(:,:,:,Kbb)), e3w (:,:,:,Kbb), 'W'  )
       CALL dom_vvl_interpol( e3u(:,:,:,Kmm), e3uw(:,:,:,Kmm), 'UW' )  ! from U to UW
       CALL dom_vvl_interpol( e3u(:,:,:,Kbb), e3uw(:,:,:,Kbb), 'UW' )
@@ -317,5 +318,6 @@
       REAL(wp)               ::   z_tmin, z_tmax        ! local scalars
       LOGICAL                ::   ll_do_bclinic         ! local logical
-      REAL(wp), DIMENSION(jpi,jpj)     ::   zht, z_scale, zwu, zwv, zhdiv
+      REAL(dp), DIMENSION(jpi,jpj)     :: z_scale
+      REAL(wp), DIMENSION(jpi,jpj)     ::   zht, zwu, zwv, zhdiv
       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ze3t
       LOGICAL , DIMENSION(:,:,:), ALLOCATABLE ::   llmsk
@@ -542,6 +544,6 @@
       ! *********************************** !
 
-      CALL dom_vvl_interpol( e3t(:,:,:,Kaa), e3u(:,:,:,Kaa), 'U' )
-      CALL dom_vvl_interpol( e3t(:,:,:,Kaa), e3v(:,:,:,Kaa), 'V' )
+      CALL dom_vvl_interpol( CASTWP(e3t(:,:,:,Kaa)), e3u(:,:,:,Kaa), 'U' )
+      CALL dom_vvl_interpol( CASTWP(e3t(:,:,:,Kaa)), e3v(:,:,:,Kaa), 'V' )
 
       ! *********************************** !
@@ -629,8 +631,8 @@
 
       ! Vertical scale factor interpolations
-      CALL dom_vvl_interpol( e3t(:,:,:,Kmm),  e3w(:,:,:,Kmm), 'W'  )
+      CALL dom_vvl_interpol( CASTWP(e3t(:,:,:,Kmm)),  e3w(:,:,:,Kmm), 'W'  )
       CALL dom_vvl_interpol( e3u(:,:,:,Kmm), e3uw(:,:,:,Kmm), 'UW' )
       CALL dom_vvl_interpol( e3v(:,:,:,Kmm), e3vw(:,:,:,Kmm), 'VW' )
-      CALL dom_vvl_interpol( e3t(:,:,:,Kbb),  e3w(:,:,:,Kbb), 'W'  )
+      CALL dom_vvl_interpol( CASTWP(e3t(:,:,:,Kbb)),  e3w(:,:,:,Kbb), 'W'  )
       CALL dom_vvl_interpol( e3u(:,:,:,Kbb), e3uw(:,:,:,Kbb), 'UW' )
       CALL dom_vvl_interpol( e3v(:,:,:,Kbb), e3vw(:,:,:,Kbb), 'VW' )
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domwri.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domwri.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domwri.F90	(revision 14219)
@@ -75,15 +75,15 @@
       CALL iom_open( TRIM(clnam), inum, ldwrt = .TRUE. )
       !                                                         ! domain characteristics
-      CALL iom_rstput( 0, 0, inum, 'jperio', REAL( jperio, wp), ktype = jp_i4 )
+      CALL iom_rstput( 0, 0, inum, 'jperio', REAL( jperio, dp), ktype = jp_i4 )
       !                                                         ! type of vertical coordinate
       IF( ln_zco    ) THEN   ;   izco = 1   ;   ELSE   ;   izco = 0   ;   ENDIF
       IF( ln_zps    ) THEN   ;   izps = 1   ;   ELSE   ;   izps = 0   ;   ENDIF
       IF( ln_sco    ) THEN   ;   isco = 1   ;   ELSE   ;   isco = 0   ;   ENDIF
-      CALL iom_rstput( 0, 0, inum, 'ln_zco'   , REAL( izco, wp), ktype = jp_i4 )
-      CALL iom_rstput( 0, 0, inum, 'ln_zps'   , REAL( izps, wp), ktype = jp_i4 )
-      CALL iom_rstput( 0, 0, inum, 'ln_sco'   , REAL( isco, wp), ktype = jp_i4 )
+      CALL iom_rstput( 0, 0, inum, 'ln_zco'   , REAL( izco, dp), ktype = jp_i4 )
+      CALL iom_rstput( 0, 0, inum, 'ln_zps'   , REAL( izps, dp), ktype = jp_i4 )
+      CALL iom_rstput( 0, 0, inum, 'ln_sco'   , REAL( isco, dp), ktype = jp_i4 )
       !                                                         ! ocean cavities under iceshelves
       IF( ln_isfcav ) THEN   ;   icav = 1   ;   ELSE   ;   icav = 0   ;   ENDIF
-      CALL iom_rstput( 0, 0, inum, 'ln_isfcav', REAL( icav, wp), ktype = jp_i4 )
+      CALL iom_rstput( 0, 0, inum, 'ln_isfcav', REAL( icav, dp), ktype = jp_i4 )
   
       !                                                         ! masks
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domzgr.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domzgr.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/domzgr.F90	(revision 14219)
@@ -45,4 +45,5 @@
   !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -125,5 +126,5 @@
          zmsk(:,mj0(jpjglo-nn_hls):mj1(jpjglo-nn_hls)  ) = 0._wp   ! last    line of inner global domain at 0
       ENDIF
-      CALL lbc_lnk( 'usrdef_zgr', zmsk, 'T', 1. )             ! set halos
+      CALL lbc_lnk( 'usrdef_zgr', zmsk, 'T', 1._wp )             ! set halos
       k_top(:,:) = k_top(:,:) * NINT( zmsk(:,:) )
       !
@@ -220,5 +221,6 @@
       REAL(wp), DIMENSION(:)    , INTENT(out) ::   pe3t_1d , pe3w_1d           ! 1D vertical scale factors [m]
       REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   pdept, pdepw                ! grid-point depth          [m]
-      REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   pe3t , pe3u , pe3v , pe3f   ! vertical scale factors    [m]
+      REAL(dp), DIMENSION(:,:,:), INTENT(out) ::   pe3t
+      REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   pe3u , pe3v , pe3f          ! vertical scale factors    [m]
       REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   pe3w , pe3uw, pe3vw         !    -       -      -
       INTEGER , DIMENSION(:,:)  , INTENT(out) ::   k_top , k_bot               ! first & last ocean level
@@ -277,5 +279,5 @@
       ELSE                                !- depths computed from e3. scale factors
          CALL e3_to_depth( pe3t_1d, pe3w_1d, pdept_1d, pdepw_1d )    ! 1D reference depth
-         CALL e3_to_depth( pe3t   , pe3w   , pdept   , pdepw    )    ! 3D depths
+CALL e3_to_depth( CASTWP(pe3t)   , pe3w   , pdept   , pdepw    )
          IF(lwp) THEN
             WRITE(numout,*)
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/dtatsd.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/dtatsd.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DOM/dtatsd.F90	(revision 14219)
@@ -136,6 +136,6 @@
       !! ** Action  :   ptsd   T-S data on medl mesh and interpolated at time-step kt
       !!----------------------------------------------------------------------
-      INTEGER                          , INTENT(in   ) ::   kt     ! ocean time-step
-      REAL(wp), DIMENSION(A2D(nn_hls),jpk,jpts), INTENT(  out) ::   ptsd   ! T & S data
+      INTEGER                              , INTENT(in   ) ::   kt     ! ocean time-step
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(  out) ::   ptsd   ! T & S data
       !
       INTEGER ::   ji, jj, jk, jl, jkk   ! dummy loop indicies
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynadv.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynadv.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynadv.F90	(revision 14219)
@@ -66,5 +66,5 @@
       INTEGER                             , INTENT( in )  ::  kt               ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kbb, Kmm, Krhs   ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv         ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv         ! ocean velocities and RHS of momentum equation
       !!----------------------------------------------------------------------
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynadv_cen2.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynadv_cen2.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynadv_cen2.F90	(revision 14219)
@@ -29,4 +29,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -49,9 +50,11 @@
       INTEGER                             , INTENT( in )  ::  kt           ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kmm, Krhs    ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv     ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv     ! ocean velocities and RHS of momentum equation
       !
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::  zfu_t, zfu_f, zfu_uw, zfu
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::  zfv_t, zfv_f, zfv_vw, zfv, zfw
+      REAL(dp), DIMENSION(jpi,jpj,jpk) :: zfu_t, zfu_uw
+      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zfu_f, zfu
+      REAL(dp), DIMENSION(jpi,jpj,jpk) :: zfv_t, zfv_vw
+      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zfv_f, zfv, zfw
       !!----------------------------------------------------------------------
       !
@@ -130,6 +133,6 @@
       ENDIF
       !                                   ! Control print
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=puu(:,:,:,Krhs), clinfo1=' cen2 adv - Ua: ', mask1=umask,   &
-         &                                  tab3d_2=pvv(:,:,:,Krhs), clinfo2=           ' Va: ', mask2=vmask, clinfo3='dyn' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(puu(:,:,:,Krhs)), clinfo1=' cen2 adv - Ua: ', mask1=umask,   &
+         &                                  tab3d_2=CASTWP(pvv(:,:,:,Krhs)), clinfo2=           ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
    END SUBROUTINE dyn_adv_cen2
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynadv_ubs.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynadv_ubs.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynadv_ubs.F90	(revision 14219)
@@ -35,4 +35,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -71,10 +72,12 @@
       INTEGER                             , INTENT( in )  ::  kt              ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kbb, Kmm, Krhs  ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv        ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv        ! ocean velocities and RHS of momentum equation
       !
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
       REAL(wp) ::   zui, zvj, zfuj, zfvi, zl_u, zl_v   ! local scalars
-      REAL(wp), DIMENSION(jpi,jpj,jpk)   ::   zfu_t, zfu_f, zfu_uw, zfu
-      REAL(wp), DIMENSION(jpi,jpj,jpk)   ::   zfv_t, zfv_f, zfv_vw, zfv, zfw
+      REAL(dp), DIMENSION(jpi,jpj,jpk)   :: zfu_t, zfu_uw
+      REAL(wp), DIMENSION(jpi,jpj,jpk)   :: zfu_f, zfu
+      REAL(dp), DIMENSION(jpi,jpj,jpk)    :: zfv_t, zfv_vw
+      REAL(wp), DIMENSION(jpi,jpj,jpk)   :: zfv_f, zfv, zfw
       REAL(wp), DIMENSION(jpi,jpj,jpk,2) ::   zlu_uu, zlu_uv
       REAL(wp), DIMENSION(jpi,jpj,jpk,2) ::   zlv_vv, zlv_vu
@@ -221,6 +224,6 @@
       ENDIF
       !                                         ! Control print
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=puu(:,:,:,Krhs), clinfo1=' ubs2 adv - Ua: ', mask1=umask,   &
-         &                                  tab3d_2=pvv(:,:,:,Krhs), clinfo2=           ' Va: ', mask2=vmask, clinfo3='dyn' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(puu(:,:,:,Krhs)), clinfo1=' ubs2 adv - Ua: ', mask1=umask,   &
+         &                                  tab3d_2=CASTWP(pvv(:,:,:,Krhs)), clinfo2=           ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
    END SUBROUTINE dyn_adv_ubs
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynatf.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynatf.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynatf.F90	(revision 14219)
@@ -60,4 +60,5 @@
    PUBLIC    dyn_atf   ! routine called by step.F90
 
+#  include "single_precision_substitute.h90"
 #if defined key_qco   ||   defined key_linssh
    !!----------------------------------------------------------------------
@@ -71,6 +72,7 @@
       INTEGER                             , INTENT(in   ) :: kt               ! ocean time-step index
       INTEGER                             , INTENT(in   ) :: Kbb, Kmm, Kaa    ! before and after time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: puu, pvv         ! velocities to be time filtered
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: pe3t, pe3u, pe3v ! scale factors to be time filtered
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: puu, pvv         ! velocities to be time filtered
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: pe3t
+      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: pe3u, pe3v ! scale factors to be time filtered
 
       WRITE(*,*) 'dyn_atf: You should not have seen this print! error?', kt
@@ -116,13 +118,17 @@
       INTEGER                             , INTENT(in   ) :: kt               ! ocean time-step index
       INTEGER                             , INTENT(in   ) :: Kbb, Kmm, Kaa    ! before and after time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: puu, pvv         ! velocities to be time filtered
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: pe3t, pe3u, pe3v ! scale factors to be time filtered
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: puu, pvv         ! velocities to be time filtered
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: pe3t
+      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: pe3u, pe3v ! scale factors to be time filtered
       !
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
-      REAL(wp) ::   zue3a, zue3n, zue3b, zcoef    ! local scalars
+      REAL(dp)  :: zcoef
+      REAL(wp) ::   zue3a, zue3n, zue3b    ! local scalars
       REAL(wp) ::   zve3a, zve3n, zve3b, z1_2dt   !   -      -
       REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   zue, zve, zwfld
       REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   zutau, zvtau
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ze3t_f, ze3u_f, ze3v_f, zua, zva
+      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:) ::   ze3t_f
+      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:) ::   zua, zva
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ze3u_f, ze3v_f 
       !!----------------------------------------------------------------------
       !
@@ -229,5 +235,5 @@
             !     to manage rnf, isf and possibly in the futur icb, tide water glacier (...)
             !     ...(kt, coef, ktop, kbot, hz, fwf_b, fwf)
-            IF ( ln_isf ) CALL isf_dynatf( kt, Kmm, ze3t_f, rn_atfp * rn_Dt )
+            IF ( ln_isf ) CALL isf_dynatf( kt, Kmm, ze3t_f, CASTWP(rn_atfp * rn_Dt) )
             !
             pe3t(:,:,1:jpkm1,Kmm) = ze3t_f(:,:,1:jpkm1)        ! filtered scale factor at T-points
@@ -235,6 +241,6 @@
             IF( ln_dynadv_vec ) THEN      ! Asselin filter applied on velocity
                ! Before filtered scale factor at (u/v)-points
-               CALL dom_vvl_interpol( pe3t(:,:,:,Kmm), pe3u(:,:,:,Kmm), 'U' )
-               CALL dom_vvl_interpol( pe3t(:,:,:,Kmm), pe3v(:,:,:,Kmm), 'V' )
+               CALL dom_vvl_interpol( CASTWP(pe3t(:,:,:,Kmm)), pe3u(:,:,:,Kmm), 'U' )
+               CALL dom_vvl_interpol( CASTWP(pe3t(:,:,:,Kmm)), pe3v(:,:,:,Kmm), 'V' )
                DO_3D( 1, 1, 1, 1, 1, jpkm1 )
                   puu(ji,jj,jk,Kmm) = puu(ji,jj,jk,Kmm) + rn_atfp * ( puu(ji,jj,jk,Kbb) - 2._wp * puu(ji,jj,jk,Kmm) + puu(ji,jj,jk,Kaa) )
@@ -246,6 +252,6 @@
                ALLOCATE( ze3u_f(jpi,jpj,jpk) , ze3v_f(jpi,jpj,jpk) )
                ! Now filtered scale factor at (u/v)-points stored in ze3u_f, ze3v_f
-               CALL dom_vvl_interpol( pe3t(:,:,:,Kmm), ze3u_f, 'U' )
-               CALL dom_vvl_interpol( pe3t(:,:,:,Kmm), ze3v_f, 'V' )
+               CALL dom_vvl_interpol( CASTWP(pe3t(:,:,:,Kmm)), ze3u_f, 'U' )
+               CALL dom_vvl_interpol( CASTWP(pe3t(:,:,:,Kmm)), ze3v_f, 'V' )
                DO_3D( 1, 1, 1, 1, 1, jpkm1 )
                   zue3a = pe3u(ji,jj,jk,Kaa) * puu(ji,jj,jk,Kaa)
@@ -328,4 +334,5 @@
          IF ( ln_drgice_imp.OR.ln_isfcav ) THEN
             ALLOCATE(zutau(jpi,jpj))
+            zutau(:,:) = 0._wp
             DO_2D( 0, 0, 0, 0 )
                jk = miku(ji,jj)
@@ -342,4 +349,5 @@
          IF ( ln_drgice_imp.OR.ln_isfcav ) THEN
             ALLOCATE(zvtau(jpi,jpj))
+            zvtau(:,:) = 0._wp
             DO_2D( 0, 0, 0, 0 )
                jk = mikv(ji,jj)
@@ -353,7 +361,7 @@
       ENDIF
       !
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=puu(:,:,:,Kaa), clinfo1=' nxt  - puu(:,:,:,Kaa): ', mask1=umask,   &
-         &                                  tab3d_2=pvv(:,:,:,Kaa), clinfo2=' pvv(:,:,:,Kaa): '       , mask2=vmask )
-      !
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(puu(:,:,:,Kaa)), clinfo1=' nxt  - puu(:,:,:,Kaa): ', mask1=umask,   &
+         &                                  tab3d_2=CASTWP(pvv(:,:,:,Kaa)), clinfo2=' pvv(:,:,:,Kaa): '       , mask2=vmask )
+      ! 
       IF( ln_dynspg_ts )   DEALLOCATE( zue, zve )
       IF( l_trddyn     )   DEALLOCATE( zua, zva )
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynatf_qco.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynatf_qco.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynatf_qco.F90	(revision 14219)
@@ -59,4 +59,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -94,5 +95,5 @@
       INTEGER                             , INTENT(in   ) :: kt               ! ocean time-step index
       INTEGER                             , INTENT(in   ) :: Kbb, Kmm, Kaa    ! before and after time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: puu, pvv         ! velocities to be time filtered
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: puu, pvv         ! velocities to be time filtered
       !
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
@@ -100,5 +101,5 @@
       REAL(wp) ::   zve3a, zve3n, zve3b, z1_2dt   !   -      -
       REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   zue, zve
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zua, zva
+      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:) ::   zua, zva
       !!----------------------------------------------------------------------
       !
@@ -239,6 +240,6 @@
       ENDIF
       !
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=puu(:,:,:,Kaa), clinfo1=' nxt  - puu(:,:,:,Kaa): ', mask1=umask,   &
-         &                                  tab3d_2=pvv(:,:,:,Kaa), clinfo2=' pvv(:,:,:,Kaa): '       , mask2=vmask )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(puu(:,:,:,Kaa)), clinfo1=' nxt  - puu(:,:,:,Kaa): ', mask1=umask,   &
+         &                                  tab3d_2=CASTWP(pvv(:,:,:,Kaa)), clinfo2=' pvv(:,:,:,Kaa): '       , mask2=vmask )
       !
       IF( ln_dynspg_ts )   DEALLOCATE( zue, zve )
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynhpg.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynhpg.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynhpg.F90	(revision 14219)
@@ -81,4 +81,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
 
    !!----------------------------------------------------------------------
@@ -101,7 +102,7 @@
       INTEGER                             , INTENT( in )  ::  kt          ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kmm, Krhs   ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
-      !
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrdu, ztrdv
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
+      !
+      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrdu, ztrdv
       !!----------------------------------------------------------------------
       !
@@ -130,6 +131,6 @@
       ENDIF
       !
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=puu(:,:,:,Krhs), clinfo1=' hpg  - Ua: ', mask1=umask,   &
-         &                                  tab3d_2=pvv(:,:,:,Krhs), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(puu(:,:,:,Krhs)), clinfo1=' hpg  - Ua: ', mask1=umask,   &
+         &                                  tab3d_2=CASTWP(pvv(:,:,:,Krhs)), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
       IF( ln_timing )   CALL timing_stop('dyn_hpg')
@@ -262,5 +263,5 @@
       INTEGER                             , INTENT( in )  ::  kt          ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kmm, Krhs   ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
       !
       INTEGER  ::   ji, jj, jk       ! dummy loop indices
@@ -313,5 +314,5 @@
       INTEGER                             , INTENT( in )  ::  kt          ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kmm, Krhs   ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
       !!
       INTEGER  ::   ji, jj, jk                       ! dummy loop indices
@@ -405,5 +406,5 @@
       INTEGER                             , INTENT( in )  ::  kt          ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kmm, Krhs   ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
       !!
       INTEGER  ::   ji, jj, jk, jii, jjj           ! dummy loop indices
@@ -542,5 +543,5 @@
       INTEGER                             , INTENT( in )  ::  kt          ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kmm, Krhs   ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
       !!
       INTEGER  ::   ji, jj, jk             ! dummy loop indices
@@ -631,5 +632,5 @@
       INTEGER                             , INTENT( in )  ::  kt          ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kmm, Krhs   ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
       !!
       INTEGER  ::   ji, jj, jk          ! dummy loop indices
@@ -793,5 +794,5 @@
       END_3D
 
-      CALL lbc_lnk_multi( 'dynhpg', zdrhox, 'U', 1., zdzx, 'U', 1., zdrhoy, 'V', 1., zdzy, 'V', 1. ) 
+      CALL lbc_lnk_multi( 'dynhpg', zdrhox, 'U', 1._wp, zdzx, 'U', 1._wp, zdrhoy, 'V', 1._wp, zdzy, 'V', 1._wp ) 
 
       !-------------------------------------------------------------------------
@@ -963,5 +964,5 @@
       INTEGER                             , INTENT( in )  ::  kt          ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kmm, Krhs   ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
       !!
       INTEGER  ::   ji, jj, jk, jkk                 ! dummy loop indices
@@ -990,14 +991,6 @@
       zcoef0 = - grav
       znad = 1._wp
-      IF( ln_linssh )   znad = 1._wp
-      !
-      ! ---------------
-      !  Surface pressure gradient to be removed
-      ! ---------------
-      DO_2D( 0, 0, 0, 0 )
-         zpgu(ji,jj) = - grav * ( ssh(ji+1,jj,Kmm) - ssh(ji,jj,Kmm) ) * r1_e1u(ji,jj)
-         zpgv(ji,jj) = - grav * ( ssh(ji,jj+1,Kmm) - ssh(ji,jj,Kmm) ) * r1_e2v(ji,jj)
-      END_2D
-      !
+      IF( ln_linssh )   znad = 0._wp
+
       IF( ln_wd_il ) THEN
          ALLOCATE( zcpx(jpi,jpj) , zcpy(jpi,jpj) )
@@ -1057,6 +1050,7 @@
        ELSEIF( jk < jpkm1 ) THEN
           DO jkk = jk+1, jpk
-             zrhh(ji,jj,jkk) = interp1(gde3w(ji,jj,jkk  ), gde3w(ji,jj,jkk-1),   &
-                &                      gde3w(ji,jj,jkk-2), zrhh (ji,jj,jkk-1), zrhh(ji,jj,jkk-2))
+             zrhh(ji,jj,jkk) = interp1(CASTWP(gde3w(ji,jj,jkk  )), CASTWP(gde3w(ji,jj,jkk-1)),   &
+                &                      CASTWP(gde3w(ji,jj,jkk-2)), zrhh (ji,jj,jkk-1), zrhh(ji,jj,jkk-2))
+
           END DO
        ENDIF
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynkeg.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynkeg.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynkeg.F90	(revision 14219)
@@ -37,4 +37,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -74,10 +75,10 @@
       INTEGER                             , INTENT( in )  ::  kscheme          ! =0/1   type of KEG scheme 
       INTEGER                             , INTENT( in )  ::  Kmm, Krhs        ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv         ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv         ! ocean velocities and RHS of momentum equation
       !
       INTEGER  ::   ji, jj, jk             ! dummy loop indices
       REAL(wp) ::   zu, zv                   ! local scalars
       REAL(wp), DIMENSION(jpi,jpj,jpk)        ::   zhke
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrdu, ztrdv 
+      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrdu, ztrdv 
       !!----------------------------------------------------------------------
       !
@@ -137,6 +138,6 @@
       ENDIF
       !
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=puu(:,:,:,Krhs), clinfo1=' keg  - Ua: ', mask1=umask,   &
-         &                                  tab3d_2=pvv(:,:,:,Krhs), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(puu(:,:,:,Krhs)), clinfo1=' keg  - Ua: ', mask1=umask,   &
+         &                                  tab3d_2=CASTWP(pvv(:,:,:,Krhs)), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
       IF( ln_timing )   CALL timing_stop('dyn_keg')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynldf.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynldf.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynldf.F90	(revision 14219)
@@ -34,4 +34,5 @@
    PUBLIC   dyn_ldf_init  ! called by opa  module 
 
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -49,7 +50,7 @@
       INTEGER                             , INTENT( in )  ::  kt               ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kbb, Kmm, Krhs   ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv         ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv         ! ocean velocities and RHS of momentum equation
       !
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrdu, ztrdv
+      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrdu, ztrdv
       !!----------------------------------------------------------------------
       !
@@ -65,9 +66,9 @@
       !
       CASE ( np_lap   )  
-         CALL dyn_ldf_lap( kt, Kbb, Kmm, puu(:,:,:,Kbb), pvv(:,:,:,Kbb), puu(:,:,:,Krhs), pvv(:,:,:,Krhs), 1 ) ! iso-level    laplacian
+      CALL dyn_ldf_lap( kt, Kbb, Kmm, CASTWP(puu(:,:,:,Kbb)), CASTWP(pvv(:,:,:,Kbb)), puu(:,:,:,Krhs), pvv(:,:,:,Krhs), 1 )
       CASE ( np_lap_i ) 
          CALL dyn_ldf_iso( kt, Kbb, Kmm, puu, pvv, Krhs    )                                                   ! rotated      laplacian
       CASE ( np_blp   )  
-         CALL dyn_ldf_blp( kt, Kbb, Kmm, puu(:,:,:,Kbb), pvv(:,:,:,Kbb), puu(:,:,:,Krhs), pvv(:,:,:,Krhs)    ) ! iso-level bi-laplacian
+      CALL dyn_ldf_blp( kt, Kbb, Kmm, CASTWP(puu(:,:,:,Kbb)), CASTWP(pvv(:,:,:,Kbb)), puu(:,:,:,Krhs), pvv(:,:,:,Krhs)    )
       !
       END SELECT
@@ -80,6 +81,6 @@
       ENDIF
       !                                          ! print sum trends (used for debugging)
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=puu(:,:,:,Krhs), clinfo1=' ldf  - Ua: ', mask1=umask,   &
-         &                                  tab3d_2=pvv(:,:,:,Krhs), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(puu(:,:,:,Krhs)), clinfo1=' ldf  - Ua: ', mask1=umask,   &
+         &                                  tab3d_2=CASTWP(pvv(:,:,:,Krhs)), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
       IF( ln_timing )   CALL timing_stop('dyn_ldf')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynldf_iso.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynldf_iso.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynldf_iso.F90	(revision 14219)
@@ -43,4 +43,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -106,5 +107,5 @@
       INTEGER                             , INTENT( in )  ::  kt               ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kbb, Kmm, Krhs   ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv         ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv         ! ocean velocities and RHS of momentum equation
       !
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
@@ -281,6 +282,6 @@
 
       ! print sum trends (used for debugging)
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=puu(:,:,:,Krhs), clinfo1=' ldfh - Ua: ', mask1=umask, &
-         &                                  tab3d_2=pvv(:,:,:,Krhs), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(puu(:,:,:,Krhs)), clinfo1=' ldfh - Ua: ', mask1=umask, &
+         &                                  tab3d_2=CASTWP(pvv(:,:,:,Krhs)), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
 
 
@@ -399,2 +400,3 @@
    !!======================================================================
 END MODULE dynldf_iso
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynldf_lap_blp.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynldf_lap_blp.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynldf_lap_blp.F90	(revision 14219)
@@ -31,4 +31,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -56,5 +57,5 @@
       INTEGER                         , INTENT(in   ) ::   kpass      ! =1/2 first or second passage
       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   pu, pv     ! before velocity  [m/s]
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs   ! velocity trend   [m/s2]
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs   ! velocity trend   [m/s2]
       !
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
@@ -169,7 +170,7 @@
       INTEGER                         , INTENT(in   ) ::   Kbb, Kmm   ! ocean time level indices
       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   pu, pv     ! before velocity fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs   ! momentum trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs   ! momentum trend
       !
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zulap, zvlap   ! laplacian at u- and v-point
+      REAL(dp), DIMENSION(jpi,jpj,jpk) ::   zulap, zvlap   ! laplacian at u- and v-point
       !!----------------------------------------------------------------------
       !
@@ -187,5 +188,5 @@
       CALL lbc_lnk_multi( 'dynldf_lap_blp', zulap, 'U', -1.0_wp, zvlap, 'V', -1.0_wp )             ! Lateral boundary conditions
       !
-      CALL dyn_ldf_lap( kt, Kbb, Kmm, zulap, zvlap, pu_rhs, pv_rhs, 2 )   ! rotated laplacian applied to zlap (output in pt(:,:,:,:,Krhs))
+      CALL dyn_ldf_lap( kt, Kbb, Kmm, CASTWP(zulap), CASTWP(zvlap), pu_rhs, pv_rhs, 2 )   ! rotated laplacian applied to zlap (output in pt(:,:,:,:,Krhs))
       !
    END SUBROUTINE dyn_ldf_blp
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynspg.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynspg.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynspg.F90	(revision 14219)
@@ -50,4 +50,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -77,6 +78,7 @@
       INTEGER                             , INTENT( in )  ::  kt                  ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kbb, Kmm, Krhs, Kaa ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv            ! ocean velocities and RHS of momentum equation
-      REAL(wp), DIMENSION(jpi,jpj,jpt)    , INTENT(inout) ::  pssh, puu_b, pvv_b  ! SSH and barotropic velocities at main time levels
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv            ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpt)    , INTENT(inout) :: pssh                 ! SSH
+      REAL(wp), DIMENSION(jpi,jpj,jpt)    , INTENT(inout) :: puu_b, pvv_b         !barotropic velocities at main time levels
       !
       INTEGER  ::   ji, jj, jk                   ! dummy loop indices
@@ -84,5 +86,5 @@
       REAL(wp)             , DIMENSION(jpi,jpj) ::   zpgu, zpgv   ! 2D workspace
       REAL(wp), ALLOCATABLE, DIMENSION(:,:)     ::   zpice
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::   ztrdu, ztrdv
+      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:)   ::   ztrdu, ztrdv
       !!----------------------------------------------------------------------
       !
@@ -175,6 +177,6 @@
       ENDIF
       !                                      ! print mean trends (used for debugging)
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=puu(:,:,:,Krhs), clinfo1=' spg  - Ua: ', mask1=umask, &
-         &                                  tab3d_2=pvv(:,:,:,Krhs), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(puu(:,:,:,Krhs)), clinfo1=' spg  - Ua: ', mask1=umask, &
+         &                                  tab3d_2=CASTWP(pvv(:,:,:,Krhs)), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
       IF( ln_timing )   CALL timing_stop('dyn_spg')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynspg_exp.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynspg_exp.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynspg_exp.F90	(revision 14219)
@@ -57,5 +57,5 @@
       INTEGER                             , INTENT( in )  ::  kt        ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kmm, Krhs ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv  ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv  ! ocean velocities and RHS of momentum equation
       !!
       INTEGER ::   ji, jj, jk   ! dummy loop indices
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynspg_ts.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynspg_ts.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynspg_ts.F90	(revision 14219)
@@ -75,5 +75,6 @@
    REAL(wp),SAVE :: rDt_e       ! Barotropic time step
    !
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:)   ::   wgtbtp1, wgtbtp2   ! 1st & 2nd weights used in time filtering of barotropic fields
+   REAL(dp), ALLOCATABLE, SAVE, DIMENSION(:)   :: wgtbtp1   ! 1st 
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:)   :: wgtbtp2   ! & 2nd weights used in time filtering of barotropic fields
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   zwz                ! ff_f/h at F points
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ftnw, ftne         ! triad of coriolis parameter
@@ -88,4 +89,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -144,6 +146,7 @@
       INTEGER                             , INTENT( in )  ::  kt                  ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kbb, Kmm, Krhs, Kaa ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv            ! ocean velocities and RHS of momentum equation
-      REAL(wp), DIMENSION(jpi,jpj,jpt)    , INTENT(inout) ::  pssh, puu_b, pvv_b  ! SSH and barotropic velocities at main time levels
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv            ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpt)    , INTENT(inout) ::  pssh                 ! SSH
+      REAL(wp), DIMENSION(jpi,jpj,jpt)    , INTENT(inout) ::  puu_b, pvv_b         ! barotropic velocities at main time levels
       !
       INTEGER  ::   ji, jj, jk, jn        ! dummy loop indices
@@ -152,9 +155,12 @@
       INTEGER  ::   noffset               ! local integers  : time offset for bdy update
       REAL(wp) ::   r1_Dt_b, z1_hu, z1_hv          ! local scalars
-      REAL(wp) ::   za0, za1, za2, za3              !   -      -
+      REAL(dp)  :: za1
+      REAL(wp) ::   za0, za2, za3              !   -      -
       REAL(wp) ::   zztmp, zldg               !   -      -
-      REAL(wp) ::   zhu_bck, zhv_bck, zhdiv         !   -      -
+      REAL(dp)  :: zhdiv
+      REAL(wp) ::   zhu_bck, zhv_bck         !   -      -
       REAL(wp) ::   zun_save, zvn_save              !   -      -
-      REAL(wp), DIMENSION(jpi,jpj) :: zu_trd, zu_frc, zu_spg, zssh_frc
+      REAL(dp), DIMENSION(jpi,jpj)  :: zssh_frc
+      REAL(wp), DIMENSION(jpi,jpj) :: zu_trd, zu_frc, zu_spg
       REAL(wp), DIMENSION(jpi,jpj) :: zv_trd, zv_frc, zv_spg
       REAL(wp), DIMENSION(jpi,jpj) :: zsshu_a, zhup2_e, zhtp2_e
@@ -274,5 +280,5 @@
       !                                   !=  Add bottom stress contribution from baroclinic velocities  =!
       !                                   !  -----------------------------------------------------------  !
-      CALL dyn_drg_init( Kbb, Kmm, puu, pvv, puu_b ,pvv_b, zu_frc, zv_frc,  zCdU_u, zCdU_v )      ! also provide the barotropic drag coefficients
+      CALL dyn_drg_init( Kbb, Kmm, CASTWP(puu), CASTWP(pvv), puu_b ,pvv_b, zu_frc, zv_frc,  zCdU_u, zCdU_v )      ! also provide the barotropic drag coefficients
       !
       !                                   !=  Add atmospheric pressure forcing  =!
@@ -520,5 +526,10 @@
          END_2D
          !
+#if defined key_single
+         CALL lbc_lnk      ( 'dynspg_ts', ssha_e, 'T', 1._wp )
+         CALL lbc_lnk_multi( 'dynspg_ts', zhU, 'U', -1._wp,  zhV, 'V', -1._wp )
+#else
          CALL lbc_lnk_multi( 'dynspg_ts', ssha_e, 'T', 1._wp,  zhU, 'U', -1._wp,  zhV, 'V', -1._wp )
+#endif
          !
          ! Duplicate sea level across open boundaries (this is only cosmetic if linssh=T)
@@ -680,5 +691,5 @@
          ENDIF
          !                                                 ! open boundaries
-         IF( ln_bdy )   CALL bdy_dyn2d( jn, ua_e, va_e, un_e, vn_e, hur_e, hvr_e, ssha_e )
+         IF( ln_bdy )   CALL bdy_dyn2d( jn, ua_e, va_e, un_e, vn_e, hur_e, hvr_e, CASTWP(ssha_e) )
 #if defined key_agrif                                                           
          IF( .NOT.Agrif_Root() )  CALL agrif_dyn_ts( jn )  ! Agrif
@@ -840,9 +851,10 @@
       LOGICAL, INTENT(in) ::   ll_fw      ! forward time splitting =.true.
       INTEGER, INTENT(inout) :: jpit      ! cycle length    
-      REAL(wp), DIMENSION(3*nn_e), INTENT(inout) ::   zwgt1, & ! Primary weights
-                                                         zwgt2    ! Secondary weights
+      REAL(dp), DIMENSION(3*nn_e), INTENT(inout) ::   zwgt1    ! Primary weights
+      REAL(wp), DIMENSION(3*nn_e), INTENT(inout) ::   zwgt2    ! Secondary weights
       
       INTEGER ::  jic, jn, ji                      ! temporary integers
-      REAL(wp) :: za1, za2
+      REAL(dp)  :: za1
+      REAL(wp) :: za2
       !!----------------------------------------------------------------------
 
@@ -1441,5 +1453,6 @@
       INTEGER ,INTENT(in   ) ::   jn                   ! index of sub time step
       LOGICAL ,INTENT(in   ) ::   ll_init              !
-      REAL(wp),INTENT(  out) ::   za0, za1, za2, za3   ! Half-step back interpolation coefficient
+      REAL(dp),INTENT(  out)  :: za1
+      REAL(wp),INTENT(  out) ::   za0, za2, za3   ! Half-step back interpolation coefficient
       !
       REAL(wp) ::   zepsilon, zgamma                   !   -      -
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynvor.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynvor.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynvor.F90	(revision 14219)
@@ -96,4 +96,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
 
    !!----------------------------------------------------------------------
@@ -116,7 +117,7 @@
       INTEGER                             , INTENT( in  ) ::   kt          ! ocean time-step index
       INTEGER                             , INTENT( in  ) ::   Kmm, Krhs   ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::   puu, pvv    ! ocean velocity field and RHS of momentum equation
-      !
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::  ztrdu, ztrdv
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::   puu, pvv    ! ocean velocity field and RHS of momentum equation
+      !
+      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:) ::  ztrdu, ztrdv
       !!----------------------------------------------------------------------
       !
@@ -206,6 +207,6 @@
       !
       !                       ! print sum trends (used for debugging)
-      IF(sn_cfctl%l_prtctl) CALL prt_ctl( tab3d_1=puu(:,:,:,Krhs), clinfo1=' vor  - Ua: ', mask1=umask,               &
-         &                                tab3d_2=pvv(:,:,:,Krhs), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
+      IF(sn_cfctl%l_prtctl) CALL prt_ctl( tab3d_1=CASTWP(puu(:,:,:,Krhs)), clinfo1=' vor  - Ua: ', mask1=umask,               &
+         &                                tab3d_2=CASTWP(pvv(:,:,:,Krhs)), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
       IF( ln_timing )   CALL timing_stop('dyn_vor')
@@ -235,6 +236,6 @@
       INTEGER                         , INTENT(in   ) ::   Kmm              ! ocean time level index
       INTEGER                         , INTENT(in   ) ::   kvor             ! total, planetary, relative, or metric
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu, pv           ! now velocities
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs   ! total v-trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu, pv           ! now velocities
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs   ! total v-trend
       !
       INTEGER  ::   ji, jj, jk           ! dummy loop indices
@@ -351,6 +352,6 @@
       INTEGER                         , INTENT(in   ) ::   Kmm              ! ocean time level index
       INTEGER                         , INTENT(in   ) ::   kvor        ! total, planetary, relative, or metric
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu, pv    ! now velocities
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs    ! total v-trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu, pv    ! now velocities
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs    ! total v-trend
       !
       INTEGER  ::   ji, jj, jk           ! dummy loop indices
@@ -478,6 +479,6 @@
       INTEGER                         , INTENT(in   ) ::   Kmm              ! ocean time level index
       INTEGER                         , INTENT(in   ) ::   kvor        ! total, planetary, relative, or metric
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu, pv    ! now velocities
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs    ! total v-trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu, pv    ! now velocities
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs    ! total v-trend
       !
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
@@ -602,6 +603,6 @@
       INTEGER                         , INTENT(in   ) ::   Kmm              ! ocean time level index
       INTEGER                         , INTENT(in   ) ::   kvor        ! total, planetary, relative, or metric
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu, pv    ! now velocities
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs    ! total v-trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu, pv    ! now velocities
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs    ! total v-trend
       !
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
@@ -751,6 +752,6 @@
       INTEGER                         , INTENT(in   ) ::   Kmm              ! ocean time level index
       INTEGER                         , INTENT(in   ) ::   kvor             ! total, planetary, relative, or metric
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu, pv           ! now velocities
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs   ! total v-trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu, pv           ! now velocities
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu_rhs, pv_rhs   ! total v-trend
       !
       INTEGER  ::   ji, jj, jk     ! dummy loop indices
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynzad.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynzad.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynzad.F90	(revision 14219)
@@ -31,4 +31,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -56,5 +57,5 @@
       INTEGER                             , INTENT( in )  ::  kt               ! ocean time-step inedx
       INTEGER                             , INTENT( in )  ::  Kmm, Krhs        ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv         ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv         ! ocean velocities and RHS of momentum equation
       !
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
@@ -62,5 +63,5 @@
       REAL(wp), DIMENSION(jpi,jpj)     ::   zww
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zwuw, zwvw
-      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdu, ztrdv
+      REAL(dp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdu, ztrdv
       !!----------------------------------------------------------------------
       !
@@ -73,7 +74,7 @@
 
       IF( l_trddyn )   THEN           ! Save puu(:,:,:,Krhs) and pvv(:,:,:,Krhs) trends
-         ALLOCATE( ztrdu(jpi,jpj,jpk) , ztrdv(jpi,jpj,jpk) )
-         ztrdu(:,:,:) = puu(:,:,:,Krhs)
-         ztrdv(:,:,:) = pvv(:,:,:,Krhs)
+         ALLOCATE( ztrdu(jpi,jpj,jpk) , ztrdv(jpi,jpj,jpk) ) 
+         ztrdu(:,:,:) = puu(:,:,:,Krhs) 
+         ztrdv(:,:,:) = pvv(:,:,:,Krhs) 
       ENDIF
 
@@ -114,6 +115,6 @@
       ENDIF
       !                               ! Control print
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=puu(:,:,:,Krhs), clinfo1=' zad  - Ua: ', mask1=umask,   &
-         &                                  tab3d_2=pvv(:,:,:,Krhs), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(puu(:,:,:,Krhs)), clinfo1=' zad  - Ua: ', mask1=umask,   &
+         &                                  tab3d_2=CASTWP(pvv(:,:,:,Krhs)), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
       IF( ln_timing )   CALL timing_stop('dyn_zad')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynzdf.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynzdf.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/dynzdf.F90	(revision 14219)
@@ -39,4 +39,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -68,5 +69,5 @@
       INTEGER                             , INTENT( in )  ::  kt                  ! ocean time-step index
       INTEGER                             , INTENT( in )  ::  Kbb, Kmm, Krhs, Kaa ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv            ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv            ! ocean velocities and RHS of momentum equation
       !
       INTEGER  ::   ji, jj, jk         ! dummy loop indices
@@ -79,5 +80,5 @@
       REAL(wp) ::   zWus, zWvs         !   -      -
       REAL(wp), DIMENSION(jpi,jpj,jpk)        ::  zwi, zwd, zws   ! 3D workspace 
-      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdu, ztrdv   !  -      -
+      REAL(dp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdu, ztrdv   !  -      -
       !!---------------------------------------------------------------------
       !
@@ -438,6 +439,6 @@
       ENDIF
       !                                          ! print mean trends (used for debugging)
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=puu(:,:,:,Kaa), clinfo1=' zdf  - Ua: ', mask1=umask,               &
-         &                                  tab3d_2=pvv(:,:,:,Kaa), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(puu(:,:,:,Kaa)), clinfo1=' zdf  - Ua: ', mask1=umask,               &
+         &                                  tab3d_2=CASTWP(pvv(:,:,:,Kaa)), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
          !
       IF( ln_timing )   CALL timing_stop('dyn_zdf')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/sshwzv.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/sshwzv.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/sshwzv.F90	(revision 14219)
@@ -53,4 +53,6 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
+
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -76,5 +78,5 @@
       INTEGER                         , INTENT(in   ) ::   kt             ! time step
       INTEGER                         , INTENT(in   ) ::   Kbb, Kmm, Kaa  ! time level index
-      REAL(wp), DIMENSION(jpi,jpj,jpt), INTENT(inout) ::   pssh           ! sea-surface height
+      REAL(dp), DIMENSION(jpi,jpj,jpt), INTENT(inout) ::   pssh           ! sea-surface height
       ! 
       INTEGER  ::   jk      ! dummy loop index
@@ -127,5 +129,5 @@
       !                                           !------------------------------!
       !
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab2d_1=pssh(:,:,Kaa), clinfo1=' pssh(:,:,Kaa)  - : ', mask1=tmask )
+IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab2d_1=CASTWP(pssh(:,:,Kaa)), clinfo1=' pssh(:,:,Kaa)  - : ', mask1=tmask )
       !
       IF( ln_timing )   CALL timing_stop('ssh_nxt')
@@ -278,9 +280,9 @@
       INTEGER                         , INTENT(in   ) ::   kt             ! ocean time-step index
       INTEGER                         , INTENT(in   ) ::   Kbb, Kmm, Kaa  ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpt)          , TARGET, INTENT(inout) ::   pssh           ! SSH field
-      REAL(wp), DIMENSION(jpi,jpj    ), OPTIONAL, TARGET, INTENT(  out) ::   pssh_f         ! filtered SSH field
-      !
-      REAL(wp) ::   zcoef   ! local scalar
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zssh   ! pointer for filtered SSH 
+      REAL(dp), DIMENSION(jpi,jpj,jpt)          , TARGET, INTENT(inout) ::   pssh           ! SSH field
+      REAL(dp), DIMENSION(jpi,jpj    ), OPTIONAL, TARGET, INTENT(  out) ::   pssh_f         ! filtered SSH field
+      !
+      REAL(dp) ::   zcoef   ! local scalar
+      REAL(dp), POINTER, DIMENSION(:,:) ::   zssh   ! pointer for filtered SSH 
       !!----------------------------------------------------------------------
       !
@@ -314,5 +316,5 @@
       ENDIF
       !
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab2d_1=pssh(:,:,Kmm), clinfo1=' atf  - pssh(:,:,Kmm): ', mask1=tmask )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab2d_1=CASTWP(pssh(:,:,Kmm)), clinfo1=' pssh(:,:,Kmm)  - : ', mask1=tmask )
       !
       IF( ln_timing )   CALL timing_stop('ssh_atf')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/wet_dry.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/wet_dry.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/DYN/wet_dry.F90	(revision 14219)
@@ -131,9 +131,9 @@
       !! ** Action  : - calculate flux limiter and W/D flag
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(:,:)            , INTENT(inout) ::   psshb1
+      REAL(dp), DIMENSION(:,:)            , INTENT(inout) ::   psshb1
       REAL(wp), DIMENSION(:,:)            , INTENT(in   ) ::   psshemp
       REAL(wp)                            , INTENT(in   ) ::   z2dt
       INTEGER                             , INTENT(in   ) ::   Kmm       ! time level index
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::   puu, pvv  ! velocity arrays
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::   puu, pvv  ! velocity arrays
       !
       INTEGER  ::   ji, jj, jk, jk1     ! dummy loop indices
@@ -281,5 +281,6 @@
       !!----------------------------------------------------------------------
       REAL(wp)                , INTENT(in   ) ::   rDt_e    ! ocean time-step index
-      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   zflxu,  zflxv, sshn_e, zssh_frc  
+      REAL(dp), DIMENSION(:,:), INTENT(inout) ::   sshn_e, zssh_frc
+      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   zflxu,  zflxv  
       !
       INTEGER  ::   ji, jj, jk, jk1     ! dummy loop indices
@@ -391,2 +392,3 @@
    !!==============================================================================
 END MODULE wet_dry
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/FLO/flodom.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/FLO/flodom.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/FLO/flodom.F90	(revision 14219)
@@ -32,4 +32,8 @@
    INTEGER , ALLOCATABLE, DIMENSION(:) ::   idomfl, ivtest, ihtest    !   -     
    REAL(wp), ALLOCATABLE, DIMENSION(:) ::   zgifl, zgjfl,  zgkfl      ! distances in indexes
+
+
+   !! * Substitutions
+#  include "single_precision_substitute.h90"
 
    !!----------------------------------------------------------------------
@@ -229,6 +233,6 @@
             !        A--------|-----D
             !
-            zdxab = flo_dstnce( flxx(jfl), flyy(jfl), glamf(iimfl(jfl)-1,ijmfl(jfl)-1), flyy(jfl) )
-            zdyad = flo_dstnce( flxx(jfl), flyy(jfl), flxx(jfl), gphif(iimfl(jfl)-1,ijmfl(jfl)-1) )
+            zdxab = flo_dstnce( flxx(jfl), flyy(jfl), CASTWP(glamf(iimfl(jfl)-1,ijmfl(jfl)-1)), flyy(jfl) )
+            zdyad = flo_dstnce( flxx(jfl), flyy(jfl), flxx(jfl), CASTWP(gphif(iimfl(jfl)-1,ijmfl(jfl)-1)) )
 
             ! Translation of this distances (in meter) in indexes
@@ -360,10 +364,11 @@
       !! ** Method  : 
       !!----------------------------------------------------------------------
-      REAL(wp) ::   &
+      REAL(dp) , INTENT(in)::   &
          pax, pay, pbx, pby,    &     ! ???
          pcx, pcy, pdx, pdy,    &     ! ???
-         px, py,                &     ! longitude and latitude
          ptx, pty                     ! ???
-      LOGICAL ::  ldinmesh            ! ???
+      REAL(wp),  INTENT(in)::   &
+         px, py                       ! longitude and latitude
+      LOGICAL , INTENT(out) ::  ldinmesh            ! ???
       !!
       REAL(wp) ::   zabt, zbct, zcdt, zdat, zabpt, zbcpt, zcdpt, zdapt
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/FLO/flowri.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/FLO/flowri.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/FLO/flowri.F90	(revision 14219)
@@ -206,5 +206,5 @@
          CALL iom_put( "traj_salt"    , zsal  )
          CALL iom_put( "traj_dens"    , zrho )
-         CALL iom_put( "traj_group"   , REAL(ngrpfl,wp) )
+         CALL iom_put( "traj_group"   , REAL(ngrpfl,dp) )
 #else
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbdyn.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbdyn.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbdyn.F90	(revision 14219)
@@ -24,4 +24,7 @@
 
    PUBLIC   icb_dyn  ! routine called in icbstp.F90 module
+
+   !! * Substitutions
+#  include "single_precision_substitute.h90"
 
    !!----------------------------------------------------------------------
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbini.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbini.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbini.F90	(revision 14219)
@@ -41,4 +41,6 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
+
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -60,5 +62,5 @@
       !!              - setup either test icebergs or calving file
       !!----------------------------------------------------------------------
-      REAL(wp), INTENT(in) ::   pdt   ! iceberg time-step (rn_Dt*nn_fsbc)
+      REAL(dp), INTENT(in) ::   pdt   ! iceberg time-step (rn_Dt*nn_fsbc)
       INTEGER , INTENT(in) ::   kt    ! time step number
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbthm.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbthm.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbthm.F90	(revision 14219)
@@ -31,4 +31,7 @@
 
    PUBLIC   icb_thm ! routine called in icbstp.F90 module
+
+   !! * Substitutions
+#  include "single_precision_substitute.h90"
 
    !!----------------------------------------------------------------------
@@ -282,6 +285,6 @@
       END DO
       !
-      berg_grid%floating_melt = REAL(cicb_melt,dp)    ! kg/m2/s
-      berg_grid%calving_hflx  = REAL(cicb_hflx,dp)
+      berg_grid%floating_melt = CASTDP(cicb_melt)    ! kg/m2/s
+      berg_grid%calving_hflx  = CASTDP(cicb_hflx)
       !
       ! now use melt and associated heat flux in ocean (or not)
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbtrj.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbtrj.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbtrj.F90	(revision 14219)
@@ -63,5 +63,5 @@
       INTEGER                ::   iret, iyear, imonth, iday
       INTEGER                ::   idg  ! number of digits
-      REAL(wp)               ::   zfjulday, zsec
+      REAL(dp)               ::   zfjulday, zsec
       CHARACTER(len=80)      ::   cl_filename
       CHARACTER(LEN=12)      ::   clfmt            ! writing format
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbutl.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbutl.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ICB/icbutl.F90	(revision 14219)
@@ -59,4 +59,5 @@
    !! * Substitutions
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -182,6 +183,6 @@
       !
       ! metrics and coordinates
-      IF ( PRESENT(pe1 ) ) pe1 = icb_utl_bilin_e( e1t, e1u, e1v, e1f, pi, pj )      ! scale factors
-      IF ( PRESENT(pe2 ) ) pe2 = icb_utl_bilin_e( e2t, e2u, e2v, e2f, pi, pj )
+      IF ( PRESENT(pe1 ) ) pe1 = icb_utl_bilin_e( CASTWP(e1t), CASTWP(e1u), e1v, CASTWP(e1f), pi, pj )      ! scale factors
+      IF ( PRESENT(pe2 ) ) pe2 = icb_utl_bilin_e( CASTWP(e2t), e2u, CASTWP(e2v), CASTWP(e2f), pi, pj )
       IF ( PRESENT(plon) ) plon= icb_utl_bilin_h( rlon_e, iiT, ijT, zwT, .true.  )
       IF ( PRESENT(plat) ) plat= icb_utl_bilin_h( rlat_e, iiT, ijT, zwT, .false. )
@@ -215,15 +216,15 @@
       ! Estimate SSH gradient in i- and j-direction (centred evaluation)
       IF ( PRESENT(pssh_i) .AND. PRESENT(pssh_j) ) THEN
-         CALL icb_utl_pos( pi+0.1, pj    , 'T', iiTp, ijTp, zwTp, zmskTp )
-         CALL icb_utl_pos( pi-0.1, pj    , 'T', iiTm, ijTm, zwTm, zmskTm )
+         CALL icb_utl_pos( pi+0.1_wp, pj    , 'T', iiTp, ijTp, zwTp, zmskTp )
+         CALL icb_utl_pos( pi-0.1_wp, pj    , 'T', iiTm, ijTm, zwTm, zmskTm )
          !
-         IF ( .NOT. PRESENT(pe1) ) pe1 = icb_utl_bilin_e( e1t, e1u, e1v, e1f, pi, pj )
+         IF ( .NOT. PRESENT(pe1) ) pe1 = icb_utl_bilin_e( CASTWP(e1t), CASTWP(e1u), e1v, CASTWP(e1f), pi, pj )
          pssh_i = ( icb_utl_bilin_h( ssh_e, iiTp, ijTp, zwTp*zmskTp, .false. ) -   &
             &       icb_utl_bilin_h( ssh_e, iiTm, ijTm, zwTm*zmskTm, .false. )  ) / ( 0.2_wp * pe1 )
          !
-         CALL icb_utl_pos( pi    , pj+0.1, 'T', iiTp, ijTp, zwTp, zmskTp )
-         CALL icb_utl_pos( pi    , pj-0.1, 'T', iiTm, ijTm, zwTm, zmskTm )
+         CALL icb_utl_pos( pi    , pj+0.1_wp, 'T', iiTp, ijTp, zwTp, zmskTp )
+         CALL icb_utl_pos( pi    , pj-0.1_wp, 'T', iiTm, ijTm, zwTm, zmskTm )
          !
-         IF ( .NOT. PRESENT(pe2) ) pe2 = icb_utl_bilin_e( e2t, e2u, e2v, e2f, pi, pj )
+         IF ( .NOT. PRESENT(pe2) ) pe2 = icb_utl_bilin_e( CASTWP(e2t), e2u, CASTWP(e2v), CASTWP(e2f), pi, pj )
          pssh_j = ( icb_utl_bilin_h( ssh_e, iiTp, ijTp, zwTp*zmskTp, .false. ) -   &
             &       icb_utl_bilin_h( ssh_e, iiTm, ijTm, zwTm*zmskTm, .false. )  ) / ( 0.2_wp * pe2 )
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/in_out_manager.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/in_out_manager.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/in_out_manager.F90	(revision 14219)
@@ -1,3 +1,3 @@
-MODULE in_out_manager
+MODULE in_out_manager   
    !!======================================================================
    !!                       ***  MODULE  in_out_manager  ***
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/iom.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/iom.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/iom.F90	(revision 14219)
@@ -98,4 +98,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -169,11 +170,11 @@
       IF(.NOT.llrst_context) CALL set_scalar
       !
-      IF( cdname == cxios_context ) THEN
-         CALL set_grid( "T", glamt, gphit, .FALSE., .FALSE. )
+      IF( TRIM(cdname) == TRIM(cxios_context) ) THEN  
+         CALL set_grid( "T", CASTWP(glamt), CASTWP(gphit), .FALSE., .FALSE. )
          CALL set_grid( "U", glamu, gphiu, .FALSE., .FALSE. )
          CALL set_grid( "V", glamv, gphiv, .FALSE., .FALSE. )
-         CALL set_grid( "W", glamt, gphit, .FALSE., .FALSE. )
-         CALL set_grid( "F", glamf, gphif, .FALSE., .FALSE. )
-         CALL set_grid_znl( gphit )
+         CALL set_grid( "W", CASTWP(glamt), CASTWP(gphit), .FALSE., .FALSE. )
+         CALL set_grid( "F", CASTWP(glamf), CASTWP(gphif), .FALSE., .FALSE. )
+         CALL set_grid_znl( CASTWP(gphit) )
          !
          IF( ln_cfmeta ) THEN   ! Add additional grid metadata
@@ -181,11 +182,11 @@
             CALL iom_set_domain_attr("grid_U", area = real( e1e2u(Nis0:Nie0, Njs0:Nje0), dp))
             CALL iom_set_domain_attr("grid_V", area = real( e1e2v(Nis0:Nie0, Njs0:Nje0), dp))
-            CALL iom_set_domain_attr("grid_W", area = REAL( e1e2t(Nis0:Nie0, Njs0:Nje0), dp))
+            CALL iom_set_domain_attr("grid_W", area = real( e1e2t(Nis0:Nie0, Njs0:Nje0), dp))
             CALL iom_set_domain_attr("grid_F", area = real( e1e2f(Nis0:Nie0, Njs0:Nje0), dp))
-            CALL set_grid_bounds( "T", glamf, gphif, glamt, gphit )
+            CALL set_grid_bounds( "T", CASTWP(glamf), CASTWP(gphif), CASTWP(glamt), CASTWP(gphit) )
             CALL set_grid_bounds( "U", glamv, gphiv, glamu, gphiu )
             CALL set_grid_bounds( "V", glamu, gphiu, glamv, gphiv )
-            CALL set_grid_bounds( "W", glamf, gphif, glamt, gphit )
-            CALL set_grid_bounds( "F", glamt, gphit, glamf, gphif )
+            CALL set_grid_bounds( "W", CASTWP(glamf), CASTWP(gphif), CASTWP(glamt), CASTWP(gphit) )
+            CALL set_grid_bounds( "F", CASTWP(glamt), CASTWP(gphit), CASTWP(glamf), CASTWP(gphif) )
          ENDIF
       ENDIF
@@ -603,5 +604,5 @@
       CALL xios_get_handle("domain_definition",domaingroup_hdl)
       CALL xios_add_child(domaingroup_hdl, domain_hdl, "grid_N")
-      CALL set_grid("N", glamt, gphit, .TRUE., ld_rstr)
+      CALL set_grid("N", CASTWP(glamt), CASTWP(gphit), .TRUE., ld_rstr)
 
       CALL xios_get_handle("axis_definition",axisgroup_hdl)
@@ -1060,5 +1061,5 @@
       INTEGER         , INTENT(in   )              , OPTIONAL ::   ktime     ! record number
       CHARACTER(len=1), INTENT(in   )              , OPTIONAL ::   cd_type   ! nature of grid-points (T, U, V, F, W)
-      REAL(dp)        , INTENT(in   )              , OPTIONAL ::   psgn      ! -1.(1.): (not) change sign across the north fold
+      REAL(wp)        , INTENT(in   )              , OPTIONAL ::   psgn      ! -1.(1.): (not) change sign across the north fold
       INTEGER         , INTENT(in   )              , OPTIONAL ::   kfill     ! value of kfillmode in lbc_lbk
       INTEGER         , INTENT(in   ), DIMENSION(2), OPTIONAL ::   kstart    ! start axis position of the reading
@@ -1084,5 +1085,5 @@
       INTEGER         , INTENT(in   )              , OPTIONAL ::   ktime     ! record number
       CHARACTER(len=1), INTENT(in   )              , OPTIONAL ::   cd_type   ! nature of grid-points (T, U, V, F, W)
-      REAL(dp)        , INTENT(in   )              , OPTIONAL ::   psgn      ! -1.(1.): (not) change sign across the north fold
+      REAL(wp)        , INTENT(in   )              , OPTIONAL ::   psgn      ! -1.(1.): (not) change sign across the north fold
       INTEGER         , INTENT(in   )              , OPTIONAL ::   kfill     ! value of kfillmode in lbc_lbk
       INTEGER         , INTENT(in   ), DIMENSION(2), OPTIONAL ::   kstart    ! start axis position of the reading
@@ -1104,5 +1105,5 @@
       INTEGER         , INTENT(in   )              , OPTIONAL ::   ktime     ! record number
       CHARACTER(len=1), INTENT(in   )              , OPTIONAL ::   cd_type   ! nature of grid-points (T, U, V, F, W)
-      REAL(dp)        , INTENT(in   )              , OPTIONAL ::   psgn      ! -1.(1.) : (not) change sign across the north fold
+      REAL(wp)        , INTENT(in   )              , OPTIONAL ::   psgn      ! -1.(1.) : (not) change sign across the north fold
       INTEGER         , INTENT(in   )              , OPTIONAL ::   kfill     ! value of kfillmode in lbc_lbk
       INTEGER         , INTENT(in   ), DIMENSION(3), OPTIONAL ::   kstart    ! start axis position of the reading
@@ -1128,5 +1129,5 @@
       INTEGER         , INTENT(in   )              , OPTIONAL ::   ktime     ! record number
       CHARACTER(len=1), INTENT(in   )              , OPTIONAL ::   cd_type   ! nature of grid-points (T, U, V, F, W)
-      REAL(dp)        , INTENT(in   )              , OPTIONAL ::   psgn      ! -1.(1.) : (not) change sign across the north fold
+      REAL(wp)        , INTENT(in   )              , OPTIONAL ::   psgn      ! -1.(1.) : (not) change sign across the north fold
       INTEGER         , INTENT(in   )              , OPTIONAL ::   kfill     ! value of kfillmode in lbc_lbk
       INTEGER         , INTENT(in   ), DIMENSION(3), OPTIONAL ::   kstart    ! start axis position of the reading
@@ -1161,5 +1162,5 @@
       INTEGER                    , INTENT(in   ), OPTIONAL ::   ktime     ! record number
       CHARACTER(len=1)           , INTENT(in   ), OPTIONAL ::   cd_type   ! nature of grid-points (T, U, V, F, W)
-      REAL(dp)                   , INTENT(in   ), OPTIONAL ::   psgn      ! -1.(1.) : (not) change sign across the north fold
+      REAL(wp)                   , INTENT(in   ), OPTIONAL ::   psgn      ! -1.(1.) : (not) change sign across the north fold
       INTEGER                    , INTENT(in   ), OPTIONAL ::   kfill     ! value of kfillmode in lbc_lbk
       INTEGER , DIMENSION(:)     , INTENT(in   ), OPTIONAL ::   kstart    ! start position of the reading in each axis
@@ -2664,5 +2665,5 @@
       !! ** Purpose :   send back the date corresponding to the given julian day
       !!----------------------------------------------------------------------
-      REAL(wp), INTENT(in   )           ::   pjday    ! julian day
+      REAL(dp), INTENT(in   )           ::   pjday    ! julian day
       LOGICAL , INTENT(in   ), OPTIONAL ::   ld24     ! true to force 24:00 instead of 00:00
       LOGICAL , INTENT(in   ), OPTIONAL ::   ldfull   ! true to get the compleate date: yyyymmdd_hh:mm:ss
@@ -2671,5 +2672,5 @@
       CHARACTER(LEN=50) ::   clfmt                         !  format used to write the date
       INTEGER           ::   iyear, imonth, iday, ihour, iminute, isec
-      REAL(wp)          ::   zsec
+      REAL(dp)          ::   zsec
       LOGICAL           ::   ll24, llfull
       !!----------------------------------------------------------------------
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/prtctl.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/prtctl.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/prtctl.F90	(revision 14219)
@@ -310,5 +310,5 @@
             WRITE(numout,*) '~~~~~~~~~~~~~'
          ENDIF
-         IF( nn_ictls+nn_ictle+nn_jctls+nn_jctle == 0 )   THEN    ! print control done over the default area
+         IF( nn_ictls+nn_ictle+nn_jctls+nn_jctle == 0 )   THEN    ! print control done over the default area         
             nn_isplt = MAX(1, nn_isplt)            ! number of processors following i-direction
             nn_jsplt = MAX(1, nn_jsplt)            ! number of processors following j-direction
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/restart.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/restart.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/IOM/restart.F90	(revision 14219)
@@ -48,4 +48,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -328,8 +329,8 @@
                zgdept(:,:,jk) = gdept(:,:,jk,Kmm)
             END DO
-            CALL eos( ts(:,:,:,:,Kmm), rhd, rhop, zgdept )
+            CALL eos( CASTWP(ts(:,:,:,:,Kmm)), rhd, rhop, zgdept )
             DEALLOCATE( zgdept )
 #else
-            CALL eos( ts(:,:,:,:,Kmm), rhd, rhop, gdept(:,:,:,Kmm) )
+            CALL eos( CASTWP(ts(:,:,:,:,Kmm)), rhd, rhop, CASTWP(gdept(:,:,:,Kmm)) )
 #endif
          ENDIF
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfcpl.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfcpl.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfcpl.F90	(revision 14219)
@@ -50,4 +50,6 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
+
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -90,5 +92,5 @@
       IF(lwp) WRITE(numout,*) ' isfcpl_init:', id
       IF (id == 0) THEN
-         IF(lwp) WRITE(numout,*) ' isfcpl_init: restart variables for ice sheet coupling are missing, skip coupling for this leg '
+         IF(lwp) WRITE(numout,*) ' isfcpl_init: restart variables for ice sheet coupling are missing, skip coupling for this leg ' 
          IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~'
          IF(lwp) WRITE(numout,*) ''
@@ -214,5 +216,5 @@
       ssh(:,:,Kbb) = ssh(:,:,Kmm)
       !
-      IF ( ln_isfdebug ) CALL debug('isfcpl_ssh: sshn',ssh(:,:,Kmm))
+      IF ( ln_isfdebug ) CALL debug('isfcpl_ssh: sshn',CASTWP(ssh(:,:,Kmm)))
       !
       ! recompute the vertical scale factor, depth and water thickness
@@ -586,5 +588,5 @@
       ENDDO
       !
-      ! global
+      ! global 
       CALL mpp_sum('isfcpl',nisfl  )
       !
@@ -592,5 +594,5 @@
       ALLOCATE(zisfpts(nisfl(narea)))
       !
-      zisfpts(:) = isfcons(0,0,0,-HUGE(1.0), -HUGE(1.0), -HUGE(1.0), -HUGE(1.0), -HUGE(1.0), 0)
+      zisfpts(:) = isfcons(0,0,0,-HUGE(1.0_wp), -HUGE(1.0_wp), -HUGE(1.0_wp), -HUGE(1.0_wp), -HUGE(1.0_wp), 0)
       !
       ! start computing the correction and fill zisfpts
@@ -665,6 +667,6 @@
             ELSE
                iig  =0   ; ijg  =0   ; ik   =0
-               zdvol=-HUGE(1.0) ; zdsal=-HUGE(1.0) ; zdtem=-HUGE(1.0)
-               zlat =-HUGE(1.0) ; zlon =-HUGE(1.0)
+               zdvol=-HUGE(1.0_wp) ; zdsal=-HUGE(1.0_wp) ; zdtem=-HUGE(1.0)
+               zlat =-HUGE(1.0_wp) ; zlon =-HUGE(1.0_wp)
                ingb = 0
             END IF
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfdynatf.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfdynatf.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfdynatf.F90	(revision 14219)
@@ -27,4 +27,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
 
 CONTAINS
@@ -39,5 +40,5 @@
       INTEGER                         , INTENT(in   ) :: kt       ! ocean time step
       INTEGER                         , INTENT(in   ) :: Kmm      ! ocean time level index
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pe3t_f   ! time filtered scale factor to be corrected
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pe3t_f   ! time filtered scale factor to be corrected
       !
       REAL(wp)                        , INTENT(in   ) :: pcoef    ! rn_atfp * rn_Dt * r1_rho0
@@ -68,5 +69,5 @@
       !!-------------------------- IN  -------------------------------------
       INTEGER                         , INTENT(in   ) :: Kmm             ! ocean time level index
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pe3t_f          ! time-filtered scale factor to be corrected
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pe3t_f          ! time-filtered scale factor to be corrected
       INTEGER , DIMENSION(jpi,jpj)    , INTENT(in   ) :: ktop , kbot     ! top and bottom level of tbl
       REAL(wp), DIMENSION(jpi,jpj)    , INTENT(in   ) :: pfrac, phtbl    ! fraction of bottom cell included in tbl, tbl thickness
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfload.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfload.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfload.F90	(revision 14219)
@@ -28,4 +28,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -85,5 +86,5 @@
       !
       DO jk = 1, jpk                   !- compute density of the water displaced by the ice shelf 
-         CALL eos( zts_top(:,:,:), gdept(:,:,jk,Kmm), zrhd(:,:,jk) )
+         CALL eos( zts_top(:,:,:), CASTWP(gdept(:,:,jk,Kmm)), zrhd(:,:,jk) )
 !!st ==>> CALL eos( zts_top(:,:,:), gdept_0(:,:,jk), zrhd(:,:,jk) )
       END DO
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfparmlt.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfparmlt.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfparmlt.F90	(revision 14219)
@@ -28,4 +28,5 @@
    PUBLIC  isfpar_mlt 
    
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -99,7 +100,7 @@
       ! 1. ------------Mean freezing point
       DO jk = 1,jpk
-         CALL eos_fzp(ts(:,:,jk,jp_sal,Kmm), ztfrz3d(:,:,jk), gdept(:,:,jk,Kmm))
+         CALL eos_fzp(CASTWP(ts(:,:,jk,jp_sal,Kmm)), ztfrz3d(:,:,jk), CASTWP(gdept(:,:,jk,Kmm)))
       END DO
-      CALL isf_tbl(Kmm, ztfrz3d, ztfrz, 'T', misfkt_par, rhisf_tbl_par, misfkb_par, rfrac_tbl_par )
+      CALL isf_tbl(Kmm, CASTDP(ztfrz3d), ztfrz, 'T', misfkt_par, rhisf_tbl_par, misfkb_par, rfrac_tbl_par )
       !
       pqfwf(:,:) = - sf_isfpar_fwf(1)%fnow(:,:,1)      ! fresh water flux from the isf (fwfisf <0 mean melting) 
@@ -140,7 +141,7 @@
       ! 0. ------------Mean freezing point
       DO jk = 1,jpk
-         CALL eos_fzp(ts(:,:,jk,jp_sal,Kmm), ztfrz3d(:,:,jk), gdept(:,:,jk,Kmm))
+         CALL eos_fzp(CASTWP(ts(:,:,jk,jp_sal,Kmm)), ztfrz3d(:,:,jk), CASTWP(gdept(:,:,jk,Kmm)))
       END DO
-      CALL isf_tbl(Kmm, ztfrz3d, ztfrz, 'T', misfkt_par, rhisf_tbl_par, misfkb_par, rfrac_tbl_par )
+      CALL isf_tbl(Kmm, CASTDP(ztfrz3d), ztfrz, 'T', misfkt_par, rhisf_tbl_par, misfkb_par, rfrac_tbl_par )
       !
       ! 1. ------------Mean temperature
@@ -193,7 +194,7 @@
       ! 1. ------------Mean freezing point (needed for heat content flux)
       DO jk = 1,jpk
-         CALL eos_fzp(ts(:,:,jk,jp_sal,Kmm), ztfrz3d(:,:,jk), gdept(:,:,jk,Kmm))
+         CALL eos_fzp(CASTWP(ts(:,:,jk,jp_sal,Kmm)), ztfrz3d(:,:,jk), CASTWP(gdept(:,:,jk,Kmm)))
       END DO
-      CALL isf_tbl(Kmm, ztfrz3d, ztfrz, 'T', misfkt_par, rhisf_tbl_par, misfkb_par, rfrac_tbl_par )
+      CALL isf_tbl(Kmm, CASTDP(ztfrz3d), ztfrz, 'T', misfkt_par, rhisf_tbl_par, misfkb_par, rfrac_tbl_par )
       !
       ! 2. ------------Scale isf melt pattern with total amount from oasis
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfstp.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfstp.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfstp.F90	(revision 14219)
@@ -37,4 +37,5 @@
    !! * Substitutions
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -89,5 +90,5 @@
          CALL isf_tbl_lvl( ht(:,:), ze3t           , misfkt_cav, misfkb_cav, rhisf_tbl_cav, rfrac_tbl_cav )
 #else
-         CALL isf_tbl_lvl( ht(:,:),  e3t(:,:,:,Kmm), misfkt_cav, misfkb_cav, rhisf_tbl_cav, rfrac_tbl_cav )
+         CALL isf_tbl_lvl( ht(:,:),  CASTWP(e3t(:,:,:,Kmm)), misfkt_cav, misfkb_cav, rhisf_tbl_cav, rfrac_tbl_cav )
 #endif
          !
@@ -118,5 +119,5 @@
          CALL isf_tbl_lvl( ht(:,:), ze3t           , misfkt_par, misfkb_par, rhisf_tbl_par, rfrac_tbl_par )
 #else
-         CALL isf_tbl_lvl( ht(:,:),  e3t(:,:,:,Kmm), misfkt_par, misfkb_par, rhisf_tbl_par, rfrac_tbl_par )
+         CALL isf_tbl_lvl( ht(:,:),  CASTWP(e3t(:,:,:,Kmm)), misfkt_par, misfkb_par, rhisf_tbl_par, rfrac_tbl_par )
 #endif
          !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isftbl.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isftbl.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isftbl.F90	(revision 14219)
@@ -45,5 +45,5 @@
       INTEGER                               , INTENT(in   ) :: Kmm           ! ocean time level index
       CHARACTER(len=1)                      , INTENT(in   ) :: cd_ptin       ! point of variable in/out
-      REAL(wp), DIMENSION(jpi,jpj,jpk)      , INTENT(in   ) :: pvarin        ! 3d variable to average over the tbl
+      REAL(dp), DIMENSION(jpi,jpj,jpk)      , INTENT(in   ) :: pvarin        ! 3d variable to average over the tbl
       INTEGER,  DIMENSION(jpi,jpj)          , INTENT(in   ) :: ktop          ! top level
       REAL(wp), DIMENSION(jpi,jpj)          , INTENT(in   ) :: phtbl         ! tbl thickness
@@ -131,5 +131,5 @@
       REAL(wp), DIMENSION(jpi,jpj)    , INTENT(in   ) :: phtbl, pfrac ! fraction of bottom level to be affected by the tbl
       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) :: pe3          ! vertical scale factor
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) :: pvarin       ! tbl property to average between ktop, kbot over phtbl
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) :: pvarin       ! tbl property to average between ktop, kbot over phtbl
       !!--------------------------------------------------------------------
       INTEGER  :: ji,jj,jk                    ! loop indices
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfutils.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfutils.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ISF/isfutils.F90	(revision 14219)
@@ -16,5 +16,6 @@
    USE par_oce       , ONLY: jpi,jpj,jpk, jpnij, Nis0, Nie0, Njs0, Nje0      ! domain size
    USE dom_oce       , ONLY: narea, tmask_h, tmask_i                         ! local domain
-   USE in_out_manager, ONLY: i8, wp, lwp, numout                             ! miscelenious
+   USE in_out_manager, ONLY: lwp, numout                             ! miscelenious
+   USE par_kind
    USE lib_mpp
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/LBC/mpp_nfd_generic.h90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/LBC/mpp_nfd_generic.h90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/LBC/mpp_nfd_generic.h90	(revision 14219)
@@ -67,5 +67,5 @@
 #    define RECVROUTINE mpprecv_sp
 #    define MPI_TYPE MPI_REAL
-#    define HUGEVAL(x)   HUGE(x/**/_sp)
+#    define HUGEVAL(x)   HUGE(x##_sp)
 # else
 #    define PRECISION dp
@@ -73,5 +73,5 @@
 #    define RECVROUTINE mpprecv_dp
 #    define MPI_TYPE MPI_DOUBLE_PRECISION
-#    define HUGEVAL(x)   HUGE(x/**/_dp)
+#    define HUGEVAL(x)   HUGE(x##_dp)
 # endif
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/LDF/ldftra.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/LDF/ldftra.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/LDF/ldftra.F90	(revision 14219)
@@ -867,5 +867,5 @@
       CALL iom_put( "veiv_heattr3d", zztmp * zw3d )                  !  heat transport in j-direction
       !
-      IF( iom_use( 'sophteiv' ) )   CALL dia_ptr_hst( jp_tem, 'eiv', 0.5 * zw3d )
+      IF( iom_use( 'sophteiv' ) )   CALL dia_ptr_hst( jp_tem, 'eiv', 0.5_wp * zw3d )
       !
       zztmp = 0.5_wp * 0.5
@@ -891,5 +891,5 @@
       CALL iom_put( "veiv_salttr3d", zztmp * zw3d )                  !  salt transport in j-direction
       !
-      IF( iom_use( 'sopsteiv' ) ) CALL dia_ptr_hst( jp_sal, 'eiv', 0.5 * zw3d )
+      IF( iom_use( 'sopsteiv' ) ) CALL dia_ptr_hst( jp_sal, 'eiv', 0.5_wp * zw3d )
       !
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/diaobs.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/diaobs.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/diaobs.F90	(revision 14219)
@@ -98,4 +98,7 @@
 
    CHARACTER(len=8), PUBLIC, DIMENSION(:), ALLOCATABLE ::   cobstypesprof, cobstypessurf   !: Profile & surface obs types
+
+      !! * Substitutions
+#  include "single_precision_substitute.h90"
 
    !!----------------------------------------------------------------------
@@ -687,5 +690,5 @@
                   &               nit000, idaystp, jvar,                   &
                   &               zprofvar(:,:,:,jvar),                    &
-                  &               gdept(:,:,:,Kmm), gdepw(:,:,:,Kmm),      & 
+                  &               CASTWP(gdept(:,:,:,Kmm)), gdepw(:,:,:,Kmm),      & 
                   &               zprofmask(:,:,:,jvar),                   &
                   &               zglam(:,:,jvar), zgphi(:,:,jvar),        &
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_averg_h2d.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_averg_h2d.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_averg_h2d.F90	(revision 14219)
@@ -42,4 +42,7 @@
       &   obs_avg_h2d_init, & ! Set up weights for the averaging
       &   obs_max_fpsize      ! Works out the maximum number of grid points required for the averaging
+
+   !! * Substitutions
+#  include "single_precision_substitute.h90"
 
    !!----------------------------------------------------------------------
@@ -603,5 +606,5 @@
             !If the scales are specified in degrees, work out the max 
             !distance (metres) in x/y directions
-            CALL obs_deg2dist( jpi, jpj, glamt, gphit, &
+            CALL obs_deg2dist( jpi, jpj, CASTWP(glamt), CASTWP(gphit), &
                &               plamscl, pphiscl, zlamscl_m, zphiscl_m )
          ELSE
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_grid.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_grid.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_grid.F90	(revision 14219)
@@ -85,4 +85,8 @@
       & cn_gridsearchfile    ! file name head for grid search lookup 
 
+
+#  include "single_precision_substitute.h90"
+
+
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -131,5 +135,5 @@
                   &                             1, jpi, 1, jpj,           &
                   &                             nproc, jpnij,             &
-                  &                             glamt, gphit, tmask,      &
+                  &                             CASTWP(glamt), CASTWP(gphit), tmask,      &
                   &                             kobsin, plam, pphi,       &
                   &                             kobsi, kobsj, kproc )
@@ -152,5 +156,5 @@
                   &                             1, jpi, 1, jpj,           &
                   &                             nproc, jpnij,             &
-                  &                             glamf, gphif, fmask,      &
+                  &                             CASTWP(glamf), CASTWP(gphif), fmask,      &
                   &                             kobsin, plam, pphi,       &
                   &                             kobsi, kobsj, kproc )
@@ -821,5 +825,5 @@
                &                     1, jpi, 1, jpj,            &
                &                     nproc, jpnij,              &
-               &                     glamt, gphit, tmask,       &
+               &                     CASTWP(glamt), CASTWP(gphit), tmask,       &
                &                     nlons*nlats, lonsi, latsi, &
                &                     ixposi, iyposi, iproci )
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_oper.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_oper.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_oper.F90	(revision 14219)
@@ -33,4 +33,6 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
+
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -653,7 +655,7 @@
 
       CALL obs_int_comm_2d( imaxifp, imaxjfp, isurf, kpi, kpj, &
-         &                  igrdi, igrdj, glamt, zglam )
+         &                  igrdi, igrdj, CASTWP(glamt), zglam )
       CALL obs_int_comm_2d( imaxifp, imaxjfp, isurf, kpi, kpj, &
-         &                  igrdi, igrdj, gphit, zgphi )
+         &                  igrdi, igrdj, CASTWP(gphit), zgphi )
       CALL obs_int_comm_2d( imaxifp, imaxjfp, isurf, kpi, kpj, &
          &                  igrdi, igrdj, psurfmask, zmask )
@@ -661,7 +663,7 @@
          &                  igrdi, igrdj, psurf, zsurf )
       CALL obs_int_comm_2d( imaxifp+1, imaxjfp+1, isurf, kpi, kpj, &
-         &                  igrdip1, igrdjp1, glamf, zglamf )
+         &                  igrdip1, igrdjp1, CASTWP(glamf), zglamf )
       CALL obs_int_comm_2d( imaxifp+1, imaxjfp+1, isurf, kpi, kpj, &
-         &                  igrdip1, igrdjp1, gphif, zgphif )
+         &                  igrdip1, igrdjp1, CASTWP(gphif), zgphif )
 
       ! At the end of the day get interpolated means
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_prep.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_prep.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_prep.F90	(revision 14219)
@@ -32,4 +32,8 @@
    PUBLIC   obs_pre_surf     ! First level check and screening of surface obs
    PUBLIC   calc_month_len   ! Calculate the number of days in the months of a year
+
+   !! * Substitutions
+#  include "single_precision_substitute.h90"
+
 
    !!----------------------------------------------------------------------
@@ -151,5 +155,5 @@
          &                 surfdata%mi,   surfdata%mj,   & 
          &                 surfdata%rlam, surfdata%rphi, &
-         &                 glamt,        gphit,        &
+         &                 CASTWP(glamt),        CASTWP(gphit),        &
          &                 tmask(:,:,1), surfdata%nqc,  &
          &                 iosdsobs,     ilansobs,     &
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_read_altbias.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_read_altbias.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_read_altbias.F90	(revision 14219)
@@ -41,4 +41,8 @@
    PUBLIC obs_rea_altbias     ! Read the altimeter bias
 
+   !! * Substitutions
+#  include "single_precision_substitute.h90"
+
+
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -162,7 +166,7 @@
 
       CALL obs_int_comm_2d( 2, 2, sladata%nsurf, jpi, jpj, &
-         &                  igrdi, igrdj, glamt, zglam )
-      CALL obs_int_comm_2d( 2, 2, sladata%nsurf, jpi, jpj, &
-         &                  igrdi, igrdj, gphit, zgphi )
+         &                  igrdi, igrdj, CASTWP(glamt), zglam )
+      CALL obs_int_comm_2d( 2, 2, sladata%nsurf, jpi, jpj, &
+         &                  igrdi, igrdj, CASTWP(gphit), zgphi )
       CALL obs_int_comm_2d( 2, 2, sladata%nsurf, jpi, jpj, &
          &                  igrdi, igrdj, tmask(:,:,1), zmask )
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_readmdt.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_readmdt.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_readmdt.F90	(revision 14219)
@@ -39,4 +39,6 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
+
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -135,6 +137,6 @@
       END DO
 
-      CALL obs_int_comm_2d( 2, 2, sladata%nsurf, jpi, jpj, igrdi, igrdj, glamt  , zglam )
-      CALL obs_int_comm_2d( 2, 2, sladata%nsurf, jpi, jpj, igrdi, igrdj, gphit  , zgphi )
+      CALL obs_int_comm_2d( 2, 2, sladata%nsurf, jpi, jpj, igrdi, igrdj, CASTWP(glamt)  , zglam )
+      CALL obs_int_comm_2d( 2, 2, sladata%nsurf, jpi, jpj, igrdi, igrdj, CASTWP(gphit)  , zgphi )
       CALL obs_int_comm_2d( 2, 2, sladata%nsurf, jpi, jpj, igrdi, igrdj, mdtmask, zmask )
       CALL obs_int_comm_2d( 2, 2, sladata%nsurf, jpi, jpj, igrdi, igrdj, z_mdt  , zmdtl )
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_sstbias.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_sstbias.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/OBS/obs_sstbias.F90	(revision 14219)
@@ -36,4 +36,7 @@
    PRIVATE
    PUBLIC obs_app_sstbias     ! Read the altimeter bias
+   !! * Substitutions
+#  include "single_precision_substitute.h90"
+
 CONTAINS
    SUBROUTINE obs_app_sstbias( sstdata, k2dint, knumtypes, &
@@ -168,7 +171,7 @@
       END DO
       CALL obs_int_comm_2d( 2, 2, sstdata%nsurf, jpi, jpj, &
-         &                  igrdi, igrdj, glamt, zglam )
+         &                  igrdi, igrdj, CASTWP(glamt), zglam )
       CALL obs_int_comm_2d( 2, 2, sstdata%nsurf, jpi, jpj, &
-         &                  igrdi, igrdj, gphit, zgphi )
+         &                  igrdi, igrdj, CASTWP(gphit), zgphi )
       CALL obs_int_comm_2d( 2, 2, sstdata%nsurf, jpi, jpj, &
          &                  igrdi, igrdj, tmask(:,:,1), zmask )
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/cpl_oasis3.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/cpl_oasis3.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/cpl_oasis3.F90	(revision 14219)
@@ -14,5 +14,5 @@
    !!            3.6  !  2014-11  (S. Masson) OASIS3-MCT
    !!----------------------------------------------------------------------
-
+   
    !!----------------------------------------------------------------------
    !!   'key_oasis3'                    coupled Ocean/Atmosphere via OASIS3-MCT
@@ -63,15 +63,15 @@
 #endif
 
-   INTEGER                    ::   nrcv         ! total number of fields received
-   INTEGER                    ::   nsnd         ! total number of fields sent
+   INTEGER                    ::   nrcv         ! total number of fields received 
+   INTEGER                    ::   nsnd         ! total number of fields sent 
    INTEGER                    ::   ncplmodel    ! Maximum number of models to/from which NEMO is potentialy sending/receiving data
-   INTEGER, PUBLIC, PARAMETER ::   nmaxfld=62   ! Maximum number of coupling fields
+   INTEGER, PUBLIC, PARAMETER ::   nmaxfld=60   ! Maximum number of coupling fields
    INTEGER, PUBLIC, PARAMETER ::   nmaxcat=5    ! Maximum number of coupling fields
    INTEGER, PUBLIC, PARAMETER ::   nmaxcpl=5    ! Maximum number of coupling fields
-
+   
    TYPE, PUBLIC ::   FLD_CPL               !: Type for coupling field information
       LOGICAL               ::   laction   ! To be coupled or not
-      CHARACTER(len = 8)    ::   clname    ! Name of the coupling field
-      CHARACTER(len = 1)    ::   clgrid    ! Grid type
+      CHARACTER(len = 8)    ::   clname    ! Name of the coupling field   
+      CHARACTER(len = 1)    ::   clgrid    ! Grid type  
       REAL(wp)              ::   nsgn      ! Control of the sign change
       INTEGER, DIMENSION(nmaxcat,nmaxcpl) ::   nid   ! Id of the field (no more than 9 categories and 9 extrena models)
@@ -98,5 +98,5 @@
       !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software)
       !!
-      !! ** Method  :   OASIS3 MPI communication
+      !! ** Method  :   OASIS3 MPI communication 
       !!--------------------------------------------------------------------
       CHARACTER(len = *), INTENT(in   ) ::   cd_modname   ! model name as set in namcouple file
@@ -132,5 +132,5 @@
       !!    exchange between AGCM, OGCM and COUPLER. (OASIS3 software)
       !!
-      !! ** Method  :   OASIS3 MPI communication
+      !! ** Method  :   OASIS3 MPI communication 
       !!--------------------------------------------------------------------
       INTEGER, INTENT(in) ::   krcv, ksnd     ! Number of received and sent coupling fields
@@ -180,13 +180,13 @@
       !
       ! -----------------------------------------------------------------
-      ! ... Define the partition, excluding halos as we don't want them to be "seen" by oasis
+      ! ... Define the partition, excluding halos as we don't want them to be "seen" by oasis    
       ! -----------------------------------------------------------------
-
+      
       paral(1) = 2                                      ! box partitioning
-      paral(2) = Ni0glo * mjg0(nn_hls) + mig0(nn_hls)   ! NEMO lower left corner global offset, without halos
+      paral(2) = Ni0glo * mjg0(nn_hls) + mig0(nn_hls)   ! NEMO lower left corner global offset, without halos 
       paral(3) = Ni_0                                   ! local extent in i, excluding halos
       paral(4) = Nj_0                                   ! local extent in j, excluding halos
       paral(5) = Ni0glo                                 ! global extent in x, excluding halos
-
+      
       IF( sn_cfctl%l_oasout ) THEN
          WRITE(numout,*) ' multiexchg: paral (1:5)', paral
@@ -195,8 +195,8 @@
          WRITE(numout,*) ' multiexchg: Njs0, Nje0, njmpp =', Njs0, Nje0, njmpp
       ENDIF
-
+   
       CALL oasis_def_partition ( id_part, paral, nerror, Ni0glo*Nj0glo )   ! global number of points, excluding halos
       !
-      ! ... Announce send variables.
+      ! ... Announce send variables. 
       !
       ssnd(:)%ncplmodel = kcplmodel
@@ -210,5 +210,5 @@
                RETURN
             ENDIF
-
+            
             DO jc = 1, ssnd(ji)%nct
                DO jm = 1, kcplmodel
@@ -225,5 +225,5 @@
                   ENDIF
 #if defined key_agrif
-                  IF( agrif_fixed() /= 0 ) THEN
+                  IF( agrif_fixed() /= 0 ) THEN 
                      zclname=TRIM(Agrif_CFixed())//'_'//TRIM(zclname)
                   ENDIF
@@ -243,11 +243,11 @@
       END DO
       !
-      ! ... Announce received variables.
+      ! ... Announce received variables. 
       !
       srcv(:)%ncplmodel = kcplmodel
       !
       DO ji = 1, krcv
-         IF( srcv(ji)%laction ) THEN
-
+         IF( srcv(ji)%laction ) THEN 
+            
             IF( srcv(ji)%nct > nmaxcat ) THEN
                CALL oasis_abort ( ncomp_id, 'cpl_define', 'Number of categories of '//   &
@@ -255,8 +255,8 @@
                RETURN
             ENDIF
-
+            
             DO jc = 1, srcv(ji)%nct
                DO jm = 1, kcplmodel
-
+                  
                   IF( srcv(ji)%nct .GT. 1 ) THEN
                      WRITE(cli2,'(i2.2)') jc
@@ -270,5 +270,5 @@
                   ENDIF
 #if defined key_agrif
-                  IF( agrif_fixed() /= 0 ) THEN
+                  IF( agrif_fixed() /= 0 ) THEN 
                      zclname=TRIM(Agrif_CFixed())//'_'//TRIM(zclname)
                   ENDIF
@@ -288,9 +288,9 @@
          ENDIF
       END DO
-
+      
       !------------------------------------------------------------------
       ! End of definition phase
       !------------------------------------------------------------------
-      !
+      !     
 #if defined key_agrif
       IF( agrif_fixed() == Agrif_Nb_Fine_Grids() ) THEN
@@ -303,6 +303,6 @@
       !
    END SUBROUTINE cpl_define
-
-
+   
+   
    SUBROUTINE cpl_snd( kid, kstep, pdata, kinfo )
       !!---------------------------------------------------------------------
@@ -324,9 +324,9 @@
       DO jc = 1, ssnd(kid)%nct
          DO jm = 1, ssnd(kid)%ncplmodel
-
+        
             IF( ssnd(kid)%nid(jc,jm) /= -1 ) THEN   ! exclude halos from data sent to oasis
                CALL oasis_put ( ssnd(kid)%nid(jc,jm), kstep, pdata(Nis0:Nie0, Njs0:Nje0,jc), kinfo )
-
-               IF ( sn_cfctl%l_oasout ) THEN
+               
+               IF ( sn_cfctl%l_oasout ) THEN        
                   IF ( kinfo == OASIS_Sent     .OR. kinfo == OASIS_ToRest .OR.   &
                      & kinfo == OASIS_SentOut  .OR. kinfo == OASIS_ToRestOut ) THEN
@@ -342,7 +342,7 @@
                   ENDIF
                ENDIF
-
+               
             ENDIF
-
+            
          ENDDO
       ENDDO
@@ -379,16 +379,16 @@
             IF( srcv(kid)%nid(jc,jm) /= -1 ) THEN
 
-               CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo )
-
+               CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo )         
+               
                llaction =  kinfo == OASIS_Recvd   .OR. kinfo == OASIS_FromRest .OR.   &
                   &        kinfo == OASIS_RecvOut .OR. kinfo == OASIS_FromRestOut
-
+               
                IF ( sn_cfctl%l_oasout )   &
                   &  WRITE(numout,*) "llaction, kinfo, kstep, ivarid: " , llaction, kinfo, kstep, srcv(kid)%nid(jc,jm)
-
+               
                IF( llaction ) THEN   ! data received from oasis do not include halos
-
+                  
                   kinfo = OASIS_Rcv
-                  IF( ll_1st ) THEN
+                  IF( ll_1st ) THEN 
                      pdata(Nis0:Nie0,Njs0:Nje0,jc) =   exfld(:,:) * pmask(Nis0:Nie0,Njs0:Nje0,jm)
                      ll_1st = .FALSE.
@@ -397,6 +397,6 @@
                         &                                + exfld(:,:) * pmask(Nis0:Nie0,Njs0:Nje0,jm)
                   ENDIF
-
-                  IF ( sn_cfctl%l_oasout ) THEN
+                  
+                  IF ( sn_cfctl%l_oasout ) THEN        
                      WRITE(numout,*) '****************'
                      WRITE(numout,*) 'oasis_get: Incoming ', srcv(kid)%clname
@@ -409,16 +409,16 @@
                      WRITE(numout,*) '****************'
                   ENDIF
-
+                  
                ENDIF
-
+               
             ENDIF
-
+            
          ENDDO
 
          !--- we must call lbc_lnk to fill the halos that where not received.
          IF( .NOT. ll_1st ) THEN
-            CALL lbc_lnk( 'cpl_oasis3', pdata(:,:,jc), srcv(kid)%clgrid, srcv(kid)%nsgn )
+            CALL lbc_lnk( 'cpl_oasis3', pdata(:,:,jc), srcv(kid)%clgrid, srcv(kid)%nsgn )   
          ENDIF
-
+ 
       ENDDO
       !
@@ -426,5 +426,5 @@
 
 
-   INTEGER FUNCTION cpl_freq( cdfieldname )
+   INTEGER FUNCTION cpl_freq( cdfieldname )  
       !!---------------------------------------------------------------------
       !!              ***  ROUTINE cpl_freq  ***
@@ -491,8 +491,8 @@
       DEALLOCATE( exfld )
       IF(nstop == 0) THEN
-         CALL oasis_terminate( nerror )
+         CALL oasis_terminate( nerror )         
       ELSE
          CALL oasis_abort( ncomp_id, "cpl_finalize", "NEMO ABORT STOP" )
-      ENDIF
+      ENDIF       
       !
    END SUBROUTINE cpl_finalize
@@ -544,5 +544,5 @@
       WRITE(numout,*) 'oasis_enddef: Error you sould not be there...'
    END SUBROUTINE oasis_enddef
-
+  
    SUBROUTINE oasis_put(k1,k2,p1,k3)
       REAL(wp), DIMENSION(:,:), INTENT(in   ) ::  p1
@@ -574,5 +574,5 @@
       WRITE(numout,*) 'oasis_terminate: Error you sould not be there...'
    END SUBROUTINE oasis_terminate
-
+   
 #endif
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/fldread.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/fldread.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/fldread.F90	(revision 14219)
@@ -383,5 +383,5 @@
          IF( lk_c1d .AND. lmoor ) THEN
             CALL iom_get( sdjf%num, jpdom_unknown, sdjf%clvar, dta_alias(2,2,:), sdjf%nrec(1,iaa) )   ! jpdom_unknown -> no lbc_lnk
-            CALL lbc_lnk( 'fldread', dta_alias(:,:,:), 'T', 1., kfillmode = jpfillcopy )
+            CALL lbc_lnk( 'fldread', dta_alias(:,:,:), 'T', 1._wp, kfillmode = jpfillcopy )
          ELSE
             CALL iom_get( sdjf%num,  jpdom_global, sdjf%clvar, dta_alias(:,:,:), sdjf%nrec(1,iaa),   &
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/geo2ocean.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/geo2ocean.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/geo2ocean.F90	(revision 14219)
@@ -44,4 +44,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -73,5 +74,5 @@
          IF(lwp) WRITE(numout,*) ' ~~~~~~~~    '
          !
-         CALL angle( glamt, gphit, glamu, gphiu, glamv, gphiv, glamf, gphif )       ! initialization of the transformation
+         CALL angle( CASTWP(glamt), CASTWP(gphit), glamu, gphiu, glamv, gphiv, CASTWP(glamf), CASTWP(gphif) )       ! initialization of the transformation
          lmust_init = .FALSE.
       ENDIF
@@ -449,5 +450,5 @@
          IF(lwp) WRITE(numout,*) ' obs_rot : geographic <--> stretched'
          IF(lwp) WRITE(numout,*) ' ~~~~~~~   coordinate transformation'
-         CALL angle( glamt, gphit, glamu, gphiu, glamv, gphiv, glamf, gphif )       ! initialization of the transformation
+         CALL angle( CASTWP(glamt), CASTWP(gphit), glamu, gphiu, glamv, gphiv, CASTWP(glamf), CASTWP(gphif) )       ! initialization of the transformation
          lmust_init = .FALSE.
       ENDIF
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbc_phy.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbc_phy.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbc_phy.F90	(revision 14219)
@@ -770,5 +770,5 @@
       ztaa = pTa ! first guess...
       DO jq = 1, 4
-         zgamma = gamma_moist( 0.5*(ztaa+pTs) , pqa )  !#LB: why not "0.5*(pqs+pqa)" rather then "pqa" ???
+         zgamma = gamma_moist( 0.5_wp*(ztaa+pTs) , pqa )  !#LB: why not "0.5*(pqs+pqa)" rather then "pqa" ???
          ztaa = pTa - zgamma*pzu   ! Absolute temp. is slightly colder...
       END DO
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcblk.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcblk.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcblk.F90	(revision 14219)
@@ -830,7 +830,7 @@
 
          IF( ln_crt_fbk ) THEN
-            CALL lbc_lnk_multi( 'sbcblk', utau, 'U', -1., vtau, 'V', -1., taum, 'T', -1. )
+            CALL lbc_lnk_multi( 'sbcblk', utau, 'U', -1._wp, vtau, 'V', -1._wp, taum, 'T', -1._wp )
          ELSE
-            CALL lbc_lnk_multi( 'sbcblk', utau, 'U', -1., vtau, 'V', -1. )
+            CALL lbc_lnk_multi( 'sbcblk', utau, 'U', -1._wp, vtau, 'V', -1._wp )
          ENDIF
 
@@ -1197,5 +1197,5 @@
       ! --- evaporation minus precipitation --- !
       zsnw(:,:) = 0._wp
-      CALL ice_var_snwblow( (1.-at_i_b(:,:)), zsnw )  ! snow distribution over ice after wind blowing
+      CALL ice_var_snwblow( 1._wp-at_i_b(:,:), zsnw )  ! snow distribution over ice after wind blowing
       emp_oce(:,:) = ( 1._wp - at_i_b(:,:) ) * zevap(:,:) - ( tprecip(:,:) - sprecip(:,:) ) - sprecip(:,:) * (1._wp - zsnw )
       emp_ice(:,:) = SUM( a_i_b(:,:,:) * evap_ice(:,:,:), dim=3 ) - sprecip(:,:) * zsnw
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbccpl.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbccpl.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbccpl.F90	(revision 14219)
@@ -226,4 +226,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -1666,5 +1667,5 @@
                p_tauj(ji,jj) = zztmp2 * ( frcv(jpr_ity1)%z3(ji  ,jj+1,1) + frcv(jpr_ity1)%z3(ji,jj,1) )
             END_2D
-            CALL lbc_lnk_multi( 'sbccpl', p_taui, 'U',  -1., p_tauj, 'V',  -1. )
+            CALL lbc_lnk_multi( 'sbccpl', p_taui, 'U',  -1._wp, p_tauj, 'V',  -1._wp )
          END SELECT
 
@@ -2278,6 +2279,6 @@
             ztmp1(:,:) = ts(:,:,1,jp_tem,Kmm)   ! send temperature as it is (potential or conservative) -> use of l_useCT on the received part
          ELSE
-            ! we must send the surface potential temperature
-            IF( l_useCT )  THEN    ;   ztmp1(:,:) = eos_pt_from_ct( ts(:,:,1,jp_tem,Kmm), ts(:,:,1,jp_sal,Kmm) )
+            ! we must send the surface potential temperature 
+            IF( l_useCT )  THEN    ;   ztmp1(:,:) = eos_pt_from_ct( CASTWP(ts(:,:,1,jp_tem,Kmm)),CASTWP(ts(:,:,1,jp_sal,Kmm)) )
             ELSE                   ;   ztmp1(:,:) = ts(:,:,1,jp_tem,Kmm)
             ENDIF
@@ -2713,9 +2714,9 @@
       !                                                        ! SSS
       IF( ssnd(jps_soce  )%laction )  THEN
-         CALL cpl_snd( jps_soce  , isec, RESHAPE ( ts(:,:,1,jp_sal,Kmm), (/jpi,jpj,1/) ), info )
+         CALL cpl_snd( jps_soce  , isec, RESHAPE ( CASTWP(ts(:,:,1,jp_sal,Kmm)), (/jpi,jpj,1/) ), info )
       ENDIF
       !                                                        ! first T level thickness
       IF( ssnd(jps_e3t1st )%laction )  THEN
-         CALL cpl_snd( jps_e3t1st, isec, RESHAPE ( e3t(:,:,1,Kmm)   , (/jpi,jpj,1/) ), info )
+         CALL cpl_snd( jps_e3t1st, isec, RESHAPE ( CASTWP(e3t(:,:,1,Kmm))   , (/jpi,jpj,1/) ), info )
       ENDIF
       !                                                        ! Qsr fraction
@@ -2740,5 +2741,5 @@
       !                                                      ! ------------------------- !
       ! needed by Met Office
-      CALL eos_fzp(ts(:,:,1,jp_sal,Kmm), sstfrz)
+      CALL eos_fzp(CASTWP(ts(:,:,1,jp_sal,Kmm)), sstfrz)
       ztmp1(:,:) = sstfrz(:,:) + rt0
       IF( ssnd(jps_sstfrz)%laction )  CALL cpl_snd( jps_sstfrz, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info)
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcflx.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcflx.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcflx.F90	(revision 14219)
@@ -35,5 +35,5 @@
    INTEGER , PARAMETER ::   jp_emp  = 5   ! index of evaporation-precipation file
  !!INTEGER , PARAMETER ::   jp_sfx  = 6   ! index of salt flux flux
-   INTEGER , PARAMETER ::   jpfld   = 5 !! 6 ! maximum number of files to read
+   INTEGER , PARAMETER ::   jpfld   = 5 !! 6 ! maximum number of files to read 
    TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf    ! structure of input fields (file informations, fields read)
 
@@ -50,7 +50,7 @@
       !!---------------------------------------------------------------------
       !!                    ***  ROUTINE sbc_flx  ***
-      !!
+      !!                   
       !! ** Purpose :   provide at each time step the surface ocean fluxes
-      !!                (momentum, heat, freshwater and runoff)
+      !!                (momentum, heat, freshwater and runoff) 
       !!
       !! ** Method  : - READ each fluxes in NetCDF files:
@@ -91,5 +91,5 @@
       !!---------------------------------------------------------------------
       !
-      IF( kt == nit000 ) THEN                ! First call kt=nit000
+      IF( kt == nit000 ) THEN                ! First call kt=nit000  
          ! set file information
          READ  ( numnam_ref, namsbc_flx, IOSTAT = ios, ERR = 901)
@@ -98,18 +98,18 @@
          READ  ( numnam_cfg, namsbc_flx, IOSTAT = ios, ERR = 902 )
 902      IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_flx in configuration namelist' )
-         IF(lwm) WRITE ( numond, namsbc_flx )
+         IF(lwm) WRITE ( numond, namsbc_flx ) 
          !
          !                                         ! check: do we plan to use ln_dm2dc with non-daily forcing?
          IF( ln_dm2dc .AND. sn_qsr%freqh /= 24. )   &
-            &   CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' )
+            &   CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' ) 
          !
          !                                         ! store namelist information in an array
          slf_i(jp_utau) = sn_utau   ;   slf_i(jp_vtau) = sn_vtau
-         slf_i(jp_qtot) = sn_qtot   ;   slf_i(jp_qsr ) = sn_qsr
+         slf_i(jp_qtot) = sn_qtot   ;   slf_i(jp_qsr ) = sn_qsr 
          slf_i(jp_emp ) = sn_emp !! ;   slf_i(jp_sfx ) = sn_sfx
          !
          ALLOCATE( sf(jpfld), STAT=ierror )        ! set sf structure
-         IF( ierror > 0 ) THEN
-            CALL ctl_stop( 'sbc_flx: unable to allocate sf structure' )   ;   RETURN
+         IF( ierror > 0 ) THEN   
+            CALL ctl_stop( 'sbc_flx: unable to allocate sf structure' )   ;   RETURN  
          ENDIF
          DO ji= 1, jpfld
@@ -123,9 +123,9 @@
 
       CALL fld_read( kt, nn_fsbc, sf )                            ! input fields provided at the current time-step
-
+     
       IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN                        ! update ocean fluxes at each SBC frequency
 
          IF( ln_dm2dc ) THEN   ! modify now Qsr to include the diurnal cycle
-            qsr(:,:) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) * tmask(:,:,1)
+            qsr(:,:) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) * tmask(ji,jj,1)
          ELSE
             DO_2D( 0, 0, 0, 0 )
@@ -138,5 +138,5 @@
             qns (ji,jj) = ( sf(jp_qtot)%fnow(ji,jj,1) - sf(jp_qsr)%fnow(ji,jj,1) ) * tmask(ji,jj,1)
             emp (ji,jj) =   sf(jp_emp )%fnow(ji,jj,1)                              * tmask(ji,jj,1)
-            !!sfx (ji,jj) = sf(jp_sfx )%fnow(ji,jj,1)                              * tmask(ji,jj,1)
+            !!sfx (ji,jj) = sf(jp_sfx )%fnow(ji,jj,1)                              * tmask(ji,jj,1) 
          END_2D
          !                                                        ! add to qns the heat due to e-p
@@ -144,10 +144,19 @@
          !!qns(:,:) = qns(:,:) - emp(:,:) * sst_m(:,:) * rcp        ! mass flux is at SST
          !
-         ! clem: without these lbc calls, it seems that the northfold is not ok (true in 3.6, not sure in 4.x)
-         CALL lbc_lnk_multi( 'sbcflx', utau, 'U', -1._wp, vtau, 'V', -1._wp, &
-            &                           qns, 'T',  1._wp, emp , 'T',  1._wp, qsr, 'T', 1._wp ) !! sfx, 'T', 1._wp  )
+         ! clem: without these lbc calls, it seems that the northfold is not ok (true in 3.6, not sure in 4.x) 
+         CALL lbc_lnk( 'sbcflx', utau, 'U', -1._wp)
+         CALL lbc_lnk( 'sbcflx', vtau, 'V', -1._wp)
+         CALL lbc_lnk( 'sbcflx', qns, 'T', 1._wp)
+         CALL lbc_lnk( 'sbcflx', emp, 'T', 1._wp)
+         CALL lbc_lnk( 'sbcflx', qsr, 'T', 1._wp)
+
+         !
+         !
+         ! clem: without these lbc calls, it seems that the northfold is not ok (true in 3.6, not sure in 4.x) 
+        !CALL lbc_lnk_multi( 'sbcflx', utau, 'U', -1._wp, vtau, 'V', -1._wp, &
+        !   &                           qns, 'T',  1._wp, emp , 'T',  1._wp, qsr, 'T', 1._wp ) !! sfx, 'T', 1._wp  )
          !
          IF( nitend-nit000 <= 100 .AND. lwp ) THEN                ! control print (if less than 100 time-step asked)
-            WRITE(numout,*)
+            WRITE(numout,*) 
             WRITE(numout,*) '        read daily momentum, heat and freshwater fluxes OK'
             DO jf = 1, jpfld
@@ -155,5 +164,5 @@
                IF( jf == jp_qtot .OR. jf == jp_qsr  )   zfact =     0.1
                IF( jf == jp_emp                     )   zfact = 86400.
-               WRITE(numout,*)
+               WRITE(numout,*) 
                WRITE(numout,*) ' day: ', ndastp , TRIM(sf(jf)%clvar), ' * ', zfact
             END DO
@@ -166,5 +175,5 @@
       DO_2D( 0, 0, 0, 0 )
          ztx = ( utau(ji-1,jj  ) + utau(ji,jj) ) * 0.5_wp * ( 2._wp - MIN( umask(ji-1,jj  ,1), umask(ji,jj,1) ) )
-         zty = ( vtau(ji  ,jj-1) + vtau(ji,jj) ) * 0.5_wp * ( 2._wp - MIN( vmask(ji  ,jj-1,1), vmask(ji,jj,1) ) )
+         zty = ( vtau(ji  ,jj-1) + vtau(ji,jj) ) * 0.5_wp * ( 2._wp - MIN( vmask(ji  ,jj-1,1), vmask(ji,jj,1) ) ) 
          zmod = 0.5_wp * SQRT( ztx * ztx + zty * zty ) * tmask(ji,jj,1)
          taum(ji,jj) = zmod
@@ -172,5 +181,7 @@
       END_2D
       !
-      CALL lbc_lnk_multi( 'sbcflx', taum, 'T', 1._wp, wndm, 'T', 1._wp )
+      CALL lbc_lnk( 'sbcflx', taum, 'T', 1._wp)
+      CALL lbc_lnk( 'sbcflx', wndm, 'T', 1._wp)
+!     CALL lbc_lnk_multi( 'sbcflx', taum, 'T', 1._wp, wndm, 'T', 1._wp )
       !
    END SUBROUTINE sbc_flx
@@ -178,2 +189,3 @@
    !!======================================================================
 END MODULE sbcflx
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcfwb.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcfwb.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcfwb.F90	(revision 14219)
@@ -39,4 +39,6 @@
                            ! previous year
    REAL(wp) ::   area      ! global mean ocean surface (interior domain)
+
+#  include "single_precision_substitute.h90"
 
    !!----------------------------------------------------------------------
@@ -117,5 +119,5 @@
          !
          IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN
-            y_fwfnow(1) = local_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) + fwfisf_cav(:,:) + fwfisf_par(:,:) - snwice_fmass(:,:) ) )
+            y_fwfnow(1) = local_sum( CASTWP(e1e2t(:,:) * ( emp(:,:) - rnf(:,:) + fwfisf_cav(:,:) + fwfisf_par(:,:) - snwice_fmass(:,:) )) )
             CALL mpp_delay_sum( 'sbcfwb', 'fwb', y_fwfnow(:), z_fwfprv(:), kt == nitend - nn_fsbc + 1 )
             z_fwfprv(1) = z_fwfprv(1) / area
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcmod.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcmod.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcmod.F90	(revision 14219)
@@ -75,4 +75,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -441,6 +442,5 @@
          END_2D
          !
-         CALL lbc_lnk( 'sbcwave', utau, 'U', -1. )
-         CALL lbc_lnk( 'sbcwave', vtau, 'V', -1. )
+         CALL lbc_lnk_multi( 'sbcwave', utau, 'U', -1._wp , vtau, 'V', -1._wp )
          !
          taum(:,:) = taum(:,:)*tauoc_wave(:,:)
@@ -452,6 +452,5 @@
          utau(:,:) = utau(:,:) - tawx(:,:) + twox(:,:)
          vtau(:,:) = vtau(:,:) - tawy(:,:) + twoy(:,:)
-         CALL lbc_lnk( 'sbcwave', utau, 'U', -1. )
-         CALL lbc_lnk( 'sbcwave', vtau, 'V', -1. )
+         CALL lbc_lnk_multi( 'sbcwave', utau, 'U', -1._wp, vtau, 'V', -1._wp )
          !
          DO_2D( 0, 0, 0, 0)
@@ -463,5 +462,5 @@
          !
       ENDIF
-      CALL lbc_lnk( 'sbcmod', taum(:,:), 'T', 1. )
+      CALL lbc_lnk( 'sbcmod', taum(:,:), 'T', 1._wp )
       !
       !                                            !==  Misc. Options  ==!
@@ -586,6 +585,6 @@
          CALL prt_ctl(tab2d_1=qsr                 , clinfo1=' qsr      - : ', mask1=tmask )
          CALL prt_ctl(tab3d_1=tmask               , clinfo1=' tmask    - : ', mask1=tmask, kdim=jpk )
-         CALL prt_ctl(tab3d_1=ts(:,:,:,jp_tem,Kmm), clinfo1=' sst      - : ', mask1=tmask, kdim=1   )
-         CALL prt_ctl(tab3d_1=ts(:,:,:,jp_sal,Kmm), clinfo1=' sss      - : ', mask1=tmask, kdim=1   )
+         CALL prt_ctl(tab3d_1=CASTWP(ts(:,:,:,jp_tem,Kmm)), clinfo1=' sst      - : ', mask1=tmask, kdim=1   )
+         CALL prt_ctl(tab3d_1=CASTWP(ts(:,:,:,jp_sal,Kmm)), clinfo1=' sss      - : ', mask1=tmask, kdim=1   )
          CALL prt_ctl(tab2d_1=utau                , clinfo1=' utau     - : ', mask1=umask,                      &
             &         tab2d_2=vtau                , clinfo2=' vtau     - : ', mask2=vmask )
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcssm.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcssm.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcssm.F90	(revision 14219)
@@ -33,4 +33,5 @@
 
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -241,5 +242,5 @@
          ssu_m(:,:) = uu(:,:,1,Kbb)
          ssv_m(:,:) = vv(:,:,1,Kbb)
-         IF( l_useCT )  THEN    ;   sst_m(:,:) = eos_pt_from_ct( ts(:,:,1,jp_tem,Kmm), ts(:,:,1,jp_sal,Kmm) )
+         IF( l_useCT )  THEN    ;   sst_m(:,:) = eos_pt_from_ct( CASTWP(ts(:,:,1,jp_tem,Kmm)), CASTWP(ts(:,:,1,jp_sal,Kmm)) )
          ELSE                   ;   sst_m(:,:) = ts(:,:,1,jp_tem,Kmm)
          ENDIF
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcwave.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcwave.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/SBC/sbcwave.F90	(revision 14219)
@@ -71,5 +71,5 @@
    REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:)   ::   div_sd          !: barotropic stokes drift divergence
    REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:)   ::   ut0sd, vt0sd    !: surface Stokes drift velocities at t-point
-   REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:,:) ::   usd, vsd, wsd   !: Stokes drift velocities at u-, v- & w-points, resp.u
+   REAL(dp), PUBLIC, ALLOCATABLE, DIMENSION(:,:,:) ::   usd, vsd, wsd   !: Stokes drift velocities at u-, v- & w-points, resp.u
 !
    REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:)   ::   charn           !: charnock coefficient at t-point
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/STO/stopts.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/STO/stopts.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/STO/stopts.F90	(revision 14219)
@@ -44,5 +44,5 @@
       !!
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(inout) ::   pts   ! 1 : potential temperature  [Celsius]
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(inout) ::   pts   ! 1 : potential temperature  [Celsius]
       !                                                               ! 2 : salinity               [psu]
       INTEGER  ::   ji, jj, jk, jts, jdof ! dummy loop indices
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/eosbn2.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/eosbn2.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/eosbn2.F90	(revision 14219)
@@ -182,4 +182,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -313,5 +314,5 @@
       !                                                       ! 2 : salinity               [psu]
       REAL(wp), DIMENSION(:,:,:)  , INTENT(  out) ::   prd    ! in situ density            [-]
-      REAL(wp), DIMENSION(:,:,:)  , INTENT(  out) ::   prhop  ! potential density (surface referenced)
+      REAL(dp), DIMENSION(:,:,:)  , INTENT(  out) ::   prhop  ! potential density (surface referenced)
       REAL(wp), DIMENSION(:,:,:)  , INTENT(in   ) ::   pdep   ! depth                      [m]
       !!
@@ -337,5 +338,5 @@
       !                                                                    ! 2 : salinity               [psu]
       REAL(wp), DIMENSION(A2D_T(ktrd)  ,JPK     ), INTENT(  out) ::   prd    ! in situ density            [-]
-      REAL(wp), DIMENSION(A2D_T(ktrhop),JPK     ), INTENT(  out) ::   prhop  ! potential density (surface referenced)
+      REAL(dp), DIMENSION(A2D_T(ktrhop),JPK     ), INTENT(  out) ::   prhop  ! potential density (surface referenced)
       REAL(wp), DIMENSION(A2D_T(ktdep) ,JPK     ), INTENT(in   ) ::   pdep   ! depth                      [m]
       !
@@ -470,5 +471,5 @@
       !
       IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=prd, clinfo1=' eos-pot: ', &
-         &                                  tab3d_2=prhop, clinfo2=' pot : ', kdim=jpk )
+         &                                  tab3d_2=CASTWP(prhop), clinfo2=' pot : ', kdim=jpk )
       !
       IF( ln_timing )   CALL timing_stop('eos-pot')
@@ -591,5 +592,5 @@
       REAL(wp), DIMENSION(jpi,jpj,jpts), INTENT(in   ) ::   pts    ! 1 : potential temperature  [Celsius]
       !                                                                ! 2 : salinity               [psu]
-      REAL(wp), DIMENSION(jpi,jpj     ), INTENT(  out) ::   prhop  ! potential density (surface referenced)
+      REAL(dp), DIMENSION(jpi,jpj     ), INTENT(  out) ::   prhop  ! potential density (surface referenced)
       !
       INTEGER  ::   ji, jj, jk, jsmp             ! dummy loop indices
@@ -640,7 +641,7 @@
          !
       END SELECT
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab2d_1=prhop, clinfo1=' pot: ', kdim=1 )
-      !
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab2d_1=prhop, clinfo1=' eos-pot: ' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab2d_1=CASTWP(prhop), clinfo1=' pot: ', kdim=1 )
+      !
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab2d_1=CASTWP(prhop), clinfo1=' eos-pot: ' )
       !
       IF( ln_timing )   CALL timing_stop('eos-pot')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv.F90	(revision 14219)
@@ -73,4 +73,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -90,5 +91,5 @@
       INTEGER                                  , INTENT(in)    :: kt             ! ocean time-step index
       INTEGER                                  , INTENT(in)    :: Kbb, Kmm, Krhs ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts            ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts            ! active tracers and RHS of tracer equation
       !
       INTEGER ::   ji, jj, jk   ! dummy loop index
@@ -178,10 +179,10 @@
          !
          CASE ( np_CEN )                                 ! Centered scheme : 2nd / 4th order
-            IF (nn_hls.EQ.2) CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kmm), 'T', 1. )
+            IF (nn_hls.EQ.2) CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kmm), 'T', 1._wp )
             CALL tra_adv_cen    ( kt, nit000, 'TRA',         zuu, zvv, zww, Kmm, pts, jpts, Krhs, nn_cen_h, nn_cen_v )
          CASE ( np_FCT )                                 ! FCT scheme      : 2nd / 4th order
             IF (nn_hls.EQ.2) THEN
-               CALL lbc_lnk_multi( 'traadv', pts(:,:,:,:,Kbb), 'T', 1., pts(:,:,:,:,Kmm), 'T', 1.)
-               CALL lbc_lnk_multi( 'traadv', zuu(:,:,:), 'U', -1., zvv(:,:,:), 'V', -1., zww(:,:,:), 'W', 1.)
+               CALL lbc_lnk_multi( 'traadv', pts(:,:,:,:,Kbb), 'T', 1._wp, pts(:,:,:,:,Kmm), 'T', 1._wp)
+               CALL lbc_lnk_multi( 'traadv', zuu(:,:,:), 'U', -1._wp, zvv(:,:,:), 'V', -1._wp, zww(:,:,:), 'W', 1._wp)
 #if defined key_loop_fusion
                CALL tra_adv_fct_lf ( kt, nit000, 'TRA', rDt, zuu, zvv, zww, Kbb, Kmm, pts, jpts, Krhs, nn_fct_h, nn_fct_v )
@@ -194,5 +195,5 @@
          CASE ( np_MUS )                                 ! MUSCL
             IF (nn_hls.EQ.2) THEN
-                CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kbb), 'T', 1.)
+                CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kbb), 'T', 1._wp)
 #if defined key_loop_fusion
                 CALL tra_adv_mus_lf ( kt, nit000, 'TRA', rDt, zuu, zvv, zww, Kbb, Kmm, pts, jpts, Krhs, ln_mus_ups )
@@ -204,10 +205,10 @@
             END IF
          CASE ( np_UBS )                                 ! UBS
-            IF (nn_hls.EQ.2) CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kbb), 'T', 1.)
+            IF (nn_hls.EQ.2) CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kbb), 'T', 1._wp)
             CALL tra_adv_ubs    ( kt, nit000, 'TRA', rDt, zuu, zvv, zww, Kbb, Kmm, pts, jpts, Krhs, nn_ubs_v   )
          CASE ( np_QCK )                                 ! QUICKEST
             IF (nn_hls.EQ.2) THEN
-               CALL lbc_lnk_multi( 'traadv', zuu(:,:,:), 'U', -1., zvv(:,:,:), 'V', -1.)
-               CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kbb), 'T', 1.)
+               CALL lbc_lnk_multi( 'traadv', zuu(:,:,:), 'U', -1._wp, zvv(:,:,:), 'V', -1._wp)
+               CALL lbc_lnk( 'traadv', pts(:,:,:,:,Kbb), 'T', 1._wp)
             END IF
             CALL tra_adv_qck    ( kt, nit000, 'TRA', rDt, zuu, zvv, zww, Kbb, Kmm, pts, jpts, Krhs )
@@ -230,6 +231,6 @@
       ENDIF
       !                                              ! print mean trends (used for debugging)
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=pts(:,:,:,jp_tem,Krhs), clinfo1=' adv  - Ta: ', mask1=tmask, &
-         &                                  tab3d_2=pts(:,:,:,jp_sal,Krhs), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(pts(:,:,:,jp_tem,Krhs)), clinfo1=' adv  - Ta: ', mask1=tmask, &
+         &                                  tab3d_2=CASTWP(pts(:,:,:,jp_sal,Krhs)), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
 
       ! TEMP: [tiling] This change not necessary if using XIOS (subdomain support)
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_cen.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_cen.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_cen.F90	(revision 14219)
@@ -38,4 +38,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -73,5 +74,5 @@
       ! TEMP: [tiling] This can be A2D(nn_hls) if using XIOS (subdomain support)
       REAL(wp), DIMENSION(jpi,jpj,jpk         ), INTENT(in   ) ::   pU, pV, pW      ! 3 ocean volume flux components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! tracers and RHS of tracer equation
       !
       INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
@@ -131,5 +132,5 @@
                zwy(ji,jj,jk) =  0.5_wp * pV(ji,jj,jk) * zC4t_v
             END_3D
-            IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'traadv_cen', zwx, 'U', -1. , zwy, 'V', -1. )
+            IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'traadv_cen', zwx, 'U', -1._wp , zwy, 'V', -1._wp )
             !
          CASE DEFAULT
@@ -145,5 +146,5 @@
             !
          CASE(  4  )                         !* 4th order compact
-            CALL interp_4th_cpt( pt(:,:,:,jn,Kmm) , ztw )      ! ztw = interpolated value of T at w-point
+            CALL interp_4th_cpt( CASTWP(pt(:,:,:,jn,Kmm)) , ztw )      ! ztw = interpolated value of T at w-point
             DO_3D( 0, 0, 0, 0, 2, jpkm1 )
                zwz(ji,jj,jk) = pW(ji,jj,jk) * ztw(ji,jj,jk) * wmask(ji,jj,jk)
@@ -173,7 +174,7 @@
          !                               ! trend diagnostics
          IF( l_trd ) THEN
-            CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_xad, zwx, pU, pt(:,:,:,jn,Kmm) )
-            CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_yad, zwy, pV, pt(:,:,:,jn,Kmm) )
-            CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_zad, zwz, pW, pt(:,:,:,jn,Kmm) )
+            CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_xad, zwx, pU, CASTWP(pt(:,:,:,jn,Kmm)) )
+            CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_yad, zwy, pV, CASTWP(pt(:,:,:,jn,Kmm)) )
+            CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_zad, zwz, pW, CASTWP(pt(:,:,:,jn,Kmm)) )
          ENDIF
          !                                 ! "Poleward" heat and salt transports
@@ -188,2 +189,3 @@
    !!======================================================================
 END MODULE traadv_cen
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_fct.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_fct.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_fct.F90	(revision 14219)
@@ -49,4 +49,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -83,5 +84,5 @@
       ! TEMP: [tiling] This can be A2D(nn_hls) if using XIOS (subdomain support)
       REAL(wp), DIMENSION(jpi,jpj,jpk         ), INTENT(in   ) ::   pU, pV, pW      ! 3 ocean volume flux components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! tracers and RHS of tracer equation
       !
       INTEGER  ::   ji, jj, jk, jn                           ! dummy loop indices
@@ -89,5 +90,6 @@
       REAL(wp) ::   zfp_ui, zfp_vj, zfp_wk, zC2t_u, zC4t_u   !   -      -
       REAL(wp) ::   zfm_ui, zfm_vj, zfm_wk, zC2t_v, zC4t_v   !   -      -
-      REAL(wp), DIMENSION(A2D(nn_hls),jpk)        ::   zwi, zwx, zwy, zwz, ztu, ztv, zltu, zltv, ztw
+      REAL(dp), DIMENSION(jpi,jpj,jpk)        ::   zwx, zwy, zwz
+      REAL(wp), DIMENSION(jpi,jpj,jpk)        ::   zwi, ztu, ztv, zltu, zltv, ztw
       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdx, ztrdy, ztrdz, zptry
       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   zwinf, zwdia, zwsup
@@ -258,6 +260,4 @@
             IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'traadv_fct', ztu, 'U', -1.0_wp , ztv, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
             !
-            IF (nn_hls.EQ.1) CALL lbc_lnk_multi( 'traadv_fct', ztu, 'U', -1.0_wp , ztv, 'V', -1.0_wp )   ! Lateral boundary cond. (unchanged sgn)
-            !
             DO_3D( 0, 0, 0, 0, 1, jpkm1 )    ! Horizontal advective fluxes
                zC2t_u = pt(ji,jj,jk,jn,Kmm) + pt(ji+1,jj  ,jk,jn,Kmm)   ! 2 x C2 interpolation of T at u- & v-points (x2)
@@ -283,5 +283,5 @@
             !
          CASE(  4  )                   !- 4th order COMPACT
-            CALL interp_4th_cpt( pt(:,:,:,jn,Kmm) , ztw )   ! zwt = COMPACT interpolation of T at w-point
+            CALL interp_4th_cpt( CASTWP(pt(:,:,:,jn,Kmm)) , ztw )   ! zwt = COMPACT interpolation of T at w-point
             DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 )
                zwz(ji,jj,jk) = ( pW(ji,jj,jk) * ztw(ji,jj,jk) - zwz(ji,jj,jk) ) * wmask(ji,jj,jk)
@@ -294,5 +294,10 @@
          !
          IF (nn_hls.EQ.1) THEN
+#if defined key_single
+            CALL lbc_lnk      ( 'traadv_fct', zwi, 'T', 1.0_wp )
+            CALL lbc_lnk_multi( 'traadv_fct',                   zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp, zwz, 'T', 1.0_wp )
+#else
             CALL lbc_lnk_multi( 'traadv_fct', zwi, 'T', 1.0_wp, zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp, zwz, 'T', 1.0_wp )
+#endif
          ELSE
             CALL lbc_lnk( 'traadv_fct', zwi, 'T', 1.0_wp)
@@ -300,5 +305,10 @@
          !
          IF (nn_hls.EQ.1) THEN
+#if defined key_single
+            CALL lbc_lnk      ( 'traadv_fct', zwi, 'T', 1.0_wp )
+            CALL lbc_lnk_multi( 'traadv_fct',                   zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp, zwz, 'T', 1.0_wp )
+#else
             CALL lbc_lnk_multi( 'traadv_fct', zwi, 'T', 1.0_wp, zwx, 'U', -1.0_wp , zwy, 'V', -1.0_wp, zwz, 'T', 1.0_wp )
+#endif
          ELSE
             CALL lbc_lnk( 'traadv_fct', zwi, 'T', 1.0_wp)
@@ -325,5 +335,5 @@
          !        !==  monotonicity algorithm  ==!
          !
-         CALL nonosc( Kmm, pt(:,:,:,jn,Kbb), zwx, zwy, zwz, zwi, p2dt )
+         CALL nonosc( Kmm, CASTWP(pt(:,:,:,jn,Kbb)), zwx, zwy, zwz, zwi, p2dt )
          !
          !        !==  final trend with corrected fluxes  ==!
@@ -357,7 +367,7 @@
             !
             IF( l_trd ) THEN              ! trend diagnostics
-               CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_xad, ztrdx, pU, pt(:,:,:,jn,Kmm) )
-               CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_yad, ztrdy, pV, pt(:,:,:,jn,Kmm) )
-               CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_zad, ztrdz, pW, pt(:,:,:,jn,Kmm) )
+               CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_xad, ztrdx, pU, CASTWP(pt(:,:,:,jn,Kmm)) )
+               CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_yad, ztrdy, pV, CASTWP(pt(:,:,:,jn,Kmm)) )
+               CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_zad, ztrdz, pW, CASTWP(pt(:,:,:,jn,Kmm)) )
             ENDIF
             !                             ! heat/salt transport
@@ -402,5 +412,5 @@
       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   pbef            ! before field
       REAL(wp), DIMENSION(A2D(nn_hls)    ,jpk), INTENT(in   ) ::   paft            ! after field
-      REAL(wp), DIMENSION(A2D(nn_hls)    ,jpk), INTENT(inout) ::   paa, pbb, pcc   ! monotonic fluxes in the 3 directions
+      REAL(dp), DIMENSION(A2D(nn_hls)    ,jpk), INTENT(inout) ::   paa, pbb, pcc   ! monotonic fluxes in the 3 directions
       !
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_mus.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_mus.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_mus.F90	(revision 14219)
@@ -48,4 +48,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -83,5 +84,5 @@
       ! TEMP: [tiling] This can be A2D(nn_hls) if using XIOS (subdomain support)
       REAL(wp), DIMENSION(jpi,jpj,jpk         ), INTENT(in   ) ::   pU, pV, pW      ! 3 ocean volume flux components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! tracers and RHS of tracer equation
       !
       INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
@@ -185,6 +186,6 @@
          !                                ! trend diagnostics
          IF( l_trd )  THEN
-            CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_xad, zwx, pU, pt(:,:,:,jn,Kbb) )
-            CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_yad, zwy, pV, pt(:,:,:,jn,Kbb) )
+            CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_xad, zwx, pU, CASTWP(pt(:,:,:,jn,Kbb)) )
+            CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_yad, zwy, pV, CASTWP(pt(:,:,:,jn,Kbb)) )
          END IF
          !                                 ! "Poleward" heat and salt transports
@@ -237,5 +238,5 @@
          END_3D
          !                                ! send trends for diagnostic
-         IF( l_trd )  CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_zad, zwx, pW, pt(:,:,:,jn,Kbb) )
+         IF( l_trd )  CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_zad, zwx, pW, CASTWP(pt(:,:,:,jn,Kbb)) )
          !
       END DO                     ! end of tracer loop
@@ -245,2 +246,3 @@
    !!======================================================================
 END MODULE traadv_mus
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_qck.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_qck.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_qck.F90	(revision 14219)
@@ -42,4 +42,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -93,5 +94,5 @@
       ! TEMP: [tiling] This can be A2D(nn_hls) if using XIOS (subdomain support)
       REAL(wp), DIMENSION(jpi,jpj,jpk         ), INTENT(in   ) ::   pU, pV, pW      ! 3 ocean volume transport components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! tracers and RHS of tracer equation
       !!----------------------------------------------------------------------
       !
@@ -131,5 +132,5 @@
       ! TEMP: [tiling] This can be A2D(nn_hls) if using XIOS (subdomain support)
       REAL(wp), DIMENSION(jpi,jpj,jpk         ), INTENT(in   ) ::   pU        ! i-velocity components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! active tracers and RHS of tracer equation
       !!
       INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
@@ -198,5 +199,5 @@
          END_3D
          !                                 ! trend diagnostics
-         IF( l_trd )   CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_xad, zwx, pU, pt(:,:,:,jn,Kmm) )
+         IF( l_trd )   CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_xad, zwx, pU, CASTWP(pt(:,:,:,jn,Kmm)) )
          !
       END DO
@@ -216,5 +217,5 @@
       ! TEMP: [tiling] This can be A2D(nn_hls) if using XIOS (subdomain support)
       REAL(wp), DIMENSION(jpi,jpj,jpk         ), INTENT(in   ) ::   pV        ! j-velocity components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! active tracers and RHS of tracer equation
       !!
       INTEGER  :: ji, jj, jk, jn                ! dummy loop indices
@@ -289,5 +290,5 @@
          END_3D
          !                                 ! trend diagnostics
-         IF( l_trd )   CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_yad, zwy, pV, pt(:,:,:,jn,Kmm) )
+         IF( l_trd )   CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_yad, zwy, pV, CASTWP(pt(:,:,:,jn,Kmm)) )
          !                                 ! "Poleward" heat and salt transports (contribution of upstream fluxes)
          IF( l_ptr )   CALL dia_ptr_hst( jn, 'adv', zwy(:,:,:) )
@@ -308,5 +309,5 @@
       ! TEMP: [tiling] This can be A2D(nn_hls) if using XIOS (subdomain support)
       REAL(wp), DIMENSION(jpi,jpj,jpk         ), INTENT(in   ) ::   pW      ! vertical velocity
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! active tracers and RHS of tracer equation
       !
       INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
@@ -341,5 +342,5 @@
          END_3D
          !                                 ! Send trends for diagnostic
-         IF( l_trd )  CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_zad, zwz, pW, pt(:,:,:,jn,Kmm) )
+         IF( l_trd )  CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_zad, zwz, pW, CASTWP(pt(:,:,:,jn,Kmm)) )
          !
       END DO
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_ubs.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_ubs.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traadv_ubs.F90	(revision 14219)
@@ -40,4 +40,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -60,5 +61,5 @@
       !!      For example the i-component of the advective fluxes are given by :
       !!                !  e2u e3u un ( mi(Tn) - zltu(i  ) )   if un(i) >= 0
-      !!          ztu = !  or
+      !!          ztu = !  or 
       !!                !  e2u e3u un ( mi(Tn) - zltu(i+1) )   if un(i) < 0
       !!      where zltu is the second derivative of the before temperature field:
@@ -94,5 +95,5 @@
       ! TEMP: [tiling] This can be A2D(nn_hls) if using XIOS (subdomain support)
       REAL(wp), DIMENSION(jpi,jpj,jpk         ), INTENT(in   ) ::   pU, pV, pW      ! 3 ocean volume transport components
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt              ! tracers and RHS of tracer equation
       !
       INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
@@ -174,6 +175,6 @@
          !
          IF( l_trd ) THEN                  ! trend diagnostics
-             CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_xad, ztu, pU, pt(:,:,:,jn,Kmm) )
-             CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_yad, ztv, pV, pt(:,:,:,jn,Kmm) )
+             CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_xad, ztu, pU, CASTWP(pt(:,:,:,jn,Kmm)) )
+             CALL trd_tra( kt, Kmm, Krhs, cdtype, jn, jptra_yad, ztv, pV, CASTWP(pt(:,:,:,jn,Kmm)) )
          END IF
          !
@@ -232,5 +233,5 @@
             !
          CASE(  4  )                               ! 4th order COMPACT
-            CALL interp_4th_cpt( pt(:,:,:,jn,Kmm) , ztw )         ! 4th order compact interpolation of T at w-point
+            CALL interp_4th_cpt( CASTWP(pt(:,:,:,jn,Kmm)) , ztw )
             DO_3D( 0, 0, 0, 0, 2, jpkm1 )
                ztw(ji,jj,jk) = pW(ji,jj,jk) * ztw(ji,jj,jk) * wmask(ji,jj,jk)
@@ -278,5 +279,5 @@
       INTEGER , INTENT(in   )                         ::   Kmm    ! time level index
       REAL(wp), INTENT(in   )                         ::   p2dt   ! tracer time-step
-      REAL(wp),                DIMENSION(jpi,jpj,jpk) ::   pbef   ! before field
+      REAL(dp),                DIMENSION(jpi,jpj,jpk) ::   pbef   ! before field
       REAL(wp), INTENT(inout), DIMENSION(A2D(nn_hls)    ,jpk) ::   paft   ! after field
       REAL(wp), INTENT(inout), DIMENSION(A2D(nn_hls)    ,jpk) ::   pcc    ! monotonic flux in the k direction
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traatf.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traatf.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traatf.F90	(revision 14219)
@@ -59,4 +59,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -89,5 +90,5 @@
       INTEGER                                  , INTENT(in   ) :: kt             ! ocean time-step index
       INTEGER                                  , INTENT(in   ) :: Kbb, Kmm, Kaa  ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts            ! active tracers
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts            ! active tracers 
       !!
       INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
@@ -152,6 +153,6 @@
       ELSE                                            ! Leap-Frog + Asselin filter time stepping
          !
-         IF( ln_linssh ) THEN   ;   CALL tra_atf_fix( kt, Kbb, Kmm, Kaa, nit000,        'TRA', pts, jpts )  ! linear free surface
-         ELSE                   ;   CALL tra_atf_vvl( kt, Kbb, Kmm, Kaa, nit000, rn_Dt, 'TRA', pts, sbc_tsc, sbc_tsc_b, jpts )  ! non-linear free surface
+         IF( ln_linssh ) THEN   ;   CALL tra_atf_fix( kt, Kbb, Kmm, Kaa, nit000,        'TRA', pts, jpts )  ! linear free surface 
+         ELSE                   ;   CALL tra_atf_vvl( kt, Kbb, Kmm, Kaa, nit000, CASTWP(rn_Dt), 'TRA', pts, sbc_tsc, sbc_tsc_b, jpts )  ! non-linear free surface
          ENDIF
          !
@@ -171,6 +172,6 @@
       !
       !                        ! control print
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=pts(:,:,:,jp_tem,Kmm), clinfo1=' nxt  - Tn: ', mask1=tmask,   &
-         &                                  tab3d_2=pts(:,:,:,jp_sal,Kmm), clinfo2=       ' Sn: ', mask2=tmask )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(pts(:,:,:,jp_tem,Kmm)), clinfo1=' nxt  - Tn: ', mask1=tmask,   &
+         &                                  tab3d_2=CASTWP(pts(:,:,:,jp_sal,Kmm)), clinfo2=       ' Sn: ', mask2=tmask )
       !
       IF( ln_timing )   CALL timing_stop('tra_atf')
@@ -194,5 +195,5 @@
       CHARACTER(len=3)                         , INTENT(in   ) ::  cdtype        ! =TRA or TRC (tracer indicator)
       INTEGER                                  , INTENT(in   ) ::  kjpt          ! number of tracers
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::  pt            ! tracer fields
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::  pt            ! tracer fields
       !
       INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
@@ -238,5 +239,5 @@
       CHARACTER(len=3)                         , INTENT(in   ) ::  cdtype    ! =TRA or TRC (tracer indicator)
       INTEGER                                  , INTENT(in   ) ::  kjpt      ! number of tracers
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::  pt        ! tracer fields
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::  pt        ! tracer fields
       REAL(wp), DIMENSION(jpi,jpj    ,kjpt)    , INTENT(in   ) ::  psbc_tc   ! surface tracer content
       REAL(wp), DIMENSION(jpi,jpj    ,kjpt)    , INTENT(in   ) ::  psbc_tc_b ! before surface tracer content
@@ -244,6 +245,6 @@
       LOGICAL  ::   ll_traqsr, ll_rnf, ll_isf   ! local logical
       INTEGER  ::   ji, jj, jk, jn              ! dummy loop indices
-      REAL(wp) ::   zfact, zfact1, ztc_a , ztc_n , ztc_b , ztc_f , ztc_d    ! local scalar
-      REAL(wp) ::   zfact2, ze3t_b, ze3t_n, ze3t_a, ze3t_f, ze3t_d, zscale  !   -      -
+      REAL(dp) ::   zfact, zfact1, ztc_a , ztc_n , ztc_b , ztc_f , ztc_d    ! local scalar
+      REAL(dp) ::   zfact2, ze3t_b, ze3t_n, ze3t_a, ze3t_f, ze3t_d, zscale  !   -      -
       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::   ztrd_atf
       !!----------------------------------------------------------------------
@@ -384,2 +385,3 @@
    !!======================================================================
 END MODULE traatf
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traatf_qco.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traatf_qco.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traatf_qco.F90	(revision 14219)
@@ -225,5 +225,5 @@
       INTEGER                                  , INTENT(in   ) ::  Kbb, Kmm, Kaa ! time level indices
       INTEGER                                  , INTENT(in   ) ::  kit000    ! first time step index
-      REAL(wp)                                 , INTENT(in   ) ::  p2dt      ! time-step
+      REAL(dp)                                 , INTENT(in   ) ::  p2dt      ! time-step
       CHARACTER(len=3)                         , INTENT(in   ) ::  cdtype    ! =TRA or TRC (tracer indicator)
       INTEGER                                  , INTENT(in   ) ::  kjpt      ! number of tracers
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/trabbc.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/trabbc.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/trabbc.F90	(revision 14219)
@@ -47,4 +47,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -78,5 +79,5 @@
       INTEGER,                                   INTENT(in   ) :: kt         ! ocean time-step index
       INTEGER,                                   INTENT(in   ) :: Kmm, Krhs  ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts        ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts        ! active tracers and RHS of tracer equation
       !
       INTEGER  ::   ji, jj, jk    ! dummy loop indices
@@ -105,5 +106,5 @@
          CALL iom_put ( "hfgeou" , rho0_rcp * qgh_trd0(:,:) )
       ENDIF
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=pts(:,:,:,jp_tem,Krhs), clinfo1=' bbc  - Ta: ', mask1=tmask, clinfo3='tra-ta' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(pts(:,:,:,jp_tem,Krhs)), clinfo1=' bbc  - Ta: ', mask1=tmask, clinfo3='tra-ta' )
       !
       IF( ln_timing )   CALL timing_stop('tra_bbc')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/trabbl.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/trabbl.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/trabbl.F90	(revision 14219)
@@ -69,4 +69,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -104,5 +105,5 @@
       INTEGER,                                   INTENT(in   ) :: kt              ! ocean time-step
       INTEGER,                                   INTENT(in   ) :: Kbb, Kmm, Krhs  ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts             ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts             ! active tracers and RHS of tracer equation
       !
       INTEGER  ::   ji, jj, jk   ! Dummy loop indices
@@ -122,8 +123,8 @@
       IF( nn_bbl_ldf == 1 ) THEN                    !* Diffusive bbl
          !
-         CALL tra_bbl_dif( pts(:,:,:,:,Kbb), pts(:,:,:,:,Krhs), jpts, Kmm )
+         CALL tra_bbl_dif( CASTWP(pts(:,:,:,:,Kbb)), pts(:,:,:,:,Krhs), jpts, Kmm )
          IF( sn_cfctl%l_prtctl )  &
-         CALL prt_ctl( tab3d_1=pts(:,:,:,jp_tem,Krhs), clinfo1=' bbl_ldf  - Ta: ', mask1=tmask, &
-            &          tab3d_2=pts(:,:,:,jp_sal,Krhs), clinfo2=           ' Sa: ', mask2=tmask, clinfo3='tra' )
+         CALL prt_ctl( tab3d_1=CASTWP(pts(:,:,:,jp_tem,Krhs)), clinfo1=' bbl_ldf  - Ta: ', mask1=tmask, &
+            &          tab3d_2=CASTWP(pts(:,:,:,jp_sal,Krhs)), clinfo2=           ' Sa: ', mask2=tmask, clinfo3='tra' )
          IF( ntile == 0 .OR. ntile == nijtile ) THEN                       ! Do only on the last tile
             CALL iom_put( "ahu_bbl", ahu_bbl )   ! bbl diffusive flux i-coef
@@ -135,8 +136,8 @@
       IF( nn_bbl_adv /= 0 ) THEN                    !* Advective bbl
          !
-         CALL tra_bbl_adv( pts(:,:,:,:,Kbb), pts(:,:,:,:,Krhs), jpts, Kmm )
+CALL tra_bbl_adv( CASTWP(pts(:,:,:,:,Kbb)), pts(:,:,:,:,Krhs), jpts, Kmm )
          IF(sn_cfctl%l_prtctl)   &
-         CALL prt_ctl( tab3d_1=pts(:,:,:,jp_tem,Krhs), clinfo1=' bbl_adv  - Ta: ', mask1=tmask, &
-            &          tab3d_2=pts(:,:,:,jp_sal,Krhs), clinfo2=           ' Sa: ', mask2=tmask, clinfo3='tra' )
+         CALL prt_ctl( tab3d_1=CASTWP(pts(:,:,:,jp_tem,Krhs)), clinfo1=' bbl_adv  - Ta: ', mask1=tmask, &
+            &          tab3d_2=CASTWP(pts(:,:,:,jp_sal,Krhs)), clinfo2=           ' Sa: ', mask2=tmask, clinfo3='tra' )
          IF( ntile == 0 .OR. ntile == nijtile ) THEN                       ! Do only on the last tile
             ! lateral boundary conditions ; just need for outputs
@@ -184,5 +185,5 @@
       INTEGER                              , INTENT(in   ) ::   kjpt   ! number of tracers
       REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   pt     ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pt_rhs ! tracer trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pt_rhs ! tracer trend
       INTEGER                              , INTENT(in   ) ::   Kmm    ! time level indices
       !
@@ -232,5 +233,5 @@
       INTEGER                              , INTENT(in   ) ::   kjpt   ! number of tracers
       REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   pt     ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pt_rhs ! tracer trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pt_rhs ! tracer trend
       INTEGER                              , INTENT(in   ) ::   Kmm    ! time level indices
       !
@@ -551,2 +552,3 @@
    !!======================================================================
 END MODULE trabbl
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/tradmp.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/tradmp.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/tradmp.F90	(revision 14219)
@@ -53,4 +53,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -92,8 +93,8 @@
       INTEGER,                                   INTENT(in   ) :: kt              ! ocean time-step index
       INTEGER,                                   INTENT(in   ) :: Kbb, Kmm, Krhs  ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts             ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts             ! active tracers and RHS of tracer equation
       !
       INTEGER ::   ji, jj, jk, jn   ! dummy loop indices
-      REAL(wp), DIMENSION(A2D(nn_hls),jpk,jpts)     ::  zts_dta
+      REAL(dp), DIMENSION(A2D(nn_hls),jpk,jpts)     ::  zts_dta
       REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  ztrdts
       !!----------------------------------------------------------------------
@@ -147,6 +148,6 @@
       ENDIF
       !                           ! Control print
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=pts(:,:,:,jp_tem,Krhs), clinfo1=' dmp  - Ta: ', mask1=tmask,   &
-         &                                  tab3d_2=pts(:,:,:,jp_sal,Krhs), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
+IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(pts(:,:,:,jp_tem,Krhs)), clinfo1=' dmp  - Ta: ', mask1=tmask, tab3d_2=REAL(pts(:,:,:,jp_sal,Krhs), wp), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
+
       !
       IF( ln_timing )   CALL timing_stop('tra_dmp')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traisf.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traisf.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traisf.F90	(revision 14219)
@@ -25,4 +25,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -42,5 +43,5 @@
       INTEGER                                  , INTENT(in   ) :: kt        ! ocean time step
       INTEGER                                  , INTENT(in   ) :: Kmm, Krhs ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts       ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts       ! active tracers and RHS of tracer equation
       !!----------------------------------------------------------------------
       !
@@ -80,6 +81,6 @@
       IF ( ln_isfdebug ) THEN
          IF( ntile == 0 .OR. ntile == nijtile ) THEN                       ! Do only for the full domain
-            CALL debug('tra_isf: pts(:,:,:,:,Krhs) T', pts(:,:,:,1,Krhs))
-            CALL debug('tra_isf: pts(:,:,:,:,Krhs) S', pts(:,:,:,2,Krhs))
+            CALL debug('tra_isf: pts(:,:,:,:,Krhs) T', CASTWP(pts(:,:,:,1,Krhs)))
+            CALL debug('tra_isf: pts(:,:,:,:,Krhs) S', CASTWP(pts(:,:,:,2,Krhs)))
          ENDIF
       END IF
@@ -98,5 +99,5 @@
       !!
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(inout) :: pts
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(inout) :: pts
       !!----------------------------------------------------------------------
       INTEGER , DIMENSION(jpi,jpj)     , INTENT(in   ) :: ktop , kbot
@@ -139,5 +140,5 @@
       !!
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(inout) :: ptsa
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(inout) :: ptsa
       !!----------------------------------------------------------------------
       INTEGER                              , INTENT(in   ) :: Kmm   ! ocean time level index
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traldf.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traldf.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traldf.F90	(revision 14219)
@@ -40,4 +40,5 @@
    PUBLIC   tra_ldf_init   ! called by nemogcm.F90
 
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -55,5 +56,5 @@
       INTEGER,                                   INTENT(in   ) :: kt              ! ocean time-step index
       INTEGER,                                   INTENT(in   ) :: Kbb, Kmm, Krhs  ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts             ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts             ! active tracers and RHS of tracer equation
       !!
       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrdt, ztrds
@@ -86,12 +87,12 @@
          SELECT CASE ( nldf_tra )                 !* compute lateral mixing trend and add it to the general trend
          CASE ( np_lap   )                                  ! laplacian: iso-level operator
-            CALL tra_ldf_lap  ( kt, Kmm, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, pts(:,:,:,:,Kbb), pts(:,:,:,:,Krhs),                   jpts,  1 )
+            CALL tra_ldf_lap  ( kt, Kmm, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, CASTWP(pts(:,:,:,:,Kbb)), pts(:,:,:,:,Krhs),                   jpts,  1 )
          CASE ( np_lap_i )                                  ! laplacian: standard iso-neutral operator (Madec)
-            CALL tra_ldf_iso  ( kt, Kmm, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, pts(:,:,:,:,Kbb), pts(:,:,:,:,Kbb), pts(:,:,:,:,Krhs), jpts,  1 )
+            CALL tra_ldf_iso  ( kt, Kmm, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, CASTWP(pts(:,:,:,:,Kbb)), CASTWP(pts(:,:,:,:,Kbb)), pts(:,:,:,:,Krhs), jpts,  1 )
          CASE ( np_lap_it )                                 ! laplacian: triad iso-neutral operator (griffies)
-            CALL tra_ldf_triad( kt, Kmm, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, pts(:,:,:,:,Kbb), pts(:,:,:,:,Kbb), pts(:,:,:,:,Krhs), jpts,  1 )
+            CALL tra_ldf_triad( kt, Kmm, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, CASTWP(pts(:,:,:,:,Kbb)), CASTWP(pts(:,:,:,:,Kbb)), pts(:,:,:,:,Krhs), jpts,  1 )
          CASE ( np_blp , np_blp_i , np_blp_it )             ! bilaplacian: iso-level & iso-neutral operators
-            IF(nn_hls.EQ.2) CALL lbc_lnk( 'tra_ldf', pts(:,:,:,:,Kbb), 'T',1.)
-            CALL tra_ldf_blp  ( kt, Kmm, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, pts(:,:,:,:,Kbb), pts(:,:,:,:,Krhs),             jpts, nldf_tra )
+            IF(nn_hls.EQ.2) CALL lbc_lnk( 'tra_ldf', pts(:,:,:,:,Kbb), 'T',1._wp)
+            CALL tra_ldf_blp  ( kt, Kmm, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, CASTWP(pts(:,:,:,:,Kbb)), pts(:,:,:,:,Krhs),             jpts, nldf_tra )
          END SELECT
          !
@@ -108,6 +109,6 @@
       ENDIF
       !                                        !* print mean trends (used for debugging)
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=pts(:,:,:,jp_tem,Krhs), clinfo1=' ldf  - Ta: ', mask1=tmask, &
-         &                                  tab3d_2=pts(:,:,:,jp_sal,Krhs), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(pts(:,:,:,jp_tem,Krhs)), clinfo1=' ldf  - Ta: ', mask1=tmask,               &
+         &                                  tab3d_2=CASTWP(pts(:,:,:,jp_sal,Krhs)), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
       !
       IF( ln_timing )   CALL timing_stop('tra_ldf')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traldf_iso.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traldf_iso.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traldf_iso.F90	(revision 14219)
@@ -65,5 +65,5 @@
       REAL(wp), DIMENSION(:,:,:,:), INTENT(in   ) ::   pt         ! tracer (kpass=1) or laplacian of tracer (kpass=2)
       REAL(wp), DIMENSION(:,:,:,:), INTENT(in   ) ::   pt2        ! tracer (only used in kpass=2)
-      REAL(wp), DIMENSION(:,:,:,:), INTENT(inout) ::   pt_rhs     ! tracer trend
+      REAL(dp), DIMENSION(:,:,:,:), INTENT(inout) ::   pt_rhs     ! tracer trend
       !!
       CALL tra_ldf_iso_t( kt, Kmm, kit000, cdtype, pahu, pahv, is_tile(pahu),                             &
@@ -128,5 +128,5 @@
       REAL(wp), DIMENSION(A2D_T(ktt)    ,JPK,KJPT), INTENT(in   ) ::   pt         ! tracer (kpass=1) or laplacian of tracer (kpass=2)
       REAL(wp), DIMENSION(A2D_T(ktt2)   ,JPK,KJPT), INTENT(in   ) ::   pt2        ! tracer (only used in kpass=2)
-      REAL(wp), DIMENSION(A2D_T(ktt_rhs),JPK,KJPT), INTENT(inout) ::   pt_rhs     ! tracer trend
+      REAL(dp), DIMENSION(A2D_T(ktt_rhs),JPK,KJPT), INTENT(inout) ::   pt_rhs     ! tracer trend
       !
       INTEGER  ::  ji, jj, jk, jn   ! dummy loop indices
@@ -198,5 +198,5 @@
             !
             IF( ln_traldf_blp ) THEN                ! bilaplacian operator
-               DO_3D( 0, 0, 0, 0, 2, jpkm1 )
+               DO_3D( 1, 0, 1, 0, 2, jpkm1 )
                   akz(ji,jj,jk) = 16._wp   &
                      &   * ah_wslp2   (ji,jj,jk)   &
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traldf_lap_blp.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traldf_lap_blp.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traldf_lap_blp.F90	(revision 14219)
@@ -40,4 +40,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -61,5 +62,5 @@
       REAL(wp), DIMENSION(:,:,:)  , INTENT(in   ) ::   pgui, pgvi ! tracer gradient at top   levels
       REAL(wp), DIMENSION(:,:,:,:), INTENT(in   ) ::   pt         ! before tracer fields
-      REAL(wp), DIMENSION(:,:,:,:), INTENT(inout) ::   pt_rhs     ! tracer trend
+      REAL(dp), DIMENSION(:,:,:,:), INTENT(inout) ::   pt_rhs     ! tracer trend
       !!
       CALL tra_ldf_lap_t( kt, Kmm, kit000, cdtype, pahu, pahv, is_tile(pahu),                            &
@@ -100,5 +101,5 @@
       REAL(wp), DIMENSION(A2D_T(ktgi),       KJPT), INTENT(in   ) ::   pgui, pgvi ! tracer gradient at top   levels
       REAL(wp), DIMENSION(A2D_T(ktt),    JPK,KJPT), INTENT(in   ) ::   pt         ! before tracer fields
-      REAL(wp), DIMENSION(A2D_T(ktt_rhs),JPK,KJPT), INTENT(inout) ::   pt_rhs     ! tracer trend
+      REAL(dp), DIMENSION(A2D_T(ktt_rhs),JPK,KJPT), INTENT(inout) ::   pt_rhs     ! tracer trend
       !
       INTEGER  ::   ji, jj, jk, jn      ! dummy loop indices
@@ -121,4 +122,10 @@
             &                        iom_use("uadv_salttr") .OR. iom_use("vadv_salttr")  ) )  l_hst = .TRUE.
       ENDIF
+      !
+      l_hst = .FALSE.
+      l_ptr = .FALSE.
+      IF( cdtype == 'TRA' .AND. ( iom_use( 'sophtldf' ) .OR. iom_use( 'sopstldf' ) ) )     l_ptr = .TRUE.
+      IF( cdtype == 'TRA' .AND. ( iom_use("uadv_heattr") .OR. iom_use("vadv_heattr") .OR. &
+         &                        iom_use("uadv_salttr") .OR. iom_use("vadv_salttr")  ) )  l_hst = .TRUE.
       !
       !                                !==  Initialization of metric arrays used for all tracers  ==!
@@ -203,8 +210,8 @@
       REAL(wp), DIMENSION(jpi,jpj,    kjpt), INTENT(in   ) ::   pgui, pgvi ! tracer gradient at top levels
       REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   pt         ! before and now tracer fields
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pt_rhs     ! tracer trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pt_rhs     ! tracer trend
       !
       INTEGER ::   ji, jj, jk, jn   ! dummy loop indices
-      REAL(wp), DIMENSION(A2D(nn_hls),jpk,kjpt) :: zlap         ! laplacian at t-point
+      REAL(dp), DIMENSION(A2D(nn_hls),jpk,kjpt) :: zlap         ! laplacian at t-point
       REAL(wp), DIMENSION(A2D(nn_hls),    kjpt) :: zglu, zglv   ! bottom GRADh of the laplacian (u- and v-points)
       REAL(wp), DIMENSION(A2D(nn_hls),    kjpt) :: zgui, zgvi   ! top    GRADh of the laplacian (u- and v-points)
@@ -237,6 +244,6 @@
       CALL lbc_lnk( 'traldf_lap_blp', zlap(:,:,:,:) , 'T', 1.0_wp )     ! Lateral boundary conditions (unchanged sign)
       !                                               ! Partial top/bottom cell: GRADh( zlap )
-      IF( ln_isfcav .AND. ln_zps ) THEN   ;   CALL zps_hde_isf( kt, Kmm, kjpt, zlap, zglu, zglv, zgui, zgvi )  ! both top & bottom
-      ELSEIF(             ln_zps ) THEN   ;   CALL zps_hde    ( kt, Kmm, kjpt, zlap, zglu, zglv )              ! only bottom
+      IF( ln_isfcav .AND. ln_zps ) THEN   ;   CALL zps_hde_isf( kt, Kmm, kjpt, zlap, zglu, zglv, zgui, zgvi )
+      ELSEIF(             ln_zps ) THEN   ;   CALL zps_hde    ( kt, Kmm, kjpt, zlap, zglu, zglv )
       ENDIF
       !
@@ -244,9 +251,9 @@
       !
       CASE ( np_blp    )               ! iso-level bilaplacian
-         CALL tra_ldf_lap  ( kt, Kmm, kit000, cdtype, pahu, pahv, zglu, zglv, zgui, zgvi, zlap, pt_rhs,         kjpt, 2 )
+         CALL tra_ldf_lap  ( kt, Kmm, kit000, cdtype, pahu, pahv, zglu, zglv, zgui, zgvi, CASTWP(zlap), pt_rhs,         kjpt, 2 )
       CASE ( np_blp_i  )               ! rotated   bilaplacian : standard operator (Madec)
-         CALL tra_ldf_iso  ( kt, Kmm, kit000, cdtype, pahu, pahv, zglu, zglv, zgui, zgvi, zlap, pt    , pt_rhs, kjpt, 2 )
+         CALL tra_ldf_iso  ( kt, Kmm, kit000, cdtype, pahu, pahv, zglu, zglv, zgui, zgvi, CASTWP(zlap), pt    , pt_rhs, kjpt, 2 )
       CASE ( np_blp_it )               ! rotated  bilaplacian : triad operator (griffies)
-         CALL tra_ldf_triad( kt, Kmm, kit000, cdtype, pahu, pahv, zglu, zglv, zgui, zgvi, zlap, pt    , pt_rhs, kjpt, 2 )
+         CALL tra_ldf_triad( kt, Kmm, kit000, cdtype, pahu, pahv, zglu, zglv, zgui, zgvi, CASTWP(zlap), pt    , pt_rhs, kjpt, 2 )
       END SELECT
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traldf_triad.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traldf_triad.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traldf_triad.F90	(revision 14219)
@@ -43,4 +43,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -65,5 +66,5 @@
       REAL(wp), DIMENSION(:,:,:,:), INTENT(in   ) ::   pt         ! tracer (kpass=1) or laplacian of tracer (kpass=2)
       REAL(wp), DIMENSION(:,:,:,:), INTENT(in   ) ::   pt2        ! tracer (only used in kpass=2)
-      REAL(wp), DIMENSION(:,:,:,:), INTENT(inout) ::   pt_rhs     ! tracer trend
+      REAL(dp), DIMENSION(:,:,:,:), INTENT(inout) ::   pt_rhs     ! tracer trend
       !!
       CALL tra_ldf_triad_t( kt, Kmm, kit000, cdtype, pahu, pahv, is_tile(pahu),                            &
@@ -107,5 +108,5 @@
       REAL(wp), DIMENSION(A2D_T(ktt),    JPK,KJPT), INTENT(in   ) ::   pt         ! tracer (kpass=1) or laplacian of tracer (kpass=2)
       REAL(wp), DIMENSION(A2D_T(ktt2),   JPK,KJPT), INTENT(in   ) ::   pt2        ! tracer (only used in kpass=2)
-      REAL(wp), DIMENSION(A2D_T(ktt_rhs),JPK,KJPT), INTENT(inout) ::   pt_rhs     ! tracer trend
+      REAL(dp), DIMENSION(A2D_T(ktt_rhs),JPK,KJPT), INTENT(inout) ::   pt_rhs     ! tracer trend
       !
       INTEGER  ::  ji, jj, jk, jn   ! dummy loop indices
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/tramle.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/tramle.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/tramle.F90	(revision 14219)
@@ -381,2 +381,3 @@
    !!==============================================================================
 END MODULE tramle
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/tranpc.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/tranpc.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/tranpc.F90	(revision 14219)
@@ -40,4 +40,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -65,5 +66,5 @@
       INTEGER,                                   INTENT(in   ) :: kt              ! ocean time-step index
       INTEGER,                                   INTENT(in   ) :: Kmm, Krhs, Kaa  ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts             ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts             ! active tracers and RHS of tracer equation
       !
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
@@ -102,6 +103,6 @@
          ENDIF
          !
-         CALL eos_rab( pts(:,:,:,:,Kaa), zab, Kmm )         ! after alpha and beta (given on T-points)
-         CALL bn2    ( pts(:,:,:,:,Kaa), zab, zn2, Kmm )    ! after Brunt-Vaisala  (given on W-points)
+         CALL eos_rab( CASTWP(pts(:,:,:,:,Kaa)), zab, Kmm )         ! after alpha and beta (given on T-points)
+         CALL bn2    ( CASTWP(pts(:,:,:,:,Kaa)), zab, zn2, Kmm )    ! after Brunt-Vaisala  (given on W-points)
          !
          IF( ntile == 0 .OR. ntile == 1 ) nnpcc = 0         ! Do only on the first tile
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traqsr.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traqsr.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/traqsr.F90	(revision 14219)
@@ -70,4 +70,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -105,5 +106,5 @@
       INTEGER,                                   INTENT(in   ) :: kt            ! ocean time-step
       INTEGER,                                   INTENT(in   ) :: Kmm, Krhs     ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts           ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts           ! active tracers and RHS of tracer equation
       !
       INTEGER  ::   ji, jj, jk               ! dummy loop indices
@@ -324,5 +325,5 @@
       ENDIF
       !                       ! print mean trends (used for debugging)
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=pts(:,:,:,jp_tem,Krhs), clinfo1=' qsr  - Ta: ', mask1=tmask, clinfo3='tra-ta' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(pts(:,:,:,jp_tem,Krhs)), clinfo1=' qsr  - Ta: ', mask1=tmask, clinfo3='tra-ta' )
       !
       IF( ln_timing )   CALL timing_stop('tra_qsr')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/trasbc.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/trasbc.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/trasbc.F90	(revision 14219)
@@ -44,4 +44,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -72,7 +73,7 @@
       !!              - send trends to trdtra module for further diagnostics(l_trdtra=T)
       !!----------------------------------------------------------------------
-      INTEGER,                                   INTENT(in   ) ::   kt         ! ocean time-step index
-      INTEGER,                                   INTENT(in   ) ::   Kmm, Krhs  ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) ::   pts        ! active tracers and RHS of tracer Eq.
+      INTEGER,                                   INTENT(in   ) :: kt         ! ocean time-step index
+      INTEGER,                                   INTENT(in   ) :: Kmm, Krhs  ! time level indices
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts        ! active tracers and RHS of tracer equation
       !
       INTEGER  ::   ji, jj, jk, jn               ! dummy loop indices
@@ -225,6 +226,6 @@
       ENDIF
       !
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=pts(:,:,:,jp_tem,Krhs), clinfo1=' sbc  - Ta: ', mask1=tmask,   &
-         &                                  tab3d_2=pts(:,:,:,jp_sal,Krhs), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(pts(:,:,:,jp_tem,Krhs)), clinfo1=' sbc  - Ta: ', mask1=tmask,   &
+         &                                  tab3d_2=CASTWP(pts(:,:,:,jp_sal,Krhs)), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
       !
       IF( ln_timing )   CALL timing_stop('tra_sbc')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/trazdf.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/trazdf.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/trazdf.F90	(revision 14219)
@@ -40,4 +40,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -55,5 +56,5 @@
       INTEGER                                  , INTENT(in)    :: kt                  ! ocean time-step index
       INTEGER                                  , INTENT(in)    :: Kbb, Kmm, Krhs, Kaa ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts                 ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts                 ! active tracers and RHS of tracer equation
       !
       INTEGER  ::   ji, jj, jk   ! Dummy loop indices
@@ -109,6 +110,6 @@
       ENDIF
       !                                          ! print mean trends (used for debugging)
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=pts(:,:,:,jp_tem,Kaa), clinfo1=' zdf  - Ta: ', mask1=tmask,               &
-         &                                  tab3d_2=pts(:,:,:,jp_sal,Kaa), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(pts(:,:,:,jp_tem,Kaa)), clinfo1=' zdf  - Ta: ', mask1=tmask,               &
+         &                                  tab3d_2=CASTWP(pts(:,:,:,jp_sal,Kaa)), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
       !
       IF( ln_timing )   CALL timing_stop('tra_zdf')
@@ -143,9 +144,9 @@
       INTEGER                                  , INTENT(in   ) ::   kjpt     ! number of tracers
       REAL(wp)                                 , INTENT(in   ) ::   p2dt     ! tracer time-step
-      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt       ! tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,kjpt,jpt), INTENT(inout) ::   pt       ! tracers and RHS of tracer equation
       !
       INTEGER  ::  ji, jj, jk, jn   ! dummy loop indices
-      REAL(wp) ::  zrhs, zzwi, zzws ! local scalars
-      REAL(wp), DIMENSION(A2D(nn_hls),jpk) ::  zwi, zwt, zwd, zws
+      REAL(dp) ::  zrhs, zzwi, zzws ! local scalars
+      REAL(dp), DIMENSION(A2D(nn_hls),jpk) ::  zwi, zwt, zwd, zws
       !!---------------------------------------------------------------------
       !
@@ -264,2 +265,3 @@
    !!==============================================================================
 END MODULE trazdf
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/zpshde.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/zpshde.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRA/zpshde.F90	(revision 14219)
@@ -47,5 +47,5 @@
       INTEGER                     , INTENT(in   )           ::  Kmm         ! ocean time level index
       INTEGER                     , INTENT(in   )           ::  kjpt        ! number of tracers
-      REAL(wp), DIMENSION(:,:,:,:), INTENT(inout)           ::  pta         ! 4D tracers fields
+      REAL(dp), DIMENSION(:,:,:,:), INTENT(inout)           ::  pta         ! 4D tracers fields
       REAL(wp), DIMENSION(:,:,:)  , INTENT(  out)           ::  pgtu, pgtv  ! hor. grad. of ptra at u- & v-pts
       REAL(wp), DIMENSION(:,:,:)  , INTENT(inout), OPTIONAL ::  prd         ! 3D density anomaly fields
@@ -111,5 +111,5 @@
       INTEGER                                , INTENT(in   )           ::  kjpt        ! number of tracers
       INTEGER                                , INTENT(in   )           ::  ktta, ktgt, ktrd, ktgr
-      REAL(wp), DIMENSION(A2D_T(ktta),JPK,KJPT), INTENT(inout)           ::  pta         ! 4D tracers fields
+      REAL(dp), DIMENSION(A2D_T(ktta),JPK,KJPT), INTENT(inout)           ::  pta         ! 4D tracers fields
       REAL(wp), DIMENSION(A2D_T(ktgt)    ,KJPT), INTENT(  out)           ::  pgtu, pgtv  ! hor. grad. of ptra at u- & v-pts
       REAL(wp), DIMENSION(A2D_T(ktrd),JPK     ), INTENT(inout), OPTIONAL ::  prd         ! 3D density anomaly fields
@@ -221,5 +221,5 @@
       INTEGER                     , INTENT(in   )           ::  Kmm          ! ocean time level index
       INTEGER                     , INTENT(in   )           ::  kjpt         ! number of tracers
-      REAL(wp), DIMENSION(:,:,:,:), INTENT(inout)           ::  pta          ! 4D tracers fields
+      REAL(dp), DIMENSION(:,:,:,:), INTENT(inout)           ::  pta          ! 4D tracers fields
       REAL(wp), DIMENSION(:,:,:)  , INTENT(  out)           ::  pgtu, pgtv   ! hor. grad. of ptra at u- & v-pts
       REAL(wp), DIMENSION(:,:,:)  , INTENT(  out)           ::  pgtui, pgtvi ! hor. grad. of stra at u- & v-pts (ISF)
@@ -291,5 +291,5 @@
       INTEGER                                , INTENT(in   )           ::  kjpt         ! number of tracers
       INTEGER                                , INTENT(in   )           ::  ktta, ktgt, ktgti, ktrd, ktgr, ktgri
-      REAL(wp), DIMENSION(A2D_T(ktta),JPK,KJPT), INTENT(inout)           ::  pta          ! 4D tracers fields
+      REAL(dp), DIMENSION(A2D_T(ktta),JPK,KJPT), INTENT(inout)           ::  pta          ! 4D tracers fields
       REAL(wp), DIMENSION(A2D_T(ktgt)    ,KJPT), INTENT(  out)           ::  pgtu, pgtv   ! hor. grad. of ptra at u- & v-pts
       REAL(wp), DIMENSION(A2D_T(ktgti)   ,KJPT), INTENT(  out)           ::  pgtui, pgtvi ! hor. grad. of stra at u- & v-pts (ISF)
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trddyn.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trddyn.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trddyn.F90	(revision 14219)
@@ -38,4 +38,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -53,5 +54,5 @@
       !!              and/or mixed layer budget.
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   putrd, pvtrd   ! U and V trends 
+      REAL(dp), DIMENSION(:,:,:), INTENT(inout) ::   putrd, pvtrd   ! U and V trends 
       INTEGER                   , INTENT(in   ) ::   ktrd           ! trend index
       INTEGER                   , INTENT(in   ) ::   kt             ! time step
@@ -99,5 +100,5 @@
       !! ** Purpose :   output 3D trends using IOM
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   putrd, pvtrd   ! U and V trends
+      REAL(dp), DIMENSION(:,:,:), INTENT(inout) ::   putrd, pvtrd   ! U and V trends
       INTEGER                   , INTENT(in   ) ::   ktrd           ! trend index
       INTEGER                   , INTENT(in   ) ::   kt             ! time step
@@ -181,2 +182,3 @@
    !!======================================================================
 END MODULE trddyn
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdglo.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdglo.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdglo.F90	(revision 14219)
@@ -53,4 +53,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -68,6 +69,6 @@
       !!
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend 
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend
+      REAL(dp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend 
+      REAL(dp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend
       INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index
       CHARACTER(len=3)          , INTENT(in   ) ::   ctype   ! momentum or tracers trends type (='DYN'/'TRA')
@@ -202,5 +203,5 @@
          zkepe(:,:,:) = 0._wp
    
-         CALL eos( ts(:,:,:,:,Kmm), rhd, rhop )       ! now potential density
+         CALL eos( CASTWP(ts(:,:,:,:,Kmm)), rhd, CASTWP(rhop) )       ! now potential density
 
          zcof = 0.5_wp / rho0             ! Density flux at w-point
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdken.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdken.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdken.F90	(revision 14219)
@@ -78,5 +78,5 @@
       !
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   putrd, pvtrd   ! U and V masked trends
+      REAL(dp), DIMENSION(:,:,:), INTENT(inout) ::   putrd, pvtrd   ! U and V masked trends
       INTEGER                   , INTENT(in   ) ::   ktrd           ! trend index
       INTEGER                   , INTENT(in   ) ::   kt             ! time step
@@ -248,2 +248,3 @@
    !!======================================================================
 END MODULE trdken
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdpen.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdpen.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdpen.F90	(revision 14219)
@@ -37,4 +37,5 @@
    !! * Substitutions
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -79,5 +80,5 @@
       IF( kt /= nkstp ) THEN     ! full eos: set partial derivatives at the 1st call of kt time step
          nkstp = kt
-         CALL eos_pen( ts(:,:,:,:,Kmm), rab_PE, zpe, Kmm )
+         CALL eos_pen( CASTWP(ts(:,:,:,:,Kmm)), rab_PE, zpe, Kmm )
          CALL iom_put( "alphaPE", rab_pe(:,:,:,jp_tem) )
          CALL iom_put( "betaPE" , rab_pe(:,:,:,jp_sal) )
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdtra.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdtra.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdtra.F90	(revision 14219)
@@ -37,5 +37,5 @@
    PUBLIC   trd_tra   ! called by all tra_... modules
 
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   trdtx, trdty, trdt   ! use to store the temperature trends
+   REAL(dp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   trdtx, trdty, trdt   ! use to store the temperature trends
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   avt_evd  ! store avt_evd to calculate EVD trend
 
@@ -43,4 +43,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -85,6 +86,7 @@
       INTEGER ::   jk    ! loop indices
       INTEGER ::   i01   ! 0 or 1
-      REAL(wp),        DIMENSION(jpi,jpj,jpk) ::   ztrds             ! 3D workspace
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zwt, zws, ztrdt   ! 3D workspace
+      REAL(dp),        DIMENSION(jpi,jpj,jpk) ::   ztrds             ! 3D workspace
+      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:)  :: ztrdt
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zwt, zws   ! 3D workspace
       !!----------------------------------------------------------------------
       !      
@@ -204,5 +206,5 @@
       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   pt      ! now or before tracer 
       CHARACTER(len=1)                , INTENT(in   ) ::   cdir    ! X/Y/Z direction
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(  out) ::   ptrd    ! advective trend in one direction
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(  out) ::   ptrd    ! advective trend in one direction
       INTEGER,  INTENT(in)                            ::   Kmm     ! time level index
       !
@@ -239,6 +241,6 @@
       !!                mixed layer budget.
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend 
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend
+      REAL(dp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend 
+      REAL(dp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend
       INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index
       INTEGER                   , INTENT(in   ) ::   kt      ! time step
@@ -253,5 +255,5 @@
 
       !                   ! Potential ENergy trends
-      IF( ln_PE_trd  )   CALL trd_pen( ptrdx, ptrdy, ktrd, kt, rDt, Kmm )
+      IF( ln_PE_trd  )   CALL trd_pen( CASTWP(ptrdx), CASTWP(ptrdy), ktrd, kt, rDt, Kmm )
 
       !                   ! Mixed layer trends for active tracers
@@ -269,20 +271,20 @@
 
          SELECT CASE ( ktrd )
-         CASE ( jptra_xad )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_xad, '3D' )   ! zonal    advection
-         CASE ( jptra_yad )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_yad, '3D' )   ! merid.   advection
-         CASE ( jptra_zad )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_zad, '3D' )   ! vertical advection
-         CASE ( jptra_ldf )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_ldf, '3D' )   ! lateral  diffusion
-         CASE ( jptra_bbl )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_bbl, '3D' )   ! bottom boundary layer
+         CASE ( jptra_xad )        ;   CALL trd_mxl_zint( CASTWP(ptrdx), CASTWP(ptrdy), jpmxl_xad, '3D' )
+         CASE ( jptra_yad )        ;   CALL trd_mxl_zint( CASTWP(ptrdx), CASTWP(ptrdy), jpmxl_yad, '3D' )
+         CASE ( jptra_zad )        ;   CALL trd_mxl_zint( CASTWP(ptrdx), CASTWP(ptrdy), jpmxl_zad, '3D' )
+         CASE ( jptra_ldf )        ;   CALL trd_mxl_zint( CASTWP(ptrdx), CASTWP(ptrdy), jpmxl_ldf, '3D' )
+         CASE ( jptra_bbl )        ;   CALL trd_mxl_zint( CASTWP(ptrdx), CASTWP(ptrdy), jpmxl_bbl, '3D' )
          CASE ( jptra_zdf )
-            IF( ln_traldf_iso ) THEN ; CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_ldf, '3D' )   ! lateral  diffusion (K_z)
-            ELSE                   ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_zdf, '3D' )   ! vertical diffusion (K_z)
+            IF( ln_traldf_iso ) THEN ; CALL trd_mxl_zint( CASTWP(ptrdx), CASTWP(ptrdy), jpmxl_ldf, '3D' )
+            ELSE                   ;   CALL trd_mxl_zint( CASTWP(ptrdx), CASTWP(ptrdy), jpmxl_zdf, '3D' )
             ENDIF
-         CASE ( jptra_dmp )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_dmp, '3D' )   ! internal 3D restoring (tradmp)
-         CASE ( jptra_qsr )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_for, '3D' )   ! air-sea : penetrative sol radiat
+         CASE ( jptra_dmp )        ;   CALL trd_mxl_zint( CASTWP(ptrdx), CASTWP(ptrdy), jpmxl_dmp, '3D' )
+         CASE ( jptra_qsr )        ;   CALL trd_mxl_zint( CASTWP(ptrdx), CASTWP(ptrdy), jpmxl_for, '3D' )
          CASE ( jptra_nsr )        ;   ptrdx(:,:,2:jpk) = 0._wp   ;   ptrdy(:,:,2:jpk) = 0._wp
-                                       CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_for, '2D' )   ! air-sea : non penetr sol radiation
-         CASE ( jptra_bbc )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_bbc, '3D' )   ! bottom bound cond (geoth flux)
-         CASE ( jptra_npc )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_npc, '3D' )   ! non penetr convect adjustment
-         CASE ( jptra_atf )        ;   CALL trd_mxl_zint( ptrdx, ptrdy, jpmxl_atf, '3D' )   ! asselin time filter (last trend)
+                                       CALL trd_mxl_zint( CASTWP(ptrdx), CASTWP(ptrdy), jpmxl_for, '2D' )
+         CASE ( jptra_bbc )        ;   CALL trd_mxl_zint( CASTWP(ptrdx), CASTWP(ptrdy), jpmxl_bbc, '3D' )
+         CASE ( jptra_npc )        ;   CALL trd_mxl_zint( CASTWP(ptrdx), CASTWP(ptrdy), jpmxl_npc, '3D' )
+         CASE ( jptra_atf )        ;   CALL trd_mxl_zint( CASTWP(ptrdx), CASTWP(ptrdy), jpmxl_atf, '3D' )
                                    !
                                        CALL trd_mxl( kt, rDt )                             ! trends: Mixed-layer (output)
@@ -300,6 +302,6 @@
       !! ** Purpose :   output 3D tracer trends using IOM
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend 
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend
+      REAL(dp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdx   ! Temperature or U trend 
+      REAL(dp), DIMENSION(:,:,:), INTENT(inout) ::   ptrdy   ! Salinity    or V trend
       INTEGER                   , INTENT(in   ) ::   ktrd    ! tracer trend index
       INTEGER                   , INTENT(in   ) ::   kt      ! time step
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdtrc.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdtrc.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdtrc.F90	(revision 14219)
@@ -13,5 +13,5 @@
       INTEGER ::   kt, kjn, ktrd   
       INTEGER ::   Kmm            ! time level index
-      REAL(wp)::   ptrtrd(:,:,:)  
+      REAL(dp)::   ptrtrd(:,:,:)  
       WRITE(*,*) 'trd_trc : You should not have seen this print! error?', ptrtrd(1,1,1)
       WRITE(*,*) '  "      "      : You should not have seen this print! error?', kjn, ktrd, kt
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdvor.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdvor.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/TRD/trdvor.F90	(revision 14219)
@@ -49,7 +49,7 @@
    REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   vor_avrbn    ! after vorticity at time step after the
    REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   rotot        ! begining of the NN_WRITE-1 timesteps
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   vor_avrtot   !
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   vor_avrres   !
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::   vortrd       ! curl of trends
+   REAL(dp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   vor_avrtot   !
+   REAL(dp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   vor_avrres   !
+   REAL(dp), SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::   vortrd       ! curl of trends
          
    CHARACTER(len=12) ::   cvort
@@ -86,5 +86,5 @@
       !!               and make outputs (NetCDF format)
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   putrd, pvtrd   ! U and V trends 
+      REAL(dp), DIMENSION(:,:,:), INTENT(inout) ::   putrd, pvtrd   ! U and V trends 
       INTEGER                   , INTENT(in   ) ::   ktrd           ! trend index
       INTEGER                   , INTENT(in   ) ::   kt             ! time step
@@ -237,6 +237,6 @@
       INTEGER                         , INTENT(in   ) ::   ktrd       ! ocean trend index
       INTEGER                         , INTENT(in   ) ::   Kmm        ! time level index
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   putrdvor   ! u vorticity trend 
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pvtrdvor   ! v vorticity trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   putrdvor   ! u vorticity trend 
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pvtrdvor   ! v vorticity trend
       !
       INTEGER ::   ji, jj, jk   ! dummy loop indices
@@ -400,5 +400,6 @@
 
          ! Boundary conditions
-         CALL lbc_lnk_multi( 'trdvor', vor_avrtot, 'F', 1.0_wp , vor_avrres, 'F', 1.0_wp )
+         CALL lbc_lnk_multi( 'trdvor', vor_avrtot, 'F', 1.0_wp &
+              &                      , vor_avrres, 'F', 1.0_wp )
 
 
@@ -458,5 +459,7 @@
       !!      from ocean surface down to control surface (NetCDF output)
       !!----------------------------------------------------------------------
-      REAL(wp) ::   zjulian, zsto, zout
+      REAL(dp)  :: zjulian
+      REAL(dp)  :: zsto
+      REAL(dp) :: zout
       CHARACTER (len=40) ::   clhstnam
       CHARACTER (len=40) ::   clop
@@ -574,2 +577,3 @@
    !!======================================================================
 END MODULE trdvor
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/USR/usrdef_hgr.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/USR/usrdef_hgr.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/USR/usrdef_hgr.F90	(revision 14219)
@@ -59,10 +59,20 @@
       !!              - define u- & v-surfaces (if gridsize reduction is used in some straits) (in m2)
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(:,:), INTENT(out) ::   plamt, plamu, plamv, plamf   ! longitude outputs                     [degrees]
-      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pphit, pphiu, pphiv, pphif   ! latitude outputs                      [degrees]
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: plamt
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: plamf
+      REAL(wp), DIMENSION(:,:), INTENT(out) :: plamu, plamv   ! longitude outputs                     [degrees]
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: pphit
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: pphif
+      REAL(wp), DIMENSION(:,:), INTENT(out) :: pphiu, pphiv   ! latitude outputs                      [degrees]
       INTEGER                 , INTENT(out) ::   kff                          ! =1 Coriolis parameter computed here, =0 otherwise
       REAL(wp), DIMENSION(:,:), INTENT(out) ::   pff_f, pff_t                 ! Coriolis factor at f-point                [1/s]
-      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1t, pe1u, pe1v, pe1f       ! i-scale factors                             [m]
-      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe2t, pe2u, pe2v, pe2f       ! j-scale factors                             [m]
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: pe1t
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: pe1u
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: pe1f
+      REAL(wp), DIMENSION(:,:), INTENT(out) :: pe1v       ! i-scale factors                             [m]
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: pe2t
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: pe2v
+      REAL(dp), DIMENSION(:,:), INTENT(out)  :: pe2f
+      REAL(wp), DIMENSION(:,:), INTENT(out) :: pe2u       ! j-scale factors                             [m]
       INTEGER                 , INTENT(out) ::   ke1e2u_v                     ! =1 u- & v-surfaces computed here, =0 otherwise 
       REAL(wp), DIMENSION(:,:), INTENT(out) ::   pe1e2u, pe1e2v               ! u- & v-surfaces (if reduction in strait)   [m2]
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/USR/usrdef_istate.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/USR/usrdef_istate.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/USR/usrdef_istate.F90	(revision 14219)
@@ -47,7 +47,7 @@
       REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   pdept   ! depth of t-point               [m]
       REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask             [m]
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(  out) ::   pts     ! T & S fields      [Celsius ; g/kg]
-      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pu      ! i-component of the velocity  [m/s] 
-      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pv      ! j-component of the velocity  [m/s] 
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(  out) ::   pts     ! T & S fields      [Celsius ; g/kg]
+      REAL(dp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pu      ! i-component of the velocity  [m/s] 
+      REAL(dp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pv      ! j-component of the velocity  [m/s] 
       !
       INTEGER :: ji, jj, jk  ! dummy loop indices
@@ -90,5 +90,5 @@
       !!----------------------------------------------------------------------
       REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask   [m]
-      REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height   [m]
+      REAL(dp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height   [m]
       !!----------------------------------------------------------------------
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/USR/usrdef_zgr.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/USR/usrdef_zgr.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/USR/usrdef_zgr.F90	(revision 14219)
@@ -53,5 +53,6 @@
       REAL(wp), DIMENSION(:)    , INTENT(out) ::   pe3t_1d , pe3w_1d           ! 1D grid-point depth     [m]
       REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   pdept, pdepw                ! grid-point depth        [m]
-      REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   pe3t , pe3u , pe3v , pe3f   ! vertical scale factors  [m]
+      REAL(dp), DIMENSION(:,:,:), INTENT(out) ::   pe3t                        ! vertical scale factors  [m]
+      REAL(wp), DIMENSION(:,:,:), INTENT(out) ::          pe3u , pe3v , pe3f   ! vertical scale factors  [m]
       REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   pe3w , pe3uw, pe3vw         ! i-scale factors 
       INTEGER , DIMENSION(:,:)  , INTENT(out) ::   k_top, k_bot                ! first & last ocean level
@@ -221,5 +222,6 @@
       REAL(wp), DIMENSION(:)    , INTENT(in   ) ::   pe3t_1d , pe3w_1d           ! 1D vertical scale factors [m]
       REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   pdept, pdepw                ! grid-point depth          [m]
-      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   pe3t , pe3u , pe3v , pe3f   ! vertical scale factors    [m]
+      REAL(dp), DIMENSION(:,:,:), INTENT(  out) ::   pe3t                        ! vertical scale factors    [m]
+      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::          pe3u , pe3v , pe3f   ! vertical scale factors    [m]
       REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   pe3w , pe3uw, pe3vw         !    -       -      -
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ZDF/zdfdrg.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ZDF/zdfdrg.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ZDF/zdfdrg.F90	(revision 14219)
@@ -76,4 +76,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -157,6 +158,6 @@
       INTEGER                         , INTENT(in   ) ::   kt         ! ocean time-step index
       INTEGER                         , INTENT(in   ) ::   Kmm        ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pub, pvb   ! the two components of the before velocity
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pua, pva   ! the two components of the velocity tendency
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pub, pvb   ! the two components of the before velocity
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pua, pva   ! the two components of the velocity tendency
       !! 
       INTEGER  ::   ji, jj       ! dummy loop indexes
@@ -164,5 +165,5 @@
       REAL(wp) ::   zm1_2dt      ! local scalar
       REAL(wp) ::   zCdu, zCdv   !   -      -
-      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdu, ztrdv
+      REAL(dp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdu, ztrdv
       !!---------------------------------------------------------------------
       !
@@ -209,6 +210,6 @@
       ENDIF
       !                                          ! print mean trends (used for debugging)
-      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=pua, clinfo1=' bfr  - Ua: ', mask1=umask,               &
-         &                                  tab3d_2=pva, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
+      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab3d_1=CASTWP(pua), clinfo1=' bfr  - Ua: ', mask1=umask,               &
+         &                                  tab3d_2=CASTWP(pva), clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
    END SUBROUTINE zdf_drg_exp
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ZDF/zdfmfc.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ZDF/zdfmfc.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ZDF/zdfmfc.F90	(revision 14219)
@@ -59,4 +59,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.2 , NEMO Consortium (2018)
@@ -95,5 +96,5 @@
       !!----------------------------------------------------------------------
       INTEGER                                  , INTENT(in)    :: Kmm, Krhs ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts       ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts       ! active tracers and RHS of tracer equation
       REAL(wp), DIMENSION(jpi,jpj,jpk,2) ::   ztsp         ! T/S of the plume
       REAL(wp), DIMENSION(jpi,jpj,jpk,2) ::   ztse         ! T/S at W point
@@ -106,5 +107,6 @@
       REAL(wp), DIMENSION(jpi,jpj) :: zustar, zustar2   !
       REAL(wp), DIMENSION(jpi,jpj) :: zuws, zvws, zsws, zfnet          !
-      REAL(wp), DIMENSION(jpi,jpj) :: zfbuo, zrautbm1, zrautb, zraupl
+      REAL(wp), DIMENSION(jpi,jpj) :: zfbuo, zrautbm1
+      REAL(dp), DIMENSION(jpi,jpj) :: zrautb, zraupl
       REAL(wp), DIMENSION(jpi,jpj) :: zwpsurf            !
       REAL(wp), DIMENSION(jpi,jpj) :: zop0 , zsp0 !
@@ -208,6 +210,6 @@
          ! Compute the buoyancy acceleration on T-points at jk-1
          zrautbm1(:,:) = zrautb(:,:)
-         CALL eos( pts (:,:,jk  ,:,Kmm) ,  zrautb(:,:)   )
-         CALL eos( ztsp(:,:,jk-1,:    ) ,  zraupl(:,:)   )
+         CALL eos( CASTWP(pts (:,:,jk  ,:,Kmm)) ,  zrautb(:,:)   )
+         CALL eos( CASTWP(ztsp(:,:,jk-1,:    )) ,  zraupl(:,:)   )
 
          zphm1(:,:)  = zphm1(:,:)  + grav * zrautbm1(:,:) * e3t(:,:,jk-1, Kmm)
@@ -376,5 +378,5 @@
       !
       !
-      CALL lbc_lnk_multi( 'zdfmfc', edmfm,'T',1., edmfa,'T',1., edmfb,'T',1., edmfc,'T',1., edmftra(:,:,:,jp_tem),'T',1., edmftra(:,:,:,jp_sal),'T',1.)
+      CALL lbc_lnk_multi( 'zdfmfc', edmfm,'T',1._wp, edmfa,'T',1._wp, edmfb,'T',1._wp, edmfc,'T',1._wp, edmftra(:,:,:,jp_tem),'T',1._wp, edmftra(:,:,:,jp_sal),'T',1._wp)
       !
    END SUBROUTINE tra_mfc
@@ -383,5 +385,5 @@
    SUBROUTINE diag_mfc( zdiagi, zdiagd, zdiags, p2dt, Kaa )
 
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::  zdiagi, zdiagd, zdiags  ! inout: tridaig. terms 
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::  zdiagi, zdiagd, zdiags  ! inout: tridaig. terms 
       REAL(wp)                        , INTENT(in   ) ::   p2dt                   ! tracer time-step
       INTEGER                         , INTENT(in   ) ::   Kaa                    ! ocean time level indices
@@ -399,5 +401,5 @@
    SUBROUTINE rhs_mfc( zrhs, jjn )
 
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   zrhs                   ! inout: rhs trend 
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   zrhs                   ! inout: rhs trend 
       INTEGER                         , INTENT(in   ) ::   jjn                    ! tracer indices
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ZDF/zdfosm.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ZDF/zdfosm.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ZDF/zdfosm.F90	(revision 14219)
@@ -150,4 +150,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -1176,5 +1177,5 @@
        END_3D
         ! Lateral boundary conditions on final outputs for hbl,  on T-grid (sign unchanged)
-        CALL lbc_lnk_multi( 'zdfosm', hbl, 'T', 1., dh, 'T', 1., hmle, 'T', 1. )
+        CALL lbc_lnk_multi( 'zdfosm', hbl, 'T', 1._wp, dh, 'T', 1._wp, hmle, 'T', 1._wp )
         ! Lateral boundary conditions on final outputs for gham[ts],  on W-grid  (sign unchanged)
         ! Lateral boundary conditions on final outputs for gham[uv],  on [UV]-grid  (sign changed)
@@ -2752,6 +2753,6 @@
      IF( lwp ) WRITE(numout,*) ' ===>>>> : calculating hbl computed from stratification'
      ! w-level of the mixing and mixed layers
-     CALL eos_rab( ts(:,:,:,:,Kmm), rab_n, Kmm )
-     CALL bn2(ts(:,:,:,:,Kmm), rab_n, rn2, Kmm)
+     CALL eos_rab( CASTWP(ts(:,:,:,:,Kmm)), rab_n, Kmm )
+     CALL bn2(CASTWP(ts(:,:,:,:,Kmm)), rab_n, rn2, Kmm)
      imld_rst(:,:)  = nlb10         ! Initialization to the number of w ocean point
      hbl(:,:)  = 0._wp              ! here hbl used as a dummy variable, integrating vertically N^2
@@ -2795,5 +2796,5 @@
       INTEGER                                  , INTENT(in)    :: kt        ! time step index
       INTEGER                                  , INTENT(in)    :: Kmm, Krhs ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts       ! active tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts       ! active tracers and RHS of tracer equation
       !
       INTEGER :: ji, jj, jk
@@ -2832,6 +2833,6 @@
 
       IF(sn_cfctl%l_prtctl) THEN
-         CALL prt_ctl( tab3d_1=pts(:,:,:,jp_tem,Krhs), clinfo1=' osm  - Ta: ', mask1=tmask,   &
-         &             tab3d_2=pts(:,:,:,jp_sal,Krhs), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
+         CALL prt_ctl( tab3d_1=CASTWP(pts(:,:,:,jp_tem,Krhs)), clinfo1=' osm  - Ta: ', mask1=tmask,   &
+         &             tab3d_2=CASTWP(pts(:,:,:,jp_sal,Krhs)), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
       ENDIF
       !
@@ -2867,5 +2868,5 @@
       INTEGER                             , INTENT( in )  ::  kt          ! ocean time step index
       INTEGER                             , INTENT( in )  ::  Kmm, Krhs   ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::  puu, pvv    ! ocean velocities and RHS of momentum equation
       !
       INTEGER :: ji, jj, jk   ! dummy loop indices
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ZDF/zdftke.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ZDF/zdftke.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/ZDF/zdftke.F90	(revision 14219)
@@ -307,5 +307,5 @@
                   zWlc2(ji,jj) = 0.5_wp * z1_norm * ( MAX( ut0sd(ji,jj)*ztaui + vt0sd(ji,jj)*ztauj, 0._wp ) )**2
             END_2D
-         CALL lbc_lnk      ( 'zdftke', zWlc2, 'T', 1. )
+         CALL lbc_lnk      ( 'zdftke', zWlc2, 'T', 1._wp )
 !
          ELSE                          ! Surface Stokes drift deduced from surface stress
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/lib_fortran.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/lib_fortran.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/lib_fortran.F90	(revision 14219)
@@ -37,8 +37,10 @@
 
    INTERFACE glob_sum
-      MODULE PROCEDURE glob_sum_1d, glob_sum_2d, glob_sum_3d
+      MODULE PROCEDURE glob_sum_1d_sp, glob_sum_2d_sp, glob_sum_3d_sp
+      MODULE PROCEDURE glob_sum_1d_dp, glob_sum_2d_dp, glob_sum_3d_dp
    END INTERFACE
    INTERFACE glob_sum_full
-      MODULE PROCEDURE glob_sum_full_2d, glob_sum_full_3d
+      MODULE PROCEDURE glob_sum_full_2d_sp, glob_sum_full_3d_sp
+      MODULE PROCEDURE glob_sum_full_2d_dp, glob_sum_full_3d_dp
    END INTERFACE
    INTERFACE local_sum
@@ -49,8 +51,10 @@
    END INTERFACE
    INTERFACE glob_min
-      MODULE PROCEDURE glob_min_2d, glob_min_3d
+      MODULE PROCEDURE glob_min_2d_sp, glob_min_3d_sp
+      MODULE PROCEDURE glob_min_2d_dp, glob_min_3d_dp
    END INTERFACE
    INTERFACE glob_max
-      MODULE PROCEDURE glob_max_2d, glob_max_3d
+      MODULE PROCEDURE glob_max_2d_sp, glob_max_3d_sp
+      MODULE PROCEDURE glob_max_2d_dp, glob_max_3d_dp
    END INTERFACE
 
@@ -74,66 +78,128 @@
 #  define GLOBSUM_CODE
 
-#     define DIM_1d
-#     define FUNCTION_GLOBSUM           glob_sum_1d
-#     include "lib_fortran_generic.h90"
-#     undef FUNCTION_GLOBSUM
-#     undef DIM_1d
-
-#     define DIM_2d
-#     define OPERATION_GLOBSUM
-#     define FUNCTION_GLOBSUM           glob_sum_2d
-#     include "lib_fortran_generic.h90"
-#     undef FUNCTION_GLOBSUM
-#     undef OPERATION_GLOBSUM
-#     define OPERATION_FULL_GLOBSUM
-#     define FUNCTION_GLOBSUM           glob_sum_full_2d
-#     include "lib_fortran_generic.h90"
-#     undef FUNCTION_GLOBSUM
-#     undef OPERATION_FULL_GLOBSUM
-#     undef DIM_2d
-
-#     define DIM_3d
-#     define OPERATION_GLOBSUM
-#     define FUNCTION_GLOBSUM           glob_sum_3d
-#     include "lib_fortran_generic.h90"
-#     undef FUNCTION_GLOBSUM
-#     undef OPERATION_GLOBSUM
-#     define OPERATION_FULL_GLOBSUM
-#     define FUNCTION_GLOBSUM           glob_sum_full_3d
-#     include "lib_fortran_generic.h90"
-#     undef FUNCTION_GLOBSUM
-#     undef OPERATION_FULL_GLOBSUM
-#     undef DIM_3d
+#     define SINGLE_PRECISION
+#        define DIM_1d
+#        define FUNCTION_GLOBSUM           glob_sum_1d_sp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBSUM
+#        undef DIM_1d
+
+#        define DIM_2d
+#        define OPERATION_GLOBSUM
+#        define FUNCTION_GLOBSUM           glob_sum_2d_sp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBSUM
+#        undef OPERATION_GLOBSUM
+#        define OPERATION_FULL_GLOBSUM
+#        define FUNCTION_GLOBSUM           glob_sum_full_2d_sp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBSUM
+#        undef OPERATION_FULL_GLOBSUM
+#        undef DIM_2d
+
+#        define DIM_3d
+#        define OPERATION_GLOBSUM
+#        define FUNCTION_GLOBSUM           glob_sum_3d_sp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBSUM
+#        undef OPERATION_GLOBSUM
+#        define OPERATION_FULL_GLOBSUM
+#        define FUNCTION_GLOBSUM           glob_sum_full_3d_sp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBSUM
+#        undef OPERATION_FULL_GLOBSUM
+#        undef DIM_3d
+#     undef SINGLE_PRECISION
+! Double Precision versions
+#        define DIM_1d
+#        define FUNCTION_GLOBSUM           glob_sum_1d_dp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBSUM
+#        undef DIM_1d
+
+#        define DIM_2d
+#        define OPERATION_GLOBSUM
+#        define FUNCTION_GLOBSUM           glob_sum_2d_dp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBSUM
+#        undef OPERATION_GLOBSUM
+#        define OPERATION_FULL_GLOBSUM
+#        define FUNCTION_GLOBSUM           glob_sum_full_2d_dp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBSUM
+#        undef OPERATION_FULL_GLOBSUM
+#        undef DIM_2d
+
+#        define DIM_3d
+#        define OPERATION_GLOBSUM
+#        define FUNCTION_GLOBSUM           glob_sum_3d_dp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBSUM
+#        undef OPERATION_GLOBSUM
+#        define OPERATION_FULL_GLOBSUM
+#        define FUNCTION_GLOBSUM           glob_sum_full_3d_dp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBSUM
+#        undef OPERATION_FULL_GLOBSUM
+#        undef DIM_3d
 
 #  undef GLOBSUM_CODE
 
-
+! Single Precision versions
 #  define GLOBMINMAX_CODE
 
-#     define DIM_2d
-#     define OPERATION_GLOBMIN
-#     define FUNCTION_GLOBMINMAX           glob_min_2d
-#     include "lib_fortran_generic.h90"
-#     undef FUNCTION_GLOBMINMAX
-#     undef OPERATION_GLOBMIN
-#     define OPERATION_GLOBMAX
-#     define FUNCTION_GLOBMINMAX           glob_max_2d
-#     include "lib_fortran_generic.h90"
-#     undef FUNCTION_GLOBMINMAX
-#     undef OPERATION_GLOBMAX
-#     undef DIM_2d
-
-#     define DIM_3d
-#     define OPERATION_GLOBMIN
-#     define FUNCTION_GLOBMINMAX           glob_min_3d
-#     include "lib_fortran_generic.h90"
-#     undef FUNCTION_GLOBMINMAX
-#     undef OPERATION_GLOBMIN
-#     define OPERATION_GLOBMAX
-#     define FUNCTION_GLOBMINMAX           glob_max_3d
-#     include "lib_fortran_generic.h90"
-#     undef FUNCTION_GLOBMINMAX
-#     undef OPERATION_GLOBMAX
-#     undef DIM_3d
+#     define SINGLE_PRECISION
+#        define DIM_2d
+#        define OPERATION_GLOBMIN
+#        define FUNCTION_GLOBMINMAX           glob_min_2d_sp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBMINMAX
+#        undef OPERATION_GLOBMIN
+#        define OPERATION_GLOBMAX
+#        define FUNCTION_GLOBMINMAX           glob_max_2d_sp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBMINMAX
+#        undef OPERATION_GLOBMAX
+#        undef DIM_2d
+
+#        define DIM_3d
+#        define OPERATION_GLOBMIN
+#        define FUNCTION_GLOBMINMAX           glob_min_3d_sp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBMINMAX
+#        undef OPERATION_GLOBMIN
+#        define OPERATION_GLOBMAX
+#        define FUNCTION_GLOBMINMAX           glob_max_3d_sp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBMINMAX
+#        undef OPERATION_GLOBMAX
+#        undef DIM_3d
+#     undef SINGLE_PRECISION
+! Double Precision versions
+#        define DIM_2d
+#        define OPERATION_GLOBMIN
+#        define FUNCTION_GLOBMINMAX           glob_min_2d_dp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBMINMAX
+#        undef OPERATION_GLOBMIN
+#        define OPERATION_GLOBMAX
+#        define FUNCTION_GLOBMINMAX           glob_max_2d_dp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBMINMAX
+#        undef OPERATION_GLOBMAX
+#        undef DIM_2d
+
+#        define DIM_3d
+#        define OPERATION_GLOBMIN
+#        define FUNCTION_GLOBMINMAX           glob_min_3d_dp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBMINMAX
+#        undef OPERATION_GLOBMIN
+#        define OPERATION_GLOBMAX
+#        define FUNCTION_GLOBMINMAX           glob_max_3d_dp
+#        include "lib_fortran_generic.h90"
+#        undef FUNCTION_GLOBMINMAX
+#        undef OPERATION_GLOBMAX
+#        undef DIM_3d
 #  undef GLOBMINMAX_CODE
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/lib_fortran_generic.h90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/lib_fortran_generic.h90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/lib_fortran_generic.h90	(revision 14219)
@@ -1,6 +1,12 @@
+#if defined SINGLE_PRECISION
+#   define TYPE                          REAL(sp)
+#else
+#   define TYPE                          REAL(dp)
+#endif
+
 #if defined GLOBSUM_CODE
 !                          ! FUNCTION FUNCTION_GLOBSUM !
 #   if defined DIM_1d
-#      define ARRAY_TYPE(i,j,k)    REAL(wp)                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
+#      define ARRAY_TYPE(i,j,k)    TYPE                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
 #      define ARRAY_IN(i,j,k)   ptab(i)
 #      define ARRAY2_IN(i,j,k)  ptab2(i)
@@ -10,5 +16,5 @@
 #   endif
 #   if defined DIM_2d
-#      define ARRAY_TYPE(i,j,k)    REAL(wp)                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
+#      define ARRAY_TYPE(i,j,k)    TYPE                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
 #      define ARRAY_IN(i,j,k)   ptab(i,j)
 #      define ARRAY2_IN(i,j,k)  ptab2(i,j)
@@ -17,5 +23,5 @@
 #   endif
 #   if defined DIM_3d
-#      define ARRAY_TYPE(i,j,k)    REAL(wp)                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
+#      define ARRAY_TYPE(i,j,k)    TYPE                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
 #      define ARRAY_IN(i,j,k)   ptab(i,j,k)
 #      define ARRAY2_IN(i,j,k)  ptab2(i,j,k)
@@ -34,12 +40,10 @@
       CHARACTER(len=*),  INTENT(in   ) ::   cdname  ! name of the calling subroutine
       ARRAY_TYPE(:,:,:)                             ! array on which operation is applied
-      REAL(wp)   ::  FUNCTION_GLOBSUM
+      TYPE   ::  FUNCTION_GLOBSUM
       !
       !!-----------------------------------------------------------------------
-      !
-      REAL(wp)                              ::   FUNCTION_GLOB_OP   ! global sum
       !!
       COMPLEX(dp)::   ctmp
-      REAL(wp)   ::   ztmp
+      TYPE   ::   ztmp
       INTEGER    ::   ji, jj, jk   ! dummy loop indices
       INTEGER    ::   ipi, ipj, ipk    ! dimensions
@@ -65,4 +69,5 @@
    END FUNCTION FUNCTION_GLOBSUM
 
+#undef TYPE
 #undef ARRAY_TYPE
 #undef ARRAY2_TYPE
@@ -77,5 +82,5 @@
 !                          ! FUNCTION FUNCTION_GLOBMINMAX !
 #   if defined DIM_2d
-#      define ARRAY_TYPE(i,j,k)    REAL(wp)                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
+#      define ARRAY_TYPE(i,j,k)    TYPE                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
 #      define ARRAY_IN(i,j,k)   ptab(i,j)
 #      define ARRAY2_IN(i,j,k)  ptab2(i,j)
@@ -83,5 +88,5 @@
 #   endif
 #   if defined DIM_3d
-#      define ARRAY_TYPE(i,j,k)    REAL(wp)                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
+#      define ARRAY_TYPE(i,j,k)    TYPE                 , INTENT(in   ) ::   ARRAY_IN(i,j,k)
 #      define ARRAY_IN(i,j,k)   ptab(i,j,k)
 #      define ARRAY2_IN(i,j,k)  ptab2(i,j,k)
@@ -103,9 +108,8 @@
       CHARACTER(len=*),  INTENT(in   ) ::   cdname  ! name of the calling subroutine
       ARRAY_TYPE(:,:,:)                             ! array on which operation is applied
-      REAL(wp)   ::  FUNCTION_GLOBMINMAX
+      TYPE   ::  FUNCTION_GLOBMINMAX
       !
       !!-----------------------------------------------------------------------
       !
-      REAL(wp)                              ::   FUNCTION_GLOB_OP   ! global sum
       !!
       COMPLEX(dp)::   ctmp
@@ -129,4 +133,5 @@
    END FUNCTION FUNCTION_GLOBMINMAX
 
+#undef TYPE
 #undef ARRAY_TYPE
 #undef ARRAY2_TYPE
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/oce.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/oce.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/oce.F90	(revision 14219)
@@ -21,24 +21,26 @@
    !! dynamics and tracer fields
    !! --------------------------                            
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)   ::   uu   ,  vv     !: horizontal velocities        [m/s]
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)   ::   uu   ,  vv     !: horizontal velocities        [m/s]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)     ::   ww             !: vertical velocity            [m/s]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)     ::   wi             !: vertical vel. (adaptive-implicit) [m/s]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)     ::   hdiv           !: horizontal divergence        [s-1]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:,:) ::   ts             !: 4D T-S fields                  [Celsius,psu] 
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:,:) ::   ts             !: 4D T-S fields                  [Celsius,psu] 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)   ::   rab_b,  rab_n  !: thermal/haline expansion coef. [Celsius-1,psu-1]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)     ::   rn2b ,  rn2    !: brunt-vaisala frequency**2     [s-2]
    !
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   rhd    !: in situ density anomalie rhd=(rho-rho0)/rho0  [no units]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   rhop   !: potential volumic mass                           [kg/m3]
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   rhop   !: potential volumic mass                           [kg/m3]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   Cu_adv                   !: vertical Courant number (adaptive-implicit)
 
    !! free surface
    !! ------------
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ssh, uu_b,  vv_b   !: SSH [m] and barotropic velocities [m/s]
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  :: ssh
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: uu_b,  vv_b   !: SSH [m] and barotropic velocities [m/s]
 
    !! Arrays at barotropic time step:                   ! befbefore! before !  now   ! after  !
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ubb_e  ,  ub_e  ,  un_e  , ua_e   !: u-external velocity
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   vbb_e  ,  vb_e  ,  vn_e  , va_e   !: v-external velocity
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sshbb_e,  sshb_e,  sshn_e, ssha_e !: external ssh
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)  ::  sshn_e ,  ssha_e
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sshbb_e,  sshb_e !: external ssh
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::                              hu_e   !: external u-depth
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::                              hv_e   !: external v-depth
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/step.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/step.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/step.F90	(revision 14219)
@@ -57,4 +57,6 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
+
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -166,8 +168,8 @@
       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
       !  THERMODYNAMICS
-                         CALL eos_rab( ts(:,:,:,:,Nbb), rab_b, Nnn )       ! before local thermal/haline expension ratio at T-points
-                         CALL eos_rab( ts(:,:,:,:,Nnn), rab_n, Nnn )       ! now    local thermal/haline expension ratio at T-points
-                         CALL bn2    ( ts(:,:,:,:,Nbb), rab_b, rn2b, Nnn ) ! before Brunt-Vaisala frequency
-                         CALL bn2    ( ts(:,:,:,:,Nnn), rab_n, rn2, Nnn  ) ! now    Brunt-Vaisala frequency
+                         CALL eos_rab( CASTWP(ts(:,:,:,:,Nbb)), rab_b, Nnn )       ! before local thermal/haline expension ratio at T-points
+                         CALL eos_rab( CASTWP(ts(:,:,:,:,Nnn)), rab_n, Nnn )       ! now    local thermal/haline expension ratio at T-points
+                         CALL bn2    ( CASTWP(ts(:,:,:,:,Nbb)), rab_b, rn2b, Nnn ) ! before Brunt-Vaisala frequency
+                         CALL bn2    ( CASTWP(ts(:,:,:,:,Nnn)), rab_n, rn2, Nnn  ) ! now    Brunt-Vaisala frequency
 
       !  VERTICAL PHYSICS
@@ -177,5 +179,5 @@
       !
       IF( l_ldfslp ) THEN                             ! slope of lateral mixing
-                         CALL eos( ts(:,:,:,:,Nbb), rhd, gdept_0(:,:,:) )               ! before in situ density
+                         CALL eos( CASTWP(ts(:,:,:,:,Nbb)), rhd, gdept_0(:,:,:) )               ! before in situ density
 
          IF( ln_zps .AND. .NOT. ln_isfcav)                                    &
@@ -204,5 +206,5 @@
                             CALL wzv           ( kstp, Nbb, Nnn, Naa, ww  )    ! now cross-level velocity
       IF( ln_zad_Aimp )     CALL wAimp         ( kstp,      Nnn           )  ! Adaptive-implicit vertical advection partitioning
-                            CALL eos    ( ts(:,:,:,:,Nnn), rhd, rhop, gdept(:,:,:,Nnn) )  ! now in situ density for hpg computation
+                            CALL eos    ( CASTWP(ts(:,:,:,:,Nnn)), rhd, rhop, CASTWP(gdept(:,:,:,Nnn)) )  ! now in situ density for hpg computation
 
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/stpctl.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/stpctl.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/stpctl.F90	(revision 14219)
@@ -69,6 +69,7 @@
       INTEGER , DIMENSION(9)          ::   iareasum, iareamin, iareamax
       INTEGER , DIMENSION(3,4)        ::   iloc                                  ! min/max loc indices
-      REAL(wp)                        ::   zzz, zminsal, zmaxsal                 ! local real 
-      REAL(wp), DIMENSION(9)          ::   zmax, zmaxlocal
+      REAL(dp)                        ::   zzz, zminsal, zmaxsal                 ! local real 
+      REAL(dp), DIMENSION(9)          :: zmax
+      REAL(wp), DIMENSION(9)          :: zmaxlocal
       LOGICAL                         ::   ll_wrtstp, ll_colruns, ll_wrtruns, ll_0oce
       LOGICAL, DIMENSION(jpi,jpj,jpk) ::   llmsk
@@ -188,6 +189,6 @@
       !
       IF ( ln_SEOS.AND.(rn_b0==0._wp) ) THEN             ! Discard checks on salinity
-         zmaxsal = +1.e38                                ! if not used in eos
-         zminsal = -1.e38 
+         zmaxsal = +HUGE(1._dp)                                ! if not used in eos
+         zminsal = -HUGE(1._dp) 
       ELSE
          zmaxsal = 100._wp
@@ -297,6 +298,6 @@
       INTEGER , DIMENSION(3)          ::   iareasum, iareamin, iareamax
       INTEGER , DIMENSION(3,4)        ::   iloc                                  ! min/max loc indices
-      REAL(wp)                        ::   zzz                                   ! local real 
-      REAL(wp), DIMENSION(3)          ::   zmax, zmaxlocal
+      REAL(dp)                        ::   zzz                                   ! local real 
+      REAL(dp), DIMENSION(3)          ::   zmax, zmaxlocal
       LOGICAL                         ::   ll_wrtstp, ll_colruns, ll_wrtruns, ll_0oce
       LOGICAL, DIMENSION(jpi,jpj,jpk) ::   llmsk
@@ -459,5 +460,5 @@
       CHARACTER(len=*),      INTENT(  out) ::   cdline
       CHARACTER(len=*),      INTENT(in   ) ::   cdprefix
-      REAL(wp),              INTENT(in   ) ::   pval
+      REAL(dp),              INTENT(in   ) ::   pval
       INTEGER, DIMENSION(3), INTENT(in   ) ::   kloc
       INTEGER,               INTENT(in   ) ::   kt, ksum, kmin, kmax
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/timing.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/timing.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/OCE/timing.F90	(revision 14219)
@@ -40,5 +40,5 @@
       CHARACTER(LEN=20)  :: surname
       INTEGER :: rank
-      REAL(wp)  :: t_cpu, t_clock, tsum_cpu, tsum_clock, tmax_cpu, tmax_clock, tmin_cpu, tmin_clock, tsub_cpu, tsub_clock
+      REAL(dp)  :: t_cpu, t_clock, tsum_cpu, tsum_clock, tmax_cpu, tmax_clock, tmin_cpu, tmin_clock, tsub_cpu, tsub_clock
       INTEGER :: ncount, ncount_max, ncount_rate
       INTEGER :: niter
@@ -51,6 +51,6 @@
    TYPE alltimer
       CHARACTER(LEN=20), DIMENSION(:), POINTER :: cname => NULL()
-      REAL(wp), DIMENSION(:), POINTER :: tsum_cpu   => NULL()
-      REAL(wp), DIMENSION(:), POINTER :: tsum_clock => NULL()
+      REAL(dp), DIMENSION(:), POINTER :: tsum_cpu   => NULL()
+      REAL(dp), DIMENSION(:), POINTER :: tsum_clock => NULL()
       INTEGER, DIMENSION(:), POINTER :: niter => NULL()
       TYPE(alltimer), POINTER :: next => NULL()
@@ -63,12 +63,12 @@
 
    TYPE(timer), POINTER :: s_wrk        => NULL()
-   REAL(wp) :: t_overclock, t_overcpu
+   REAL(dp) :: t_overclock, t_overcpu
    LOGICAL :: l_initdone = .FALSE.
    INTEGER :: nsize
 
    ! Variables for coarse grain timing
-   REAL(wp) :: tot_etime, tot_ctime
-   REAL(kind=wp), DIMENSION(2)     :: t_elaps, t_cpu
-   REAL(wp), ALLOCATABLE, DIMENSION(:) :: all_etime, all_ctime
+   REAL(dp) :: tot_etime, tot_ctime
+   REAL(kind=dp), DIMENSION(2)     :: t_elaps, t_cpu
+   REAL(dp), ALLOCATABLE, DIMENSION(:) :: all_etime, all_ctime
    INTEGER :: nfinal_count, ncount, ncount_rate, ncount_max
    INTEGER, DIMENSION(8)           :: nvalues
@@ -137,5 +137,5 @@
       !
       INTEGER  :: ifinal_count, iperiods
-      REAL(wp) :: zcpu_end, zmpitime,zcpu_raw,zclock_raw
+      REAL(dp) :: zcpu_end, zmpitime,zcpu_raw,zclock_raw
       !
       s_wrk => NULL()
@@ -219,5 +219,5 @@
       !!----------------------------------------------------------------------
       INTEGER :: iperiods, istart_count, ifinal_count
-      REAL(wp) :: zdum
+      REAL(dp) :: zdum
       LOGICAL :: ll_f
       CHARACTER(len=*), INTENT(in), OPTIONAL :: clname
@@ -296,7 +296,7 @@
       LOGICAL :: ll_ord, ll_averep
       CHARACTER(len=120) :: clfmt
-      REAL(wp), DIMENSION(:), ALLOCATABLE ::   timing_glob
-      REAL(wp) ::   zsypd   ! simulated years per day (Balaji 2017)
-      REAL(wp) ::   zperc, ztot
+      REAL(dp), DIMENSION(:), ALLOCATABLE ::   timing_glob
+      REAL(dp) ::   zsypd   ! simulated years per day (Balaji 2017)
+      REAL(dp) ::   zperc, ztot
 
       ll_averep = .TRUE.
@@ -642,8 +642,8 @@
       INTEGER                            :: idum, icode
       INTEGER, ALLOCATABLE, DIMENSION(:) :: iall_rank
-      REAL(wp) :: ztot_ratio
-      REAL(wp) :: zmax_etime, zmax_ctime, zmax_ratio, zmin_etime, zmin_ctime, zmin_ratio
-      REAL(wp) :: zavg_etime, zavg_ctime, zavg_ratio
-      REAL(wp), ALLOCATABLE, DIMENSION(:) :: zall_ratio
+      REAL(dp) :: ztot_ratio
+      REAL(dp) :: zmax_etime, zmax_ctime, zmax_ratio, zmin_etime, zmin_ctime, zmin_ratio
+      REAL(dp) :: zavg_etime, zavg_ctime, zavg_ratio
+      REAL(dp), ALLOCATABLE, DIMENSION(:) :: zall_ratio
       CHARACTER(LEN=128), dimension(8) :: cllignes
       CHARACTER(LEN=128)               :: clhline, clstart_date, clfinal_date
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/AGE/trcsms_age.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/AGE/trcsms_age.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/AGE/trcsms_age.F90	(revision 14219)
@@ -29,4 +29,5 @@
    REAL(wp), PUBLIC :: frac_add_age    !: fraction of level nl_age below age_depth where it is incremented
 
+#  include "single_precision_substitute.h90"
 
    !!----------------------------------------------------------------------
@@ -56,8 +57,4 @@
       IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
 
-      IF( l_1st_euler .OR. ln_top_euler ) THEN
-         tr(:,:,:,jp_age,Kbb) = tr(:,:,:,jp_age,Kmm)
-      ENDIF
-
 
       DO jk = 1, nla_age
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/C14/trcsms_c14.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/C14/trcsms_c14.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/C14/trcsms_c14.F90	(revision 14219)
@@ -144,9 +144,9 @@
          IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
          !
-         CALL iom_rstput( kt, nitrst, numrtw, 'co2sbc', co2sbc ) ! These five need      &
-         CALL iom_rstput( kt, nitrst, numrtw, 'c14sbc', c14sbc ) ! &    to be written   &
+         CALL iom_rstput( kt, nitrst, numrtw, 'co2sbc', co2sbc )       ! These five need      &
+         CALL iom_rstput( kt, nitrst, numrtw, 'c14sbc', c14sbc )     ! &    to be written   &
          CALL iom_rstput( kt, nitrst, numrtw, 'exch_co2', exch_co2 ) ! &    for temporal    &
          CALL iom_rstput( kt, nitrst, numrtw, 'exch_c14', exch_c14 ) ! &    averages        &
-         CALL iom_rstput( kt, nitrst, numrtw, 'qtr_c14', qtr_c14   ) ! &    to be coherent.
+         CALL iom_rstput( kt, nitrst, numrtw, 'qtr_c14', qtr_c14 )   ! &    to be coherent.
          CALL iom_rstput( kt, nitrst, numrtw, 'qint_c14', qint_c14 ) ! Cumulative
          !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/MY_TRC/trcsms_my_trc.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/MY_TRC/trcsms_my_trc.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/MY_TRC/trcsms_my_trc.F90	(revision 14219)
@@ -43,5 +43,5 @@
       INTEGER, INTENT(in) ::   Kbb, Kmm, Krhs  ! time level indices
       INTEGER ::   jn   ! dummy loop index
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: ztrmyt
+      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:) :: ztrmyt
       !!----------------------------------------------------------------------
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z/p2zbio.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z/p2zbio.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z/p2zbio.F90	(revision 14219)
@@ -59,4 +59,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -368,5 +369,5 @@
          WRITE(charout, FMT="('bio')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z/p2zexp.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z/p2zexp.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z/p2zexp.F90	(revision 14219)
@@ -40,4 +40,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -141,5 +142,5 @@
          WRITE(charout, FMT="('exp')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z/p2zopt.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z/p2zopt.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z/p2zopt.F90	(revision 14219)
@@ -41,4 +41,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -126,5 +127,5 @@
          WRITE(charout, FMT="('opt')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl( tab4d_1=tr(:,:,:,:,Kmm), mask1=tmask, clinfo=ctrcnm )
+         CALL prt_ctl( tab4d_1=CASTWP(tr(:,:,:,:,Kmm)), mask1=tmask, clinfo=ctrcnm )
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z/p2zsed.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z/p2zsed.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P2Z/p2zsed.F90	(revision 14219)
@@ -34,4 +34,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -110,5 +111,5 @@
          WRITE(charout, FMT="('sed')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zagg.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zagg.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zagg.F90	(revision 14219)
@@ -26,4 +26,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -171,5 +172,5 @@
          WRITE(charout, FMT="('agg')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zbio.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zbio.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zbio.F90	(revision 14219)
@@ -41,4 +41,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -109,5 +110,5 @@
          WRITE(charout, FMT="('bio ')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zfechem.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zfechem.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zfechem.F90	(revision 14219)
@@ -34,4 +34,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -219,5 +220,5 @@
          WRITE(charout, FMT="('fechem')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zflx.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zflx.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zflx.F90	(revision 14219)
@@ -55,4 +55,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -179,5 +180,5 @@
          WRITE(charout, FMT="('flx ')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zligand.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zligand.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zligand.F90	(revision 14219)
@@ -28,4 +28,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -90,5 +91,5 @@
          WRITE(charout, FMT="('ligand1')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zlys.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zlys.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zlys.F90	(revision 14219)
@@ -37,4 +37,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -131,5 +132,5 @@
         WRITE(charout, FMT="('lys ')")
         CALL prt_ctl_info( charout, cdcomp = 'top' )
-        CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+        CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zmeso.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zmeso.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zmeso.F90	(revision 14219)
@@ -46,4 +46,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -247,5 +248,5 @@
         WRITE(charout, FMT="('meso')")
         CALL prt_ctl_info( charout, cdcomp = 'top' )
-        CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+        CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zmicro.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zmicro.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zmicro.F90	(revision 14219)
@@ -44,4 +44,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -203,5 +204,5 @@
          WRITE(charout, FMT="('micro')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zmort.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zmort.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zmort.F90	(revision 14219)
@@ -31,4 +31,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -121,5 +122,5 @@
          WRITE(charout, FMT="('nano')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
        ENDIF
       !
@@ -193,5 +194,5 @@
          WRITE(charout, FMT="('diat')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zpoc.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zpoc.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zpoc.F90	(revision 14219)
@@ -40,4 +40,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -243,5 +244,5 @@
         WRITE(charout, FMT="('poc1')")
         CALL prt_ctl_info( charout, cdcomp = 'top' )
-        CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+        CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
      ENDIF
 
@@ -435,5 +436,5 @@
          WRITE(charout, FMT="('poc2')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
@@ -504,15 +505,15 @@
          !
          alphan(1) = gamain(reminup, rshape, ifault)
-         reminp(1) = gamain(reminup, rshape+1.0, ifault) * xremip / alphan(1)
+         reminp(1) = gamain(reminup, rshape+1.0_wp, ifault) * xremip / alphan(1)
          DO jn = 2, jcpoc-1
             reminup = 1./ 400. * EXP( REAL(jn, wp) * remindelta)
             remindown = 1. / 400. * EXP( REAL(jn-1, wp) * remindelta)
             alphan(jn) = gamain(reminup, rshape, ifault) - gamain(remindown, rshape, ifault)
-            reminp(jn) = gamain(reminup, rshape+1.0, ifault) - gamain(remindown, rshape+1.0, ifault)
+            reminp(jn) = gamain(reminup, rshape+1.0_wp, ifault) - gamain(remindown, rshape+1.0_wp, ifault)
             reminp(jn) = reminp(jn) * xremip / alphan(jn)
          END DO
          remindown = 1. / 400. * EXP( REAL(jcpoc-1, wp) * remindelta)
          alphan(jcpoc) = 1.0 - gamain(remindown, rshape, ifault)
-         reminp(jcpoc) = 1.0 - gamain(remindown, rshape+1.0, ifault)
+         reminp(jcpoc) = 1.0 - gamain(remindown, rshape+1.0_wp, ifault)
          reminp(jcpoc) = reminp(jcpoc) * xremip / alphan(jcpoc)
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zprod.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zprod.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zprod.F90	(revision 14219)
@@ -49,4 +49,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -332,5 +333,5 @@
          WRITE(charout, FMT="('prod')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
      ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zrem.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zrem.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zrem.F90	(revision 14219)
@@ -45,4 +45,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -197,5 +198,5 @@
          WRITE(charout, FMT="('rem1')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
        ENDIF
 
@@ -219,5 +220,5 @@
          WRITE(charout, FMT="('rem2')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
        ENDIF
 
@@ -250,5 +251,5 @@
          WRITE(charout, FMT="('rem3')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
        ENDIF
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zsed.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zsed.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zsed.F90	(revision 14219)
@@ -40,4 +40,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -316,5 +317,5 @@
          WRITE(charout, fmt="('sed ')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zsink.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zsink.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zsink.F90	(revision 14219)
@@ -41,4 +41,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -145,5 +146,5 @@
          WRITE(charout, FMT="('sink')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zsms.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zsms.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p4zsms.F90	(revision 14219)
@@ -11,4 +11,5 @@
    USE oce_trc         ! shared variables between ocean and passive tracers
    USE trc             ! passive tracers common variables 
+   USE trcdta          ! 
    USE sms_pisces      ! PISCES Source Minus Sink variables
    USE p4zbio          ! Biological model
@@ -368,6 +369,6 @@
             IF(lwp) WRITE(numout,*) '~~~~~~~'
          ENDIF
-         CALL iom_rstput( kt, nitrst, numrtw, 'PH', hi(:,:,:)           )
-         CALL iom_rstput( kt, nitrst, numrtw, 'Silicalim', xksi(:,:)    )
+         CALL iom_rstput( kt, nitrst, numrtw, 'PH', hi(:,:,:) )
+         CALL iom_rstput( kt, nitrst, numrtw, 'Silicalim', xksi(:,:) )
          CALL iom_rstput( kt, nitrst, numrtw, 'Silicamax', xksimax(:,:) )
          CALL iom_rstput( kt, nitrst, numrtw, 'tcflxcum', t_oce_co2_flx_cum )
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p5zmeso.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p5zmeso.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p5zmeso.F90	(revision 14219)
@@ -53,4 +53,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -360,5 +361,5 @@
         WRITE(charout, FMT="('meso')")
         CALL prt_ctl_info( charout, cdcomp = 'top' )
-        CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+        CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p5zmicro.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p5zmicro.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p5zmicro.F90	(revision 14219)
@@ -54,4 +54,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -307,5 +308,5 @@
          WRITE(charout, FMT="('micro')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p5zmort.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p5zmort.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p5zmort.F90	(revision 14219)
@@ -35,4 +35,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -122,5 +123,5 @@
          WRITE(charout, FMT="('nano')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
        ENDIF
       !
@@ -180,5 +181,5 @@
          WRITE(charout, FMT="('pico')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
        ENDIF
       !
@@ -255,5 +256,5 @@
          WRITE(charout, FMT="('diat')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p5zprod.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p5zprod.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/P4Z/p5zprod.F90	(revision 14219)
@@ -53,4 +53,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -462,5 +463,5 @@
          WRITE(charout, FMT="('prod')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/SED/sedbtb.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/SED/sedbtb.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/SED/sedbtb.F90	(revision 14219)
@@ -60,5 +60,5 @@
       ENDDO
 
-      CALL sed_mat( jpsol, jpoce, jpksedm1, zsol, dtsed / 2.0 )
+      CALL sed_mat( jpsol, jpoce, jpksedm1, zsol, dtsed / 2.0_wp )
 
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/SED/seddiff.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/SED/seddiff.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/SED/seddiff.F90	(revision 14219)
@@ -68,5 +68,5 @@
 
       ! solves tridiagonal system
-      CALL sed_mat( jwpo4, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwpo4), dtsed2 / 2.0 )
+      CALL sed_mat( jwpo4, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwpo4), dtsed2 / 2.0_wp )
 
       !---------------------------
@@ -75,5 +75,5 @@
 
       ! solves tridiagonal system
-      CALL sed_mat( jwnh4, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwnh4), dtsed2 / 2.0 )
+      CALL sed_mat( jwnh4, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwnh4), dtsed2 / 2.0_wp)
 
       !---------------------------
@@ -82,5 +82,5 @@
 
       ! solves tridiagonal system
-      CALL sed_mat( jwfe2, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwfe2), dtsed2 / 2.0 )
+      CALL sed_mat( jwfe2, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwfe2), dtsed2 / 2.0_wp )
 
       !---------------------------
@@ -89,5 +89,5 @@
 
       ! solves tridiagonal system
-      CALL sed_mat( jwh2s, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwh2s), dtsed2 / 2.0  )
+      CALL sed_mat( jwh2s, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwh2s), dtsed2 / 2.0_wp  )
 
       !---------------------------
@@ -96,5 +96,5 @@
 
       ! solves tridiagonal system
-      CALL sed_mat( jwso4, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwso4), dtsed2 / 2.0 )
+      CALL sed_mat( jwso4, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwso4), dtsed2 / 2.0_wp )
 
       !---------------------------
@@ -103,5 +103,5 @@
 
       ! solves tridiagonal system
-      CALL sed_mat( jwoxy, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwoxy), dtsed2 / 2.0 )
+      CALL sed_mat( jwoxy, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwoxy), dtsed2 / 2.0_wp )
 
       !---------------------------
@@ -110,7 +110,7 @@
 
       ! solves tridiagonal system
-      CALL sed_mat( jwno3, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwno3), dtsed2 / 2.0 )
+      CALL sed_mat( jwno3, jpoce, jpksed, zrearat1, zrearat2, pwcp(:,:,jwno3), dtsed2 / 2.0_wp )
 
-      CALL sed_mat( jwdic, jpoce, jpksed, zrearat1, zrearat2, sedligand(:,:), dtsed2 / 2.0 )
+      CALL sed_mat( jwdic, jpoce, jpksed, zrearat1, zrearat2, sedligand(:,:), dtsed2 / 2.0_wp )
 
       IF( ln_timing )  CALL timing_stop('sed_diff')
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/SED/sedstp.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/SED/sedstp.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/SED/sedstp.F90	(revision 14219)
@@ -86,6 +86,5 @@
       IF( kt == nitsed000 ) THEN
           CALL iom_close( numrsr )       ! close input tracer restart file
-          IF(lrxios) CALL iom_context_finalize(      cr_sedrst_cxt  )
-!         IF(lwm) CALL FLUSH( numont )   ! flush namelist output
+!          IF(lwm) CALL FLUSH( numont )   ! flush namelist output
       ENDIF
       IF( lrst_sed )            CALL sed_rst_wri( kt )   ! restart file output
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/SED/trcdmp_sed.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/SED/trcdmp_sed.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/PISCES/SED/trcdmp_sed.F90	(revision 14219)
@@ -36,4 +36,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 3.3 , NEMO Consortium (2010)
@@ -78,5 +79,5 @@
       INTEGER ::   ji, jj, jk, jn, jl, ikt   ! dummy loop indices
       CHARACTER (len=22) ::   charout
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ztrcdta   ! 3D  workspace
+      REAL(dp), DIMENSION(jpi,jpj,jpk) ::   ztrcdta   ! 3D  workspace
       !!----------------------------------------------------------------------
       !
@@ -108,5 +109,5 @@
          WRITE(charout, FMT="('dmp ')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl( tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm,clinfo3='trd' )
+         CALL prt_ctl( tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm,clinfo3='trd' )
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcadv.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcadv.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcadv.F90	(revision 14219)
@@ -63,4 +63,5 @@
    
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -80,5 +81,5 @@
       INTEGER                                   , INTENT(in)    :: kt   ! ocean time-step index
       INTEGER                                   , INTENT(in)    :: Kbb, Kmm, Krhs ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr            ! passive tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr            ! passive tracers and RHS of tracer equation
       !
       INTEGER ::   jk   ! dummy loop index
@@ -127,10 +128,10 @@
       !
       CASE ( np_CEN )                                 ! Centered : 2nd / 4th order
-         IF (nn_hls.EQ.2) CALL lbc_lnk( 'trcadv', ptr(:,:,:,:,Kmm), 'T', 1.)
+         IF (nn_hls.EQ.2) CALL lbc_lnk( 'trcadv', ptr(:,:,:,:,Kmm), 'T', 1._wp)
          CALL tra_adv_cen( kt, nittrc000,'TRC',          zuu, zvv, zww,      Kmm, ptr, jptra, Krhs, nn_cen_h, nn_cen_v )
       CASE ( np_FCT )                                 ! FCT      : 2nd / 4th order
          IF (nn_hls.EQ.2) THEN
-            CALL lbc_lnk_multi( 'trcadv', ptr(:,:,:,:,Kbb), 'T', 1., ptr(:,:,:,:,Kmm), 'T', 1.)
-            CALL lbc_lnk_multi( 'traadv', zuu(:,:,:), 'U', -1., zvv(:,:,:), 'V', -1., zww(:,:,:), 'W', 1.)
+            CALL lbc_lnk_multi( 'trcadv', ptr(:,:,:,:,Kbb), 'T', 1._wp, ptr(:,:,:,:,Kmm), 'T', 1._wp)
+            CALL lbc_lnk_multi( 'traadv', zuu(:,:,:), 'U', -1._wp, zvv(:,:,:), 'V', -1._wp, zww(:,:,:), 'W', 1._wp)
 #if defined key_loop_fusion
             CALL tra_adv_fct_lf( kt, nittrc000,'TRC', rDt_trc, zuu, zvv, zww, Kbb, Kmm, ptr, jptra, Krhs, nn_fct_h, nn_fct_v )
@@ -143,5 +144,5 @@
       CASE ( np_MUS )                                 ! MUSCL
          IF (nn_hls.EQ.2) THEN
-            IF (nn_hls.EQ.2) CALL lbc_lnk( 'trcadv', ptr(:,:,:,:,Kbb), 'T', 1.)
+            IF (nn_hls.EQ.2) CALL lbc_lnk( 'trcadv', ptr(:,:,:,:,Kbb), 'T', 1._wp)
 #if defined key_loop_fusion
             CALL tra_adv_mus_lf( kt, nittrc000,'TRC', rDt_trc, zuu, zvv, zww, Kbb, Kmm, ptr, jptra, Krhs, ln_mus_ups ) 
@@ -153,10 +154,10 @@
          END IF
       CASE ( np_UBS )                                 ! UBS
-         IF (nn_hls.EQ.2) CALL lbc_lnk( 'trcadv', ptr(:,:,:,:,Kbb), 'T', 1.)
+         IF (nn_hls.EQ.2) CALL lbc_lnk( 'trcadv', ptr(:,:,:,:,Kbb), 'T', 1._wp)
          CALL tra_adv_ubs( kt, nittrc000,'TRC', rDt_trc, zuu, zvv, zww, Kbb, Kmm, ptr, jptra, Krhs, nn_ubs_v           )
       CASE ( np_QCK )                                 ! QUICKEST
          IF (nn_hls.EQ.2) THEN
-            CALL lbc_lnk_multi( 'trcadv', zuu(:,:,:), 'U', -1., zvv(:,:,:), 'V', -1.)
-            CALL lbc_lnk( 'traadv', ptr(:,:,:,:,Kbb), 'T', 1.)
+            CALL lbc_lnk_multi( 'trcadv', zuu(:,:,:), 'U', -1._wp, zvv(:,:,:), 'V', -1._wp)
+            CALL lbc_lnk( 'traadv', ptr(:,:,:,:,Kbb), 'T', 1._wp)
          END IF
          CALL tra_adv_qck( kt, nittrc000,'TRC', rDt_trc, zuu, zvv, zww, Kbb, Kmm, ptr, jptra, Krhs                     )
@@ -167,5 +168,5 @@
          WRITE(charout, FMT="('adv ')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl( tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
+         CALL prt_ctl( tab4d_1=CASTWP(tr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
       END IF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcatf.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcatf.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcatf.F90	(revision 14219)
@@ -56,4 +56,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -84,5 +85,5 @@
       INTEGER                                   , INTENT( in )  :: kt             ! ocean time-step index
       INTEGER                                   , INTENT( in )  :: Kbb, Kmm, Kaa ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr            ! passive tracers
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr            ! passive tracers
       !
       INTEGER  ::   jk, jn   ! dummy loop indices
@@ -162,5 +163,5 @@
 # else
             IF( ln_linssh ) THEN   ;   CALL tra_atf_fix( kt, Kbb, Kmm, Kaa, nittrc000,         'TRC', ptr, jptra )                       !     linear ssh
-            ELSE                   ;   CALL tra_atf_vvl( kt, Kbb, Kmm, Kaa, nittrc000, rn_Dt, 'TRC', ptr, sbc_trc, sbc_trc_b, jptra )    ! non-linear ssh
+            ELSE                   ;   CALL tra_atf_vvl( kt, Kbb, Kmm, Kaa, nittrc000, CASTWP(rn_Dt), 'TRC', ptr, sbc_trc, sbc_trc_b, jptra )    ! non-linear ssh
 # endif
             ENDIF
@@ -186,5 +187,5 @@
          WRITE(charout, FMT="('nxt')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl(tab4d_1=ptr(:,:,:,:,Kmm), mask1=tmask, clinfo=ctrcnm)
+         CALL prt_ctl(tab4d_1=CASTWP(ptr(:,:,:,:,Kmm)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
       !
@@ -221,5 +222,5 @@
       INTEGER                                   , INTENT(in   ) ::  kt            ! ocean time-step index
       INTEGER                                   , INTENT(in   ) ::  Kbb, Kmm, Kaa ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) ::  ptr           ! passive tracers
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) ::  ptr           ! passive tracers
       !!     
       INTEGER  ::   ji, jj, jk, jn              ! dummy loop indices
@@ -294,5 +295,5 @@
       INTEGER                                   , INTENT(in   ) ::  kt            ! ocean time-step index
       INTEGER                                   , INTENT(in   ) ::  Kbb, Kmm, Kaa ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) ::  ptr           ! passive tracers
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) ::  ptr           ! passive tracers
       !!     
       INTEGER  ::   ji, jj, jk, jn              ! dummy loop indices
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcbbl.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcbbl.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcbbl.F90	(revision 14219)
@@ -30,4 +30,5 @@
    PUBLIC   trc_bbl   !  routine called by trctrp.F90
 
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -48,5 +49,5 @@
       INTEGER,                                    INTENT( in  ) :: kt              ! ocean time-step 
       INTEGER,                                    INTENT( in  ) :: Kbb, Kmm, Krhs  ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr             ! passive tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr             ! passive tracers and RHS of tracer equation
       INTEGER :: jn                   ! loop index
       CHARACTER (len=22) :: charout
@@ -69,8 +70,8 @@
       IF( nn_bbl_ldf == 1 ) THEN
          !
-         CALL tra_bbl_dif( ptr(:,:,:,:,Kbb), ptr(:,:,:,:,Krhs), jptra, Kmm )  
+         CALL tra_bbl_dif( CASTWP(ptr(:,:,:,:,Kbb)), ptr(:,:,:,:,Krhs), jptra, Kmm )  
          IF( sn_cfctl%l_prttrc )   THEN
             WRITE(charout, FMT="(' bbl_dif')")  ;  CALL prt_ctl_info( charout, cdcomp = 'top' )
-            CALL prt_ctl( tab4d_1=ptr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
+            CALL prt_ctl( tab4d_1=CASTWP(ptr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
          ENDIF
          !
@@ -80,8 +81,8 @@
       IF( nn_bbl_adv /= 0 ) THEN
          !
-         CALL tra_bbl_adv( ptr(:,:,:,:,Kbb), ptr(:,:,:,:,Krhs), jptra, Kmm )  
+         CALL tra_bbl_adv( CASTWP(ptr(:,:,:,:,Kbb)), ptr(:,:,:,:,Krhs), jptra, Kmm )  
          IF( sn_cfctl%l_prttrc )   THEN
             WRITE(charout, FMT="(' bbl_adv')")  ;  CALL prt_ctl_info( charout, cdcomp = 'top' )
-            CALL prt_ctl( tab4d_1=ptr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
+            CALL prt_ctl( tab4d_1=CASTWP(ptr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
          ENDIF
          !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcdmp.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcdmp.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcdmp.F90	(revision 14219)
@@ -47,4 +47,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -86,10 +87,10 @@
       INTEGER,                                    INTENT(in   ) :: kt              ! ocean time-step index
       INTEGER,                                    INTENT(in   ) :: Kbb, Kmm, Krhs  ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr             ! passive tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr             ! passive tracers and RHS of tracer equation
       !
       INTEGER ::   ji, jj, jk, jn, jl   ! dummy loop indices
       CHARACTER (len=22) ::   charout
       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrtrd
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrcdta   ! 3D  workspace
+      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrcdta   ! 3D  workspace
       !!----------------------------------------------------------------------
       !
@@ -151,5 +152,5 @@
          WRITE(charout, FMT="('dmp ')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl( tab4d_1=ptr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
+         CALL prt_ctl( tab4d_1=CASTWP(ptr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
       ENDIF
       !
@@ -231,5 +232,5 @@
       INTEGER :: ji , jj, jk, jn, jl, jc                    ! dummy loop indicesa
       INTEGER :: isrow                                      ! local index
-      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta       ! 3D  workspace
+      REAL(dp), POINTER, DIMENSION(:,:,:) ::  ztrcdta       ! 3D  workspace
       !!----------------------------------------------------------------------
 
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcldf.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcldf.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcldf.F90	(revision 14219)
@@ -46,4 +46,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -62,5 +63,5 @@
       INTEGER,                                    INTENT(in   ) :: kt              ! ocean time-step index
       INTEGER,                                    INTENT(in   ) :: Kbb, Kmm, Krhs  ! ocean time-level index
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr             ! passive tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr             ! passive tracers and RHS of tracer equation
       !
       INTEGER            :: ji, jj, jk, jn
@@ -94,15 +95,15 @@
       CASE ( np_lap   )                                                                                    ! iso-level laplacian
          CALL tra_ldf_lap  ( kt, Kmm, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi,            &
-           &                     ptr(:,:,:,:,Kbb), ptr(:,:,:,:,Krhs),                   jptra, 1 )
+           &                     CASTWP(ptr(:,:,:,:,Kbb)), ptr(:,:,:,:,Krhs),                   jptra, 1 )
       CASE ( np_lap_i )                                                                                    ! laplacian : standard iso-neutral operator (Madec)
          CALL tra_ldf_iso  ( kt, Kmm, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi,            &
-           &                     ptr(:,:,:,:,Kbb), ptr(:,:,:,:,Kbb), ptr(:,:,:,:,Krhs), jptra, 1 )
+           &                     CASTWP(ptr(:,:,:,:,Kbb)), CASTWP(ptr(:,:,:,:,Kbb)), ptr(:,:,:,:,Krhs), jptra, 1 )
       CASE ( np_lap_it )                                                                                   ! laplacian : triad iso-neutral operator (griffies)
          CALL tra_ldf_triad( kt, Kmm, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi,            &
-           &                     ptr(:,:,:,:,Kbb), ptr(:,:,:,:,Kbb), ptr(:,:,:,:,Krhs), jptra, 1 )
+           &                     CASTWP(ptr(:,:,:,:,Kbb)), CASTWP(ptr(:,:,:,:,Kbb)), ptr(:,:,:,:,Krhs), jptra, 1 )
       CASE ( np_blp , np_blp_i , np_blp_it )                                                               ! bilaplacian: all operator (iso-level, -neutral)
-         IF(nn_hls.EQ.2) CALL lbc_lnk( 'trc_ldf', ptr(:,:,:,:,Kbb), 'T',1.)
+         IF(nn_hls.EQ.2) CALL lbc_lnk( 'trc_ldf', ptr(:,:,:,:,Kbb), 'T',1._wp)
          CALL tra_ldf_blp  ( kt, Kmm, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi,            &
-           &                     ptr(:,:,:,:,Kbb) , ptr(:,:,:,:,Krhs),                 jptra, nldf_trc )
+           &                     CASTWP(ptr(:,:,:,:,Kbb)) , ptr(:,:,:,:,Krhs),                 jptra, nldf_trc )
       END SELECT
       !
@@ -118,5 +119,5 @@
          WRITE(charout, FMT="('ldf ')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl( tab4d_1=ptr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
+         CALL prt_ctl( tab4d_1=CASTWP(ptr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
       ENDIF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcrad.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcrad.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcrad.F90	(revision 14219)
@@ -33,4 +33,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -57,5 +58,5 @@
       INTEGER,                                    INTENT(in   ) :: kt         ! ocean time-step index
       INTEGER,                                    INTENT(in   ) :: Kbb, Kmm   ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr        ! passive tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr        ! passive tracers and RHS of tracer equation
       !
       CHARACTER (len=22) :: charout
@@ -73,5 +74,5 @@
          WRITE(charout, FMT="('rad')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl( tab4d_1=ptr(:,:,:,:,Kbb), mask1=tmask, clinfo=ctrcnm )
+         CALL prt_ctl( tab4d_1=CASTWP(ptr(:,:,:,:,Kbb)), mask1=tmask, clinfo=ctrcnm )
       ENDIF
       !
@@ -135,5 +136,5 @@
      INTEGER                                    , INTENT(in   ) ::   Kbb, Kmm           ! time level indices
      INTEGER                                    , INTENT(in   ) ::   jp_sms0, jp_sms1   ! First & last index of the passive tracer model
-     REAL(wp), DIMENSION (jpi,jpj,jpk,jptra,jpt), INTENT(inout) ::   ptr                ! before and now traceur concentration
+     REAL(dp), DIMENSION (jpi,jpj,jpk,jptra,jpt), INTENT(inout) ::   ptr                ! before and now traceur concentration
      CHARACTER( len = 1), OPTIONAL              , INTENT(in   ) ::   cpreserv           ! flag to preserve content or not
      !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcsbc.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcsbc.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trcsbc.F90	(revision 14219)
@@ -32,4 +32,5 @@
 #  include "do_loop_substitute.h90"
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -62,5 +63,5 @@
       INTEGER,                                    INTENT(in   ) :: kt        ! ocean time-step index
       INTEGER,                                    INTENT(in   ) :: Kmm, Krhs ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr       ! passive tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr       ! passive tracers and RHS of tracer equation
       !
       INTEGER  ::   ji, jj, jn                      ! dummy loop indices
@@ -189,5 +190,5 @@
       IF( sn_cfctl%l_prttrc )   THEN
          WRITE(charout, FMT="('sbc ')") ;  CALL prt_ctl_info( charout, cdcomp = 'top' )
-                                           CALL prt_ctl( tab4d_1=ptr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
+                                           CALL prt_ctl( tab4d_1=CASTWP(ptr(:,:,:,:,Krhs)), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
       ENDIF
       IF( l_trdtrc )  DEALLOCATE( ztrtrd )
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trctrp.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trctrp.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trctrp.F90	(revision 14219)
@@ -40,4 +40,5 @@
    PUBLIC   trc_trp    ! called by trc_stp
 
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trczdf.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trczdf.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trczdf.F90	(revision 14219)
@@ -27,4 +27,5 @@
    PUBLIC   trc_zdf         ! called by step.F90 
    
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -43,5 +44,5 @@
       INTEGER                                   , INTENT(in   ) ::   kt                   ! ocean time-step index
       INTEGER                                   , INTENT(in   ) ::   Kbb, Kmm, Krhs, Kaa  ! ocean time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) ::   ptr                  ! passive tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) ::   ptr                  ! passive tracers and RHS of tracer equation
       !
       INTEGER               ::  jk, jn
@@ -68,5 +69,5 @@
          WRITE(charout, FMT="('zdf ')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl( tab4d_1=tr(:,:,:,:,Kaa), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
+         CALL prt_ctl( tab4d_1=CASTWP(tr(:,:,:,:,Kaa)), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
       END IF
       !
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trdmxl_trc.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trdmxl_trc.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trdmxl_trc.F90	(revision 14219)
@@ -419,6 +419,6 @@
          !-- Lateral boundary conditions
                IF ( cn_cfg .NE. 'gyre' ) THEN
-                  CALL lbc_lnk_multi( 'trdmxl_trc', ztmltot(:,:,jn) , 'T', 1. , ztmlres(:,:,jn) , 'T', 1., &
-                     &                ztmlatf(:,:,jn) , 'T', 1. , ztmlrad(:,:,jn) , 'T', 1. )
+                  CALL lbc_lnk_multi( 'trdmxl_trc', ztmltot(:,:,jn) , 'T', 1._wp , ztmlres(:,:,jn) , 'T', 1._wp, &
+                     &                ztmlatf(:,:,jn) , 'T', 1._wp , ztmlrad(:,:,jn) , 'T', 1._wp )
                ENDIF
 
@@ -470,5 +470,5 @@
          !-- Lateral boundary conditions 
                IF ( cn_cfg .NE. 'gyre' ) THEN            ! other than GYRE configuration    
-                  CALL lbc_lnk_multi( 'trdmxl_trc', ztmltot2(:,:,jn), 'T', 1., ztmlres2(:,:,jn), 'T', 1. )
+                  CALL lbc_lnk_multi( 'trdmxl_trc', ztmltot2(:,:,jn), 'T', 1., ztmlres2(:,:,jn), 'T', 1.)
                   DO jl = 1, jpltrd_trc
                      CALL lbc_lnk( 'trdmxl_trc', ztmltrd2(:,:,jl,jn), 'T', 1. )       ! will be output in the NetCDF trends file
@@ -986,2 +986,3 @@
    !!======================================================================
 END MODULE trdmxl_trc
+
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trdtrc.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trdtrc.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/TRP/trdtrc.F90	(revision 14219)
@@ -41,5 +41,5 @@
       INTEGER, INTENT( in )  ::   kjn                                 ! tracer index
       INTEGER, INTENT( in )  ::   ktrd                                ! tracer trend index
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( inout )  ::   ptrtrd  ! Temperature or U trend
+      REAL(dp), DIMENSION(jpi,jpj,jpk), INTENT( inout )  ::   ptrtrd  ! Temperature or U trend
       CHARACTER (len=20) :: cltra
       !!----------------------------------------------------------------------
@@ -119,5 +119,5 @@
       INTEGER               , INTENT( in )     ::   kjn     ! tracer index
       INTEGER               , INTENT( in )     ::   ktrd    ! tracer trend index
-      REAL(wp), DIMENSION(:,:,:), INTENT( inout )  ::   ptrtrd  ! Temperature or U trend
+      REAL(dp), DIMENSION(:,:,:), INTENT( inout )  ::   ptrtrd  ! Temperature or U trend
       WRITE(*,*) 'trd_trc : You should not have seen this print! error?', ptrtrd(1,1,1)
       WRITE(*,*) '  "      "      : You should not have seen this print! error?', kjn
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trc.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trc.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trc.F90	(revision 14219)
@@ -31,5 +31,5 @@
    REAL(wp), PUBLIC                                        ::  areatot        !: total volume 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  ) ::  cvol           !: volume correction -degrad option- 
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:,:) ::  tr           !: tracer concentration 
+   REAL(dp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:,:) ::  tr           !: tracer concentration 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  ) ::  sbc_trc_b      !: Before sbc fluxes for tracers
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  ) ::  sbc_trc        !: Now sbc fluxes for tracers
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcais.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcais.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcais.F90	(revision 14219)
@@ -143,5 +143,5 @@
       INTEGER                                   , INTENT(in)           ::   kt ! ocean time-step index
       INTEGER                                   , INTENT(in)           ::   Kmm, Krhs ! time level indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout)        ::   ptr ! passive tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout)        ::   ptr ! passive tracers and RHS of tracer equation
       !!
       INTEGER  :: ji, jj, jk, jn, jl             ! Loop index
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcbc.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcbc.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcbc.F90	(revision 14219)
@@ -352,5 +352,5 @@
       INTEGER                                   , INTENT(in)           ::   Kmm, Krhs ! time level indices
       INTEGER                                   , INTENT(in), OPTIONAL ::   jit       ! subcycle time-step index (for timesplitting option)
-      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr            ! passive tracers and RHS of tracer equation
+      REAL(dp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr            ! passive tracers and RHS of tracer equation
       !!
       INTEGER  :: ji, jj, jk, jn, jl             ! Loop index
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcdta.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcdta.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcdta.F90	(revision 14219)
@@ -167,5 +167,5 @@
       INTEGER                          , INTENT(in   )   ::   kt         ! ocean time-step
       INTEGER                          , INTENT(in   )   ::   kjl        ! tracer index
-      REAL(wp),  DIMENSION(jpi,jpj,jpk), INTENT(inout  ) ::   ptrcdta    ! 3D data array
+      REAL(dp),  DIMENSION(jpi,jpj,jpk), INTENT(inout  ) ::   ptrcdta    ! 3D data array
       !
       INTEGER ::   ji, jj, jk, jl, jkk, ik    ! dummy loop indices
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcini.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcini.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcini.F90	(revision 14219)
@@ -34,4 +34,5 @@
 
 #  include "domzgr_substitute.h90"
+#  include "single_precision_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/TOP 4.0 , NEMO Consortium (2018)
@@ -131,5 +132,5 @@
          WRITE(charout, FMT="('ini ')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl( tab4d_1=tr(:,:,:,:,Kmm), mask1=tmask, clinfo=ctrcnm )
+         CALL prt_ctl( tab4d_1=CASTWP(tr(:,:,:,:,Kmm)), mask1=tmask, clinfo=ctrcnm)
       ENDIF
 9000  FORMAT('      tracer nb : ',i2,'      name :',a10,'      initial content :',e18.10)
Index: /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcsms.F90
===================================================================
--- /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcsms.F90	(revision 14218)
+++ /NEMO/branches/2020/dev_r14116_HPC-04_mcastril_Mixed_Precision_implementation_final/src/TOP/trcsms.F90	(revision 14219)
@@ -26,4 +26,7 @@
 
    PUBLIC   trc_sms    ! called in trcstp.F90
+
+   !! * Substitutions
+#  include "single_precision_substitute.h90"
 
    !!----------------------------------------------------------------------
@@ -59,5 +62,5 @@
          WRITE(charout, FMT="('sms ')")
          CALL prt_ctl_info( charout, cdcomp = 'top' )
-         CALL prt_ctl( tab4d_1=tr(:,:,:,:,Kmm), mask1=tmask, clinfo=ctrcnm )
+         CALL prt_ctl( tab4d_1=CASTWP(tr(:,:,:,:,Kmm)), mask1=tmask, clinfo=ctrcnm )
       ENDIF
       !
