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 5260 for branches/2014/dev_r4650_UKMO10_Tidally_Meaned_Diagnostics/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90 – NEMO

Ignore:
Timestamp:
2015-05-12T12:37:15+02:00 (9 years ago)
Author:
deazer
Message:

Merged branch with Trunk at revision 5253.
Checked with SETTE, passes modified iodef.xml for AMM12 experiment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4650_UKMO10_Tidally_Meaned_Diagnostics/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90

    r4624 r5260  
    5656    LOGICAL, PUBLIC, PARAMETER :: lk_asminc = .FALSE.  !: No assimilation increments 
    5757#endif 
    58    LOGICAL, PUBLIC :: ln_bkgwri     !: No output of the background state fields 
    59    LOGICAL, PUBLIC :: ln_asmiau     !: No applying forcing with an assimilation increment 
    60    LOGICAL, PUBLIC :: ln_asmdin     !: No direct initialization 
    61    LOGICAL, PUBLIC :: ln_trainc     !: No tracer (T and S) assimilation increments 
    62    LOGICAL, PUBLIC :: ln_dyninc     !: No dynamics (u and v) assimilation increments 
    63    LOGICAL, PUBLIC :: ln_sshinc     !: No sea surface height assimilation increment 
    64    LOGICAL, PUBLIC :: ln_seaiceinc  !: No sea ice concentration increment 
    65    LOGICAL, PUBLIC :: ln_salfix     !: Apply minimum salinity check 
     58   LOGICAL, PUBLIC :: ln_bkgwri = .FALSE.      !: No output of the background state fields 
     59   LOGICAL, PUBLIC :: ln_asmiau = .FALSE.      !: No applying forcing with an assimilation increment 
     60   LOGICAL, PUBLIC :: ln_asmdin = .FALSE.      !: No direct initialization 
     61   LOGICAL, PUBLIC :: ln_trainc = .FALSE.      !: No tracer (T and S) assimilation increments 
     62   LOGICAL, PUBLIC :: ln_dyninc = .FALSE.      !: No dynamics (u and v) assimilation increments 
     63   LOGICAL, PUBLIC :: ln_sshinc = .FALSE.      !: No sea surface height assimilation increment 
     64   LOGICAL, PUBLIC :: ln_seaiceinc             !: No sea ice concentration increment 
     65   LOGICAL, PUBLIC :: ln_salfix = .FALSE.      !: Apply minimum salinity check 
    6666   LOGICAL, PUBLIC :: ln_temnofreeze = .FALSE. !: Don't allow the temperature to drop below freezing 
    67    INTEGER, PUBLIC :: nn_divdmp     !: Apply divergence damping filter nn_divdmp times 
     67   INTEGER, PUBLIC :: nn_divdmp                !: Apply divergence damping filter nn_divdmp times 
    6868 
    6969   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE ::   t_bkg   , s_bkg      !: Background temperature and salinity 
     
    109109      !! ** Action  :  
    110110      !!---------------------------------------------------------------------- 
    111       INTEGER :: ji, jj, jk 
    112       INTEGER :: jt 
    113       INTEGER :: imid 
    114       INTEGER :: inum 
     111      INTEGER :: ji, jj, jk, jt  ! dummy loop indices 
     112      INTEGER :: imid, inum      ! local integers 
     113      INTEGER :: ios             ! Local integer output status for namelist read 
    115114      INTEGER :: iiauper         ! Number of time steps in the IAU period 
    116115      INTEGER :: icycper         ! Number of time steps in the cycle 
     
    120119      INTEGER :: iitiaustr_date  ! Date YYYYMMDD of IAU interval start time step 
    121120      INTEGER :: iitiaufin_date  ! Date YYYYMMDD of IAU interval final time step 
    122       INTEGER :: ios             ! Local integer output status for namelist read 
    123  
     121      ! 
    124122      REAL(wp) :: znorm        ! Normalization factor for IAU weights 
    125       REAL(wp) :: ztotwgt      ! Value of time-integrated IAU weights  
    126                                ! (should be equal to one) 
     123      REAL(wp) :: ztotwgt      ! Value of time-integrated IAU weights (should be equal to one) 
    127124      REAL(wp) :: z_inc_dateb  ! Start date of interval on which increment is valid 
    128125      REAL(wp) :: z_inc_datef  ! End date of interval on which increment is valid 
    129126      REAL(wp) :: zdate_bkg    ! Date in background state file for DI 
    130127      REAL(wp) :: zdate_inc    ! Time axis in increments file 
    131  
    132       REAL(wp), POINTER, DIMENSION(:,:) :: hdiv 
     128      ! 
     129      REAL(wp), POINTER, DIMENSION(:,:) ::   hdiv   ! 2D workspace 
    133130      !! 
    134131      NAMELIST/nam_asminc/ ln_bkgwri,                                      & 
     
    136133         &                 ln_asmdin, ln_asmiau,                           & 
    137134         &                 nitbkg, nitdin, nitiaustr, nitiaufin, niaufn,   & 
    138          &                 ln_salfix, salfixmin,                & 
    139          &                 nn_divdmp 
     135         &                 ln_salfix, salfixmin, nn_divdmp 
    140136      !!---------------------------------------------------------------------- 
    141137 
     
    143139      ! Read Namelist nam_asminc : assimilation increment interface 
    144140      !----------------------------------------------------------------------- 
    145  
    146141      ln_seaiceinc = .FALSE. 
    147142      ln_temnofreeze = .FALSE. 
     
    186181      icycper = nitend      - nit000      + 1  ! Cycle interval length 
    187182 
    188       ! Date of final time step 
    189       CALL calc_date( nit000, nitend, ndate0, iitend_date ) 
    190  
    191       ! Background time for Jb referenced to ndate0 
    192       CALL calc_date( nit000, nitbkg_r, ndate0, iitbkg_date ) 
    193  
    194       ! Background time for DI referenced to ndate0 
    195       CALL calc_date( nit000, nitdin_r, ndate0, iitdin_date ) 
    196  
    197       ! IAU start time referenced to ndate0 
    198       CALL calc_date( nit000, nitiaustr_r, ndate0, iitiaustr_date ) 
    199  
    200       ! IAU end time referenced to ndate0 
    201       CALL calc_date( nit000, nitiaufin_r, ndate0, iitiaufin_date ) 
    202  
     183      CALL calc_date( nit000, nitend     , ndate0, iitend_date    )     ! Date of final time step 
     184      CALL calc_date( nit000, nitbkg_r   , ndate0, iitbkg_date    )     ! Background time for Jb referenced to ndate0 
     185      CALL calc_date( nit000, nitdin_r   , ndate0, iitdin_date    )     ! Background time for DI referenced to ndate0 
     186      CALL calc_date( nit000, nitiaustr_r, ndate0, iitiaustr_date )     ! IAU start time referenced to ndate0 
     187      CALL calc_date( nit000, nitiaufin_r, ndate0, iitiaufin_date )     ! IAU end time referenced to ndate0 
     188      ! 
    203189      IF(lwp) THEN 
    204190         WRITE(numout,*) 
     
    237223         &                ' Inconsistent options') 
    238224 
    239       IF ( ( ln_bkgwri ).AND.( ( ln_asmdin ).OR.( ln_asmiau ) ) )  & 
    240          & CALL ctl_stop( ' ln_bkgwri and either ln_asmdin or ln_asmiau are set to .true.:', & 
    241          &                ' The background state must be written before applying the increments') 
    242  
    243225      IF ( ( niaufn /= 0 ).AND.( niaufn /= 1 ) ) & 
    244226         & CALL ctl_stop( ' niaufn /= 0 or niaufn /=1 :',  & 
     
    675657      ! used to prevent the applied increments taking the temperature below the local freezing point  
    676658 
    677       DO jk=1, jpkm1 
    678          fzptnz (:,:,jk) = tfreez( tsn(:,:,jk,jp_sal), fsdept(:,:,jk) ) 
    679       ENDDO 
     659      DO jk = 1, jpkm1 
     660         fzptnz(:,:,jk) = eos_fzp( tsn(:,:,jk,jp_sal), fsdept(:,:,jk) ) 
     661      END DO 
    680662 
    681663      IF ( ln_asmiau ) THEN 
     
    692674            IF(lwp) THEN 
    693675               WRITE(numout,*)  
    694                WRITE(numout,*) 'tra_asm_inc : Tracer IAU at time step = ', & 
    695                   &  kt,' with IAU weight = ', wgtiau(it) 
     676               WRITE(numout,*) 'tra_asm_inc : Tracer IAU at time step = ', kt,' with IAU weight = ', wgtiau(it) 
    696677               WRITE(numout,*) '~~~~~~~~~~~~' 
    697678            ENDIF 
     
    741722            IF (ln_temnofreeze) THEN 
    742723               ! Do not apply negative increments if the temperature will fall below freezing 
    743                WHERE(t_bkginc(:,:,:) > 0.0_wp .OR. & 
    744                   &   tsn(:,:,:,jp_tem) + t_bkginc(:,:,:) > fzptnz(:,:,:) )  
     724               WHERE( t_bkginc(:,:,:) > 0.0_wp .OR. tsn(:,:,:,jp_tem) + t_bkginc(:,:,:) > fzptnz(:,:,:) )  
    745725                  tsn(:,:,:,jp_tem) = t_bkg(:,:,:) + t_bkginc(:,:,:)    
    746726               END WHERE 
     
    751731               ! Do not apply negative increments if the salinity will fall below a specified 
    752732               ! minimum value salfixmin 
    753                WHERE(s_bkginc(:,:,:) > 0.0_wp .OR. & 
    754                   &   tsn(:,:,:,jp_sal) + s_bkginc(:,:,:) > salfixmin )  
     733               WHERE( s_bkginc(:,:,:) > 0.0_wp .OR. tsn(:,:,:,jp_sal) + s_bkginc(:,:,:) > salfixmin )  
    755734                  tsn(:,:,:,jp_sal) = s_bkg(:,:,:) + s_bkginc(:,:,:)    
    756735               END WHERE 
     
    759738            ENDIF 
    760739 
    761             tsb(:,:,:,:) = tsn(:,:,:,:)               ! Update before fields 
    762  
    763             CALL eos( tsb, rhd, rhop, gdept_0(:,:,:) )                ! Before potential and in situ densities 
    764           
    765             IF( ln_zps .AND. .NOT. lk_c1d ) & 
    766                &  CALL zps_hde( nit000, jpts, tsb, &  ! Partial steps: before horizontal derivative 
    767                &                gtsu, gtsv, rhd,   &  ! of T, S, rd at the bottom ocean level 
    768                &                gru , grv ) 
     740            tsb(:,:,:,:) = tsn(:,:,:,:)                 ! Update before fields 
     741 
     742            CALL eos( tsb, rhd, rhop, gdept_0(:,:,:) )  ! Before potential and in situ densities 
     743!!gm  fabien 
     744!            CALL eos( tsb, rhd, rhop )                ! Before potential and in situ densities 
     745!!gm 
     746 
     747 
     748            IF( ln_zps .AND. .NOT. lk_c1d .AND. .NOT. ln_isfcav)      & 
     749               &  CALL zps_hde    ( kt, jpts, tsb, gtsu, gtsv,        &  ! Partial steps: before horizontal gradient 
     750               &                              rhd, gru , grv          )  ! of t, s, rd at the last ocean level 
     751            IF( ln_zps .AND. .NOT. lk_c1d .AND.       ln_isfcav)      & 
     752               &  CALL zps_hde_isf( nit000, jpts, tsb, gtsu, gtsv,    &    ! Partial steps for top cell (ISF) 
     753               &                                  rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv ,   & 
     754               &                           gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi    ) ! of t, s, rd at the last ocean level 
    769755 
    770756#if defined key_zdfkpp 
    771757            CALL eos( tsn, rhd, fsdept_n(:,:,:) )                      ! Compute rhd 
     758!!gm fabien            CALL eos( tsn, rhd )                      ! Compute rhd 
    772759#endif 
    773760 
Note: See TracChangeset for help on using the changeset viewer.