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 1116 for trunk/NEMO/OPA_SRC/SBC/sbcrnf.F90 – NEMO

Ignore:
Timestamp:
2008-06-20T16:11:57+02:00 (16 years ago)
Author:
ctlod
Message:

trunk: clarify tha way to manage the runoffs fileds, see ticket: #162

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMO/OPA_SRC/SBC/sbcrnf.F90

    r920 r1116  
    1111   !!---------------------------------------------------------------------- 
    1212   !!   sbc_rnf      : monthly runoffs read in a NetCDF file 
     13   !!   sbc_rnf_init : runoffs initialisation 
    1314   !!   rnf_mouth    : set river mouth mask 
    1415   !!---------------------------------------------------------------------- 
     
    2829 
    2930   !! * namsbc_rnf namelist 
    30    CHARACTER(len=100), PUBLIC ::   cn_dir     = './'    !: Root directory for location of ssr files 
    31    INTEGER           , PUBLIC ::   nn_runoff  = 1       !: runoffs flag 
    32    REAL(wp)          , PUBLIC ::   rn_hrnf    = 0.e0    !: runoffs, depth over which enhanced vertical mixing is used 
    33    REAL(wp)          , PUBLIC ::   rn_avt_rnf = 0.e0    !: runoffs, value of the additional vertical mixing coef. [m2/s] 
    34    TYPE(FLD_N)       , PUBLIC ::   sn_rnf               !: information about the runoff file to be read 
    35    TYPE(FLD_N)       , PUBLIC ::   sn_cnf               !: information about the runoff mouth file to be read 
     31   CHARACTER(len=100), PUBLIC ::   cn_dir       = './'    !: Root directory for location of ssr files 
     32   LOGICAL           , PUBLIC ::   ln_rnf_emp   = .false. !: runoffs into a file to be read or already into precipitation 
     33   TYPE(FLD_N)       , PUBLIC ::   sn_rnf                 !: information about the runoff file to be read 
     34   TYPE(FLD_N)       , PUBLIC ::   sn_cnf                 !: information about the runoff mouth file to be read 
     35   LOGICAL           , PUBLIC ::   ln_rnf_mouth = .false. !: specific treatment in mouths vicinity 
     36   REAL(wp)          , PUBLIC ::   rn_hrnf      = 0.e0    !: runoffs, depth over which enhanced vertical mixing is used 
     37   REAL(wp)          , PUBLIC ::   rn_avt_rnf   = 0.e0    !: runoffs, value of the additional vertical mixing coef. [m2/s] 
    3638 
    3739   INTEGER , PUBLIC                     ::   nkrnf = 0   !: number of levels over which Kz is increased at river mouths 
     
    4345   !!---------------------------------------------------------------------- 
    4446   !!   OPA 9.0 , LOCEAN-IPSL (2006)  
    45    !! $ Id: $ 
     47   !! $Id: $ 
    4648   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    4749   !!---------------------------------------------------------------------- 
     
    6466      ! 
    6567      INTEGER  ::   ji, jj   ! dummy loop indices 
    66       INTEGER  ::   ierror   ! temporary integer 
    67       !!---------------------------------------------------------------------- 
    68       NAMELIST/namsbc_rnf/ cn_dir, nn_runoff, rn_hrnf, rn_avt_rnf, sn_rnf, sn_cnf 
    69       !                                                   !------------------! 
    70       IF( kt == nit000 ) THEN                             !  Initialisation  ! 
    71          !                                                !------------------! 
    72          ! Default values (NB: frequency positive => hours, negative => months) 
    73          !            !   file    ! frequency !  variable  ! time intep !  clim  ! starting ! 
    74          !            !   name    !  (hours)  !   name     !   (T/F)    !  (0/1) !  record  ! 
    75          sn_rnf = FLD_N( 'runoffs',   -12.    , 'sorunoff' ,  .TRUE.    ,    1   ,     0    ) 
    76          sn_cnf = FLD_N( 'runoffs',     0.    , 'sorunoff' ,  .FALSE.   ,    1   ,     0    ) 
    77  
    78          ! 
    79          REWIND ( numnam )                   ! Read Namelist namsbc_rnf 
    80          READ   ( numnam, namsbc_rnf ) 
    81  
    82          ! Control print 
    83          IF(lwp) THEN 
    84             WRITE(numout,*) 
    85             WRITE(numout,*) 'sbc_rnf : runoff ' 
    86             WRITE(numout,*) '~~~~~~~ ' 
    87             WRITE(numout,*) '   Namelist namsbc_rnf' 
    88             WRITE(numout,*) '      runoff type (=-1/1/2)                      nn_runoff   = ', nn_runoff 
    89             WRITE(numout,*) '      river mouth additional Kz                  rn_avt_rnf  = ', rn_avt_rnf 
    90             WRITE(numout,*) '      depth of river mouth additional mixing     rn_hrnf     = ', rn_hrnf 
    91          ENDIF 
    92  
    93          IF( nn_runoff >= 1 ) THEN      ! set sf_rnf structure 
    94             ! 
    95             ALLOCATE( sf_rnf(1), STAT=ierror ) 
    96             IF( ierror > 0 ) THEN 
    97                CALL ctl_stop( 'sbc_rnf: unable to allocate sf_rnf structure' )   ;   RETURN 
    98             ENDIF 
    99             ! namelist informations stored in sf_rnf structures 
    100             WRITE( sf_rnf(1)%clrootname, '(a,a)' )   TRIM( cn_dir ), TRIM( sn_rnf%clname ) 
    101             sf_rnf(1)%freqh   = sn_rnf%freqh 
    102             sf_rnf(1)%clvar   = sn_rnf%clvar 
    103             sf_rnf(1)%ln_tint = sn_rnf%ln_tint 
    104             sf_rnf(1)%nclim   = sn_rnf%nclim 
    105             sf_rnf(1)%nstrec  = sn_rnf%nstrec 
    106             IF(lwp) THEN             ! control print 
    107                WRITE(numout,*) '   Runoffs data read in the following file: ' 
    108                WRITE(numout,*) '               root filename: '  , trim( sf_rnf(1)%clrootname ),   & 
    109                   &                          ' variable name: '  , trim( sf_rnf(1)%clvar      ) 
    110                WRITE(numout,*) '               frequency: '      ,       sf_rnf(1)%freqh       ,   & 
    111                   &                          ' time interp: '    ,       sf_rnf(1)%ln_tint     ,   & 
    112                   &                          ' climatology: '    ,       sf_rnf(1)%nclim       ,   & 
    113                   &                          ' starting record: ',       sf_rnf(1)%nstrec 
    114             ENDIF 
    115          ENDIF 
    116  
    117          IF( nn_runoff == 1 ) THEN 
    118             IF(lwp) WRITE(numout,*) 
    119             IF(lwp) WRITE(numout,*) '          No specific treatment at river mouths' 
    120             rnfmsk  (:,:) = 0.e0  
    121             rnfmsk_z(:)   = 0.e0 
    122             nkrnf = 0 
    123          ELSE 
    124             ! 
    125             ! Number of level over which Kz increase in vicinity of river mouths 
    126             IF( rn_hrnf == 0.e0 ) THEN 
    127                nkrnf = 0 
    128             ELSE 
    129                nkrnf = 2 
    130                DO WHILE( nkrnf == jpkm1 .OR. gdepw_0(nkrnf) > rn_hrnf ) 
    131                   nkrnf = nkrnf + 1 
    132                END DO 
    133                IF( ln_sco )   & 
    134                   CALL ctl_warn( 'sbc_rnf: number of levels over which Kz is increased is computed for zco...' ) 
    135             ENDIF 
    136             ! 
    137             ! river mouths mask 
    138             CALL rnf_mouth            ! set river mouth mask 
    139             ! 
    140          ENDIF 
    141  
    142          IF( nn_runoff /= -1 .AND. nn_runoff /= 1 .AND. nn_runoff /= 2 ) THEN 
    143             WRITE(ctmp1,*) 'sbc_rnf: Error nn_runoff = ', nn_runoff, ' /= -1, 1 or 2' 
    144             CALL ctl_stop( ctmp1 ) 
    145          ENDIF 
    146  
    147          ! Control print 
    148          IF(lwp) THEN 
    149             IF( nn_runoff == -1 ) THEN 
    150                WRITE(numout,*) '          runoff directly provided in the precipitations' 
    151             ELSE 
    152                WRITE(numout,*) '          monthly runoff read in NetCDF file ' 
    153             ENDIF 
    154             IF( nn_runoff ==  1 ) THEN 
    155                WRITE(numout,*) '          No Kz increase nor upstream advection at river mouths' 
    156             ELSE 
    157                IF(lwp) WRITE(numout,*) '          mixed upstream/centered at river mouths (ln_traadv_cen2=T) '  
    158                IF(lwp) WRITE(numout,*) '          Kz is increased by ', rn_avt_rnf,' m2/s  over ', nkrnf, ' w-levels' 
    159             ENDIF 
    160          ENDIF 
    161          ! 
    162       ENDIF 
     68      !!---------------------------------------------------------------------- 
     69      !                                    
     70      IF( kt == nit000 )   CALL sbc_rnf_init 
     71 
    16372      !                                                   !-------------------! 
    164       IF( nn_runoff == 1 .OR. nn_runoff == 2 ) THEN       !   Update runoff   ! 
     73      IF( .NOT. ln_rnf_emp ) THEN                         !   Update runoff   ! 
    16574         !                                                !-------------------! 
    16675         ! 
     
    18897 
    18998 
     99   SUBROUTINE sbc_rnf_init 
     100      !!---------------------------------------------------------------------- 
     101      !!                  ***  ROUTINE sbc_rnf_init  *** 
     102      !! 
     103      !! ** Purpose :   Initialisation of the runoffs if (ln_rnf=T) 
     104      !! 
     105      !! ** Method  : - read the runoff namsbc_rnf namelist 
     106      !! 
     107      !! ** Action  : - read parameters 
     108      !!---------------------------------------------------------------------- 
     109      INTEGER  ::   ierror   ! temporary integer 
     110      !! 
     111      NAMELIST/namsbc_rnf/ cn_dir, ln_rnf_emp, sn_rnf, sn_cnf, ln_rnf_mouth,   & 
     112         &                 rn_hrnf, rn_avt_rnf 
     113      !!---------------------------------------------------------------------- 
     114 
     115      !                                   ! ============ 
     116      !                                   !   Namelist 
     117      !                                   ! ============ 
     118      !                                         ! Default values NB: frequency>0 hours, <0 months) 
     119      !            !   file    ! frequency !  variable  ! time intep !  clim  ! starting ! 
     120      !            !   name    !  (hours)  !   name     !   (T/F)    !  (0/1) !  record  ! 
     121      sn_rnf = FLD_N( 'runoffs',   -12.    , 'sorunoff' ,  .TRUE.    ,    1   ,     0    ) 
     122      sn_cnf = FLD_N( 'runoffs',     0.    , 'sorunoff' ,  .FALSE.   ,    1   ,     0    ) 
     123 
     124      ! 
     125      REWIND ( numnam )                         ! Read Namelist namsbc_rnf 
     126      READ   ( numnam, namsbc_rnf ) 
     127 
     128      !                                         ! Control print 
     129      IF(lwp) THEN 
     130         WRITE(numout,*) 
     131         WRITE(numout,*) 'sbc_rnf : runoff ' 
     132         WRITE(numout,*) '~~~~~~~ ' 
     133         WRITE(numout,*) '   Namelist namsbc_rnf' 
     134         WRITE(numout,*) '      runoff in a file to be read                ln_rnf_emp   = ', ln_rnf_emp 
     135         WRITE(numout,*) '      specific river mouths treatment            ln_rnf_mouth = ', ln_rnf_mouth 
     136         WRITE(numout,*) '      river mouth additional Kz                  rn_avt_rnf   = ', rn_avt_rnf 
     137         WRITE(numout,*) '      depth of river mouth additional mixing     rn_hrnf      = ', rn_hrnf 
     138      ENDIF 
     139 
     140      !                                   ! ================== 
     141      !                                   !   Type of runoff 
     142      !                                   ! ================== 
     143      ! 
     144      IF( ln_rnf_emp ) THEN                     ! runoffs directly provided in the precipitations 
     145         IF(lwp) WRITE(numout,*) 
     146         IF(lwp) WRITE(numout,*) '          runoffs directly provided in the precipitations' 
     147         ! 
     148      ELSE                                      ! runoffs read in a file : set sf_rnf structure  
     149         ! 
     150         ALLOCATE( sf_rnf(1), STAT=ierror ) 
     151         IF( ierror > 0 ) THEN 
     152            CALL ctl_stop( 'sbc_rnf: unable to allocate sf_rnf structure' )   ;   RETURN 
     153         ENDIF 
     154         !                                         ! namelist informations stored in sf_rnf structures 
     155         WRITE( sf_rnf(1)%clrootname, '(a,a)' )   TRIM( cn_dir ), TRIM( sn_rnf%clname ) 
     156         sf_rnf(1)%freqh   = sn_rnf%freqh 
     157         sf_rnf(1)%clvar   = sn_rnf%clvar 
     158         sf_rnf(1)%ln_tint = sn_rnf%ln_tint 
     159         sf_rnf(1)%nclim   = sn_rnf%nclim 
     160         sf_rnf(1)%nstrec  = sn_rnf%nstrec 
     161         IF(lwp) THEN                              ! control print 
     162            WRITE(numout,*) '   Runoffs data read in the following file: ' 
     163            WRITE(numout,*) '               root filename: '  , trim( sf_rnf(1)%clrootname ),   & 
     164               &                          ' variable name: '  , trim( sf_rnf(1)%clvar      ) 
     165            WRITE(numout,*) '               frequency: '      ,       sf_rnf(1)%freqh       ,   & 
     166               &                          ' time interp: '    ,       sf_rnf(1)%ln_tint     ,   & 
     167               &                          ' climatology: '    ,       sf_rnf(1)%nclim       ,   & 
     168               &                          ' starting record: ',       sf_rnf(1)%nstrec 
     169         ENDIF 
     170         ! 
     171      ENDIF 
     172 
     173      !                                   ! ======================== 
     174      !                                   !   River mouth vicinity 
     175      !                                   ! ======================== 
     176      ! 
     177      IF( ln_rnf_mouth ) THEN                   ! Specific treatment in vicinity of river mouths : 
     178         !                                      !    - Increase Kz in surface layers ( rn_hrnf > 0 ) 
     179         !                                      !    - set to zero SSS damping (ln_ssr=T) 
     180         !                                      !    - mixed upstream-centered (ln_traadv_cen2=T) 
     181         ! 
     182         !                                          ! Number of level over which Kz increase 
     183         nkrnf = 0 
     184         IF( rn_hrnf > 0.e0 ) THEN 
     185            nkrnf = 2 
     186            DO WHILE( nkrnf == jpkm1 .OR. gdepw_0(nkrnf) > rn_hrnf )   ;   nkrnf = nkrnf + 1   ;   END DO 
     187            IF( ln_sco )   & 
     188               CALL ctl_warn( 'sbc_rnf: number of levels over which Kz is increased is computed for zco...' ) 
     189         ENDIF 
     190         IF(lwp) WRITE(numout,*) 
     191         IF(lwp) WRITE(numout,*) '          Specific treatment used in vicinity of river mouths :' 
     192         IF(lwp) WRITE(numout,*) '             - Increase Kz in surface layers (if rn_hrnf > 0 )' 
     193         IF(lwp) WRITE(numout,*) '               by ', rn_avt_rnf,' m2/s  over ', nkrnf, ' w-levels' 
     194         IF(lwp) WRITE(numout,*) '             - set to zero SSS damping       (if ln_ssr=T)' 
     195         IF(lwp) WRITE(numout,*) '             - mixed upstream-centered       (if ln_traadv_cen2=T)' 
     196         ! 
     197         CALL rnf_mouth                             ! set river mouth mask 
     198         ! 
     199      ELSE                                      ! No treatment at river mouths 
     200         IF(lwp) WRITE(numout,*) 
     201         IF(lwp) WRITE(numout,*) '          No specific treatment at river mouths' 
     202         rnfmsk  (:,:) = 0.e0  
     203         rnfmsk_z(:)   = 0.e0 
     204         nkrnf = 0 
     205      ENDIF 
     206 
     207   END SUBROUTINE sbc_rnf_init 
     208 
     209 
    190210   SUBROUTINE rnf_mouth 
    191211      !!---------------------------------------------------------------------- 
     
    200220      !!                This fields can be used to: 
    201221      !!                 - set an upstream advection scheme   
    202       !!                   (nn_runoff=2 and ln_traadv_cen2=T) 
     222      !!                   (ln_rnf_mouth=T and ln_traadv_cen2=T) 
    203223      !!                 - increase vertical on the top nn_krnf vertical levels  
    204224      !!                   at river runoff input grid point (nn_krnf>=2, see step.F90) 
Note: See TracChangeset for help on using the changeset viewer.