[921] | 1 | SUBROUTINE lim_wri |
---|
[825] | 2 | !!---------------------------------------------------------------------- |
---|
[2528] | 3 | !! NEMO/LIM3 3.3 , UCL - NEMO Consortium (2010) |
---|
[1156] | 4 | !! $Id$ |
---|
[2528] | 5 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[825] | 6 | !!---------------------------------------------------------------------- |
---|
[921] | 7 | !!------------------------------------------------------------------- |
---|
| 8 | !! This routine computes the average of some variables and write it |
---|
| 9 | !! on the ouput files. |
---|
| 10 | !! ATTENTION cette routine n'est valable que si le pas de temps est |
---|
| 11 | !! egale a une fraction entiere de 1 jours. |
---|
| 12 | !! Diff 1-D 3-D : suppress common also included in etat |
---|
| 13 | !! suppress cmoymo 11-18 |
---|
| 14 | !! modif : 03/06/98 |
---|
| 15 | !!------------------------------------------------------------------- |
---|
| 16 | USE diawri, ONLY : dia_wri_dimg |
---|
[3764] | 17 | USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) |
---|
| 18 | |
---|
[921] | 19 | REAL(wp),DIMENSION(1) :: zdept |
---|
[825] | 20 | |
---|
[2715] | 21 | REAL(wp) :: zsto, zsec, zjulian,zout, & |
---|
| 22 | REAL(wp) :: zindh,zinda,zindb, ztmu |
---|
| 23 | REAL(wp), DIMENSION(jpi,jpj,jpnoumax) :: zcmo |
---|
| 24 | REAL(wp), DIMENSION(jpi,jpj) :: zfield |
---|
| 25 | INTEGER, SAVE :: nmoyice !: counter for averaging |
---|
| 26 | INTEGER, SAVE :: nwf !: number of fields to write on disk |
---|
[921] | 27 | INTEGER, SAVE,DIMENSION (:), ALLOCATABLE :: nsubindex !: subindex to be saved |
---|
| 28 | ! according to namelist |
---|
[825] | 29 | |
---|
[921] | 30 | REAL(wp), SAVE, DIMENSION(jpi,jpj,jpnoumax) :: rcmoy |
---|
[825] | 31 | #if ! defined key_diainstant |
---|
[921] | 32 | LOGICAL, PARAMETER :: ll_dia_inst=.false. ! local logical variable |
---|
[825] | 33 | #else |
---|
[921] | 34 | LOGICAL, PARAMETER :: ll_dia_inst=.true. |
---|
[825] | 35 | #endif |
---|
[921] | 36 | INTEGER :: ji, jj, jf, ii ! dummy loop indices and array index |
---|
| 37 | INTEGER :: iyear, iday, imon ! |
---|
[825] | 38 | |
---|
[921] | 39 | CHARACTER(LEN=80) :: clname, cltext, clmode |
---|
[825] | 40 | |
---|
| 41 | |
---|
[2715] | 42 | INTEGER , SAVE :: nice, nhorid, ndim, niter, ndepid |
---|
| 43 | INTEGER , DIMENSION( jpij ) , SAVE :: ndex51 |
---|
[921] | 44 | !!------------------------------------------------------------------- |
---|
| 45 | IF ( numit == nstart ) THEN |
---|
[825] | 46 | |
---|
[921] | 47 | CALL lim_wri_init |
---|
[825] | 48 | |
---|
[921] | 49 | nwf = 0 |
---|
| 50 | ii = 0 |
---|
[825] | 51 | |
---|
[921] | 52 | IF (lwp ) THEN |
---|
| 53 | WRITE(numout,*) 'lim_wri : Write ice outputs in dimg' |
---|
| 54 | WRITE(numout,*) '~~~~~~~~' |
---|
| 55 | WRITE(numout,*) ' According to namelist_ice, following fields saved:' |
---|
| 56 | DO jf =1, noumef |
---|
| 57 | IF (nc(jf) == 1 ) THEN |
---|
| 58 | WRITE(numout,* ) ' -',titn(jf), nam(jf), uni(jf) |
---|
| 59 | ENDIF |
---|
| 60 | END DO |
---|
| 61 | ENDIF |
---|
[825] | 62 | |
---|
[921] | 63 | DO jf = 1, noumef |
---|
| 64 | IF (nc(jf) == 1 ) nwf = nwf + 1 |
---|
| 65 | END DO |
---|
[825] | 66 | |
---|
[921] | 67 | ALLOCATE( nsubindex (nwf) ) |
---|
[825] | 68 | |
---|
[921] | 69 | DO jf = 1, noumef |
---|
| 70 | IF (nc(jf) == 1 ) THEN |
---|
| 71 | ii = ii +1 |
---|
| 72 | nsubindex(ii) = jf |
---|
| 73 | END IF |
---|
| 74 | END DO |
---|
[825] | 75 | |
---|
[921] | 76 | zsto = rdt_ice |
---|
| 77 | zout = nwrite * rdt_ice / nn_fsbc |
---|
| 78 | zsec = 0. |
---|
| 79 | niter = 0 |
---|
| 80 | zdept(1) = 0. |
---|
| 81 | nmoyice = 0 |
---|
[825] | 82 | |
---|
[921] | 83 | ENDIF |
---|
[825] | 84 | |
---|
| 85 | #if ! defined key_diainstant |
---|
[921] | 86 | !-- calculs des valeurs instantanees |
---|
[825] | 87 | |
---|
[921] | 88 | zcmo(:,:, 1:jpnoumax ) = 0.e0 |
---|
| 89 | DO jj = 2 , jpjm1 |
---|
[1694] | 90 | DO ji = 2 , jpim1 ! NO vector opt. |
---|
[5965] | 91 | zindh = MAX( 0._wp , SIGN( 1._wp , ht_i(ji,jj,1) * (1.0 - frld(ji,jj) ) - 0.10 ) ) |
---|
| 92 | zinda = MAX( 0._wp , SIGN( 1._wp , ( 1.0 - frld(ji,jj) ) - 0.10 ) ) |
---|
[921] | 93 | zindb = zindh * zinda |
---|
[5965] | 94 | ztmu = MAX( 0.5 * 1._wp , ( umask(ji,jj,1) + umask(ji+1,jj,1) + umask(ji,jj+1,1) + umask(ji+1,jj+1,1) ) ) |
---|
[921] | 95 | zcmo(ji,jj,1) = ht_s (ji,jj,1) |
---|
| 96 | zcmo(ji,jj,2) = ht_i (ji,jj,1) |
---|
[5965] | 97 | zcmo(ji,jj,3) = 0. |
---|
[921] | 98 | zcmo(ji,jj,4) = frld (ji,jj) |
---|
| 99 | zcmo(ji,jj,5) = sist (ji,jj) |
---|
[5965] | 100 | zcmo(ji,jj,6) = fhtur (ji,jj) |
---|
| 101 | zcmo(ji,jj,7) = zindb * ( u_ice(ji,jj ) * umask(ji,jj,1) + u_ice(ji+1,jj ) * umask(ji+1,jj,1) & |
---|
| 102 | + u_ice(ji,jj+1) * umask(ji,jj+1,1) + u_ice(ji+1,jj+1) * umask(ji+1,jj+1,1) ) & |
---|
[921] | 103 | / ztmu |
---|
[825] | 104 | |
---|
[5965] | 105 | zcmo(ji,jj,8) = zindb * ( v_ice(ji,jj ) * umask(ji,jj,1) + v_ice(ji+1,jj ) * umask(ji+1,jj,1) & |
---|
| 106 | + v_ice(ji,jj+1) * umask(ji,jj+1,1) + v_ice(ji+1,jj+1) * umask(ji+1,jj+1,1) ) & |
---|
[921] | 107 | / ztmu |
---|
| 108 | zcmo(ji,jj,9) = sst_m(ji,jj) |
---|
| 109 | zcmo(ji,jj,10) = sss_m(ji,jj) |
---|
[825] | 110 | |
---|
[921] | 111 | zcmo(ji,jj,11) = qns(ji,jj) + qsr(ji,jj) |
---|
| 112 | zcmo(ji,jj,12) = qsr(ji,jj) |
---|
| 113 | zcmo(ji,jj,13) = qns(ji,jj) |
---|
| 114 | ! See thersf for the coefficient |
---|
[3625] | 115 | zcmo(ji,jj,14) = - sfx (ji,jj) * rday ! converted in Kg/m2/day = mm/day |
---|
[1469] | 116 | zcmo(ji,jj,15) = utau_ice(ji,jj) |
---|
| 117 | zcmo(ji,jj,16) = vtau_ice(ji,jj) |
---|
[921] | 118 | zcmo(ji,jj,17) = qsr (ji,jj) |
---|
| 119 | zcmo(ji,jj,18) = qns(ji,jj) |
---|
| 120 | zcmo(ji,jj,19) = sprecip(ji,jj) |
---|
| 121 | END DO |
---|
| 122 | END DO |
---|
| 123 | ! Cumulates values between outputs |
---|
| 124 | rcmoy(:,:,:)= rcmoy(:,:,:) + zcmo(:,:,:) |
---|
| 125 | nmoyice = nmoyice + 1 |
---|
| 126 | ! compute mean value if it is time to write on file |
---|
| 127 | IF ( MOD(numit,nwrite) == 0 ) THEN |
---|
| 128 | rcmoy(:,:,:) = rcmoy(:,:,:) / FLOAT(nmoyice) |
---|
[825] | 129 | #else |
---|
[921] | 130 | IF ( MOD(numit,nwrite) == 0 ) THEN |
---|
| 131 | ! case of instantaneaous output rcmoy(:,:, 1:jpnoumax ) = 0.e0 |
---|
| 132 | DO jj = 2 , jpjm1 |
---|
[1694] | 133 | DO ji = 2 , jpim1 ! NO vector opt. |
---|
[5965] | 134 | zindh = MAX( 0._wp , SIGN( 1._wp , ht_i(ji,jj,1) * (1.0 - frld(ji,jj) ) - 0.10 ) ) |
---|
| 135 | zinda = MAX( 0._wp , SIGN( 1._wp , ( 1.0 - frld(ji,jj) ) - 0.10 ) ) |
---|
[921] | 136 | zindb = zindh * zinda |
---|
[5965] | 137 | ztmu = MAX( 0.5 * 1._wp , ( umask(ji,jj,1) + umask(ji+1,jj,1) + umask(ji,jj+1,1) + umask(ji+1,jj+1,1) ) ) |
---|
[921] | 138 | rcmoy(ji,jj,1) = ht_s (ji,jj,1) |
---|
| 139 | rcmoy(ji,jj,2) = ht_i (ji,jj,1) |
---|
[5965] | 140 | rcmoy(ji,jj,3) = 0. |
---|
[921] | 141 | rcmoy(ji,jj,4) = frld (ji,jj) |
---|
| 142 | rcmoy(ji,jj,5) = sist (ji,jj) |
---|
[5965] | 143 | rcmoy(ji,jj,6) = fhtur (ji,jj) |
---|
| 144 | rcmoy(ji,jj,7) = zindb * ( u_ice(ji,jj ) * umask(ji,jj,1) + u_ice(ji+1,jj ) * umask(ji+1,jj,1) & |
---|
| 145 | + u_ice(ji,jj+1) * umask(ji,jj+1,1) + u_ice(ji+1,jj+1) * umask(ji+1,jj+1,1) ) & |
---|
[921] | 146 | / ztmu |
---|
[825] | 147 | |
---|
[5965] | 148 | rcmoy(ji,jj,8) = zindb * ( v_ice(ji,jj ) * umask(ji,jj,1) + v_ice(ji+1,jj ) * umask(ji+1,jj,1) & |
---|
| 149 | + v_ice(ji,jj+1) * umask(ji,jj+1,1) + v_ice(ji+1,jj+1) * umask(ji+1,jj+1,1) ) & |
---|
[921] | 150 | / ztmu |
---|
| 151 | rcmoy(ji,jj,9) = sst_m(ji,jj) |
---|
| 152 | rcmoy(ji,jj,10) = sss_m(ji,jj) |
---|
[825] | 153 | |
---|
[921] | 154 | rcmoy(ji,jj,11) = qns(ji,jj) + qsr(ji,jj) |
---|
| 155 | rcmoy(ji,jj,12) = qsr(ji,jj) |
---|
| 156 | rcmoy(ji,jj,13) = qns(ji,jj) |
---|
| 157 | ! See thersf for the coefficient |
---|
[3625] | 158 | rcmoy(ji,jj,14) = - sfx (ji,jj) * rday ! converted in mm/day |
---|
[1469] | 159 | rcmoy(ji,jj,15) = utau_ice(ji,jj) |
---|
| 160 | rcmoy(ji,jj,16) = vtau_ice(ji,jj) |
---|
[921] | 161 | rcmoy(ji,jj,17) = qsr(ji,jj) |
---|
| 162 | rcmoy(ji,jj,18) = qns(ji,jj) |
---|
| 163 | rcmoy(ji,jj,19) = sprecip(ji,jj) |
---|
| 164 | END DO |
---|
| 165 | END DO |
---|
[825] | 166 | #endif |
---|
| 167 | |
---|
[921] | 168 | ! |
---|
| 169 | niter = niter + 1 |
---|
| 170 | DO jf = 1 , noumef |
---|
| 171 | zfield(:,:) = (rcmoy(:,:,jf) * cmulti(jf) + cadd(jf)) * tmask(:,:,1) |
---|
[825] | 172 | |
---|
[921] | 173 | IF ( jf == 7 .OR. jf == 8 .OR. jf == 15 .OR. jf == 16 ) THEN |
---|
| 174 | CALL lbc_lnk( zfield, 'T', -1. ) |
---|
| 175 | ELSE |
---|
| 176 | CALL lbc_lnk( zfield, 'T', 1. ) |
---|
| 177 | ENDIF |
---|
| 178 | rcmoy(:,:,jf) = zfield(:,:) |
---|
| 179 | END DO |
---|
[825] | 180 | |
---|
[921] | 181 | IF (ll_dia_inst) THEN |
---|
| 182 | clmode='instantaneous' |
---|
| 183 | ELSE |
---|
| 184 | WRITE(clmode,'(f5.1,a)' ) nwrite*rdt/86400.,' days average' |
---|
| 185 | END IF |
---|
| 186 | iyear = ndastp/10000 |
---|
| 187 | imon = (ndastp-iyear*10000)/100 |
---|
| 188 | iday = ndastp - imon*100 - iyear*10000 |
---|
| 189 | WRITE(clname,9000) TRIM(cexper),'ICEMOD',iyear,imon,iday |
---|
| 190 | cltext=TRIM(cexper)//' ice modele output'//TRIM(clmode) |
---|
| 191 | CALL dia_wri_dimg (clname, cltext, rcmoy, nwf , 'I', nsubindex) |
---|
| 192 | 9000 FORMAT(a,"_",a,"_y",i4.4,"m",i2.2,"d",i2.2,".dimgproc") |
---|
[825] | 193 | |
---|
[921] | 194 | rcmoy(:,:,:) = 0.0 |
---|
| 195 | nmoyice = 0 |
---|
| 196 | END IF ! MOD(numit, nwrite == 0 ) ! |
---|
[825] | 197 | |
---|
[921] | 198 | END SUBROUTINE lim_wri |
---|