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_3/limdyn.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_3/limdyn.F90

    r2528 r2715  
    44   !!   Sea-Ice dynamics :   
    55   !!====================================================================== 
    6    !! history :  1.0  ! 2002-08 (C. Ethe, G. Madec)  original VP code  
    7    !!            3.0  ! 2007-03 (MA Morales Maqueda, S. Bouillon, M. Vancoppenolle)  LIM3: EVP-Cgrid 
     6   !! history :  1.0  ! 2002-08  (C. Ethe, G. Madec)  original VP code  
     7   !!            3.0  ! 2007-03  (MA Morales Maqueda, S. Bouillon, M. Vancoppenolle)  LIM3: EVP-Cgrid 
     8   !!            4.0  ! 2011-02  (G. Madec) dynamical allocation 
    89   !!---------------------------------------------------------------------- 
    910#if defined key_lim3 
     
    1415   !!    lim_dyn_init : initialization and namelist read 
    1516   !!---------------------------------------------------------------------- 
    16    USE phycst 
    17    USE in_out_manager  ! I/O manager 
    18    USE dom_ice 
    19    USE dom_oce         ! ocean space and time domain 
    20    USE ice 
    21    USE par_ice 
    22    USE sbc_oce         ! Surface boundary condition: ocean fields 
    23    USE sbc_ice         ! Surface boundary condition: ice fields 
    24    USE limrhg          ! ice rheology 
    25    USE lbclnk 
    26    USE lib_mpp 
    27    USE prtctl          ! Print control 
     17   USE phycst           ! physical constants 
     18   USE dom_oce          ! ocean space and time domain 
     19   USE sbc_oce          ! Surface boundary condition: ocean fields 
     20   USE sbc_ice          ! Surface boundary condition: ice   fields 
     21   USE ice              ! LIM-3 variables 
     22   USE par_ice          ! LIM-3 parameters 
     23   USE dom_ice          ! LIM-3 domain 
     24   USE limrhg           ! LIM-3 rheology 
     25   USE lbclnk           ! lateral boundary conditions - MPP exchanges 
     26   USE lib_mpp          ! MPP library 
     27   USE in_out_manager   ! I/O manager 
     28   USE prtctl           ! Print control 
    2829 
    2930   IMPLICIT NONE 
     
    3536#  include "vectopt_loop_substitute.h90" 
    3637   !!---------------------------------------------------------------------- 
    37    !! NEMO/LIM3 3.3 , UCL - NEMO Consortium (2010) 
     38   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011) 
    3839   !! $Id$ 
    3940   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     
    5455      !!              - treatment of the case if no ice dynamic 
    5556      !!------------------------------------------------------------------------------------ 
     57      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
     58      USE wrk_nemo, ONLY:   wrk_1d_1, wrk_1d_2 
     59      USE wrk_nemo, ONLY:   zu_io => wrk_2d_1, zv_io => wrk_2d_2  ! ice-ocean velocity 
     60      ! 
    5661      INTEGER, INTENT(in) ::   kt     ! number of iteration 
    5762      !! 
     
    5964      INTEGER  ::   i_j1, i_jpj       ! Starting/ending j-indices for rheology 
    6065      REAL(wp) ::   zcoef             ! local scalar 
    61       REAL(wp), DIMENSION(jpj)     ::   zind           ! i-averaged indicator of sea-ice 
    62       REAL(wp), DIMENSION(jpj)     ::   zmsk           ! i-averaged of tmask 
    63       REAL(wp), DIMENSION(jpi,jpj) ::   zu_io, zv_io   ! ice-ocean velocity 
     66      REAL(wp), POINTER, DIMENSION(:) ::   zind     ! i-averaged indicator of sea-ice 
     67      REAL(wp), POINTER, DIMENSION(:) ::   zmsk     ! i-averaged of tmask 
    6468      !!--------------------------------------------------------------------- 
    6569 
    66       IF( kt == nit000 .AND. lwp ) THEN 
    67          WRITE(numout,*) ' lim_dyn : Ice dynamics ' 
    68          WRITE(numout,*) ' ~~~~~~~ ' 
    69       ENDIF 
    70  
    71       IF( numit == nstart  )   CALL lim_dyn_init   ! Initialization (first time-step only) 
    72  
    73       IF ( ln_limdyn ) THEN 
    74  
     70      IF(  wrk_in_use(1, 1,2)  .OR.  wrk_in_use(2, 1,2)  ) THEN 
     71         CALL ctl_stop('lim_dyn : requested workspace arrays unavailable')   ;   RETURN 
     72      ENDIF 
     73      zind => wrk_1d_1(1:jpj)      ! Set-up pointers to sub-arrays of workspaces 
     74      zmsk => wrk_1d_2(1:jpj) 
     75 
     76      IF( kt == nit000 )   CALL lim_dyn_init   ! Initialization (first time-step only) 
     77 
     78      IF( ln_limdyn ) THEN 
     79         ! 
    7580         old_u_ice(:,:) = u_ice(:,:) * tmu(:,:) 
    7681         old_v_ice(:,:) = v_ice(:,:) * tmv(:,:) 
     
    8893            CALL lim_rhg( i_j1, i_jpj ) 
    8994         ELSE                                 ! optimization of the computational area 
    90  
     95            ! 
    9196            DO jj = 1, jpj 
    92                zind(jj) = SUM( 1.0 - at_i (:,jj  ) )   ! = FLOAT(jpj) if ocean everywhere on a j-line 
    93                zmsk(jj) = SUM( tmask(:,jj,1) )   ! = 0          if land  everywhere on a j-line 
     97               zind(jj) = SUM( 1.0 - at_i(:,jj) )   ! = REAL(jpj) if ocean everywhere on a j-line 
     98               zmsk(jj) = SUM( tmask(:,jj,1)    )   ! = 0         if land  everywhere on a j-line 
    9499            END DO 
    95100 
     
    106111               IF(ln_ctl) CALL prt_ctl_info( 'lim_dyn  : NH  i_j1 = ', ivar1=i_j1, clinfo2=' ij_jpj = ', ivar2=i_jpj ) 
    107112               CALL lim_rhg( i_j1, i_jpj ) 
    108  
     113               ! 
    109114               ! Southern hemisphere 
    110115               i_j1  =  1 
     
    115120               i_jpj = MIN( jpj, i_jpj+1 ) 
    116121               IF(ln_ctl) CALL prt_ctl_info( 'lim_dyn  : SH  i_j1 = ', ivar1=i_j1, clinfo2=' ij_jpj = ', ivar2=i_jpj ) 
    117  
    118        CALL lim_rhg( i_j1, i_jpj ) 
    119  
    120     ELSE                                 ! local domain extends over one hemisphere only 
    121        !                                 ! Rheology is computed only over the ice cover 
    122        !                                 ! latitude strip 
    123        i_j1  = 1 
     122               ! 
     123               CALL lim_rhg( i_j1, i_jpj ) 
     124               ! 
     125            ELSE                                 ! local domain extends over one hemisphere only 
     126               !                                 ! Rheology is computed only over the ice cover 
     127               !                                 ! latitude strip 
     128               i_j1  = 1 
    124129               DO WHILE ( i_j1 <= jpj .AND. zind(i_j1) == FLOAT(jpi) .AND. zmsk(i_j1) /=0 ) 
    125130                  i_j1 = i_j1 + 1 
     
    132137               END DO 
    133138               i_jpj = MIN( jpj, i_jpj+1) 
    134  
     139               ! 
    135140               IF(ln_ctl) CALL prt_ctl_info( 'lim_dyn  : one hemisphere:  i_j1 = ', ivar1=i_j1, clinfo2=' ij_jpj = ', ivar2=i_jpj ) 
    136  
     141               ! 
    137142               CALL lim_rhg( i_j1, i_jpj ) 
    138  
     143               ! 
    139144            ENDIF 
    140  
     145            ! 
    141146         ENDIF 
    142147 
     
    147152         zv_io(:,:) = v_ice(:,:) - ssv_m(:,:) 
    148153         ! frictional velocity at T-point 
    149          zcoef = 0.5 * cw 
     154         zcoef = 0.5_wp * cw 
    150155         DO jj = 2, jpjm1  
    151156            DO ji = fs_2, fs_jpim1   ! vector opt. 
     
    157162      ELSE      ! no ice dynamics : transmit directly the atmospheric stress to the ocean 
    158163         ! 
    159          zcoef = SQRT( 0.5 ) / rau0 
     164         zcoef = SQRT( 0.5_wp ) / rau0 
    160165         DO jj = 2, jpjm1 
    161166            DO ji = fs_2, fs_jpim1   ! vector opt. 
     
    207212      ENDIF 
    208213      ! 
     214      IF( wrk_not_released(1, 1,2) .OR.   & 
     215          wrk_not_released(2, 1,2)  )   CALL ctl_stop('lim_dyn : failed to release workspace arrays' ) 
     216      ! 
    209217   END SUBROUTINE lim_dyn 
    210218 
     
    271279      ahiu(:,:) = ahi0 * umask(:,:,1) 
    272280      ahiv(:,:) = ahi0 * vmask(:,:,1) 
    273  
     281      ! 
    274282   END SUBROUTINE lim_dyn_init 
    275283 
Note: See TracChangeset for help on using the changeset viewer.