| 1 | SUBROUTINE condsurfs(jour, edgar, flag_dms, & |
|---|
| 2 | lmt_so2h, lmt_so2b, lmt_so2bb, lmt_so2ba, & |
|---|
| 3 | lmt_so2volc, lmt_altvolc, & |
|---|
| 4 | lmt_dmsbio, lmt_h2sbio, lmt_dms, lmt_dmsconc) |
|---|
| 5 | USE dimphy |
|---|
| 6 | USE netcdf, ONLY: nf90_close, nf90_noerr, nf90_inq_varid, nf90_open, & |
|---|
| 7 | nf90_nowrite, nf90_get_var |
|---|
| 8 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
|---|
| 9 | IMPLICIT NONE |
|---|
| 10 | |
|---|
| 11 | ! Lire les conditions aux limites du modele pour la chimie. |
|---|
| 12 | ! -------------------------------------------------------- |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | REAL :: lmt_so2h(klon), lmt_so2b(klon), lmt_so2bb(klon) |
|---|
| 17 | REAL :: lmt_dmsbio(klon), lmt_h2sbio(klon), lmt_so2ba(klon) |
|---|
| 18 | REAL :: lmt_so2volc(klon), lmt_altvolc(klon) |
|---|
| 19 | REAL :: lmt_dms(klon), lmt_dmsconc(klon) |
|---|
| 20 | LOGICAL :: edgar |
|---|
| 21 | INTEGER :: flag_dms |
|---|
| 22 | |
|---|
| 23 | INTEGER :: jour, i |
|---|
| 24 | INTEGER :: ierr |
|---|
| 25 | INTEGER :: nid, nvarid |
|---|
| 26 | INTEGER :: debut(2), epais(2) |
|---|
| 27 | |
|---|
| 28 | IF (jour<0 .OR. jour>(360 - 1)) THEN |
|---|
| 29 | IF ((jour>(360 - 1)) .AND. (jour<=367)) THEN |
|---|
| 30 | jour = 360 - 1 |
|---|
| 31 | PRINT *, 'JE: jour changed to jour= ', jour |
|---|
| 32 | ELSE |
|---|
| 33 | PRINT*, 'Le jour demande n est pas correcte:', jour |
|---|
| 34 | CALL ABORT |
|---|
| 35 | ENDIF |
|---|
| 36 | ENDIF |
|---|
| 37 | |
|---|
| 38 | ierr = nf90_open ("limitsoufre.nc", nf90_nowrite, nid) |
|---|
| 39 | IF (ierr/=nf90_noerr) THEN |
|---|
| 40 | WRITE(6, *)' Pb d''ouverture du fichier limitsoufre.nc' |
|---|
| 41 | WRITE(6, *)' ierr = ', ierr |
|---|
| 42 | CALL exit(1) |
|---|
| 43 | ENDIF |
|---|
| 44 | |
|---|
| 45 | ! Tranche a lire: |
|---|
| 46 | debut(1) = 1 |
|---|
| 47 | debut(2) = jour + 1 |
|---|
| 48 | epais(1) = klon |
|---|
| 49 | epais(2) = 1 |
|---|
| 50 | |
|---|
| 51 | ierr = nf90_inq_varid (nid, "VOLC", nvarid) |
|---|
| 52 | ierr = nf90_get_var(nid, nvarid, lmt_so2volc, debut, epais) |
|---|
| 53 | IF (ierr /= nf90_noerr) THEN |
|---|
| 54 | PRINT*, 'Pb de lecture pour les sources so2 volcan' |
|---|
| 55 | CALL exit(1) |
|---|
| 56 | ENDIF |
|---|
| 57 | |
|---|
| 58 | ierr = nf90_inq_varid (nid, "ALTI", nvarid) |
|---|
| 59 | ierr = nf90_get_var(nid, nvarid, lmt_altvolc, debut, epais) |
|---|
| 60 | IF (ierr /= nf90_noerr) THEN |
|---|
| 61 | PRINT*, 'Pb de lecture pour les altitudes volcan' |
|---|
| 62 | CALL exit(1) |
|---|
| 63 | ENDIF |
|---|
| 64 | |
|---|
| 65 | IF (edgar) THEN !--EDGAR w/o ship and biomass burning |
|---|
| 66 | |
|---|
| 67 | ierr = nf90_inq_varid (nid, "SO2ED95L", nvarid) |
|---|
| 68 | ierr = nf90_get_var(nid, nvarid, lmt_so2b, debut, epais) |
|---|
| 69 | IF (ierr /= nf90_noerr) THEN |
|---|
| 70 | PRINT*, 'Pb de lecture pour les sources so2 edgar low' |
|---|
| 71 | CALL exit(1) |
|---|
| 72 | ENDIF |
|---|
| 73 | |
|---|
| 74 | ierr = nf90_inq_varid (nid, "SO2ED95H", nvarid) |
|---|
| 75 | ierr = nf90_get_var(nid, nvarid, lmt_so2h, debut, epais) |
|---|
| 76 | IF (ierr /= nf90_noerr) THEN |
|---|
| 77 | PRINT*, 'Pb de lecture pour les sources so2 edgar high' |
|---|
| 78 | CALL exit(1) |
|---|
| 79 | ENDIF |
|---|
| 80 | |
|---|
| 81 | ELSE !--GEIA |
|---|
| 82 | |
|---|
| 83 | ierr = nf90_inq_varid (nid, "SO2H", nvarid) |
|---|
| 84 | ierr = nf90_get_var(nid, nvarid, lmt_so2h, debut, epais) |
|---|
| 85 | IF (ierr /= nf90_noerr) THEN |
|---|
| 86 | PRINT*, 'Pb de lecture pour les sources so2 haut' |
|---|
| 87 | CALL exit(1) |
|---|
| 88 | ENDIF |
|---|
| 89 | |
|---|
| 90 | ierr = nf90_inq_varid (nid, "SO2B", nvarid) |
|---|
| 91 | ierr = nf90_get_var(nid, nvarid, lmt_so2b, debut, epais) |
|---|
| 92 | IF (ierr /= nf90_noerr) THEN |
|---|
| 93 | PRINT*, 'Pb de lecture pour les sources so2 bas' |
|---|
| 94 | CALL exit(1) |
|---|
| 95 | ENDIF |
|---|
| 96 | |
|---|
| 97 | ENDIF !--edgar |
|---|
| 98 | |
|---|
| 99 | ierr = nf90_inq_varid (nid, "SO2BB", nvarid) |
|---|
| 100 | ierr = nf90_get_var(nid, nvarid, lmt_so2bb, debut, epais) |
|---|
| 101 | IF (ierr /= nf90_noerr) THEN |
|---|
| 102 | PRINT*, 'Pb de lecture pour les sources so2 bb' |
|---|
| 103 | CALL exit(1) |
|---|
| 104 | ENDIF |
|---|
| 105 | |
|---|
| 106 | ierr = nf90_inq_varid (nid, "SO2BA", nvarid) |
|---|
| 107 | ierr = nf90_get_var(nid, nvarid, lmt_so2ba, debut, epais) |
|---|
| 108 | IF (ierr /= nf90_noerr) THEN |
|---|
| 109 | PRINT*, 'Pb de lecture pour les sources so2 bateau' |
|---|
| 110 | CALL exit(1) |
|---|
| 111 | ENDIF |
|---|
| 112 | |
|---|
| 113 | ierr = nf90_inq_varid (nid, "DMSB", nvarid) |
|---|
| 114 | ierr = nf90_get_var(nid, nvarid, lmt_dmsbio, debut, epais) |
|---|
| 115 | IF (ierr /= nf90_noerr) THEN |
|---|
| 116 | PRINT*, 'Pb de lecture pour les sources dms bio' |
|---|
| 117 | CALL exit(1) |
|---|
| 118 | ENDIF |
|---|
| 119 | |
|---|
| 120 | ierr = nf90_inq_varid (nid, "H2SB", nvarid) |
|---|
| 121 | ierr = nf90_get_var(nid, nvarid, lmt_h2sbio, debut, epais) |
|---|
| 122 | IF (ierr /= nf90_noerr) THEN |
|---|
| 123 | PRINT*, 'Pb de lecture pour les sources h2s bio' |
|---|
| 124 | CALL exit(1) |
|---|
| 125 | ENDIF |
|---|
| 126 | |
|---|
| 127 | IF (flag_dms==1) THEN |
|---|
| 128 | |
|---|
| 129 | ierr = nf90_inq_varid (nid, "DMSL", nvarid) |
|---|
| 130 | ierr = nf90_get_var(nid, nvarid, lmt_dms, debut, epais) |
|---|
| 131 | IF (ierr /= nf90_noerr) THEN |
|---|
| 132 | PRINT*, 'Pb de lecture pour les sources dms liss' |
|---|
| 133 | CALL exit(1) |
|---|
| 134 | ENDIF |
|---|
| 135 | |
|---|
| 136 | ELSEIF (flag_dms==2) THEN |
|---|
| 137 | |
|---|
| 138 | ierr = nf90_inq_varid (nid, "DMSW", nvarid) |
|---|
| 139 | ierr = nf90_get_var(nid, nvarid, lmt_dms, debut, epais) |
|---|
| 140 | IF (ierr /= nf90_noerr) THEN |
|---|
| 141 | PRINT*, 'Pb de lecture pour les sources dms wann' |
|---|
| 142 | CALL exit(1) |
|---|
| 143 | ENDIF |
|---|
| 144 | |
|---|
| 145 | ELSEIF (flag_dms==3) THEN |
|---|
| 146 | |
|---|
| 147 | ierr = nf90_inq_varid (nid, "DMSC1", nvarid) |
|---|
| 148 | ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais) |
|---|
| 149 | IF (ierr /= nf90_noerr) THEN |
|---|
| 150 | PRINT*, 'Pb de lecture pour les sources dmsconc old' |
|---|
| 151 | CALL exit(1) |
|---|
| 152 | ENDIF |
|---|
| 153 | |
|---|
| 154 | ELSEIF (flag_dms==4) THEN |
|---|
| 155 | |
|---|
| 156 | ierr = nf90_inq_varid (nid, "DMSC2", nvarid) |
|---|
| 157 | ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais) |
|---|
| 158 | IF (ierr /= nf90_noerr) THEN |
|---|
| 159 | PRINT*, 'Pb de lecture pour les sources dms conc 2' |
|---|
| 160 | CALL exit(1) |
|---|
| 161 | ENDIF |
|---|
| 162 | |
|---|
| 163 | ELSEIF (flag_dms==5) THEN |
|---|
| 164 | |
|---|
| 165 | ierr = nf90_inq_varid (nid, "DMSC3", nvarid) |
|---|
| 166 | ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais) |
|---|
| 167 | IF (ierr /= nf90_noerr) THEN |
|---|
| 168 | PRINT*, 'Pb de lecture pour les sources dms conc 3' |
|---|
| 169 | CALL exit(1) |
|---|
| 170 | ENDIF |
|---|
| 171 | |
|---|
| 172 | ELSEIF (flag_dms==6) THEN |
|---|
| 173 | |
|---|
| 174 | ierr = nf90_inq_varid (nid, "DMSC4", nvarid) |
|---|
| 175 | ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais) |
|---|
| 176 | IF (ierr /= nf90_noerr) THEN |
|---|
| 177 | PRINT*, 'Pb de lecture pour les sources dms conc 4' |
|---|
| 178 | CALL exit(1) |
|---|
| 179 | ENDIF |
|---|
| 180 | |
|---|
| 181 | ELSEIF (flag_dms==7) THEN |
|---|
| 182 | |
|---|
| 183 | ierr = nf90_inq_varid (nid, "DMSC5", nvarid) |
|---|
| 184 | ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais) |
|---|
| 185 | IF (ierr /= nf90_noerr) THEN |
|---|
| 186 | PRINT*, 'Pb de lecture pour les sources dms conc 5' |
|---|
| 187 | CALL exit(1) |
|---|
| 188 | ENDIF |
|---|
| 189 | |
|---|
| 190 | ELSEIF (flag_dms==8) THEN |
|---|
| 191 | |
|---|
| 192 | ierr = nf90_inq_varid (nid, "DMSC6", nvarid) |
|---|
| 193 | ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais) |
|---|
| 194 | IF (ierr /= nf90_noerr) THEN |
|---|
| 195 | PRINT*, 'Pb de lecture pour les sources dms conc 6' |
|---|
| 196 | CALL exit(1) |
|---|
| 197 | ENDIF |
|---|
| 198 | |
|---|
| 199 | ELSEIF (flag_dms==9) THEN |
|---|
| 200 | |
|---|
| 201 | ierr = nf90_inq_varid (nid, "DMSC7", nvarid) |
|---|
| 202 | ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais) |
|---|
| 203 | IF (ierr /= nf90_noerr) THEN |
|---|
| 204 | PRINT*, 'Pb de lecture pour les sources dms conc 7' |
|---|
| 205 | CALL exit(1) |
|---|
| 206 | ENDIF |
|---|
| 207 | |
|---|
| 208 | ELSEIF (flag_dms==10) THEN |
|---|
| 209 | |
|---|
| 210 | ierr = nf90_inq_varid (nid, "DMSC8", nvarid) |
|---|
| 211 | ierr = nf90_get_var(nid, nvarid, lmt_dmsconc, debut, epais) |
|---|
| 212 | IF (ierr /= nf90_noerr) THEN |
|---|
| 213 | PRINT*, 'Pb de lecture pour les sources dms conc 8' |
|---|
| 214 | CALL exit(1) |
|---|
| 215 | ENDIF |
|---|
| 216 | |
|---|
| 217 | ELSE |
|---|
| 218 | |
|---|
| 219 | PRINT *, 'choix non possible pour flag_dms' |
|---|
| 220 | STOP |
|---|
| 221 | |
|---|
| 222 | ENDIF |
|---|
| 223 | |
|---|
| 224 | ierr = nf90_close(nid) |
|---|
| 225 | |
|---|
| 226 | IF (flag_dms<=2) THEN |
|---|
| 227 | DO i = 1, klon |
|---|
| 228 | lmt_dmsconc(i) = 0.0 |
|---|
| 229 | ENDDO |
|---|
| 230 | ELSE |
|---|
| 231 | DO i = 1, klon |
|---|
| 232 | lmt_dms(i) = 0.0 |
|---|
| 233 | ENDDO |
|---|
| 234 | ENDIF |
|---|
| 235 | |
|---|
| 236 | PRINT*, 'Sources SOUFRE lues pour jour: ', jour |
|---|
| 237 | |
|---|
| 238 | |
|---|
| 239 | END SUBROUTINE condsurfs |
|---|