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 3764 for branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90 – NEMO

Ignore:
Timestamp:
2013-01-23T15:33:04+01:00 (11 years ago)
Author:
smasson
Message:

dev_MERGE_2012: report bugfixes done in the trunk from r3555 to r3763 into dev_MERGE_2012

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2012/dev_MERGE_2012/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90

    r3680 r3764  
    66   !! History :  OPA  ! 2000-11  (R. Hordoir, E. Durand)  NetCDF FORMAT 
    77   !!   NEMO     1.0  ! 2002-09  (G. Madec)  F90: Free form and module 
    8    !!            3.0  ! 2006-07  (G. Madec)  Surface module  
     8   !!            3.0  ! 2006-07  (G. Madec)  Surface module 
    99   !!            3.2  ! 2009-04  (B. Lemaire)  Introduce iom_put 
    1010   !!            3.3  ! 2010-10  (R. Furner, G. Madec) runoff distributed over ocean levels 
     
    3131   PUBLIC   sbc_rnf_div   ! routine called in sshwzv module 
    3232   PUBLIC   sbc_rnf_alloc ! routine call in sbcmod module 
    33  
     33   PUBLIC   sbc_rnf_init  ! (PUBLIC for TAM) 
    3434   !                                                     !!* namsbc_rnf namelist * 
    3535   CHARACTER(len=100), PUBLIC ::   cn_dir       = './'    !: Root directory for location of ssr files 
    3636   LOGICAL           , PUBLIC ::   ln_rnf_depth = .false. !: depth       river runoffs attribute specified in a file 
    37    LOGICAL           , PUBLIC ::   ln_rnf_tem   = .false. !: temperature river runoffs attribute specified in a file  
    38    LOGICAL           , PUBLIC ::   ln_rnf_sal   = .false. !: salinity    river runoffs attribute specified in a file  
     37   LOGICAL           , PUBLIC ::   ln_rnf_tem   = .false. !: temperature river runoffs attribute specified in a file 
     38   LOGICAL           , PUBLIC ::   ln_rnf_sal   = .false. !: salinity    river runoffs attribute specified in a file 
    3939   LOGICAL           , PUBLIC ::   ln_rnf_emp   = .false. !: runoffs into a file to be read or already into precipitation 
    4040   TYPE(FLD_N)       , PUBLIC ::   sn_rnf                 !: information about the runoff file to be read 
    4141   TYPE(FLD_N)       , PUBLIC ::   sn_cnf                 !: information about the runoff mouth file to be read 
    42    TYPE(FLD_N)                ::   sn_s_rnf               !: information about the salinities of runoff file to be read   
    43    TYPE(FLD_N)                ::   sn_t_rnf               !: information about the temperatures of runoff file to be read   
     42   TYPE(FLD_N)                ::   sn_s_rnf               !: information about the salinities of runoff file to be read 
     43   TYPE(FLD_N)                ::   sn_t_rnf               !: information about the temperatures of runoff file to be read 
    4444   TYPE(FLD_N)                ::   sn_dep_rnf             !: information about the depth which river inflow affects 
    4545   LOGICAL           , PUBLIC ::   ln_rnf_mouth = .false. !: specific treatment in mouths vicinity 
     
    5353   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   h_rnf               !: depth of runoff in m 
    5454   INTEGER,  PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   nk_rnf              !: depth of runoff in model levels 
    55    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   rnf_tsc_b, rnf_tsc  !: before and now T & S runoff contents   [K.m/s & PSU.m/s] 
    56     
     55   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   rnf_tsc_b, rnf_tsc  !: before and now T & S runoff contents   [K.m/s & PSU.m/s]    
    5756 
    5857   TYPE(FLD), PUBLIC, ALLOCATABLE, DIMENSION(:) ::   sf_rnf       ! structure: river runoff (file information, fields read) 
     
    8584      !!---------------------------------------------------------------------- 
    8685      !!                  ***  ROUTINE sbc_rnf  *** 
    87       !!        
     86      !! 
    8887      !! ** Purpose :   Introduce a climatological run off forcing 
    8988      !! 
    90       !! ** Method  :   Set each river mouth with a monthly climatology  
     89      !! ** Method  :   Set each river mouth with a monthly climatology 
    9190      !!                provided from different data. 
    9291      !!                CAUTION : upward water flux, runoff forced to be < 0 
     
    9897      INTEGER  ::   ji, jj   ! dummy loop indices 
    9998      !!---------------------------------------------------------------------- 
    100       !                                    
     99      ! 
    101100      IF( kt == nit000 )   CALL sbc_rnf_init                           ! Read namelist and allocate structures 
    102101 
     
    113112         !                                                !-------------------! 
    114113         ! 
    115                              CALL fld_read ( kt, nn_fsbc, sf_rnf   )    ! Read Runoffs data and provide it at kt  
     114                             CALL fld_read ( kt, nn_fsbc, sf_rnf   )    ! Read Runoffs data and provide it at kt 
    116115         IF( ln_rnf_tem  )   CALL fld_read ( kt, nn_fsbc, sf_t_rnf )    ! idem for runoffs temperature if required 
    117116         IF( ln_rnf_sal  )   CALL fld_read ( kt, nn_fsbc, sf_s_rnf )    ! idem for runoffs salinity    if required 
     
    132131            IF( ln_rnf_tem ) THEN                                       ! use runoffs temperature data 
    133132               rnf_tsc(:,:,jp_tem) = ( sf_t_rnf(1)%fnow(:,:,1) ) * rnf(:,:) * r1_rau0 
    134                WHERE( sf_t_rnf(1)%fnow(:,:,1) == -999 )                 ! if missing data value use SST as runoffs temperature   
     133               WHERE( sf_t_rnf(1)%fnow(:,:,1) == -999 )                 ! if missing data value use SST as runoffs temperature 
    135134                   rnf_tsc(:,:,jp_tem) = sst_m(:,:) * rnf(:,:) * r1_rau0 
    136135               END WHERE 
    137136            ELSE                                                        ! use SST as runoffs temperature 
    138137               rnf_tsc(:,:,jp_tem) = sst_m(:,:) * rnf(:,:) * r1_rau0 
    139             ENDIF   
    140             !                                                           ! use runoffs salinity data  
     138            ENDIF 
     139            !                                                           ! use runoffs salinity data 
    141140            IF( ln_rnf_sal )   rnf_tsc(:,:,jp_sal) = ( sf_s_rnf(1)%fnow(:,:,1) ) * rnf(:,:) * r1_rau0 
    142141            !                                                           ! else use S=0 for runoffs (done one for all in the init) 
    143142            ! 
    144143            IF( ln_rnf_tem .OR. ln_rnf_sal ) THEN                 ! runoffs as outflow: use ocean SST and SSS 
    145                WHERE( rnf(:,:) < 0._wp )                                 ! example baltic model when flow is out of domain  
     144               WHERE( rnf(:,:) < 0._wp )                                 ! example baltic model when flow is out of domain 
    146145                  rnf_tsc(:,:,jp_tem) = sst_m(:,:) * rnf(:,:) * r1_rau0 
    147146                  rnf_tsc(:,:,jp_sal) = sss_m(:,:) * rnf(:,:) * r1_rau0 
     
    157156         !                                             ! ---------------------------------------- ! 
    158157         IF( ln_rstart .AND.    &                               !* Restart: read in restart file 
    159             & iom_varid( numror, 'rnf_b', ldstop = .FALSE. ) > 0 ) THEN  
     158            & iom_varid( numror, 'rnf_b', ldstop = .FALSE. ) > 0 ) THEN 
    160159            IF(lwp) WRITE(numout,*) '          nit000-1 runoff forcing fields red in the restart file' 
    161160            CALL iom_get( numror, jpdom_autoglo, 'rnf_b', rnf_b )     ! before runoff 
     
    164163         ELSE                                                   !* no restart: set from nit000 values 
    165164            IF(lwp) WRITE(numout,*) '          nit000-1 runoff forcing fields set to nit000' 
    166              rnf_b    (:,:  ) = rnf    (:,:  )   
    167              rnf_tsc_b(:,:,:) = rnf_tsc(:,:,:)    
     165             rnf_b    (:,:  ) = rnf    (:,:  ) 
     166             rnf_tsc_b(:,:,:) = rnf_tsc(:,:,:) 
    168167         ENDIF 
    169168      ENDIF 
     
    186185      !!---------------------------------------------------------------------- 
    187186      !!                  ***  ROUTINE sbc_rnf  *** 
    188       !!        
     187      !! 
    189188      !! ** Purpose :   update the horizontal divergence with the runoff inflow 
    190189      !! 
    191       !! ** Method  :    
    192       !!                CAUTION : rnf is positive (inflow) decreasing the  
     190      !! ** Method  : 
     191      !!                CAUTION : rnf is positive (inflow) decreasing the 
    193192      !!                          divergence and expressed in m/s 
    194193      !! 
     
    204203      ! 
    205204      IF( ln_rnf_depth ) THEN      !==   runoff distributed over several levels   ==! 
    206          IF( lk_vvl ) THEN             ! variable volume case  
     205         IF( lk_vvl ) THEN             ! variable volume case 
    207206            DO jj = 1, jpj                   ! update the depth over which runoffs are distributed 
    208207               DO ji = 1, jpi 
    209                   h_rnf(ji,jj) = 0._wp  
     208                  h_rnf(ji,jj) = 0._wp 
    210209                  DO jk = 1, nk_rnf(ji,jj)                           ! recalculates h_rnf to be the depth in metres 
    211                      h_rnf(ji,jj) = h_rnf(ji,jj) + fse3t(ji,jj,jk)   ! to the bottom of the relevant grid box  
    212                   END DO  
     210                     h_rnf(ji,jj) = h_rnf(ji,jj) + fse3t(ji,jj,jk)   ! to the bottom of the relevant grid box 
     211                  END DO 
    213212                  !                          ! apply the runoff input flow 
    214213                  DO jk = 1, nk_rnf(ji,jj) 
     
    246245      !! ** Action  : - read parameters 
    247246      !!---------------------------------------------------------------------- 
    248       CHARACTER(len=32) ::   rn_dep_file   ! runoff file name   
     247      CHARACTER(len=32) ::   rn_dep_file   ! runoff file name 
    249248      INTEGER           ::   ji, jj, jk    ! dummy loop indices 
    250249      INTEGER           ::   ierror, inum  ! temporary integer 
    251250      ! 
    252251      NAMELIST/namsbc_rnf/ cn_dir, ln_rnf_emp, ln_rnf_depth, ln_rnf_tem, ln_rnf_sal,   & 
    253          &                 sn_rnf, sn_cnf    , sn_s_rnf    , sn_t_rnf  , sn_dep_rnf,   &   
    254          &                 ln_rnf_mouth      , rn_hrnf     , rn_avt_rnf, rn_rfact   
     252         &                 sn_rnf, sn_cnf    , sn_s_rnf    , sn_t_rnf  , sn_dep_rnf,   & 
     253         &                 ln_rnf_mouth      , rn_hrnf     , rn_avt_rnf, rn_rfact 
    255254      !!---------------------------------------------------------------------- 
    256255      ! 
     
    264263      sn_cnf = FLD_N( 'runoffs',     0     , 'sorunoff' ,  .FALSE.   , .true. ,   'yearly'  , ''       , ''         ) 
    265264 
    266       sn_s_rnf = FLD_N( 'runoffs',  24.  , 'rosaline' ,  .TRUE.    , .true. ,   'yearly'  , ''    , ''  )   
    267       sn_t_rnf = FLD_N( 'runoffs',  24.  , 'rotemper' ,  .TRUE.    , .true. ,   'yearly'  , ''    , ''  )   
    268       sn_dep_rnf = FLD_N( 'runoffs',   0.  , 'rodepth'  ,  .FALSE.   , .true. ,   'yearly'  , ''    , ''  )   
     265      sn_s_rnf = FLD_N( 'runoffs',  24.  , 'rosaline' ,  .TRUE.    , .true. ,   'yearly'  , ''    , ''  ) 
     266      sn_t_rnf = FLD_N( 'runoffs',  24.  , 'rotemper' ,  .TRUE.    , .true. ,   'yearly'  , ''    , ''  ) 
     267      sn_dep_rnf = FLD_N( 'runoffs',   0.  , 'rodepth'  ,  .FALSE.   , .true. ,   'yearly'  , ''    , ''  ) 
    269268      ! 
    270269      REWIND ( numnam )                         ! Read Namelist namsbc_rnf 
     
    281280         WRITE(numout,*) '      river mouth additional Kz                  rn_avt_rnf   = ', rn_avt_rnf 
    282281         WRITE(numout,*) '      depth of river mouth additional mixing     rn_hrnf      = ', rn_hrnf 
    283          WRITE(numout,*) '      multiplicative factor for runoff           rn_rfact     = ', rn_rfact     
     282         WRITE(numout,*) '      multiplicative factor for runoff           rn_rfact     = ', rn_rfact 
    284283      ENDIF 
    285284      ! 
     
    294293         IF(lwp) WRITE(numout,*) '          runoffs directly provided in the precipitations' 
    295294         IF( ln_rnf_depth .OR. ln_rnf_tem .OR. ln_rnf_sal ) THEN 
    296            CALL ctl_warn( 'runoffs already included in precipitations, so runoff (T,S, depth) attributes will not be used' )  
     295           CALL ctl_warn( 'runoffs already included in precipitations, so runoff (T,S, depth) attributes will not be used' ) 
    297296           ln_rnf_depth = .FALSE.   ;   ln_rnf_tem = .FALSE.   ;   ln_rnf_sal = .FALSE. 
    298297         ENDIF 
     
    320319            ALLOCATE( sf_t_rnf(1)%fnow(jpi,jpj,1)   ) 
    321320            IF( sn_t_rnf%ln_tint ) ALLOCATE( sf_t_rnf(1)%fdta(jpi,jpj,1,2) ) 
    322             CALL fld_fill (sf_t_rnf, (/ sn_t_rnf /), cn_dir, 'sbc_rnf_init', 'read runoff temperature data', 'namsbc_rnf' )   
     321            CALL fld_fill (sf_t_rnf, (/ sn_t_rnf /), cn_dir, 'sbc_rnf_init', 'read runoff temperature data', 'namsbc_rnf' ) 
    323322         ENDIF 
    324323         ! 
     
    332331            ALLOCATE( sf_s_rnf(1)%fnow(jpi,jpj,1)   ) 
    333332            IF( sn_s_rnf%ln_tint ) ALLOCATE( sf_s_rnf(1)%fdta(jpi,jpj,1,2) ) 
    334             CALL fld_fill (sf_s_rnf, (/ sn_s_rnf /), cn_dir, 'sbc_rnf_init', 'read runoff salinity data', 'namsbc_rnf' )   
    335          ENDIF 
    336          ! 
    337          IF( ln_rnf_depth ) THEN                    ! depth of runoffs set from a file  
     333            CALL fld_fill (sf_s_rnf, (/ sn_s_rnf /), cn_dir, 'sbc_rnf_init', 'read runoff salinity data', 'namsbc_rnf' ) 
     334         ENDIF 
     335         ! 
     336         IF( ln_rnf_depth ) THEN                    ! depth of runoffs set from a file 
    338337            IF(lwp) WRITE(numout,*) 
    339338            IF(lwp) WRITE(numout,*) '          runoffs depth read in a file' 
    340             rn_dep_file = TRIM( cn_dir )//TRIM( sn_dep_rnf%clname )   
    341             CALL iom_open ( rn_dep_file, inum )                           ! open file   
    342             CALL iom_get  ( inum, jpdom_data, sn_dep_rnf%clvar, h_rnf )   ! read the river mouth array   
    343             CALL iom_close( inum )                                        ! close file   
     339            rn_dep_file = TRIM( cn_dir )//TRIM( sn_dep_rnf%clname ) 
     340            CALL iom_open ( rn_dep_file, inum )                           ! open file 
     341            CALL iom_get  ( inum, jpdom_data, sn_dep_rnf%clvar, h_rnf )   ! read the river mouth array 
     342            CALL iom_close( inum )                                        ! close file 
    344343            ! 
    345344            nk_rnf(:,:) = 0                               ! set the number of level over which river runoffs are applied 
    346             DO jj = 1, jpj   
    347                DO ji = 1, jpi   
    348                   IF( h_rnf(ji,jj) > 0._wp ) THEN   
    349                      jk = 2   
    350                      DO WHILE ( jk /= mbkt(ji,jj) .AND. fsdept(ji,jj,jk) < h_rnf(ji,jj) ) ;  jk = jk + 1 ;  END DO   
    351                      nk_rnf(ji,jj) = jk   
    352                   ELSEIF( h_rnf(ji,jj) == -1   ) THEN   ;  nk_rnf(ji,jj) = 1   
    353                   ELSEIF( h_rnf(ji,jj) == -999 ) THEN   ;  nk_rnf(ji,jj) = mbkt(ji,jj) 
    354                   ELSEIF( h_rnf(ji,jj) /=  0   ) THEN   
    355                      CALL ctl_stop( 'runoff depth not positive, and not -999 or -1, rnf value in file fort.999'  )   
    356                      WRITE(999,*) 'ji, jj, rnf(ji,jj) :', ji, jj, rnf(ji,jj)   
    357                   ENDIF   
    358                END DO   
    359             END DO   
    360             DO jj = 1, jpj                                ! set the associated depth  
    361                DO ji = 1, jpi  
     345            DO jj = 1, jpj 
     346               DO ji = 1, jpi 
     347                  IF( h_rnf(ji,jj) > 0._wp ) THEN 
     348                     jk = 2 
     349                     DO WHILE ( jk /= mbkt(ji,jj) .AND. fsdept(ji,jj,jk) < h_rnf(ji,jj) ) ;  jk = jk + 1 ;  END DO 
     350                     nk_rnf(ji,jj) = jk 
     351                  ELSEIF( h_rnf(ji,jj) == -1._wp   ) THEN   ;  nk_rnf(ji,jj) = 1 
     352                  ELSEIF( h_rnf(ji,jj) == -999._wp ) THEN   ;  nk_rnf(ji,jj) = mbkt(ji,jj) 
     353                  ELSE 
     354                     CALL ctl_stop( 'runoff depth not positive, and not -999 or -1, rnf value in file fort.999'  ) 
     355                     WRITE(999,*) 'ji, jj, rnf(ji,jj) :', ji, jj, rnf(ji,jj) 
     356                  ENDIF 
     357               END DO 
     358            END DO 
     359            DO jj = 1, jpj                                ! set the associated depth 
     360               DO ji = 1, jpi 
    362361                  h_rnf(ji,jj) = 0._wp 
    363                   DO jk = 1, nk_rnf(ji,jj)                         
    364                      h_rnf(ji,jj) = h_rnf(ji,jj) + fse3t(ji,jj,jk)   
     362                  DO jk = 1, nk_rnf(ji,jj) 
     363                     h_rnf(ji,jj) = h_rnf(ji,jj) + fse3t(ji,jj,jk) 
    365364                  END DO 
    366365               END DO 
    367366            END DO 
    368          ELSE                                       ! runoffs applied at the surface  
    369             nk_rnf(:,:) = 1   
     367         ELSE                                       ! runoffs applied at the surface 
     368            nk_rnf(:,:) = 1 
    370369            h_rnf (:,:) = fse3t(:,:,1) 
    371          ENDIF   
    372          !  
     370         ENDIF 
     371         ! 
    373372      ENDIF 
    374373      ! 
     
    386385         ! 
    387386         IF ( ln_rnf_depth )   CALL ctl_warn( 'sbc_rnf_init: increased mixing turned on but effects may already',   & 
    388             &                                              'be spread through depth by ln_rnf_depth'               )  
     387            &                                              'be spread through depth by ln_rnf_depth'               ) 
    389388         ! 
    390389         nkrnf = 0                                  ! Number of level over which Kz increase 
     
    406405         IF(lwp) WRITE(numout,*) 
    407406         IF(lwp) WRITE(numout,*) '          No specific treatment at river mouths' 
    408          rnfmsk  (:,:) = 0._wp  
     407         rnfmsk  (:,:) = 0._wp 
    409408         rnfmsk_z(:)   = 0._wp 
    410409         nkrnf = 0 
     
    417416      !!---------------------------------------------------------------------- 
    418417      !!                  ***  ROUTINE rnf_mouth  *** 
    419       !!        
     418      !! 
    420419      !! ** Purpose :   define the river mouths mask 
    421420      !! 
    422421      !! ** Method  :   read the river mouth mask (=0/1) in the river runoff 
    423       !!                climatological file. Defined a given vertical structure.  
    424       !!                CAUTION, the vertical structure is hard coded on the  
     422      !!                climatological file. Defined a given vertical structure. 
     423      !!                CAUTION, the vertical structure is hard coded on the 
    425424      !!                first 5 levels. 
    426425      !!                This fields can be used to: 
    427       !!                 - set an upstream advection scheme   
     426      !!                 - set an upstream advection scheme 
    428427      !!                   (ln_rnf_mouth=T and ln_traadv_cen2=T) 
    429       !!                 - increase vertical on the top nn_krnf vertical levels  
     428      !!                 - increase vertical on the top nn_krnf vertical levels 
    430429      !!                   at river runoff input grid point (nn_krnf>=2, see step.F90) 
    431430      !!                 - set to zero SSS restoring flux at river mouth grid points 
     
    437436      CHARACTER(len=140) ::   cl_rnfile   ! runoff file name 
    438437      !!---------------------------------------------------------------------- 
    439       !  
     438      ! 
    440439      IF(lwp) WRITE(numout,*) 
    441440      IF(lwp) WRITE(numout,*) 'rnf_mouth : river mouth mask' 
     
    454453      IF( nn_closea == 1 )   CALL clo_rnf( rnfmsk )               ! closed sea inflow set as ruver mouth 
    455454      ! 
    456       rnfmsk_z(:)   = 0._wp                                       ! vertical structure  
     455      rnfmsk_z(:)   = 0._wp                                       ! vertical structure 
    457456      rnfmsk_z(1)   = 1.0 
    458457      rnfmsk_z(2)   = 1.0                                         ! ********** 
     
    460459      rnfmsk_z(4)   = 0.25                                        ! ********** 
    461460      rnfmsk_z(5)   = 0.125 
    462       !          
     461      ! 
    463462   END SUBROUTINE rnf_mouth 
    464     
     463 
    465464   !!====================================================================== 
    466465END MODULE sbcrnf 
Note: See TracChangeset for help on using the changeset viewer.