Index: branches/UKMO/dev_r5518_pcbias_ipc/NEMOGCM/NEMO/LIM_SRC_2/dom_ice_2.F90
===================================================================
--- branches/UKMO/dev_r5518_pcbias_ipc/NEMOGCM/NEMO/LIM_SRC_2/dom_ice_2.F90	(revision 8433)
+++ branches/UKMO/dev_r5518_pcbias_ipc/NEMOGCM/NEMO/LIM_SRC_2/dom_ice_2.F90	(revision 8435)
@@ -1,4 +1,3 @@
 MODULE dom_ice_2
-!test
    !!======================================================================
    !!                   ***  MODULE  dom_ice  ***
Index: branches/UKMO/dev_r5518_pcbias_ipc/NEMOGCM/NEMO/OPA_SRC/ASM/bias.F90
===================================================================
--- branches/UKMO/dev_r5518_pcbias_ipc/NEMOGCM/NEMO/OPA_SRC/ASM/bias.F90	(revision 8433)
+++ branches/UKMO/dev_r5518_pcbias_ipc/NEMOGCM/NEMO/OPA_SRC/ASM/bias.F90	(revision 8435)
@@ -211,13 +211,13 @@
       !! * Local declarations
 
-      CHARACTER(len=100) ::  cn_dir       ! dir for location ofline bias
+      CHARACTER(len=100) ::  cn_dir          ! dir for location ofline bias
       INTEGER            ::  ierror
-      INTEGER            ::  ios          ! Local integer output status for namelist read
-      REAL(wp)           ::  eft_rlx,  &  ! efolding time (bias memory) in days
-         &                   eft_asm,  &  !     "      "
+      INTEGER            ::  ios             ! Local integer output status for namelist read
+      REAL(wp)           ::  eft_rlx,  &     ! efolding time (bias memory) in days
+         &                   eft_asm,  &     !     "      "
          &                   log2,     &
-         &                   lenscl_bias, &  !lengthscale of the pressure bias decay between minlat and maxlat.
-         &                   minlat_bias, &     !used in ipc
-         &                   maxlat_bias    !used in ipc
+         &                   lenscl_bias, &  ! lengthscale pressure bias decay between minlat and maxlat.
+         &                   minlat_bias, &  ! used in ipc
+         &                   maxlat_bias     ! used in ipc
       
       NAMELIST/nambias/ ln_bias, ln_bias_asm, ln_bias_rlx, ln_bias_ofl,   &
@@ -396,23 +396,24 @@
          tbias_i(:,:,:) = 0.0_wp
          sbias_i(:,:,:) = 0.0_wp
-         IF(lwp) WRITE(numout,*) 'gru_pc and grv_pc are set to zero '
          gru_pc(:,:)    = 0.0_wp
          grv_pc(:,:)    = 0.0_wp
+         
          IF ( ln_bias_rlx ) THEN
             tbias_rlx(:,:,:) = 0.0_wp
             sbias_rlx(:,:,:) = 0.0_wp
          ENDIF
+
          IF ( ln_bias_asm ) THEN   !now rlx and asm bias in same file
-           tbias_asm(:,:,:) = 0.0_wp
-           sbias_asm(:,:,:) = 0.0_wp
-           tbias_asm_out(:,:,:) = 0.0_wp
-           sbias_asm_out(:,:,:) = 0.0_wp
+            tbias_asm(:,:,:) = 0.0_wp
+            sbias_asm(:,:,:) = 0.0_wp
+            tbias_asm_out(:,:,:) = 0.0_wp
+            sbias_asm_out(:,:,:) = 0.0_wp
          ENDIF
 
          IF ( ln_incpc ) THEN   !incr pressure correction
-           tbias_asm_stscale(:,:,:) = 0.0_wp
-           sbias_asm_stscale(:,:,:) = 0.0_wp
-           tbias_asm_stscale_out(:,:,:) = 0.0_wp
-           sbias_asm_stscale_out(:,:,:) = 0.0_wp
+            tbias_asm_stscale(:,:,:) = 0.0_wp
+            sbias_asm_stscale(:,:,:) = 0.0_wp
+            tbias_asm_stscale_out(:,:,:) = 0.0_wp
+            sbias_asm_stscale_out(:,:,:) = 0.0_wp
          ENDIF
 
