New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 7590 for branches/UKMO – NEMO

Changeset 7590 for branches/UKMO


Ignore:
Timestamp:
2017-01-20T16:51:19+01:00 (7 years ago)
Author:
kingr
Message:

Added diagnostics from operational version: Kara ML, diaopfoam, diurnal.

Location:
branches/UKMO/CO6_KD490_amm7_oper/NEMOGCM/NEMO/OPA_SRC
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/CO6_KD490_amm7_oper/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90

    r6332 r7590  
    5050      REAL(wp), POINTER, DIMENSION(:,:,:)    ::   v          !: Tidal constituents : V    (after nodal cor.) 
    5151   END TYPE TIDES_DATA 
     52   INTEGER, PUBLIC, PARAMETER                  ::   jptides_max = 15      !: Max number of tidal contituents 
     53      LOGICAL, PUBLIC                           ::   ln_harm_ana_store    !: =T Stores data for  harmonic Analysis 
     54      LOGICAL, PUBLIC                           ::   ln_harm_ana_compute     !: =T  Compute harmonic Analysis 
     55      LOGICAL, PUBLIC                           ::   ln_harmana_read         !: =T  Decide to do the analysis  
     56                                                                             !from scratch or continue previous run 
    5257 
    5358!$AGRIF_DO_NOT_TREAT 
     
    9095      TYPE(MAP_POINTER), DIMENSION(jpbgrd)      ::   ibmap_ptr           !: array of pointers to nbmap 
    9196      !! 
    92       NAMELIST/nambdy_tide/filtide, ln_bdytide_2ddta, ln_bdytide_conj 
     97      NAMELIST/nambdy_tide/filtide, ln_bdytide_2ddta, ln_bdytide_conj, ln_harm_ana_store, ln_harm_ana_compute, ln_harmana_read 
    9398      !!---------------------------------------------------------------------- 
    9499 
     
    126131            IF(lwp) WRITE(numout,*) '             assume complex conjugate   : ', ln_bdytide_conj 
    127132            IF(lwp) WRITE(numout,*) '             Number of tidal components to read: ', nb_harmo 
     133            IF(lwp) WRITE(numout,*) '             Use PCOMS harmonic ananalysis or not: ', ln_harm_ana_store 
     134            IF(lwp) WRITE(numout,*) '             Compute Final  harmonic ananalysis or not: ', ln_harm_ana_compute 
     135            IF(lwp) WRITE(numout,*) '             Read in previous days harmonic data or start afresh: ', ln_harmana_read 
    128136            IF(lwp) THEN  
    129137                    WRITE(numout,*) '             Tidal components: '  
  • branches/UKMO/CO6_KD490_amm7_oper/NEMOGCM/NEMO/OPA_SRC/DIA/dia25h.F90

    r6332 r7590  
    2020   USE zdf_oce, ONLY: en 
    2121#endif 
     22   USE diatmb 
    2223 
    2324   IMPLICIT NONE 
     
    3031  !! * variables for calculating 25-hourly means 
    3132   REAL(wp),SAVE, ALLOCATABLE,   DIMENSION(:,:,:) ::   tn_25h  , sn_25h, rinsitu_t_25h   
    32    REAL(wp),SAVE, ALLOCATABLE,   DIMENSION(:,:)   ::   sshn_25h  
     33   REAL(wp),SAVE, ALLOCATABLE,   DIMENSION(:,:)   ::   sshn_25h, insitu_bot_25h, temp_bot_25h  
    3334   REAL(wp),SAVE, ALLOCATABLE,   DIMENSION(:,:,:) ::   un_25h  , vn_25h  , wn_25h 
    3435   REAL(wp),SAVE, ALLOCATABLE,   DIMENSION(:,:,:) ::   avt_25h , avm_25h 
     
    6364      INTEGER ::   ios                 ! Local integer output status for namelist read 
    6465      INTEGER ::   ierror              ! Local integer for memory allocation 
     66      REAL(wp), DIMENSION(jpi,jpj,3)   ::   zwtmb                                 ! temporary workspace 
    6567      ! 
    6668      NAMELIST/nam_dia25h/ ln_dia25h 
     
    98100      IF( ierror > 0 ) THEN 
    99101         CALL ctl_stop( 'dia_25h: unable to allocate rinsitu_t_25h' )   ;   RETURN 
     102      ENDIF 
     103      ALLOCATE( insitu_bot_25h(jpi,jpj), STAT=ierror ) 
     104      IF( ierror > 0 ) THEN 
     105         CALL ctl_stop( 'dia_tide: unable to allocate insitu_bot_25h' )   ;   RETURN 
     106      ENDIF       
     107      ALLOCATE( temp_bot_25h(jpi,jpj), STAT=ierror ) 
     108      IF( ierror > 0 ) THEN 
     109         CALL ctl_stop( 'dia_tide: unable to allocate temp_bot_25h' )   ;   RETURN 
    100110      ENDIF 
    101111      ALLOCATE( un_25h(jpi,jpj,jpk), STAT=ierror ) 
     
    143153      CALL theta2t 
    144154      rinsitu_t_25h(:,:,:) = rinsitu_t(:,:,:) 
     155      CALL dia_calctmb( rinsitu_t(:,:,:),zwtmb ) 
     156      insitu_bot_25h(:,:) = zwtmb(:,:,3) 
     157      CALL dia_calctmb( tn_25h(:,:,:),zwtmb ) 
     158      temp_bot_25h(:,:) = zwtmb(:,:,3) 
    145159      sshn_25h(:,:) = sshb(:,:) 
    146160      un_25h(:,:,:) = ub(:,:,:) 
     
    237251         CALL theta2t 
    238252         rinsitu_t_25h(:,:,:)  = rinsitu_t_25h(:,:,:) + rinsitu_t(:,:,:) 
     253         CALL dia_calctmb( rinsitu_t(:,:,:),zwtmb ) 
     254         insitu_bot_25h(:,:)  = insitu_bot_25h(:,:) + zwtmb(:,:,3) 
     255         zw3d(:,:,:)          = tsn(:,:,:,jp_tem) 
     256         CALL dia_calctmb( zw3d,zwtmb ) 
     257         temp_bot_25h(:,:)    = temp_bot_25h(:,:) + zwtmb(:,:,3) 
    239258         sshn_25h(:,:)        = sshn_25h(:,:) + sshn (:,:) 
    240259         un_25h(:,:,:)        = un_25h(:,:,:) + un(:,:,:) 
     
    268287            sn_25h(:,:,:)        = sn_25h(:,:,:) / 25.0_wp 
    269288            rinsitu_t_25h(:,:,:)  = rinsitu_t_25h(:,:,:) / 25.0_wp 
     289            insitu_bot_25h(:,:)  = insitu_bot_25h(:,:) / 25.0_wp  
     290            temp_bot_25h(:,:)    = temp_bot_25h(:,:) /25.0_wp 
    270291            sshn_25h(:,:)        = sshn_25h(:,:) / 25.0_wp 
    271292            un_25h(:,:,:)        = un_25h(:,:,:) / 25.0_wp 
     
    289310            zw3d(:,:,:) = rinsitu_t_25h(:,:,:)*tmask(:,:,:) + zmdi*(1.0-tmask(:,:,:)) 
    290311            CALL iom_put("tempis25h", zw3d)   ! in-situ temperature 
     312            zw2d(:,:) = insitu_bot_25h(:,:)*tmask(:,:,1) + zmdi*(1.0-tmask(:,:,1)) 
     313            CALL iom_put("tempisbot25h", zw2d) ! bottom in-situ temperature 
     314            zw2d(:,:) = temp_bot_25h(:,:)*tmask(:,:,1) + zmdi*(1.0-tmask(:,:,1)) 
     315            CALL iom_put("temperbot25h",zw2d) ! bottom potential temperature 
    291316            zw3d(:,:,:) = sn_25h(:,:,:)*tmask(:,:,:) + zmdi*(1.0-tmask(:,:,:)) 
    292317            CALL iom_put( "salin25h", zw3d  )   ! salinity 
     
    321346            CALL theta2t 
    322347            rinsitu_t_25h(:,:,:) = rinsitu_t(:,:,:) 
     348            CALL dia_calctmb( rinsitu_t(:,:,:),zwtmb ) 
     349            insitu_bot_25h(:,:) = zwtmb(:,:,3) 
     350            CALL dia_calctmb( tn_25h(:,:,:),zwtmb) 
     351            temp_bot_25h(:,:) = zwtmb(:,:,3) 
    323352            sshn_25h(:,:) = sshn (:,:) 
    324353            un_25h(:,:,:) = un(:,:,:) 
  • branches/UKMO/CO6_KD490_amm7_oper/NEMOGCM/NEMO/OPA_SRC/DIA/diatmb.F90

    r6332 r7590  
    1919   PUBLIC   dia_tmb_init            ! routine called by nemogcm.F90 
    2020   PUBLIC   dia_tmb                 ! routine called by diawri.F90 
     21   PUBLIC   dia_calctmb             ! routine called by dia25h.F90 
    2122 
    2223   !!---------------------------------------------------------------------- 
     
    108109      DO jj = 1,jpj 
    109110         DO ji = 1,jpi 
    110             jk              = max(1,mbathy(ji,jj) - 1) 
     111            jk              = max(1,mbathy(ji,jj)) 
    111112            pouttmb(ji,jj,3) = pinfield(ji,jj,jk)*tmask(ji,jj,jk)  + zmdi*(1.0-tmask(ji,jj,jk)) 
    112113         END DO 
  • branches/UKMO/CO6_KD490_amm7_oper/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90

    r6332 r7590  
    4646   USE diatmb          ! Top,middle,bottom output 
    4747   USE dia25h          ! 25h Mean output 
     48   USE diaopfoam   ! Diaopfoam output 
    4849   USE iom 
    4950   USE ioipsl 
     
    189190               zztmpy = (  bfrva(ji,  jj) * vn(ji,jj  ,mbkv(ji,jj  ))  & 
    190191                      &  + bfrva(ji,jj-1) * vn(ji,jj-1,mbkv(ji,jj-1))  )  
    191                z2d(ji,jj) = rau0 * SQRT( zztmpx * zztmpx + zztmpy * zztmpy ) * tmask(ji,jj,1)  
     192               z2d(ji,jj) = 0.5_wp * rau0 * SQRT( zztmpx * zztmpx + zztmpy * zztmpy ) * tmask(ji,jj,1)  
    192193               ! 
    193194            ENDDO 
     
    389390      IF (ln_dia25h) THEN 
    390391         CALL dia_25h( kt ) 
     392      ENDIF 
     393      IF (ln_diaopfoam) THEN 
     394         CALL dia_diaopfoam 
    391395      ENDIF 
    392396      ! 
  • branches/UKMO/CO6_KD490_amm7_oper/NEMOGCM/NEMO/OPA_SRC/IOM/iom_def.F90

    r6331 r7590  
    4343   INTEGER, PARAMETER, PUBLIC ::   jp_i1    = 204      !: write INTEGER(1) 
    4444 
    45    INTEGER, PARAMETER, PUBLIC ::   jpmax_files  = 100   !: maximum number of simultaneously opened file 
     45   INTEGER, PARAMETER, PUBLIC ::   jpmax_files  = 200   !: maximum number of simultaneously opened file 
    4646   INTEGER, PARAMETER, PUBLIC ::   jpmax_vars   = 600  !: maximum number of variables in one file 
    4747   INTEGER, PARAMETER, PUBLIC ::   jpmax_dims   =  4   !: maximum number of dimensions for one variable 
  • branches/UKMO/CO6_KD490_amm7_oper/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90

    r6332 r7590  
    2525   USE trdmxl_oce      ! ocean active mixed layer tracers trends variables 
    2626   USE divcur          ! hor. divergence and curl      (div & cur routines) 
     27   USE diurnal_bulk    ! diurnal SST 
    2728 
    2829   IMPLICIT NONE 
     
    153154                     CALL iom_rstput( kt, nitrst, numrow, 'rhd'    , rhd       ) 
    154155#endif 
     156 
     157      IF (ln_diurnal) CALL iom_rstput( kt, nitrst, numrow, 'Dsst', x_dsst      ) 
     158 
    155159      IF( kt == nitrst ) THEN 
    156160         CALL iom_close( numrow )     ! close the restart file (only at last time step) 
     
    265269      ENDIF 
    266270#endif 
     271 
     272      ! Diurnal SST 
     273      IF( ln_diurnal ) CALL iom_get( numror, jpdom_autoglo, 'Dsst' , x_dsst  )   
     274 
    267275      ! 
    268276      IF( neuler == 0 ) THEN                                  ! Euler restart (neuler=0) 
  • branches/UKMO/CO6_KD490_amm7_oper/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfmxl.F90

    r6331 r7590  
    2222   USE timing          ! Timing 
    2323   USE trc_oce, ONLY : lk_offline ! offline flag 
     24   USE lbclnk  
     25   USE eosbn2          ! Equation of state 
    2426 
    2527   IMPLICIT NONE 
     
    2729 
    2830   PUBLIC   zdf_mxl       ! called by step.F90 
     31   PUBLIC   zdf_mxl_tref  ! called by asminc.F90 
    2932   PUBLIC   zdf_mxl_alloc ! Used in zdf_tke_init 
    3033 
     
    3336   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hmlp    !: mixed layer depth  (rho=rho0+zdcrit) [m] 
    3437   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hmlpt   !: mixed layer depth at t-points        [m] 
     38   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hmld_tref  !: mixed layer depth at t-points - temperature criterion [m] 
     39   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hmld_kara  !: mixed layer depth of Kara et al   [m] 
    3540 
    3641   REAL(wp), PUBLIC ::   rho_c = 0.01_wp    !: density criterion for mixed layer depth 
    3742   REAL(wp)         ::   avt_c = 5.e-4_wp   ! Kz criterion for the turbocline depth 
     43 
     44   ! Namelist variables for  namzdf_karaml  
     45  
     46   LOGICAL   :: ln_kara            ! Logical switch for calculating kara mixed 
     47                                     ! layer 
     48   LOGICAL   :: ln_kara_write25h   ! Logical switch for 25 hour outputs 
     49   INTEGER   :: jpmld_type         ! mixed layer type              
     50   REAL(wp)  :: ppz_ref            ! depth of initial T_ref  
     51   REAL(wp)  :: ppdT_crit          ! Critical temp diff   
     52   REAL(wp)  :: ppiso_frac         ! Fraction of ppdT_crit used  
     53    
     54   !Used for 25h mean 
     55   LOGICAL, PRIVATE :: kara_25h_init = .TRUE.   !Logical used to initalise 25h  
     56                                                !outputs. Necissary, because we need to 
     57                                                !initalise the kara_25h on the zeroth 
     58                                                !timestep (i.e in the nemogcm_init call) 
     59   REAL, PRIVATE, ALLOCATABLE, DIMENSION(:,:) :: hmld_kara_25h 
    3860 
    3961   !! * Substitutions 
     
    5274      zdf_mxl_alloc = 0      ! set to zero if no array to be allocated 
    5375      IF( .NOT. ALLOCATED( nmln ) ) THEN 
    54          ALLOCATE( nmln(jpi,jpj), hmld(jpi,jpj), hmlp(jpi,jpj), hmlpt(jpi,jpj), STAT= zdf_mxl_alloc ) 
     76         ALLOCATE( nmln(jpi,jpj), hmld(jpi,jpj), hmlp(jpi,jpj), hmlpt(jpi,jpj), & 
     77         &                           hmld_tref(jpi,jpj), STAT= zdf_mxl_alloc ) 
    5578         ! 
    5679         IF( lk_mpp             )   CALL mpp_sum ( zdf_mxl_alloc ) 
     
    123146      END DO 
    124147      ! depth of the mixing and mixed layers 
     148 
     149      CALL zdf_mxl_kara( kt ) ! kara MLD 
     150 
    125151      DO jj = 1, jpj 
    126152         DO ji = 1, jpi 
     
    146172   END SUBROUTINE zdf_mxl 
    147173 
     174 
     175   SUBROUTINE zdf_mxl_tref() 
     176      !!---------------------------------------------------------------------- 
     177      !!                  ***  ROUTINE zdf_mxl_tref  *** 
     178      !!                    
     179      !! ** Purpose :   Compute the mixed layer depth with temperature criteria. 
     180      !! 
     181      !! ** Method  :   The temperature-defined mixed layer depth is required 
     182      !!                   when assimilating SST in a 2D analysis.  
     183      !! 
     184      !! ** Action  :   hmld_tref 
     185      !!---------------------------------------------------------------------- 
     186      ! 
     187      INTEGER  ::   ji, jj, jk   ! dummy loop indices 
     188      REAL(wp) ::   t_ref               ! Reference temperature   
     189      REAL(wp) ::   temp_c = 0.2        ! temperature criterion for mixed layer depth   
     190      !!---------------------------------------------------------------------- 
     191      ! 
     192      ! Initialise array 
     193      IF( zdf_mxl_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'zdf_mxl_tref : unable to allocate arrays' ) 
     194       
     195      !For the AMM model assimiation uses a temperature based mixed layer depth   
     196      !This is defined here   
     197      DO jj = 1, jpj   
     198         DO ji = 1, jpi   
     199           hmld_tref(ji,jj)=fsdept(ji,jj,1  )    
     200           IF(ssmask(ji,jj) > 0.)THEN   
     201             t_ref=tsn(ji,jj,1,jp_tem)  
     202             DO jk=2,jpk   
     203               IF(ssmask(ji,jj)==0.)THEN   
     204                  hmld_tref(ji,jj)=fsdept(ji,jj,jk )   
     205                  EXIT   
     206               ELSEIF( ABS(tsn(ji,jj,jk,jp_tem)-t_ref) < temp_c)THEN   
     207                  hmld_tref(ji,jj)=fsdept(ji,jj,jk )   
     208               ELSE   
     209                  EXIT   
     210               ENDIF   
     211             ENDDO   
     212           ENDIF   
     213         ENDDO   
     214      ENDDO 
     215 
     216   END SUBROUTINE zdf_mxl_tref 
     217 
     218   SUBROUTINE zdf_mxl_kara( kt )  
     219      !!----------------------------------------------------------------------------------  
     220      !!                    ***  ROUTINE zdf_mxl_kara  ***  
     221      !                                                                         
     222      !   Calculate mixed layer depth according to the definition of           
     223      !   Kara et al, 2000, JGR, 105, 16803.   
     224      !  
     225      !   If mld_type=1 the mixed layer depth is calculated as the depth at which the   
     226      !   density has increased by an amount equivalent to a temperature difference of   
     227      !   0.8C at the surface.  
     228      !  
     229      !   For other values of mld_type the mixed layer is calculated as the depth at   
     230      !   which the temperature differs by 0.8C from the surface temperature.   
     231      !                                                                         
     232      !   Original version: David Acreman                                       
     233      !  
     234      !!----------------------------------------------------------------------------------- 
     235      
     236      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index  
     237  
     238      NAMELIST/namzdf_karaml/ ln_kara,jpmld_type, ppz_ref, ppdT_crit, & 
     239      &                       ppiso_frac, ln_kara_write25h  
     240  
     241      ! Local variables                                                         
     242      REAL, DIMENSION(jpi,jpk) :: ppzdep      ! depth for use in calculating d(rho)  
     243      REAL(wp), DIMENSION(jpi,jpj,jpts) :: ztsn_2d  !Local version of tsn  
     244      LOGICAL :: ll_found(jpi,jpj)              ! Is T_b to be found by interpolation ?  
     245      LOGICAL :: ll_belowml(jpi,jpj,jpk)        ! Flag points below mixed layer when ll_found=F  
     246      INTEGER :: ji, jj, jk                     ! loop counter  
     247      INTEGER :: ik_ref(jpi,jpj)                ! index of reference level  
     248      INTEGER :: ik_iso(jpi,jpj)                ! index of last uniform temp level  
     249      REAL    :: zT(jpi,jpj,jpk)                ! Temperature or denisty  
     250      REAL    :: zT_ref(jpi,jpj)                ! reference temperature  
     251      REAL    :: zT_b                           ! base temperature  
     252      REAL    :: zdTdz(jpi,jpj,jpk-2)           ! gradient of zT  
     253      REAL    :: zmoddT(jpi,jpj,jpk-2)          ! Absolute temperature difference  
     254      REAL    :: zdz                            ! depth difference  
     255      REAL    :: zdT                            ! temperature difference  
     256      REAL    :: zdelta_T(jpi,jpj)              ! difference critereon  
     257      REAL    :: zRHO1(jpi,jpj), zRHO2(jpi,jpj) ! Densities 
     258      INTEGER, SAVE :: idt, i_steps 
     259      INTEGER, SAVE :: i_cnt_25h     ! Counter for 25 hour means 
     260      INTEGER :: ios                 ! Local integer output status for namelist read 
     261 
     262      
     263  
     264      !!-------------------------------------------------------------------------------------  
     265  
     266      IF( kt == nit000 ) THEN  
     267         ! Default values  
     268         ln_kara      = .FALSE. 
     269         ln_kara_write25h = .FALSE.  
     270         jpmld_type   = 1      
     271         ppz_ref      = 10.0  
     272         ppdT_crit    = 0.2   
     273         ppiso_frac   = 0.1    
     274         ! Read namelist 
     275         REWIND ( numnam_ref ) 
     276         READ   ( numnam_ref, namzdf_karaml, IOSTAT=ios, ERR= 901 ) 
     277901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_karaml in reference namelist', lwp ) 
     278 
     279         REWIND( numnam_cfg )              ! Namelist nam_diadiaop in configuration namelist  3D hourly diagnostics 
     280         READ  ( numnam_cfg,  namzdf_karaml, IOSTAT = ios, ERR = 902 ) 
     281902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_karaml in configuration namelist', lwp ) 
     282         IF(lwm) WRITE ( numond, namzdf_karaml ) 
     283  
     284 
     285         WRITE(numout,*) '===== Kara mixed layer ====='  
     286         WRITE(numout,*) 'ln_kara = ',    ln_kara 
     287         WRITE(numout,*) 'jpmld_type = ', jpmld_type  
     288         WRITE(numout,*) 'ppz_ref = ',    ppz_ref  
     289         WRITE(numout,*) 'ppdT_crit = ',  ppdT_crit  
     290         WRITE(numout,*) 'ppiso_frac = ', ppiso_frac 
     291         WRITE(numout,*) 'ln_kara_write25h = ', ln_kara_write25h 
     292         WRITE(numout,*) '============================'  
     293       
     294         IF ( .NOT.ln_kara ) THEN 
     295            WRITE(numout,*) "ln_kara not set; Kara mixed layer not calculated"  
     296         ELSE 
     297            IF (.NOT. ALLOCATED(hmld_kara) ) ALLOCATE( hmld_kara(jpi,jpj) ) 
     298            IF ( ln_kara_write25h .AND. kara_25h_init ) THEN 
     299               i_cnt_25h = 0 
     300               IF (.NOT. ALLOCATED(hmld_kara_25h) ) & 
     301               &   ALLOCATE( hmld_kara_25h(jpi,jpj) ) 
     302               hmld_kara_25h = 0._wp 
     303               IF( nacc == 1 ) THEN 
     304                  idt = INT(rdtmin) 
     305               ELSE 
     306                  idt = INT(rdt) 
     307               ENDIF 
     308               IF( MOD( 3600,idt) == 0 ) THEN  
     309                  i_steps = 3600 / idt   
     310               ELSE  
     311                  CALL ctl_stop('STOP', & 
     312                  & 'zdf_mxl_kara: timestep must give MOD(3600,rdt)'// & 
     313                  & ' = 0 otherwise no hourly values are possible')  
     314               ENDIF   
     315            ENDIF 
     316         ENDIF 
     317      ENDIF 
     318       
     319      IF ( ln_kara ) THEN 
     320          
     321         !set critical ln_kara 
     322         ztsn_2d = tsn(:,:,1,:) 
     323         ztsn_2d(:,:,jp_tem) = ztsn_2d(:,:,jp_tem) + ppdT_crit 
     324      
     325         ! Set the mixed layer depth criterion at each grid point  
     326         ppzdep = 0._wp 
     327         IF( jpmld_type == 1 ) THEN                                          
     328            CALL eos ( tsn(:,:,1,:), & 
     329            &          ppzdep(:,:), zRHO1(:,:) )  
     330            CALL eos ( ztsn_2d(:,:,:), & 
     331            &           ppzdep(:,:), zRHO2(:,:) )  
     332            zdelta_T(:,:) = abs( zRHO1(:,:) - zRHO2(:,:) ) * rau0  
     333            ! RHO from eos (2d version) doesn't calculate north or east halo:  
     334            CALL lbc_lnk( zdelta_T, 'T', 1. )  
     335            zT(:,:,:) = rhop(:,:,:)  
     336         ELSE  
     337            zdelta_T(:,:) = ppdT_crit                       
     338            zT(:,:,:) = tsn(:,:,:,jp_tem)                            
     339         ENDIF  
     340      
     341         ! Calculate the gradient of zT and absolute difference for use later  
     342         DO jk = 1 ,jpk-2  
     343            zdTdz(:,:,jk)  =    ( zT(:,:,jk+1) - zT(:,:,jk) ) / fse3w(:,:,jk+1)  
     344            zmoddT(:,:,jk) = abs( zT(:,:,jk+1) - zT(:,:,jk) )  
     345         END DO  
     346      
     347         ! Find density/temperature at the reference level (Kara et al use 10m).           
     348         ! ik_ref is the index of the box centre immediately above or at the reference level  
     349         ! Find ppz_ref in the array of model level depths and find the ref     
     350         ! density/temperature by linear interpolation.                                    
     351         ik_ref = -1 
     352         DO jk = jpkm1, 2, -1  
     353            WHERE( fsdept(:,:,jk) > ppz_ref )  
     354               ik_ref(:,:) = jk - 1  
     355               zT_ref(:,:) = zT(:,:,jk-1) + & 
     356               &             zdTdz(:,:,jk-1) * ( ppz_ref - fsdept(:,:,jk-1) )  
     357            ENDWHERE  
     358         END DO 
     359         IF ( ANY( ik_ref  < 0 ) .OR. ANY( ik_ref  > jpkm1 ) ) THEN 
     360            CALL ctl_stop( "STOP", & 
     361            & "zdf_mxl_kara: unable to find reference level for kara ML" )  
     362         ELSE 
     363            ! If the first grid box centre is below the reference level then use the  
     364            ! top model level to get zT_ref  
     365            WHERE( fsdept(:,:,1) > ppz_ref )   
     366               zT_ref = zT(:,:,1)  
     367               ik_ref = 1  
     368            ENDWHERE  
     369      
     370            ! Search for a uniform density/temperature region where adjacent levels           
     371            ! differ by less than ppiso_frac * deltaT.                                       
     372            ! ik_iso is the index of the last level in the uniform layer   
     373            ! ll_found indicates whether the mixed layer depth can be found by interpolation  
     374            ik_iso(:,:)   = ik_ref(:,:)  
     375            ll_found(:,:) = .false.  
     376            DO jj = 1, nlcj  
     377               DO ji = 1, nlci  
     378                 !CDIR NOVECTOR  
     379                  DO jk = ik_ref(ji,jj), mbathy(ji,jj)-1  
     380                     IF( zmoddT(ji,jj,jk) > ( ppiso_frac * zdelta_T(ji,jj) ) ) THEN  
     381                        ik_iso(ji,jj)   = jk  
     382                        ll_found(ji,jj) = ( zmoddT(ji,jj,jk) > zdelta_T(ji,jj) )  
     383                        EXIT  
     384                     ENDIF  
     385                  END DO  
     386               END DO  
     387            END DO  
     388      
     389            ! Use linear interpolation to find depth of mixed layer base where possible  
     390            hmld_kara(:,:) = ppz_ref  
     391            DO jj = 1, jpj  
     392               DO ji = 1, jpi  
     393                  IF( ll_found(ji,jj) .and. tmask(ji,jj,1) == 1.0 ) THEN  
     394                     zdz =  abs( zdelta_T(ji,jj) / zdTdz(ji,jj,ik_iso(ji,jj)) )  
     395                     hmld_kara(ji,jj) = fsdept(ji,jj,ik_iso(ji,jj)) + zdz  
     396                  ENDIF  
     397               END DO  
     398            END DO  
     399      
     400            ! If ll_found = .false. then calculate MLD using difference of zdelta_T     
     401            ! from the reference density/temperature  
     402      
     403            ! Prevent this section from working on land points  
     404            WHERE( tmask(:,:,1) /= 1.0 )  
     405               ll_found = .true.  
     406            ENDWHERE  
     407      
     408            DO jk = 1, jpk  
     409               ll_belowml(:,:,jk) = abs( zT(:,:,jk) - zT_ref(:,:) ) >= & 
     410               & zdelta_T(:,:) 
     411            END DO  
     412      
     413            ! Set default value where interpolation cannot be used (ll_found=false)   
     414            DO jj = 1, jpj  
     415               DO ji = 1, jpi  
     416                  IF( .NOT. ll_found(ji,jj) )  & 
     417                  &   hmld_kara(ji,jj) = fsdept(ji,jj,mbathy(ji,jj))  
     418               END DO  
     419            END DO  
     420      
     421            DO jj = 1, jpj  
     422               DO ji = 1, jpi  
     423                  !CDIR NOVECTOR  
     424                  DO jk = ik_ref(ji,jj)+1, mbathy(ji,jj)  
     425                     IF( ll_found(ji,jj) ) EXIT  
     426                     IF( ll_belowml(ji,jj,jk) ) THEN                 
     427                        zT_b = zT_ref(ji,jj) + zdelta_T(ji,jj) * & 
     428                        &      SIGN(1.0, zdTdz(ji,jj,jk-1) )  
     429                        zdT  = zT_b - zT(ji,jj,jk-1)                                       
     430                        zdz  = zdT / zdTdz(ji,jj,jk-1)                                        
     431                        hmld_kara(ji,jj) = fsdept(ji,jj,jk-1) + zdz  
     432                        EXIT                                                    
     433                     ENDIF  
     434                  END DO  
     435               END DO  
     436            END DO  
     437      
     438            hmld_kara(:,:) = hmld_kara(:,:) * tmask(:,:,1)  
     439  
     440            IF(  ln_kara_write25h  ) THEN 
     441               !Double IF required as i_steps not defined if ln_kara_write25h = 
     442               ! FALSE 
     443               IF ( ( MOD( kt, i_steps ) == 0 ) .OR.  kara_25h_init ) THEN 
     444                  hmld_kara_25h = hmld_kara_25h + hmld_kara 
     445                  i_cnt_25h = i_cnt_25h + 1 
     446                  IF ( kara_25h_init ) kara_25h_init = .FALSE. 
     447               ENDIF 
     448            ENDIF 
     449  
     450#if defined key_iomput  
     451            IF( kt /= nit000 ) THEN  
     452               CALL iom_put( "mldkara"  , hmld_kara )    
     453               IF( ( MOD( i_cnt_25h, 25) == 0 ) .AND.  ln_kara_write25h ) & 
     454                  CALL iom_put( "kara25h"  , ( hmld_kara_25h / 25._wp ) ) 
     455            ENDIF 
     456#endif 
     457  
     458         ENDIF 
     459      ENDIF 
     460        
     461   END SUBROUTINE zdf_mxl_kara  
     462 
    148463   !!====================================================================== 
    149464END MODULE zdfmxl 
  • branches/UKMO/CO6_KD490_amm7_oper/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90

    r6332 r7590  
    8787   USE diatmb          ! Top,middle,bottom output 
    8888   USE dia25h          ! 25h mean output 
     89   USE diaopfoam       ! 3D hourly output 
     90   USE diurnal_bulk    ! diurnal bulk SST  
    8991 
    9092   IMPLICIT NONE 
     
    405407                            CALL  istate_init   ! ocean initial state (Dynamics and tracers) 
    406408 
     409      CALL diurnal_sst_bulk_init                ! diurnal sst 
     410      IF ( ln_diurnal ) CALL diurnal_sst_coolskin_init   ! cool skin     
     411 
    407412      IF( lk_tide       )   CALL    tide_init( nit000 )    ! Initialisation of the tidal harmonics 
    408413 
     
    479484                            CALL dia_tmb_init  ! TMB outputs 
    480485                            CALL dia_25h_init  ! 25h mean  outputs 
     486                            CALL dia_diaopfoam_init  ! 25h mean  outputs 
    481487      ! 
    482488   END SUBROUTINE nemo_init 
  • branches/UKMO/CO6_KD490_amm7_oper/NEMOGCM/NEMO/OPA_SRC/step.F90

    r6610 r7590  
    225225      ENDIF 
    226226 
     227      ! Cool skin 
     228      IF ( ln_diurnal ) THEN   
     229         IF ( ln_blk_core ) THEN 
     230            CALL diurnal_sst_coolskin_step( &   
     231                    qns(:,:)+(rn_abs*qsr(:,:)), taum, rhop(:,:,1), rdt)  
     232         ELSE 
     233            CALL diurnal_sst_coolskin_step( &   
     234                    qns, taum, rhop(:,:,1), rdt)  
     235         ENDIF 
     236      ENDIF 
     237 
    227238      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    228239      ! diagnostics and outputs             (ua, va, tsa used as workspace) 
     
    237248      ! 
    238249      IF( ln_crs     )      CALL crs_fld( kstp )         ! ocean model: online field coarsening & output 
     250 
     251      !Diurnal warm layer model         
     252      IF ( ln_diurnal ) THEN 
     253         IF ( ln_blk_core ) THEN 
     254            IF( kstp == nit000 )THEN   
     255               CALL diurnal_sst_takaya_step( &   
     256               &    qsr(:,:)-(rn_abs*qsr(:,:)), qns(:,:)+(rn_abs*qsr(:,:)), & 
     257               &    taum, rhop(:,:,1), & 
     258               &    rdt, ld_calcfrac = .TRUE.)   
     259            ELSE   
     260               CALL diurnal_sst_takaya_step( &   
     261               &    qsr(:,:)-(rn_abs*qsr(:,:)), qns(:,:)+(rn_abs*qsr(:,:)), & 
     262               &    taum, rhop(:,:,1), rdt )   
     263            ENDIF  
     264         ELSE 
     265            IF( kstp == nit000 )THEN   
     266               CALL diurnal_sst_takaya_step( &   
     267               &    qsr, qns, taum, rhop(:,:,1), & 
     268               &    rdt, ld_calcfrac = .TRUE.)   
     269            ELSE   
     270               CALL diurnal_sst_takaya_step( &   
     271               &    qsr, qns, taum, rhop(:,:,1), rdt )   
     272            ENDIF  
     273         ENDIF 
     274      ENDIF 
    239275 
    240276#if defined key_top 
     
    338374      IF( lk_vvl           )   CALL dom_vvl_sf_swp( kstp )  ! swap of vertical scale factors 
    339375      ! 
    340       IF( lrst_oce         )   CALL rst_write( kstp )       ! write output ocean restart file 
    341376 
    342377#if defined key_agrif 
     
    362397                               CALL dia_wri_state( 'output.abort', kstp ) 
    363398      ENDIF 
     399      IF( ln_harm_ana_store   )   CALL harm_ana( kstp )        ! Harmonic analysis of tides  
    364400      IF( kstp == nit000   )   THEN 
    365401                 CALL iom_close( numror )     ! close input  ocean restart file 
     
    367403         IF( lwm.AND.numoni /= -1 ) CALL FLUSH    ( numoni )     ! flush output namelist ice 
    368404      ENDIF 
     405      IF( lrst_oce         )   CALL rst_write( kstp )       ! write output ocean restart file 
    369406 
    370407      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
  • branches/UKMO/CO6_KD490_amm7_oper/NEMOGCM/NEMO/OPA_SRC/step_oce.F90

    r6610 r7590  
    108108   USE prtctl           ! Print control                    (prt_ctl routine) 
    109109 
     110   USE harmonic_analysis ! harmonic analysis of tides (harm_ana routine)  
     111   USE bdytides          ! harmonic analysis of tides (harm_ana routine)  
    110112   USE diaobs           ! Observation operator 
     113 
     114   USE diurnal_bulk    ! diurnal SST bulk routines  (diurnal_sst_takaya routine)   
     115   USE cool_skin       ! diurnal cool skin correction (diurnal_sst_coolskin routine) 
    111116 
    112117   USE timing           ! Timing 
Note: See TracChangeset for help on using the changeset viewer.