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 6761 for branches/UKMO/dev_r5518_25hr_mean_assim_bkg/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90 – NEMO

Ignore:
Timestamp:
2016-06-30T15:21:49+02:00 (8 years ago)
Author:
kingr
Message:

Merged branches/UKMO/dev_r5518_v3.4_asm_nemovar_community@6754

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5518_25hr_mean_assim_bkg/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90

    r6757 r6761  
    4040#endif 
    4141   USE sbc_oce          ! Surface boundary condition variables. 
     42   USE zdfmxl, ONLY :  &   
     43   &  hmld_tref,       &    
     44#if defined key_karaml 
     45   &  hmld_kara,       & 
     46   &  ln_kara,         & 
     47#endif    
     48   &  hmld,            &  
     49   &  hmlp,            & 
     50   &  hmlpt 
     51#if defined key_bdy  
     52   USE bdy_oce, ONLY: bdytmask   
     53#endif   
    4254 
    4355   IMPLICIT NONE 
     
    88100   REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   seaice_bkginc         ! Increment to the background sea ice conc 
    89101 
     102   INTEGER :: mld_choice        = 4   !: choice of mld criteria to use for physics assimilation 
     103                                      !: 1) hmld      - Turbocline/mixing depth                           [W points] 
     104                                      !: 2) hmlp      - Density criterion (0.01 kg/m^3 change from 10m)   [W points] 
     105                                      !: 3) hmld_kara - Kara MLD                                          [Interpolated] 
     106                                      !: 4) hmld_tref - Temperature criterion (0.2 K change from surface) [T points] 
     107 
     108 
    90109   !! * Substitutions 
    91110#  include "domzgr_substitute.h90" 
     
    119138      INTEGER :: iitiaustr_date  ! Date YYYYMMDD of IAU interval start time step 
    120139      INTEGER :: iitiaufin_date  ! Date YYYYMMDD of IAU interval final time step 
     140      INTEGER :: isurfstat       ! Local integer for status of reading surft variable 
    121141      ! 
    122142      REAL(wp) :: znorm        ! Normalization factor for IAU weights 
     
    127147      REAL(wp) :: zdate_inc    ! Time axis in increments file 
    128148      ! 
     149      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: &  
     150          &       t_bkginc_2d  ! file for reading in 2D   
     151      !                        ! temperature increments  
     152      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: &  
     153          &       z_mld     ! Mixed layer depth  
     154           
    129155      REAL(wp), POINTER, DIMENSION(:,:) ::   hdiv   ! 2D workspace 
     156      ! 
     157      LOGICAL :: lk_surft      ! Logical: T => Increments file contains surft variable  
     158                               !               so only apply surft increments. 
    130159      !! 
    131160      NAMELIST/nam_asminc/ ln_bkgwri,                                      & 
     
    133162         &                 ln_asmdin, ln_asmiau,                           & 
    134163         &                 nitbkg, nitdin, nitiaustr, nitiaufin, niaufn,   & 
    135          &                 ln_salfix, salfixmin, nn_divdmp 
     164         &                 ln_salfix, salfixmin, nn_divdmp, mld_choice 
    136165      !!---------------------------------------------------------------------- 
    137166 
     
    139168      ! Read Namelist nam_asminc : assimilation increment interface 
    140169      !----------------------------------------------------------------------- 
     170 
     171      ! Set default values 
     172      ln_bkgwri = .FALSE. 
     173      ln_trainc = .FALSE. 
     174      ln_dyninc = .FALSE. 
     175      ln_sshinc = .FALSE. 
    141176      ln_seaiceinc = .FALSE. 
     177      ln_asmdin = .FALSE. 
     178      ln_asmiau = .TRUE. 
     179      ln_salfix = .FALSE. 
    142180      ln_temnofreeze = .FALSE. 
     181      salfixmin = -9999 
     182      nitbkg    = 0 
     183      nitdin    = 0       
     184      nitiaustr = 1 
     185      nitiaufin = 150 
     186      niaufn    = 0 
    143187 
    144188      REWIND( numnam_ref )              ! Namelist nam_asminc in reference namelist : Assimilation increment 
     
    171215         WRITE(numout,*) '      Logical switch for ensuring that the sa > salfixmin      ln_salfix = ', ln_salfix 
    172216         WRITE(numout,*) '      Minimum salinity after applying the increments           salfixmin = ', salfixmin 
     217         WRITE(numout,*) '      Choice of MLD for physics assimilation                  mld_choice = ', mld_choice 
    173218      ENDIF 
    174219 
     
    327372      !-------------------------------------------------------------------- 
    328373 
    329       ALLOCATE( t_bkginc(jpi,jpj,jpk) ) 
    330       ALLOCATE( s_bkginc(jpi,jpj,jpk) ) 
    331       ALLOCATE( u_bkginc(jpi,jpj,jpk) ) 
    332       ALLOCATE( v_bkginc(jpi,jpj,jpk) ) 
    333       ALLOCATE( ssh_bkginc(jpi,jpj)   ) 
    334       ALLOCATE( seaice_bkginc(jpi,jpj)) 
     374      IF ( ln_trainc ) THEN 
     375         ALLOCATE( t_bkginc(jpi,jpj,jpk) ) 
     376         ALLOCATE( s_bkginc(jpi,jpj,jpk) ) 
     377         t_bkginc(:,:,:) = 0.0 
     378         s_bkginc(:,:,:) = 0.0 
     379      ENDIF 
     380      IF ( ln_dyninc ) THEN  
     381         ALLOCATE( u_bkginc(jpi,jpj,jpk) ) 
     382         ALLOCATE( v_bkginc(jpi,jpj,jpk) ) 
     383         u_bkginc(:,:,:) = 0.0 
     384         v_bkginc(:,:,:) = 0.0 
     385      ENDIF 
     386      IF ( ln_sshinc ) THEN 
     387         ALLOCATE( ssh_bkginc(jpi,jpj)   ) 
     388         ssh_bkginc(:,:) = 0.0 
     389      ENDIF 
     390      IF ( ln_seaiceinc ) THEN  
     391         ALLOCATE( seaice_bkginc(jpi,jpj)) 
     392         seaice_bkginc(:,:) = 0.0 
     393      ENDIF 
    335394#if defined key_asminc 
    336395      ALLOCATE( ssh_iau(jpi,jpj)      ) 
    337 #endif 
    338       t_bkginc(:,:,:) = 0.0 
    339       s_bkginc(:,:,:) = 0.0 
    340       u_bkginc(:,:,:) = 0.0 
    341       v_bkginc(:,:,:) = 0.0 
    342       ssh_bkginc(:,:) = 0.0 
    343       seaice_bkginc(:,:) = 0.0 
    344 #if defined key_asminc 
    345396      ssh_iau(:,:)    = 0.0 
    346397#endif 
     
    378429 
    379430         IF ( ln_trainc ) THEN    
    380             CALL iom_get( inum, jpdom_autoglo, 'bckint', t_bkginc, 1 ) 
    381             CALL iom_get( inum, jpdom_autoglo, 'bckins', s_bkginc, 1 ) 
    382             ! Apply the masks 
    383             t_bkginc(:,:,:) = t_bkginc(:,:,:) * tmask(:,:,:) 
    384             s_bkginc(:,:,:) = s_bkginc(:,:,:) * tmask(:,:,:) 
    385             ! Set missing increments to 0.0 rather than 1e+20 
    386             ! to allow for differences in masks 
    387             WHERE( ABS( t_bkginc(:,:,:) ) > 1.0e+10 ) t_bkginc(:,:,:) = 0.0 
    388             WHERE( ABS( s_bkginc(:,:,:) ) > 1.0e+10 ) s_bkginc(:,:,:) = 0.0 
     431             
     432            !Test if the increments file contains the surft variable. 
     433            isurfstat = iom_varid( inum, 'bckinsurft', ldstop = .FALSE. ) 
     434            IF ( isurfstat == -1 ) THEN 
     435               lk_surft = .FALSE. 
     436            ELSE 
     437               lk_surft = .TRUE. 
     438               CALL ctl_warn( ' Applying 2D temperature increment to bottom of ML: ', & 
     439            &                 ' bckinsurft found in increments file.' ) 
     440            ENDIF              
     441 
     442            IF (lk_surft) THEN  
     443                 
     444               ALLOCATE(z_mld(jpi,jpj))  
     445               SELECT CASE(mld_choice)  
     446               CASE(1)  
     447                  z_mld = hmld  
     448               CASE(2)  
     449                  z_mld = hmlp  
     450               CASE(3)  
     451#if defined key_karaml 
     452                  IF ( ln_kara ) THEN 
     453                     z_mld = hmld_kara 
     454                  ELSE 
     455                     CALL ctl_stop("Kara mixed layer not calculated as ln_kara=.false.") 
     456                  ENDIF 
     457#else 
     458                  CALL ctl_stop("Kara mixed layer not defined in current version of NEMO")  ! JW: Safety feature, should be removed 
     459                                                                                            ! once the Kara mixed layer is available  
     460#endif 
     461               CASE(4)  
     462                  z_mld = hmld_tref  
     463               END SELECT        
     464                       
     465               ALLOCATE( t_bkginc_2d(jpi,jpj) )  
     466               CALL iom_get( inum, jpdom_autoglo, 'bckinsurft', t_bkginc_2d, 1)  
     467#if defined key_bdy                 
     468               DO jk = 1,jpkm1  
     469                  WHERE( z_mld(:,:) > fsdepw(:,:,jk) )  
     470                     t_bkginc(:,:,jk) = t_bkginc_2d(:,:) * 0.5 * & 
     471                     &       ( 1 + cos( (fsdept(:,:,jk)/z_mld(:,:) ) * rpi ) ) 
     472                      
     473                     t_bkginc(:,:,jk) = t_bkginc(:,:,jk) * bdytmask(:,:)  
     474                  ELSEWHERE  
     475                     t_bkginc(:,:,jk) = 0.  
     476                  ENDWHERE  
     477               ENDDO  
     478#else  
     479               t_bkginc(:,:,:) = 0.  
     480#endif                 
     481               s_bkginc(:,:,:) = 0.  
     482                 
     483               DEALLOCATE(z_mld, t_bkginc_2d)  
     484             
     485            ELSE  
     486                
     487               CALL iom_get( inum, jpdom_autoglo, 'bckint', t_bkginc, 1 ) 
     488               CALL iom_get( inum, jpdom_autoglo, 'bckins', s_bkginc, 1 ) 
     489               ! Apply the masks 
     490               t_bkginc(:,:,:) = t_bkginc(:,:,:) * tmask(:,:,:) 
     491               s_bkginc(:,:,:) = s_bkginc(:,:,:) * tmask(:,:,:) 
     492               ! Set missing increments to 0.0 rather than 1e+20 
     493               ! to allow for differences in masks 
     494               WHERE( ABS( t_bkginc(:,:,:) ) > 1.0e+10 ) t_bkginc(:,:,:) = 0.0 
     495               WHERE( ABS( s_bkginc(:,:,:) ) > 1.0e+10 ) s_bkginc(:,:,:) = 0.0 
     496          
     497            ENDIF 
     498          
    389499         ENDIF 
    390500 
Note: See TracChangeset for help on using the changeset viewer.