@@ -458,7 +459,7 @@
                   ! Get the T and S bias data
                   CALL iom_get( numbias_tot, jpdom_autoglo, 'tbias_asm_stscale', tbias_asm_stscale )
-                     CALL iom_get( numbias_tot, jpdom_autoglo, 'sbias_asm_stscale', sbias_asm_stscale )
+                  CALL iom_get( numbias_tot, jpdom_autoglo, 'sbias_asm_stscale', sbias_asm_stscale )
                ELSE
-                     CALL ctl_stop( 'Short time scale bias assim variables not found in ',cn_bias_tot )
+                  CALL ctl_stop( 'Short time scale bias assim variables not found in ',cn_bias_tot )
                ENDIF
             ENDIF  
@@ -550,5 +551,4 @@
 
       IF ( ln_incpc) THEN
-       ! not sure if this should be a special case of nn_lat_ramp == 1
          minlat_bias = 3.0_wp
          maxlat_bias = 8.0_wp  
@@ -616,22 +616,18 @@
             &                              fbcoef(:,:)   * fb_t_asm_max )
          zcof2(:,:) = ( 1.0_wp - fbcoef(:,:) ) * fb_p_asm
-     
 
          IF ( ln_itdecay ) THEN   !decay the pressure correction at each time step
 	 
-	    ztsday  = rday / real(rdt)
-
-            zdecay = (1-ztscale)**(1/real(ztsday)) ! used in ipc
-            zfrac1 = zdecay**real(kt) ! used in ipc
+	    ztsday  = rday / REAL(rdt,wp)
+
+            zdecay = (1-ztscale)**(1/REAL(ztsday,wp)) ! used in ipc
+            zfrac1 = zdecay**REAL(kt,wp) ! used in ipc
             IF ( zfrac1 <= 0.0 ) zfrac1 = 0.0_wp
 
-
             IF( ln_asmiau .and. ln_trainc ) THEN  ! nudge in increments and decay historical contribution
-
                
                IF ( kt <= nitiaufin ) THEN  ! During IAU calculate the fraction of increments to apply at each time step
 
-                  ztfrac = real(kt) / real(nitiaufin)  ! nudging factor during the IAU
-                  
+                  ztfrac = REAL(kt,wp) / REAL(nitiaufin,wp)  ! nudging factor during the IAU
 	       
                   IF (lwp) THEN
@@ -639,28 +635,24 @@
                      WRITE(numout,*) '~~~~~~~~~~~~'
                      WRITE(numout,* ) "proportion of  increment applied in pcbias ",ztfrac
-                     WRITE(numout,* ) "proportion of  historical pcbias applied ",t_asm_mem**(real(kt)/ztsday)
+                     WRITE(numout,* ) "proportion of  historical pcbias applied ",t_asm_mem**(REAL(kt,wp)/ztsday)
                   ENDIF
 
-
-                  DO jk = 1, jpkm1
-                     
+                  DO jk = 1, jpkm1  
                      tbias(:,:,jk) = tbias(:,:,jk) +                            &
