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 8355 for branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/limcons.F90 – NEMO

Ignore:
Timestamp:
2017-07-20T10:20:49+02:00 (7 years ago)
Author:
clem
Message:

simplifications

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/limcons.F90

    r8341 r8355  
    2828   PRIVATE 
    2929 
    30    PUBLIC   lim_column_sum 
    31    PUBLIC   lim_column_sum_energy 
    32    PUBLIC   lim_cons_check 
    3330   PUBLIC   lim_cons_hsm 
    3431   PUBLIC   lim_cons_final 
     
    4037   !!---------------------------------------------------------------------- 
    4138CONTAINS 
    42  
    43    SUBROUTINE lim_column_sum( ksum, pin, pout ) 
    44       !!------------------------------------------------------------------- 
    45       !!               ***  ROUTINE lim_column_sum *** 
    46       !! 
    47       !! ** Purpose : Compute the sum of xin over nsum categories 
    48       !! 
    49       !! ** Method  : Arithmetics 
    50       !! 
    51       !! ** Action  : Gets xin(ji,jj,jl) and computes xout(ji,jj) 
    52       !!--------------------------------------------------------------------- 
    53       INTEGER                   , INTENT(in   ) ::   ksum   ! number of categories/layers 
    54       REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pin    ! input field 
    55       REAL(wp), DIMENSION(:,:)  , INTENT(  out) ::   pout   ! output field 
    56       ! 
    57       INTEGER ::   jl   ! dummy loop indices 
    58       !!--------------------------------------------------------------------- 
    59       ! 
    60       pout(:,:) = pin(:,:,1) 
    61       DO jl = 2, ksum 
    62          pout(:,:) = pout(:,:) + pin(:,:,jl) 
    63       END DO 
    64       ! 
    65    END SUBROUTINE lim_column_sum 
    66  
    67  
    68    SUBROUTINE lim_column_sum_energy( ksum, klay, pin, pout) 
    69       !!------------------------------------------------------------------- 
    70       !!               ***  ROUTINE lim_column_sum_energy *** 
    71       !! 
    72       !! ** Purpose : Compute the sum of xin over nsum categories 
    73       !!              and nlay layers 
    74       !! 
    75       !! ** Method  : Arithmetics 
    76       !!--------------------------------------------------------------------- 
    77       INTEGER                                , INTENT(in   ) ::   ksum   !: number of categories 
    78       INTEGER                                , INTENT(in   ) ::   klay   !: number of vertical layers 
    79       REAL(wp), DIMENSION(jpi,jpj,nlay_i,jpl), INTENT(in   ) ::   pin    !: input field 
    80       REAL(wp), DIMENSION(jpi,jpj)           , INTENT(  out) ::   pout   !: output field 
    81       ! 
    82       INTEGER ::   jk, jl   ! dummy loop indices 
    83       !!--------------------------------------------------------------------- 
    84       ! 
    85       pout(:,:) = 0._wp 
    86       DO jl = 1, ksum 
    87          DO jk = 2, klay  
    88             pout(:,:) = pout(:,:) + pin(:,:,jk,jl) 
    89          END DO 
    90       END DO 
    91       ! 
    92    END SUBROUTINE lim_column_sum_energy 
    93  
    94  
    95    SUBROUTINE lim_cons_check( px1, px2, pmax_err, cd_fieldid ) 
    96       !!------------------------------------------------------------------- 
    97       !!               ***  ROUTINE lim_cons_check *** 
    98       !! 
    99       !! ** Purpose : Test the conservation of a certain variable 
    100       !!              For each physical grid cell, check that initial  
    101       !!              and final values 
    102       !!              of a conserved field are equal to within a small value. 
    103       !! 
    104       !! ** Method  : 
    105       !!--------------------------------------------------------------------- 
    106       REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   px1          !: initial field 
    107       REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   px2          !: final field 
    108       REAL(wp)                , INTENT(in   ) ::   pmax_err     !: max allowed error 
    109       CHARACTER(len=15)       , INTENT(in   ) ::   cd_fieldid   !: field identifyer 
    110       ! 
    111       INTEGER  ::   ji, jj          ! dummy loop indices 
    112       INTEGER  ::   inb_error       ! number of g.c where there is a cons. error 
    113       LOGICAL  ::   llconserv_err   ! = .true. if conservation check failed 
    114       REAL(wp) ::   zmean_error     ! mean error on error points 
    115       !!--------------------------------------------------------------------- 
    116       ! 
    117       IF(lwp) WRITE(numout,*) ' lim_cons_check ' 
    118       IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~ ' 
    119  
    120       llconserv_err = .FALSE. 
    121       inb_error     = 0 
    122       zmean_error   = 0._wp 
    123       IF( MAXVAL( px2(:,:) - px1(:,:) ) > pmax_err )   llconserv_err = .TRUE. 
    124  
    125       IF( llconserv_err ) THEN 
    126          DO jj = 1, jpj  
    127             DO ji = 1, jpi 
    128                IF( ABS( px2(ji,jj) - px1(ji,jj) ) > pmax_err ) THEN 
    129                   inb_error   = inb_error + 1 
    130                   zmean_error = zmean_error + ABS( px2(ji,jj) - px1(ji,jj) ) 
    131                   ! 
    132                   IF(lwp) THEN 
    133                      WRITE (numout,*) ' ALERTE 99 ' 
    134                      WRITE (numout,*) ' Conservation error: ', cd_fieldid 
    135                      WRITE (numout,*) ' Point             : ', ji, jj  
    136                      WRITE (numout,*) ' lat, lon          : ', gphit(ji,jj), glamt(ji,jj) 
    137                      WRITE (numout,*) ' Initial value     : ', px1(ji,jj) 
    138                      WRITE (numout,*) ' Final value       : ', px2(ji,jj) 
    139                      WRITE (numout,*) ' Difference        : ', px2(ji,jj) - px1(ji,jj) 
    140                   ENDIF 
    141                ENDIF 
    142             END DO 
    143          END DO 
    144          ! 
    145       ENDIF 
    146       IF(lk_mpp)   CALL mpp_sum( inb_error   ) 
    147       IF(lk_mpp)   CALL mpp_sum( zmean_error ) 
    148       ! 
    149       IF( inb_error > 0 .AND. lwp ) THEN 
    150          zmean_error = zmean_error / REAL( inb_error, wp ) 
    151          WRITE(numout,*) ' Conservation check for : ', cd_fieldid 
    152          WRITE(numout,*) ' Number of error points : ', inb_error 
    153          WRITE(numout,*) ' Mean error on these pts: ', zmean_error 
    154       ENDIF 
    155       ! 
    156    END SUBROUTINE lim_cons_check 
    157  
    15839 
    15940   SUBROUTINE lim_cons_hsm( icount, cd_routine, zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b ) 
Note: See TracChangeset for help on using the changeset viewer.