- Timestamp:
- 2017-07-20T10:20:49+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/limcons.F90
r8341 r8355 28 28 PRIVATE 29 29 30 PUBLIC lim_column_sum31 PUBLIC lim_column_sum_energy32 PUBLIC lim_cons_check33 30 PUBLIC lim_cons_hsm 34 31 PUBLIC lim_cons_final … … 40 37 !!---------------------------------------------------------------------- 41 38 CONTAINS 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 categories48 !!49 !! ** Method : Arithmetics50 !!51 !! ** Action : Gets xin(ji,jj,jl) and computes xout(ji,jj)52 !!---------------------------------------------------------------------53 INTEGER , INTENT(in ) :: ksum ! number of categories/layers54 REAL(wp), DIMENSION(:,:,:), INTENT(in ) :: pin ! input field55 REAL(wp), DIMENSION(:,:) , INTENT( out) :: pout ! output field56 !57 INTEGER :: jl ! dummy loop indices58 !!---------------------------------------------------------------------59 !60 pout(:,:) = pin(:,:,1)61 DO jl = 2, ksum62 pout(:,:) = pout(:,:) + pin(:,:,jl)63 END DO64 !65 END SUBROUTINE lim_column_sum66 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 categories73 !! and nlay layers74 !!75 !! ** Method : Arithmetics76 !!---------------------------------------------------------------------77 INTEGER , INTENT(in ) :: ksum !: number of categories78 INTEGER , INTENT(in ) :: klay !: number of vertical layers79 REAL(wp), DIMENSION(jpi,jpj,nlay_i,jpl), INTENT(in ) :: pin !: input field80 REAL(wp), DIMENSION(jpi,jpj) , INTENT( out) :: pout !: output field81 !82 INTEGER :: jk, jl ! dummy loop indices83 !!---------------------------------------------------------------------84 !85 pout(:,:) = 0._wp86 DO jl = 1, ksum87 DO jk = 2, klay88 pout(:,:) = pout(:,:) + pin(:,:,jk,jl)89 END DO90 END DO91 !92 END SUBROUTINE lim_column_sum_energy93 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 variable100 !! For each physical grid cell, check that initial101 !! and final values102 !! of a conserved field are equal to within a small value.103 !!104 !! ** Method :105 !!---------------------------------------------------------------------106 REAL(wp), DIMENSION(:,:), INTENT(in ) :: px1 !: initial field107 REAL(wp), DIMENSION(:,:), INTENT(in ) :: px2 !: final field108 REAL(wp) , INTENT(in ) :: pmax_err !: max allowed error109 CHARACTER(len=15) , INTENT(in ) :: cd_fieldid !: field identifyer110 !111 INTEGER :: ji, jj ! dummy loop indices112 INTEGER :: inb_error ! number of g.c where there is a cons. error113 LOGICAL :: llconserv_err ! = .true. if conservation check failed114 REAL(wp) :: zmean_error ! mean error on error points115 !!---------------------------------------------------------------------116 !117 IF(lwp) WRITE(numout,*) ' lim_cons_check '118 IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~ '119 120 llconserv_err = .FALSE.121 inb_error = 0122 zmean_error = 0._wp123 IF( MAXVAL( px2(:,:) - px1(:,:) ) > pmax_err ) llconserv_err = .TRUE.124 125 IF( llconserv_err ) THEN126 DO jj = 1, jpj127 DO ji = 1, jpi128 IF( ABS( px2(ji,jj) - px1(ji,jj) ) > pmax_err ) THEN129 inb_error = inb_error + 1130 zmean_error = zmean_error + ABS( px2(ji,jj) - px1(ji,jj) )131 !132 IF(lwp) THEN133 WRITE (numout,*) ' ALERTE 99 '134 WRITE (numout,*) ' Conservation error: ', cd_fieldid135 WRITE (numout,*) ' Point : ', ji, jj136 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 ENDIF141 ENDIF142 END DO143 END DO144 !145 ENDIF146 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 ) THEN150 zmean_error = zmean_error / REAL( inb_error, wp )151 WRITE(numout,*) ' Conservation check for : ', cd_fieldid152 WRITE(numout,*) ' Number of error points : ', inb_error153 WRITE(numout,*) ' Mean error on these pts: ', zmean_error154 ENDIF155 !156 END SUBROUTINE lim_cons_check157 158 39 159 40 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.