-                     &                ( t_asm_mem**(real(kt)/ztsday) * tbias_asm(:,:,jk)  +                    &
+                     &                ( t_asm_mem**(REAL(kt,wp)/ztsday) * tbias_asm(:,:,jk)  +                    &
                      &                ztfrac * t_asm_upd * t_bkginc(:,:,jk) * tmask(:,:,jk) ) * zcof1(:,:)
                      sbias(:,:,jk) = sbias(:,:,jk) +                            &
-                     &               ( t_asm_mem**(real(kt)/ztsday) * sbias_asm(:,:,jk)  +                     &
+                     &               ( t_asm_mem**(REAL(kt,wp)/ztsday) * sbias_asm(:,:,jk)  +                     &
                      &               ztfrac * t_asm_upd * s_bkginc(:,:,jk) * tmask(:,:,jk) ) * zcof1(:,:)
 
-                    tbias_p(:,:,jk) = tbias_p(:,:,jk) +                        &
-                     &               ( t_asm_mem**(real(kt)/ztsday) * tbias_asm(:,:,jk)  +                     &
+                     tbias_p(:,:,jk) = tbias_p(:,:,jk) +                        &
+                     &               ( t_asm_mem**(REAL(kt,wp)/ztsday) * tbias_asm(:,:,jk)  +                     &
                      &               ztfrac * t_asm_upd * t_bkginc(:,:,jk) * tmask(:,:,jk) ) * zcof2(:,:)
                      sbias_p(:,:,jk) = sbias_p(:,:,jk) +                        &  
-                     &               ( t_asm_mem**(real(kt)/ztsday) * sbias_asm(:,:,jk)  +                     &
+                     &               ( t_asm_mem**(REAL(kt,wp)/ztsday) * sbias_asm(:,:,jk)  +                     &
                      &               ztfrac * t_asm_upd * s_bkginc(:,:,jk) * tmask(:,:,jk) ) * zcof2(:,:)
                   ENDDO
 
-
                   IF (ln_incpc) THEN
-
 
                      IF (lwp) THEN
@@ -687,7 +679,7 @@
 
                         DO jk = 1, jpkm1
-                           tbias_asm_out(:,:,jk) =  t_asm_mem**(real(kt)/ztsday) * tbias_asm(:,:,jk)  +       &
+                           tbias_asm_out(:,:,jk) =  t_asm_mem**(REAL(kt,wp)/ztsday) * tbias_asm(:,:,jk)  +       &
                            &                     ztfrac * t_asm_upd * t_bkginc(:,:,jk) * tmask(:,:,jk)
-                           sbias_asm_out(:,:,jk) =  t_asm_mem**(real(kt)/ztsday) * sbias_asm(:,:,jk)  +       &
+                           sbias_asm_out(:,:,jk) =  t_asm_mem**(REAL(kt,wp)/ztsday) * sbias_asm(:,:,jk)  +       &
                            &                     ztfrac * t_asm_upd * s_bkginc(:,:,jk) * tmask(:,:,jk)
                          END DO
@@ -707,7 +699,7 @@
                   IF ( kt == nitiaufin ) THEN
                      DO jk = 1, jpkm1
-                        tbias_asm(:,:,jk) =  t_asm_mem**(real(kt)/ztsday) * tbias_asm(:,:,jk)  +       &
+                        tbias_asm(:,:,jk) =  t_asm_mem**(REAL(kt,wp)/ztsday) * tbias_asm(:,:,jk)  +       &
                         &                     ztfrac * t_asm_upd * t_bkginc(:,:,jk) * tmask(:,:,jk)
-                        sbias_asm(:,:,jk) =  t_asm_mem**(real(kt)/ztsday) * sbias_asm(:,:,jk)  +       &
+                        sbias_asm(:,:,jk) =  t_asm_mem**(REAL(kt,wp)/ztsday) * sbias_asm(:,:,jk)  +       &
                         &                     ztfrac * t_asm_upd * s_bkginc(:,:,jk) * tmask(:,:,jk)
                      END DO
@@ -721,10 +713,8 @@
      
                   ENDIF
-
                
                ELSE ! decay pressure correction from combined historical component and increments after IAU
 
-                  ztfrac=t_asm_mem**(real(kt-nitiaufin)/real(nitiaufin))  ! decay from end of IAU
-                  
+                  ztfrac=t_asm_mem**(REAL(kt-nitiaufin,wp)/REAL(nitiaufin,wp))  ! decay from end of IAU
                   
                   DO jk = 1, jpkm1
@@ -737,13 +727,11 @@
                      sbias_p(:,:,jk) = sbias_p(:,:,jk) +                        &  
                      &               ( ztfrac * sbias_asm(:,:,jk) ) * zcof2(:,:)
-
                   ENDDO
 
                  IF (ln_incpc) THEN
 
-                   zfrac  = zdecay**real(kt-nitiaufin) 
+                   zfrac  = zdecay**REAL(kt-nitiaufin,wp) 
                    IF ( zfrac <= 0.0 ) zfrac = 0.0_wp
    
-
                    DO jk = 1, jpkm1
                       tbias_i(:,:,jk) =  tbias_asm_stscale(:,:,jk) * zfrac * (1.0 - fbcoef_stscale(:,:))
@@ -752,38 +740,34 @@
 
                    IF (lwp) THEN
-                     WRITE(numout,*) 'tra_bias : bias weights'
-                     WRITE(numout,*) '~~~~~~~~~~~~'
-                     WRITE(numout,* ) "IPC - proportion of increments + historical pcbias applied ",zfrac
+                      WRITE(numout,*) 'tra_bias : bias weights'
+                      WRITE(numout,*) '~~~~~~~~~~~~'
+                      WRITE(numout,* ) "IPC - proportion of increments + historical pcbias applied ",zfrac
                    ENDIF
 
                  ENDIF
 
-                  IF (lwp) THEN
-                     WRITE(numout,*) 'tra_bias : bias weights'
-                     WRITE(numout,*) '~~~~~~~~~~~~'
-                     WRITE(numout,* ) "proportion of increments + historical pcbias applied ",ztfrac
-                  ENDIF
-
-                  IF ( ln_trainc .and. .not.ln_bsyncro ) THEN 
-                     IF ( kt == nn_bias_itwrt ) THEN
-                        DO jk = 1, jpkm1
-                           tbias_asm_out(:,:,jk) =  ztfrac * tbias_asm(:,:,jk) 
-                           sbias_asm_out(:,:,jk) =  ztfrac * sbias_asm(:,:,jk) 
-                        END DO
-
-                        IF ( ln_incpc ) THEN
-                         IF (lwp) WRITE(numout,*) 'after end of IAU - IPC - saving s/tbias_asm_stscale'
-                           DO jk = 1, jpkm1
-                              tbias_asm_stscale_out(:,:,jk) =  tbias_asm_stscale(:,:,jk) * zfrac
-                              sbias_asm_stscale_out(:,:,jk) =  sbias_asm_stscale(:,:,jk) * zfrac
-                           ENDDO
-                        ENDIF
-
-                     ENDIF
-
-                  ENDIF
-
-               ENDIF
-
+                 IF (lwp) THEN
+                    WRITE(numout,*) 'tra_bias : bias weights'
+                    WRITE(numout,*) '~~~~~~~~~~~~'
+                    WRITE(numout,* ) "proportion of increments + historical pcbias applied ",ztfrac
+                 ENDIF
+
+                 IF ( ln_trainc .and. .not.ln_bsyncro ) THEN 
+                    IF ( kt == nn_bias_itwrt ) THEN
+                       DO jk = 1, jpkm1
+                          tbias_asm_out(:,:,jk) =  ztfrac * tbias_asm(:,:,jk) 
+                          sbias_asm_out(:,:,jk) =  ztfrac * sbias_asm(:,:,jk) 
+                       END DO
+
+                       IF ( ln_incpc ) THEN
+                          IF (lwp) WRITE(numout,*) 'after end of IAU - IPC - saving s/tbias_asm_stscale'
+                             DO jk = 1, jpkm1
+                                tbias_asm_stscale_out(:,:,jk) =  tbias_asm_stscale(:,:,jk) * zfrac
+                                sbias_asm_stscale_out(:,:,jk) =  sbias_asm_stscale(:,:,jk) * zfrac
+                             ENDDO
+                          ENDIF
+                       ENDIF
+                    ENDIF
+                 ENDIF
 
             ELSE ! no assimilation increments, simply decay pressure correction (e.g for forecasts)
@@ -792,11 +776,11 @@
                DO jk = 1, jpkm1
                   tbias(:,:,jk) = tbias(:,:,jk) +                                                         &
-                  &               ( t_asm_mem**(real(kt)/ztsday) * tbias_asm(:,:,jk) ) * zcof1(:,:)
+                  &               ( t_asm_mem**(REAL(kt,wp)/ztsday) * tbias_asm(:,:,jk) ) * zcof1(:,:)
                   sbias(:,:,jk) = sbias(:,:,jk) +                                                         &
-                  &               ( t_asm_mem**(real(kt)/ztsday) * sbias_asm(:,:,jk) ) * zcof1(:,:)
+                  &               ( t_asm_mem**(REAL(kt,wp)/ztsday) * sbias_asm(:,:,jk) ) * zcof1(:,:)
                   tbias_p(:,:,jk) = tbias_p(:,:,jk) +                                                     &
-                  &               ( t_asm_mem**(real(kt)/ztsday) * tbias_asm(:,:,jk) ) * zcof2(:,:)
+                  &               ( t_asm_mem**(REAL(kt,wp)/ztsday) * tbias_asm(:,:,jk) ) * zcof2(:,:)
                   sbias_p(:,:,jk) = sbias_p(:,:,jk) +                                                     &  
-                  &               ( t_asm_mem**(real(kt)/ztsday) * sbias_asm(:,:,jk) ) * zcof2(:,:)
+                  &               ( t_asm_mem**(REAL(kt,wp)/ztsday) * sbias_asm(:,:,jk) ) * zcof2(:,:)
                ENDDO
 
@@ -804,8 +788,6 @@
                   WRITE(numout,*) 'tra_bias : bias weights'
                   WRITE(numout,*) '~~~~~~~~~~~~'
-                  WRITE(numout,* ) "proportion of historical pcbias applied ",t_asm_mem**(real(kt)/ztsday)
+                  WRITE(numout,* ) "proportion of historical pcbias applied ",t_asm_mem**(REAL(kt,wp)/ztsday)
                ENDIF
-
-
 
                IF (ln_incpc) THEN
@@ -957,5 +939,4 @@
             tsw(:,:,:,jp_sal) = tsa(:,:,:,jp_sal) - sbias_p(:,:,:) - sbias_i(:,:,:)
             IF ( ln_incpc_only ) THEN
-               IF(lwp) WRITE(numout,*) 'SUM(tbias_i) is', SUM(tbias_i), 'before to be added to tsw'
                IF(lwp) WRITE(numout,*) 'ln_incpc_only =', ln_incpc_only, 'tsw updated with IPC only and ln_dynhpg_imp = ',ln_dynhpg_imp
                tsw(:,:,:,jp_tem) = tsa(:,:,:,jp_tem) - tbias_i(:,:,:)
@@ -970,5 +951,4 @@
             tsw(:,:,:,jp_sal) = tsb(:,:,:,jp_sal) - sbias_p(:,:,:) - sbias_i(:,:,:)
             IF ( ln_incpc_only ) THEN
-               IF(lwp) WRITE(numout,*) 'SUM(tbias_i) is', SUM(tbias_i), 'before to be added to tsw'
                IF(lwp) WRITE(numout,*) 'ln_incpc_only =', ln_incpc_only, 'tsw updated with IPC only and ln_dynhpg_imp = ',ln_dynhpg_imp
                tsw(:,:,:,jp_tem) = tsb(:,:,:,jp_tem) - tbias_i(:,:,:)
@@ -978,17 +958,12 @@
       ENDIF
 
-     
-
       IF(lwp) WRITE(numout,*) 'dyn_bias( kt ) calculating rhd_pc, kt =', kt
-      !! GO5: CALL eos( tsw, rhd_pc, rhop )
-              CALL eos( tsw, rhd_pc, rhop, fsdept_n(:,:,:) )
+      CALL eos( tsw, rhd_pc, rhop, fsdept_n(:,:,:) )
       
-      ! is this needed?
-      IF(lwp) WRITE(numout,*) 'CALL lbc_lnk( rhd_pc, T, 1.0_wp )'
       CALL lbc_lnk( rhd_pc, 'T', 1.0_wp )
 
       ! Partial steps: now horizontal gradient of t,s,rd 
       ! at the bottom ocean level
-      IF(lwp) WRITE(numout,*) 'horizontal gradient of t,s,rd '
+
       IF( ln_zps    )  THEN
          CALL zps_hde( kt, jpts, tsw, gtsu, gtsv,  &
Index: branches/UKMO/dev_r5518_pcbias_ipc/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90
===================================================================
--- branches/UKMO/dev_r5518_pcbias_ipc/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90	(revision 8433)
+++ branches/UKMO/dev_r5518_pcbias_ipc/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90	(revision 8435)
@@ -99,7 +99,4 @@
       !
       IF ( ln_bias .AND. ln_bias_pc_app ) THEN
-         IF(lwp) THEN 
-         WRITE(numout,*) " ! store orig density, use pressure corrected density using gru_pc and grv_pc"
-         ENDIF
          z_rhd_st(:,:,:) = rhd(:,:,:)     ! store orig density 
          rhd(:,:,:)      = rhd_pc(:,:,:)  ! use pressure corrected density
@@ -110,5 +107,4 @@
       ENDIF
 
-         IF(lwp) WRITE(numout,*) " computing pressure gradient with nhpg = ",nhpg
       SELECT CASE ( nhpg )      ! Hydrostatic pressure gradient computation
       CASE (  0 )   ;   CALL hpg_zco    ( kt )      ! z-coordinate
Index: branches/UKMO/dev_r5518_pcbias_ipc/NEMOGCM/NEMO/OPA_SRC/step.F90
===================================================================
--- branches/UKMO/dev_r5518_pcbias_ipc/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 8433)
+++ branches/UKMO/dev_r5518_pcbias_ipc/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 8435)
@@ -273,6 +273,6 @@
                              CALL tra_nxt( kstp )                ! tracer fields at next time step
             IF( ln_sto_eos ) CALL sto_pts( tsn )                 ! Random T/S fluctuations
-                             CALL eos    ( tsa, rhd, rhop, fsdept_n(:,:,:) )  ! Time-filtered in situ density for hpg computation
-                             CALL lbc_lnk( rhd, 'T', 1.0_wp )
+            CALL eos    ( tsa, rhd, rhop, fsdept_n(:,:,:) )  ! Time-filtered in situ density for hpg computation
+            CALL lbc_lnk( rhd, 'T', 1.0_wp )
             IF( ln_zps .AND. .NOT. ln_isfcav)                                &
                &             CALL zps_hde    ( kstp, jpts, tsa, gtsu, gtsv,  &    ! Partial steps: before horizontal gradient
@@ -283,9 +283,9 @@
                &                                    gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi    ) ! of t, s, rd at the last ocean level
             IF( ln_bias )    CALL dyn_bias( kstp )
-      ELSE                                                  ! centered hpg  (eos then time stepping)
-         IF ( .NOT. lk_dynspg_ts ) THEN                     ! eos already called in time-split case
-            IF( ln_sto_eos ) CALL sto_pts( tsn )    ! Random T/S fluctuations
-                             CALL eos    ( tsn, rhd, rhop, fsdept_n(:,:,:) )  ! now in situ density for hpg computation
-                             CALL lbc_lnk( rhd, 'T', 1.0_wp )
+      ELSE                                                   ! centered hpg  (eos then time stepping)
+         IF ( .NOT. lk_dynspg_ts ) THEN                      ! eos already called in time-split case
+            IF( ln_sto_eos ) CALL sto_pts( tsn )             ! Random T/S fluctuations
+            CALL eos    ( tsn, rhd, rhop, fsdept_n(:,:,:) )  ! now in situ density for hpg computation
+            CALL lbc_lnk( rhd, 'T', 1.0_wp )
          IF( ln_zps .AND. .NOT. ln_isfcav)                                   &
                &             CALL zps_hde    ( kstp, jpts, tsn, gtsu, gtsv,  &    ! Partial steps: before horizontal gradient
