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/LIM_SRC_2/limwri_2.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/LIM_SRC_2/limwri_2.F90

    r2528 r2715  
    2626   USE ice_2 
    2727 
     28   USE dianam          ! build name of file (routine) 
    2829   USE lbclnk 
    29    USE dianam          ! build name of file (routine) 
    3030   USE in_out_manager 
     31   USE lib_mpp         ! MPP library 
    3132   USE iom 
    3233   USE ioipsl 
     
    3940#endif 
    4041   PUBLIC   lim_wri_state_2   ! called by dia_wri_state  
     42   PUBLIC   lim_wri_alloc_2   ! called by nemogcm.F90 
    4143 
    4244   INTEGER, PARAMETER                       ::   jpnoumax = 40   ! maximum number of variable for ice output 
     
    5052 
    5153   INTEGER ::   nice, nhorid, ndim, niter, ndepid       ! ???? 
    52    INTEGER , DIMENSION( jpij ) ::   ndex51              ! ???? 
    53  
    54    REAL(wp)  ::            &  ! constant values 
    55       epsi16 = 1.e-16   ,  & 
    56       zzero  = 0.e0     ,  & 
    57       zone   = 1.e0 
     54   INTEGER, ALLOCATABLE, SAVE, DIMENSION(:) :: ndex51   ! ???? 
     55 
     56   REAL(wp) ::   epsi16 = 1.e-16_wp   ! constant values 
     57   REAL(wp) ::   zzero  = 0._wp       !     -      - 
     58   REAL(wp) ::   zone   = 1._wp       !     -      - 
     59 
     60   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   zcmo      ! Workspace array for netcdf writer.  
     61 
    5862 
    5963   !! * Substitutions 
     
    6468   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    6569   !!---------------------------------------------------------------------- 
    66  
    6770CONTAINS 
     71 
     72   INTEGER FUNCTION lim_wri_alloc_2() 
     73      !!------------------------------------------------------------------- 
     74      !!                  ***   ROUTINE lim_wri_alloc_2  *** 
     75      !!------------------------------------------------------------------- 
     76      ALLOCATE( ndex51(jpij), zcmo(jpi,jpj,jpnoumax), STAT=lim_wri_alloc_2) 
     77      ! 
     78      IF( lk_mpp               )   CALL mpp_sum ( lim_wri_alloc_2 ) 
     79      IF( lim_wri_alloc_2 /= 0 )   CALL ctl_warn('lim_wri_alloc_2: failed to allocate array ndex51') 
     80      ! 
     81   END FUNCTION lim_wri_alloc_2 
     82 
    6883 
    6984#if ! defined key_iomput 
     
    85100      !!      of a day 
    86101      !!------------------------------------------------------------------- 
     102      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released 
     103      USE wrk_nemo, ONLY: zfield => wrk_2d_1 
     104      !! 
    87105      INTEGER, INTENT(in) ::   kt     ! number of iteration 
    88106      !! 
     
    92110         &          zindh, zinda, zindb, ztmu 
    93111      REAL(wp), DIMENSION(1)                ::   zdept 
    94       REAL(wp), DIMENSION(jpi,jpj)          ::   zfield 
    95       REAL(wp), DIMENSION(jpi,jpj,jpnoumax) ::   zcmo 
    96       !!------------------------------------------------------------------- 
     112      !!------------------------------------------------------------------- 
     113 
     114      IF( wrk_in_use(2, 1) ) THEN 
     115         CALL ctl_stop('lim_wri_2 : requested workspace array unavailable')   ;   RETURN 
     116      ENDIF 
    97117                                                 !--------------------! 
    98118      IF( kt == nit000 ) THEN                    !   Initialisation   ! 
    99119         !                                       !--------------------! 
     120 
    100121         CALL lim_wri_init_2  
    101122                            
     
    186207      IF( ( nn_fsbc * niter ) >= nitend )   CALL histclo( nice )  
    187208 
     209      IF( wrk_not_released(2, 1) )   CALL ctl_stop('lim_wri_2 : failed to release workspace array.') 
     210      ! 
    188211   END SUBROUTINE lim_wri_2 
    189212      
     
    222245         field_19 
    223246      !!------------------------------------------------------------------- 
     247      ! 
     248      IF( lim_wri_alloc_2() /= 0 ) THEN      ! allocate lim_wri arrrays 
     249         CALL ctl_stop( 'STOP', 'lim_wri_init_2 : unable to allocate standard arrays' )   ;   RETURN 
     250      ENDIF 
    224251 
    225252      REWIND ( numnam_ice )                ! Read Namelist namicewri 
Note: See TracChangeset for help on using the changeset viewer.