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 5948 for branches/2014/dev_r4650_UKMO12_CFL_diags_take2/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90 – NEMO

Ignore:
Timestamp:
2015-11-30T11:47:24+01:00 (8 years ago)
Author:
timgraham
Message:

Merged in head of trunk (r5936)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4650_UKMO12_CFL_diags_take2/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90

    r5947 r5948  
    1818   USE eosbn2          ! equation of state 
    1919   USE sbc_oce         ! surface boundary condition: ocean fields 
     20   USE zdfbfr          ! 
     21   ! 
     22   USE in_out_manager  ! I/O manager 
     23   USE iom             ! I/O manager library 
     24   USE fldread         ! read input field at current time step 
    2025   USE lbclnk          ! 
    21    USE iom             ! I/O manager library 
    22    USE in_out_manager  ! I/O manager 
    2326   USE wrk_nemo        ! Memory allocation 
    2427   USE timing          ! Timing 
    2528   USE lib_fortran     ! glob_sum 
    26    USE zdfbfr 
    27    USE fldread         ! read input field at current time step 
    28  
    29  
    3029 
    3130   IMPLICIT NONE 
    3231   PRIVATE 
    3332 
    34    PUBLIC   sbc_isf, sbc_isf_div, sbc_isf_alloc  ! routine called in sbcmod and divcur 
     33   PUBLIC   sbc_isf, sbc_isf_div, sbc_isf_alloc  ! routine called in sbcmod and divhor 
    3534 
    3635   ! public in order to be able to output then  
     
    5352   REAL(wp)   , PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:)     ::  risfLeff               !:effective length (Leff) BG03 nn_isf==2 
    5453   REAL(wp)   , PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:)     ::  ttbl, stbl, utbl, vtbl !:top boundary layer variable at T point 
    55 #if defined key_agrif 
    56    ! AGRIF can not handle these arrays as integers. The reason is a mystery but problems avoided by declaring them as reals 
    57    REAL(wp),    PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:)     ::  misfkt, misfkb         !:Level of ice shelf base 
    58                                                                                           !: (first wet level and last level include in the tbl) 
    59 #else 
    6054   INTEGER,    PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:)     ::  misfkt, misfkb         !:Level of ice shelf base 
    61 #endif 
    62  
    6355 
    6456   REAL(wp), PUBLIC, SAVE ::   rcpi   = 2000.0_wp     ! phycst ? 
     
    7971#  include "domzgr_substitute.h90" 
    8072   !!---------------------------------------------------------------------- 
    81    !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008) 
     73   !! NEMO/OPA 3.7 , LOCEAN-IPSL (2015) 
    8274   !! $Id$ 
    8375   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    8476   !!---------------------------------------------------------------------- 
    85  
    8677CONTAINS 
    8778  
    88   SUBROUTINE sbc_isf(kt) 
    89     INTEGER, INTENT(in)          ::   kt         ! ocean time step 
    90     INTEGER                      ::   ji, jj, jk, ijkmin, inum, ierror 
    91     INTEGER                      ::   ikt, ikb   ! top and bottom level of the isf boundary layer 
    92     REAL(wp)                     ::   rmin 
    93     REAL(wp)                     ::   zhk 
    94     CHARACTER(len=256)           ::   cfisf, cvarzisf, cvarhisf   ! name for isf file 
    95     CHARACTER(LEN=256)           :: cnameis                     ! name of iceshelf file 
    96     CHARACTER (LEN=32)           :: cvarLeff                    ! variable name for efficient Length scale 
    97     INTEGER           ::   ios           ! Local integer output status for namelist read 
    98       ! 
     79   SUBROUTINE sbc_isf(kt) 
    9980      !!--------------------------------------------------------------------- 
     81      !!                     ***  ROUTINE sbc_isf  *** 
     82      !!--------------------------------------------------------------------- 
     83      INTEGER, INTENT(in)          ::   kt         ! ocean time step 
     84      ! 
     85      INTEGER                      ::   ji, jj, jk, ijkmin, inum, ierror 
     86      INTEGER                      ::   ikt, ikb   ! top and bottom level of the isf boundary layer 
     87      REAL(wp)                     ::   rmin 
     88      REAL(wp)                     ::   zhk 
     89      REAL(wp)                     ::   zt_frz, zpress 
     90      CHARACTER(len=256)           ::   cfisf , cvarzisf, cvarhisf   ! name for isf file 
     91      CHARACTER(LEN=256)           :: cnameis                     ! name of iceshelf file 
     92      CHARACTER (LEN=32)           :: cvarLeff                    ! variable name for efficient Length scale 
     93      INTEGER           ::   ios           ! Local integer output status for namelist read 
     94      !! 
    10095      NAMELIST/namsbc_isf/ nn_isfblk, rn_hisf_tbl, ln_divisf, ln_conserve, rn_gammat0, rn_gammas0, nn_gammablk, & 
    101                          & sn_fwfisf, sn_qisf, sn_rnfisf, sn_depmax_isf, sn_depmin_isf, sn_Leff_isf 
    102       ! 
     96         &                sn_fwfisf, sn_qisf, sn_rnfisf, sn_depmax_isf, sn_depmin_isf, sn_Leff_isf 
     97      !!--------------------------------------------------------------------- 
    10398      ! 
    10499      !                                         ! ====================== ! 
     
    113108902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_isf in configuration namelist', lwp ) 
    114109         IF(lwm) WRITE ( numond, namsbc_isf ) 
    115  
    116110 
    117111         IF ( lwp ) WRITE(numout,*) 
     
    194188         END IF 
    195189          
     190         ! compute bottom level of isf tbl and thickness of tbl below the ice shelf 
    196191         rhisf_tbl_0(:,:) = rhisf_tbl(:,:) 
    197  
    198          ! compute bottom level of isf tbl and thickness of tbl below the ice shelf 
    199192         DO jj = 1,jpj 
    200193            DO ji = 1,jpi 
     
    217210            END DO 
    218211         END DO 
    219           
     212         ! 
    220213      END IF 
    221214 
     
    270263         END IF 
    271264         ! compute tsc due to isf 
    272          ! WARNING water add at temp = 0C, correction term is added in trasbc, maybe better here but need a 3D variable). 
    273          risf_tsc(:,:,jp_tem) = qisf(:,:) * r1_rau0_rcp ! 
     265         ! WARNING water add at temp = 0C, correction term is added, maybe better here but need a 3D variable). 
     266!         zpress = grav*rau0*fsdept(ji,jj,jk)*1.e-04 
     267         zt_frz = -1.9 !eos_fzp( tsn(ji,jj,jk,jp_sal), zpress ) 
     268         risf_tsc(:,:,jp_tem) = qisf(:,:) * r1_rau0_rcp - rdivisf * fwfisf(:,:) * zt_frz * r1_rau0 ! 
    274269          
    275270         ! salt effect already take into account in vertical advection 
    276271         risf_tsc(:,:,jp_sal) = (1.0_wp-rdivisf) * fwfisf(:,:) * stbl(:,:) * r1_rau0 
    277            
     272 
     273         ! output 
     274         IF( iom_use('qisf'  ) )   CALL iom_put('qisf'  , qisf) 
     275         IF( iom_use('fwfisf') )   CALL iom_put('fwfisf', fwfisf * stbl(:,:) / soce ) 
     276 
     277         ! if apply only on the trend and not as a volume flux (rdivisf = 0), fwfisf have to be set to 0 now 
     278         fwfisf(:,:) = rdivisf * fwfisf(:,:)          
     279  
    278280         ! lbclnk 
    279281         CALL lbc_lnk(risf_tsc(:,:,jp_tem),'T',1.) 
     
    295297         ENDIF 
    296298         !  
    297          ! output 
    298          CALL iom_put('qisf'  , qisf) 
    299          IF( iom_use('fwfisf') )   CALL iom_put('fwfisf', fwfisf * stbl(:,:) / soce ) 
    300299      END IF 
    301    
     300      !   
    302301  END SUBROUTINE sbc_isf 
     302 
    303303 
    304304  INTEGER FUNCTION sbc_isf_alloc() 
     
    321321  END FUNCTION 
    322322 
    323   SUBROUTINE sbc_isf_bg03(kt) 
    324    !!========================================================================== 
    325    !!                 *** SUBROUTINE sbcisf_bg03  *** 
    326    !! add net heat and fresh water flux from ice shelf melting 
    327    !! into the adjacent ocean using the parameterisation by 
    328    !! Beckmann and Goosse (2003), "A parameterization of ice shelf-ocean 
    329    !!     interaction for climate models", Ocean Modelling 5(2003) 157-170. 
    330    !!  (hereafter BG) 
    331    !!========================================================================== 
    332    !!---------------------------------------------------------------------- 
    333    !!   sbc_isf_bg03      : routine called from sbcmod 
    334    !!---------------------------------------------------------------------- 
    335    !! 
    336    !! ** Purpose   :   Add heat and fresh water fluxes due to ice shelf melting 
    337    !! ** Reference :   Beckmann et Goosse, 2003, Ocean Modelling 
    338    !! 
    339    !! History : 
    340    !!      !  06-02  (C. Wang) Original code 
    341    !!---------------------------------------------------------------------- 
    342  
    343     INTEGER, INTENT ( in ) :: kt 
    344  
     323 
     324   SUBROUTINE sbc_isf_bg03(kt) 
     325      !!========================================================================== 
     326      !!                 *** SUBROUTINE sbcisf_bg03  *** 
     327      !! add net heat and fresh water flux from ice shelf melting 
     328      !! into the adjacent ocean using the parameterisation by 
     329      !! Beckmann and Goosse (2003), "A parameterization of ice shelf-ocean 
     330      !!     interaction for climate models", Ocean Modelling 5(2003) 157-170. 
     331      !!  (hereafter BG) 
     332      !!========================================================================== 
     333      !!---------------------------------------------------------------------- 
     334      !!   sbc_isf_bg03      : routine called from sbcmod 
     335      !!---------------------------------------------------------------------- 
     336      !! 
     337      !! ** Purpose   :   Add heat and fresh water fluxes due to ice shelf melting 
     338      !! ** Reference :   Beckmann et Goosse, 2003, Ocean Modelling 
     339      !! 
     340      !! History : 
     341      !!      !  06-02  (C. Wang) Original code 
     342      !!---------------------------------------------------------------------- 
     343      INTEGER, INTENT ( in ) :: kt 
     344      ! 
    345345    INTEGER :: ji, jj, jk, jish  !temporary integer 
    346346    INTEGER :: ijkmin 
     
    370370             ! Calculate freezing temperature 
    371371                zpress = grav*rau0*fsdept(ji,jj,ik)*1.e-04  
    372                 zt_frz = eos_fzp(tsb(ji,jj,ik,jp_sal), zpress)  
     372                CALL eos_fzp(tsb(ji,jj,ik,jp_sal), zt_frz, zpress)  
    373373                zt_sum = zt_sum + (tsn(ji,jj,ik,jp_tem)-zt_frz) * fse3t(ji,jj,ik) * tmask(ji,jj,ik)  ! sum temp 
    374374             ENDDO 
     
    386386             qisf(ji,jj) = 0._wp ; fwfisf(ji,jj) = 0._wp 
    387387          END IF 
    388        ENDDO 
    389     ENDDO 
     388       END DO 
     389    END DO 
    390390    ! 
    391391    IF( nn_timing == 1 )  CALL timing_stop('sbc_isf_bg03') 
     392      ! 
    392393  END SUBROUTINE sbc_isf_bg03 
     394 
    393395 
    394396   SUBROUTINE sbc_isf_cav( kt ) 
     
    439441      ! 
    440442      ! 
    441 !CDIR COLLAPSE 
    442443      DO jj = 1, jpj 
    443444         DO ji = 1, jpi 
     
    452453      zti(:,:)=tinsitu( ttbl, stbl, zpress ) 
    453454! Calculate freezing temperature 
    454       zfrz(:,:)=eos_fzp( sss_m(:,:), zpress ) 
     455      CALL eos_fzp( sss_m(:,:), zfrz(:,:), zpress ) 
    455456 
    456457       
     
    472473 
    473474                     nit = nit + 1 
    474                      IF (nit .GE. 100) THEN 
    475                         !WRITE(numout,*) "sbcisf : too many iteration ... ", zhtflx, zhtflx_b,zgammat, rn_gammat0, rn_tfri2, nn_gammablk, ji,jj 
    476                         !WRITE(numout,*) "sbcisf : too many iteration ... ", (zhtflx - zhtflx_b)/zhtflx 
    477                         CALL ctl_stop( 'STOP', 'sbc_isf_hol99 : too many iteration ...' ) 
    478                      END IF 
     475                     IF (nit .GE. 100) CALL ctl_stop( 'STOP', 'sbc_isf_hol99 : too many iteration ...' ) 
     476 
    479477! save gammat and compute zhtflx_b 
    480478                     zgammat2d(ji,jj)=zgammat 
     
    496494 
    497495! More complicated 3 equation thermodynamics as in MITgcm 
    498 !CDIR COLLAPSE 
    499496         DO jj = 2, jpj 
    500497            DO ji = 2, jpi 
     
    565562      ! 
    566563      IF( nn_timing == 1 )  CALL timing_stop('sbc_isf_cav') 
    567  
     564      ! 
    568565   END SUBROUTINE sbc_isf_cav 
     566 
    569567 
    570568   SUBROUTINE sbc_isf_gammats(gt, gs, zqhisf, zqwisf, ji, jj, lit ) 
     
    693691               END IF 
    694692      END IF 
    695  
     693      ! 
    696694   END SUBROUTINE 
     695 
    697696 
    698697   SUBROUTINE sbc_isf_tbl( varin, varout, cptin ) 
     
    756755      IF (cptin == 'T') CALL lbc_lnk(varout,'T',1.) 
    757756      IF (cptin == 'U' .OR. cptin == 'V') CALL lbc_lnk(varout,'T',-1.) 
    758  
     757      ! 
    759758   END SUBROUTINE sbc_isf_tbl 
    760759       
     
    794793               ! test on tmask useless ????? 
    795794               DO jk = ikt, mbkt(ji,jj) 
    796 !                  IF ( (SUM(fse3t(ji,jj,ikt:jk-1)) .LT. rhisf_tbl(ji,jj)) .AND. (tmask(ji,jj,jk) == 1) ) ikb = jk 
     795                  IF ( (SUM(fse3t(ji,jj,ikt:jk-1)) .LT. rhisf_tbl(ji,jj)) .AND. (tmask(ji,jj,jk) == 1) ) ikb = jk 
    797796               END DO 
    798797               rhisf_tbl(ji,jj) = MIN(rhisf_tbl(ji,jj), SUM(fse3t(ji,jj,ikt:ikb)))  ! limit the tbl to water thickness. 
     
    823822      ! 
    824823   END SUBROUTINE sbc_isf_div 
    825                          
     824 
     825 
    826826   FUNCTION tinsitu( ptem, psal, ppress ) RESULT( pti ) 
    827827      !!---------------------------------------------------------------------- 
     
    874874      ! 
    875875   END FUNCTION tinsitu 
    876    ! 
     876 
     877 
    877878   FUNCTION fsatg( pfps, pfpt, pfphp ) 
    878879      !!---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.