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

Ignore:
Timestamp:
2011-03-30T17:58:35+02:00 (13 years ago)
Author:
rblod
Message:

First attempt to put dynamic allocation on the trunk

File:
1 edited

Legend:

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

    r2528 r2715  
    1919   USE phycst          ! physical constants 
    2020   USE sbc_oce         ! surface boundary condition variables 
     21   USE closea          ! closed seas 
    2122   USE fldread         ! read input field at current time step 
     23   USE restart         ! restart 
    2224   USE in_out_manager  ! I/O manager 
    2325   USE iom             ! I/O module 
    24    USE restart         ! restart 
    25    USE closea          ! closed seas 
     26   USE lib_mpp         ! MPP library 
    2627 
    2728   IMPLICIT NONE 
     
    3031   PUBLIC   sbc_rnf       ! routine call in sbcmod module 
    3132   PUBLIC   sbc_rnf_div   ! routine called in sshwzv module 
    32  
    33    !                                                      !!* namsbc_rnf namelist * 
     33   PUBLIC   sbc_rnf_alloc ! routine call in sbcmod module 
     34 
     35   !                                                     !!* namsbc_rnf namelist * 
    3436   CHARACTER(len=100), PUBLIC ::   cn_dir       = './'    !: Root directory for location of ssr files 
    3537   LOGICAL           , PUBLIC ::   ln_rnf_depth = .false. !: depth       river runoffs attribute specified in a file 
     
    4749   REAL(wp)          , PUBLIC ::   rn_rfact     = 1._wp   !: multiplicative factor for runoff 
    4850 
    49    INTEGER , PUBLIC                          ::   nkrnf = 0         !: nb of levels over which Kz is increased at river mouths 
    50    REAL(wp), PUBLIC, DIMENSION(jpi,jpj)      ::   rnfmsk            !: river mouth mask (hori.) 
    51    REAL(wp), PUBLIC, DIMENSION(jpk)          ::   rnfmsk_z          !: river mouth mask (vert.) 
    52    REAL(wp), PUBLIC, DIMENSION(jpi,jpj)      ::   h_rnf             !: depth of runoff in m 
    53    INTEGER,  PUBLIC, DIMENSION(jpi,jpj)      ::   nk_rnf            !: depth of runoff in model levels 
    54    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpts) :: rnf_tsc_b, rnf_tsc  !: before and now T & S contents of runoffs  [K.m/s & PSU.m/s] 
     51   INTEGER , PUBLIC  ::   nkrnf = 0         !: nb of levels over which Kz is increased at river mouths 
     52   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   rnfmsk              !: river mouth mask (hori.) 
     53   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)     ::   rnfmsk_z            !: river mouth mask (vert.) 
     54   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   h_rnf               !: depth of runoff in m 
     55   INTEGER,  PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   nk_rnf              !: depth of runoff in model levels 
     56   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   rnf_tsc_b, rnf_tsc  !: before and now T & S runoff contents   [K.m/s & PSU.m/s] 
    5557    
    5658   REAL(wp) ::   r1_rau0   ! = 1 / rau0  
     
    6870   !!---------------------------------------------------------------------- 
    6971CONTAINS 
     72 
     73   INTEGER FUNCTION sbc_rnf_alloc() 
     74      !!---------------------------------------------------------------------- 
     75      !!                ***  ROUTINE sbc_rnf_alloc  *** 
     76      !!---------------------------------------------------------------------- 
     77      ALLOCATE( rnfmsk(jpi,jpj)         , rnfmsk_z(jpk)          ,     & 
     78         &      h_rnf (jpi,jpj)         , nk_rnf  (jpi,jpj)      ,     & 
     79         &      rnf_tsc_b(jpi,jpj,jpts) , rnf_tsc (jpi,jpj,jpts) , STAT=sbc_rnf_alloc ) 
     80         ! 
     81      IF( lk_mpp            )   CALL mpp_sum ( sbc_rnf_alloc ) 
     82      IF( sbc_rnf_alloc > 0 )   CALL ctl_warn('sbc_rnf_alloc: allocation of arrays failed') 
     83   END FUNCTION sbc_rnf_alloc 
    7084 
    7185   SUBROUTINE sbc_rnf( kt ) 
     
    182196      !! ** Action  :   phdivn   decreased by the runoff inflow 
    183197      !!---------------------------------------------------------------------- 
    184       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   phdivn   ! horizontal divergence 
     198      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   phdivn   ! horizontal divergence 
    185199      !! 
    186200      INTEGER  ::   ji, jj, jk   ! dummy loop indices 
     
    276290      !                                   !   Type of runoff 
    277291      !                                   ! ================== 
     292      !                                         !==  allocate runoff arrays 
     293      IF( sbc_rnf_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_rnf_alloc : unable to allocate arrays' ) 
    278294      ! 
    279295      IF( ln_rnf_emp ) THEN                     !==  runoffs directly provided in the precipitations  ==! 
Note: See TracChangeset for help on using the changeset viewer.