| 1 | SUBROUTINE condsurf( jour, jourvrai, pctsrf, |
|---|
| 2 | s lmt_sst,lmt_alb,lmt_rug,lmt_bils ) |
|---|
| 3 | IMPLICIT none |
|---|
| 4 | c |
|---|
| 5 | c Lire les conditions aux limites du modele. |
|---|
| 6 | c ----------------------------------------- |
|---|
| 7 | c jour : input , numero du jour a lire |
|---|
| 8 | c jourvrai : input , vrai jour de la simulation |
|---|
| 9 | c |
|---|
| 10 | c pctsrf: sous-maille fractionnelle, la somme doit = 1 |
|---|
| 11 | c lmt_sst: temperature de la surface oceanique |
|---|
| 12 | c lmt_alb: albedo du sol |
|---|
| 13 | c lmt_rug: longeur de rugosite du sol |
|---|
| 14 | c lmt_bils: bilan chaleur au sol (a utiliser pour "slab-ocean") |
|---|
| 15 | c |
|---|
| 16 | #include "netcdf.inc" |
|---|
| 17 | INTEGER nid, nvarid |
|---|
| 18 | INTEGER debut(2) |
|---|
| 19 | INTEGER epais(2) |
|---|
| 20 | INTEGER lnblnk |
|---|
| 21 | EXTERNAL lnblnk |
|---|
| 22 | c |
|---|
| 23 | #include "dimensions.h" |
|---|
| 24 | #include "dimphy.h" |
|---|
| 25 | #include "indicesol.h" |
|---|
| 26 | #include "temps.h" |
|---|
| 27 | #include "clesphys.h" |
|---|
| 28 | c |
|---|
| 29 | c newlmt indique l'utilisation de la sous-maille fractionnelle, |
|---|
| 30 | c tandis que l'ancien regime utilisait l'indicateur du sol (0,1,2,3). |
|---|
| 31 | |
|---|
| 32 | LOGICAL newlmt |
|---|
| 33 | PARAMETER (newlmt=.FALSE.) |
|---|
| 34 | |
|---|
| 35 | INTEGER nannemax |
|---|
| 36 | PARAMETER ( nannemax = 60 ) |
|---|
| 37 | c |
|---|
| 38 | INTEGER jour,jourvrai |
|---|
| 39 | REAL lmt_nat(klon) ! indicateur de la nature du sol |
|---|
| 40 | REAL pctsrf(klon,nbsrf) ! sous-maille fractionnelle |
|---|
| 41 | REAL lmt_sst(klon) ! temperature de la surface oceanique |
|---|
| 42 | REAL lmt_alb(klon) ! albedo du sol |
|---|
| 43 | REAL lmt_rug(klon) ! longeur de rugosite du sol |
|---|
| 44 | REAL lmt_bils(klon) |
|---|
| 45 | c |
|---|
| 46 | c Variables locales: |
|---|
| 47 | INTEGER ig, i, j, kt, ierr |
|---|
| 48 | LOGICAL ok |
|---|
| 49 | INTEGER anneelim,anneemax |
|---|
| 50 | CHARACTER*20 fich |
|---|
| 51 | cc |
|---|
| 52 | cc ..................................................................... |
|---|
| 53 | cc |
|---|
| 54 | cc Pour lire le fichier limit correspondant vraiment a l'annee de la |
|---|
| 55 | cc simulation en cours , il suffit de mettre ok_limitvrai = .TRUE. |
|---|
| 56 | cc |
|---|
| 57 | cc ...................................................................... |
|---|
| 58 | c |
|---|
| 59 | c |
|---|
| 60 | IF (jour.LT.0 .OR. jour.GT.(360-1)) THEN |
|---|
| 61 | PRINT*,'Le jour demande n est pas correct: ', jour |
|---|
| 62 | CALL ABORT |
|---|
| 63 | ENDIF |
|---|
| 64 | c |
|---|
| 65 | c ............. modif ( P. Le Van ) ........... |
|---|
| 66 | |
|---|
| 67 | anneelim = anne_ini |
|---|
| 68 | anneemax = anne_ini + nannemax |
|---|
| 69 | c |
|---|
| 70 | c |
|---|
| 71 | IF( ok_limitvrai ) THEN |
|---|
| 72 | DO kt = 1, nannemax |
|---|
| 73 | IF(jourvrai.LE. (kt-1)*360 + 359 ) THEN |
|---|
| 74 | WRITE(fich,'("limit",i4,".nc")') anneelim |
|---|
| 75 | PRINT *,' Fichier Limite ',fich |
|---|
| 76 | GO TO 100 |
|---|
| 77 | ENDIF |
|---|
| 78 | anneelim = anneelim + 1 |
|---|
| 79 | ENDDO |
|---|
| 80 | |
|---|
| 81 | PRINT *,' PBS ! Le jour a lire sur le fichier limit ne se ' |
|---|
| 82 | PRINT *,' trouve pas sur les ',nannemax,' annees a partir de ' |
|---|
| 83 | PRINT *,' l annee de debut', anne_ini |
|---|
| 84 | CALL EXIT(1) |
|---|
| 85 | c |
|---|
| 86 | 100 CONTINUE |
|---|
| 87 | c |
|---|
| 88 | ELSE |
|---|
| 89 | |
|---|
| 90 | WRITE(fich,'("limit.nc")') |
|---|
| 91 | PRINT *,' Fichier Limite ',fich |
|---|
| 92 | ENDIF |
|---|
| 93 | c |
|---|
| 94 | c ........... ( fin modif P. Le Van ) ............ |
|---|
| 95 | c |
|---|
| 96 | c Ouvrir le fichier en format NetCDF: |
|---|
| 97 | c |
|---|
| 98 | ierr = NF_OPEN (fich, NF_NOWRITE,nid) |
|---|
| 99 | IF (ierr.NE.NF_NOERR) THEN |
|---|
| 100 | WRITE(6,*)' Pb d''ouverture du fichier ', fich |
|---|
| 101 | WRITE(6,*)' Le fichier limit ',fich,' (avec 4 chiffres , pour' |
|---|
| 102 | WRITE(6,*)' l an 2000 ) , n existe pas ! ' |
|---|
| 103 | WRITE(6,*)' ierr = ', ierr |
|---|
| 104 | CALL EXIT(1) |
|---|
| 105 | ENDIF |
|---|
| 106 | c |
|---|
| 107 | c La tranche de donnees a lire: |
|---|
| 108 | c |
|---|
| 109 | debut(1) = 1 |
|---|
| 110 | debut(2) = jour + 1 |
|---|
| 111 | epais(1) = klon |
|---|
| 112 | epais(2) = 1 |
|---|
| 113 | c |
|---|
| 114 | IF (newlmt) THEN |
|---|
| 115 | c |
|---|
| 116 | c Fraction "ocean": |
|---|
| 117 | ierr = NF_INQ_VARID (nid, "FOCE", nvarid) |
|---|
| 118 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 119 | PRINT*, "condsurf: Le champ <FOCE> est absent" |
|---|
| 120 | CALL abort |
|---|
| 121 | ENDIF |
|---|
| 122 | #ifdef NC_DOUBLE |
|---|
| 123 | ierr = NF_GET_VARA_DOUBLE(nid,nvarid,debut,epais,pctsrf(1,is_oce)) |
|---|
| 124 | #else |
|---|
| 125 | ierr = NF_GET_VARA_REAL(nid,nvarid,debut,epais,pctsrf(1,is_oce)) |
|---|
| 126 | #endif |
|---|
| 127 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 128 | PRINT*, "condsurf: Lecture echouee pour <FOCE>" |
|---|
| 129 | CALL abort |
|---|
| 130 | ENDIF |
|---|
| 131 | c |
|---|
| 132 | c Fraction "glace de mer": |
|---|
| 133 | ierr = NF_INQ_VARID (nid, "FSIC", nvarid) |
|---|
| 134 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 135 | PRINT*, "condsurf: Le champ <FSIC> est absent" |
|---|
| 136 | CALL abort |
|---|
| 137 | ENDIF |
|---|
| 138 | #ifdef NC_DOUBLE |
|---|
| 139 | ierr = NF_GET_VARA_DOUBLE(nid,nvarid,debut,epais,pctsrf(1,is_sic)) |
|---|
| 140 | #else |
|---|
| 141 | ierr = NF_GET_VARA_REAL(nid,nvarid,debut,epais,pctsrf(1,is_sic)) |
|---|
| 142 | #endif |
|---|
| 143 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 144 | PRINT*, "condsurf: Lecture echouee pour <FSIC>" |
|---|
| 145 | CALL abort |
|---|
| 146 | ENDIF |
|---|
| 147 | c |
|---|
| 148 | c Fraction "terre": |
|---|
| 149 | ierr = NF_INQ_VARID (nid, "FTER", nvarid) |
|---|
| 150 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 151 | PRINT*, "condsurf: Le champ <FTER> est absent" |
|---|
| 152 | CALL abort |
|---|
| 153 | ENDIF |
|---|
| 154 | #ifdef NC_DOUBLE |
|---|
| 155 | ierr = NF_GET_VARA_DOUBLE(nid,nvarid,debut,epais,pctsrf(1,is_ter)) |
|---|
| 156 | #else |
|---|
| 157 | ierr = NF_GET_VARA_REAL(nid,nvarid,debut,epais,pctsrf(1,is_ter)) |
|---|
| 158 | #endif |
|---|
| 159 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 160 | PRINT*, "condsurf: Lecture echouee pour <FTER>" |
|---|
| 161 | CALL abort |
|---|
| 162 | ENDIF |
|---|
| 163 | c |
|---|
| 164 | c Fraction "glacier terre": |
|---|
| 165 | ierr = NF_INQ_VARID (nid, "FLIC", nvarid) |
|---|
| 166 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 167 | PRINT*, "condsurf: Le champ <FLIC> est absent" |
|---|
| 168 | CALL abort |
|---|
| 169 | ENDIF |
|---|
| 170 | #ifdef NC_DOUBLE |
|---|
| 171 | ierr = NF_GET_VARA_DOUBLE(nid,nvarid,debut,epais,pctsrf(1,is_lic)) |
|---|
| 172 | #else |
|---|
| 173 | ierr = NF_GET_VARA_REAL(nid,nvarid,debut,epais,pctsrf(1,is_lic)) |
|---|
| 174 | #endif |
|---|
| 175 | IF (ierr .NE. 0) THEN |
|---|
| 176 | PRINT*, "condsurf: Lecture echouee pour <FLIC>" |
|---|
| 177 | CALL abort |
|---|
| 178 | ENDIF |
|---|
| 179 | c |
|---|
| 180 | ELSE ! test sur newlmt |
|---|
| 181 | c |
|---|
| 182 | c Indicateur de la nature du sol (0,1,2,3): |
|---|
| 183 | ierr = NF_INQ_VARID (nid, "NAT", nvarid) |
|---|
| 184 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 185 | PRINT*, "condsurf: Le champ <NAT> est absent" |
|---|
| 186 | CALL abort |
|---|
| 187 | ENDIF |
|---|
| 188 | #ifdef NC_DOUBLE |
|---|
| 189 | ierr = NF_GET_VARA_DOUBLE(nid, nvarid,debut,epais,lmt_nat) |
|---|
| 190 | #else |
|---|
| 191 | ierr = NF_GET_VARA_REAL(nid, nvarid,debut,epais,lmt_nat) |
|---|
| 192 | #endif |
|---|
| 193 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 194 | PRINT*, "condsurf: Lecture echouee pour <NAT>" |
|---|
| 195 | CALL abort |
|---|
| 196 | ENDIF |
|---|
| 197 | c |
|---|
| 198 | DO ig = 1, klon |
|---|
| 199 | pctsrf(ig,is_oce) = 0.0 |
|---|
| 200 | pctsrf(ig,is_ter) = 0.0 |
|---|
| 201 | pctsrf(ig,is_lic) = 0.0 |
|---|
| 202 | pctsrf(ig,is_sic) = 0.0 |
|---|
| 203 | ENDDO |
|---|
| 204 | ok = .TRUE. |
|---|
| 205 | DO ig = 1, klon |
|---|
| 206 | IF (NINT(lmt_nat(ig)).EQ.0) THEN |
|---|
| 207 | pctsrf(ig,is_oce) = 1.0 |
|---|
| 208 | ELSE IF (NINT(lmt_nat(ig)).EQ.1) THEN |
|---|
| 209 | pctsrf(ig,is_ter) = 1.0 |
|---|
| 210 | ELSE IF (NINT(lmt_nat(ig)).EQ.2) THEN |
|---|
| 211 | pctsrf(ig,is_lic) = 1.0 |
|---|
| 212 | ELSE IF (NINT(lmt_nat(ig)).EQ.3) THEN |
|---|
| 213 | pctsrf(ig,is_sic) = 1.0 |
|---|
| 214 | ELSE |
|---|
| 215 | ok = .FALSE. |
|---|
| 216 | ENDIF |
|---|
| 217 | ENDDO |
|---|
| 218 | IF (.NOT.ok) THEN |
|---|
| 219 | PRINT*, "valeur fausse pour lmt_nat:", lmt_nat |
|---|
| 220 | CALL abort |
|---|
| 221 | ENDIF |
|---|
| 222 | c |
|---|
| 223 | ENDIF ! fin de test sur newlmt |
|---|
| 224 | c |
|---|
| 225 | c Sea surface temperature: |
|---|
| 226 | ierr = NF_INQ_VARID (nid, "SST", nvarid) |
|---|
| 227 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 228 | PRINT*, "condsurf: Le champ <SST> est absent" |
|---|
| 229 | CALL abort |
|---|
| 230 | ENDIF |
|---|
| 231 | #ifdef NC_DOUBLE |
|---|
| 232 | ierr = NF_GET_VARA_DOUBLE(nid, nvarid,debut,epais,lmt_sst) |
|---|
| 233 | #else |
|---|
| 234 | ierr = NF_GET_VARA_REAL(nid, nvarid,debut,epais,lmt_sst) |
|---|
| 235 | #endif |
|---|
| 236 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 237 | PRINT*, "condsurf: Lecture echouee pour <SST>" |
|---|
| 238 | CALL abort |
|---|
| 239 | ENDIF |
|---|
| 240 | c |
|---|
| 241 | c Albedo de surface: |
|---|
| 242 | ierr = NF_INQ_VARID (nid, "ALB", nvarid) |
|---|
| 243 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 244 | PRINT*, "condsurf: Le champ <ALB> est absent" |
|---|
| 245 | CALL abort |
|---|
| 246 | ENDIF |
|---|
| 247 | #ifdef NC_DOUBLE |
|---|
| 248 | ierr = NF_GET_VARA_DOUBLE(nid, nvarid,debut,epais,lmt_alb) |
|---|
| 249 | #else |
|---|
| 250 | ierr = NF_GET_VARA_REAL(nid, nvarid,debut,epais,lmt_alb) |
|---|
| 251 | #endif |
|---|
| 252 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 253 | PRINT*, "condsurf: Lecture echouee pour <ALB>" |
|---|
| 254 | CALL abort |
|---|
| 255 | ENDIF |
|---|
| 256 | c |
|---|
| 257 | c Longueur de rugosite au sol: |
|---|
| 258 | ierr = NF_INQ_VARID (nid, "RUG", nvarid) |
|---|
| 259 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 260 | PRINT*, "condsurf: Le champ <RUG> est absent" |
|---|
| 261 | CALL abort |
|---|
| 262 | ENDIF |
|---|
| 263 | #ifdef NC_DOUBLE |
|---|
| 264 | ierr = NF_GET_VARA_DOUBLE(nid, nvarid,debut,epais,lmt_rug) |
|---|
| 265 | #else |
|---|
| 266 | ierr = NF_GET_VARA_REAL(nid, nvarid,debut,epais,lmt_rug) |
|---|
| 267 | #endif |
|---|
| 268 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 269 | PRINT*, "condsurf: Lecture echouee pour <RUG>" |
|---|
| 270 | CALL abort |
|---|
| 271 | ENDIF |
|---|
| 272 | c |
|---|
| 273 | c Bilan flux de chaleur au sol: |
|---|
| 274 | ierr = NF_INQ_VARID (nid, "BILS", nvarid) |
|---|
| 275 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 276 | PRINT*, "condsurf: Le champ <BILS> est absent" |
|---|
| 277 | CALL abort |
|---|
| 278 | ENDIF |
|---|
| 279 | #ifdef NC_DOUBLE |
|---|
| 280 | ierr = NF_GET_VARA_DOUBLE(nid, nvarid,debut,epais,lmt_bils) |
|---|
| 281 | #else |
|---|
| 282 | ierr = NF_GET_VARA_REAL(nid, nvarid,debut,epais,lmt_bils) |
|---|
| 283 | #endif |
|---|
| 284 | IF (ierr .NE. NF_NOERR) THEN |
|---|
| 285 | PRINT*, "condsurf: Lecture echouee pour <BILS>" |
|---|
| 286 | CALL abort |
|---|
| 287 | ENDIF |
|---|
| 288 | c |
|---|
| 289 | c Fermer le fichier: |
|---|
| 290 | c |
|---|
| 291 | ierr = NF_CLOSE(nid) |
|---|
| 292 | c |
|---|
| 293 | c |
|---|
| 294 | PRINT*, 'SST, ALB, RUG, etc. sont lus pour jour: ', jour |
|---|
| 295 | c |
|---|
| 296 | RETURN |
|---|
| 297 | END |
|---|