[2] | 1 | SUBROUTINE dynhist0(fichnom,idayref,anneeref,phis,nq) |
---|
| 2 | IMPLICIT NONE |
---|
| 3 | c======================================================================= |
---|
| 4 | c Ecriture du fichier de redemarrage sous format NetCDF (initialisation) |
---|
| 5 | c======================================================================= |
---|
| 6 | c Declarations: |
---|
| 7 | c ------------- |
---|
| 8 | #include "dimensions.h" |
---|
| 9 | #include "paramet.h" |
---|
| 10 | #include "comconst.h" |
---|
| 11 | #include "comvert.h" |
---|
| 12 | #include "comgeom.h" |
---|
| 13 | #include "temps.h" |
---|
| 14 | #include "ener.h" |
---|
| 15 | #include "logic.h" |
---|
| 16 | #include "netcdf.inc" |
---|
| 17 | #include "description.h" |
---|
| 18 | #include "serre.h" |
---|
| 19 | |
---|
| 20 | c Arguments: |
---|
| 21 | c ---------- |
---|
| 22 | INTEGER*4 idayref,anneeref |
---|
| 23 | REAL phis(ip1jmp1) |
---|
| 24 | CHARACTER*(*) fichnom |
---|
| 25 | INTEGER nq |
---|
| 26 | |
---|
| 27 | c Local: |
---|
| 28 | c ------ |
---|
| 29 | INTEGER iq,l |
---|
| 30 | CHARACTER str3*3 |
---|
| 31 | INTEGER length |
---|
| 32 | PARAMETER (length = 100) |
---|
| 33 | REAL tab_cntrl(length) ! tableau des parametres du run |
---|
| 34 | INTEGER ierr |
---|
| 35 | |
---|
| 36 | c Variables locales pour NetCDF: |
---|
| 37 | c |
---|
| 38 | INTEGER dims2(2), dims3(3), dims4(4) |
---|
| 39 | INTEGER idim_index |
---|
| 40 | INTEGER idim_rlonu, idim_rlonv, idim_rlatu, idim_rlatv |
---|
| 41 | INTEGER idim_s, idim_sig |
---|
| 42 | INTEGER idim_tim |
---|
| 43 | INTEGER nid,nvarid |
---|
| 44 | c----------------------------------------------------------------------- |
---|
| 45 | |
---|
| 46 | DO l=1,length |
---|
| 47 | tab_cntrl(l) = 0. |
---|
| 48 | ENDDO |
---|
| 49 | tab_cntrl(1) = FLOAT(iim) |
---|
| 50 | tab_cntrl(2) = FLOAT(jjm) |
---|
| 51 | tab_cntrl(3) = FLOAT(llm) |
---|
| 52 | tab_cntrl(4) = FLOAT(idayref) |
---|
| 53 | tab_cntrl(5) = FLOAT(anneeref) |
---|
| 54 | tab_cntrl(6) = rad |
---|
| 55 | tab_cntrl(7) = omeg |
---|
| 56 | tab_cntrl(8) = g |
---|
| 57 | tab_cntrl(9) = cpp |
---|
| 58 | tab_cntrl(10) = kappa |
---|
| 59 | tab_cntrl(11) = daysec |
---|
| 60 | tab_cntrl(12) = dtvr |
---|
| 61 | tab_cntrl(13) = etot0 |
---|
| 62 | tab_cntrl(14) = ptot0 |
---|
| 63 | tab_cntrl(15) = ztot0 |
---|
| 64 | tab_cntrl(16) = stot0 |
---|
| 65 | tab_cntrl(17) = ang0 |
---|
| 66 | tab_cntrl(18) = pa |
---|
| 67 | tab_cntrl(19) = preff |
---|
| 68 | c |
---|
| 69 | c ..... parametres pour le zoom ...... |
---|
| 70 | |
---|
| 71 | tab_cntrl(20) = clon |
---|
| 72 | tab_cntrl(21) = clat |
---|
| 73 | tab_cntrl(22) = grossismx |
---|
| 74 | tab_cntrl(23) = grossismy |
---|
| 75 | c |
---|
| 76 | IF ( fxyhypb ) THEN |
---|
| 77 | tab_cntrl(24) = 1. |
---|
| 78 | tab_cntrl(25) = dzoomx |
---|
| 79 | tab_cntrl(26) = dzoomy |
---|
| 80 | ELSE |
---|
| 81 | tab_cntrl(24) = 0. |
---|
| 82 | tab_cntrl(25) = dzoomx |
---|
| 83 | tab_cntrl(26) = dzoomy |
---|
| 84 | tab_cntrl(27) = 0. |
---|
| 85 | IF( ysinus ) tab_cntrl(27) = 1. |
---|
| 86 | ENDIF |
---|
| 87 | c |
---|
| 88 | c ......................................................... |
---|
| 89 | c |
---|
| 90 | c Creation du fichier: |
---|
| 91 | c |
---|
| 92 | ierr = NF_CREATE(fichnom, NF_CLOBBER, nid) |
---|
| 93 | IF (ierr.NE.NF_NOERR) THEN |
---|
| 94 | WRITE(6,*)" Pb d ouverture du fichier "//fichnom |
---|
| 95 | WRITE(6,*)' ierr = ', ierr |
---|
| 96 | CALL ABORT |
---|
| 97 | ENDIF |
---|
| 98 | c |
---|
| 99 | c Preciser quelques attributs globaux: |
---|
| 100 | c |
---|
| 101 | ierr = NF_PUT_ATT_TEXT (nid, NF_GLOBAL, "title", 27, |
---|
| 102 | . "Fichier demmarage dynamique") |
---|
| 103 | c |
---|
| 104 | c Definir les dimensions du fichiers: |
---|
| 105 | c |
---|
| 106 | ierr = NF_DEF_DIM (nid, "index", length, idim_index) |
---|
| 107 | ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu) |
---|
| 108 | ierr = NF_DEF_DIM (nid, "rlatu", jjp1, idim_rlatu) |
---|
| 109 | ierr = NF_DEF_DIM (nid, "rlonv", iip1, idim_rlonv) |
---|
| 110 | ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv) |
---|
| 111 | ierr = NF_DEF_DIM (nid, "sigs", llm, idim_s) |
---|
| 112 | ierr = NF_DEF_DIM (nid, "sig", llmp1, idim_sig) |
---|
| 113 | ierr = NF_DEF_DIM (nid, "temps", NF_UNLIMITED, idim_tim) |
---|
| 114 | c |
---|
| 115 | ierr = NF_ENDDEF(nid) ! sortir du mode de definition |
---|
| 116 | c |
---|
| 117 | c Definir et enregistrer certains champs invariants: |
---|
| 118 | c |
---|
| 119 | ierr = NF_REDEF (nid) |
---|
| 120 | #ifdef NC_DOUBLE |
---|
| 121 | ierr = NF_DEF_VAR (nid,"controle",NF_DOUBLE,1,idim_index,nvarid) |
---|
| 122 | #else |
---|
| 123 | ierr = NF_DEF_VAR (nid,"controle",NF_FLOAT,1,idim_index,nvarid) |
---|
| 124 | #endif |
---|
| 125 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
| 126 | . "Parametres de controle") |
---|
| 127 | ierr = NF_ENDDEF(nid) |
---|
| 128 | #ifdef NC_DOUBLE |
---|
| 129 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
| 130 | #else |
---|
| 131 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
| 132 | #endif |
---|
| 133 | c |
---|
| 134 | ierr = NF_REDEF (nid) |
---|
| 135 | #ifdef NC_DOUBLE |
---|
| 136 | ierr = NF_DEF_VAR (nid,"rlonu",NF_DOUBLE,1,idim_rlonu,nvarid) |
---|
| 137 | #else |
---|
| 138 | ierr = NF_DEF_VAR (nid,"rlonu",NF_FLOAT,1,idim_rlonu,nvarid) |
---|
| 139 | #endif |
---|
| 140 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23, |
---|
| 141 | . "Longitudes des points U") |
---|
| 142 | ierr = NF_ENDDEF(nid) |
---|
| 143 | #ifdef NC_DOUBLE |
---|
| 144 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu) |
---|
| 145 | #else |
---|
| 146 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu) |
---|
| 147 | #endif |
---|
| 148 | c |
---|
| 149 | ierr = NF_REDEF (nid) |
---|
| 150 | #ifdef NC_DOUBLE |
---|
| 151 | ierr = NF_DEF_VAR (nid,"rlatu",NF_DOUBLE,1,idim_rlatu,nvarid) |
---|
| 152 | #else |
---|
| 153 | ierr = NF_DEF_VAR (nid,"rlatu",NF_FLOAT,1,idim_rlatu,nvarid) |
---|
| 154 | #endif |
---|
| 155 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
| 156 | . "Latitudes des points U") |
---|
| 157 | ierr = NF_ENDDEF(nid) |
---|
| 158 | #ifdef NC_DOUBLE |
---|
| 159 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu) |
---|
| 160 | #else |
---|
| 161 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu) |
---|
| 162 | #endif |
---|
| 163 | c |
---|
| 164 | ierr = NF_REDEF (nid) |
---|
| 165 | #ifdef NC_DOUBLE |
---|
| 166 | ierr = NF_DEF_VAR (nid,"rlonv",NF_DOUBLE,1,idim_rlonv,nvarid) |
---|
| 167 | #else |
---|
| 168 | ierr = NF_DEF_VAR (nid,"rlonv",NF_FLOAT,1,idim_rlonv,nvarid) |
---|
| 169 | #endif |
---|
| 170 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23, |
---|
| 171 | . "Longitudes des points V") |
---|
| 172 | ierr = NF_ENDDEF(nid) |
---|
| 173 | #ifdef NC_DOUBLE |
---|
| 174 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv) |
---|
| 175 | #else |
---|
| 176 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv) |
---|
| 177 | #endif |
---|
| 178 | c |
---|
| 179 | ierr = NF_REDEF (nid) |
---|
| 180 | #ifdef NC_DOUBLE |
---|
| 181 | ierr = NF_DEF_VAR (nid,"rlatv",NF_DOUBLE,1,idim_rlatv,nvarid) |
---|
| 182 | #else |
---|
| 183 | ierr = NF_DEF_VAR (nid,"rlatv",NF_FLOAT,1,idim_rlatv,nvarid) |
---|
| 184 | #endif |
---|
| 185 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
| 186 | . "Latitudes des points V") |
---|
| 187 | ierr = NF_ENDDEF(nid) |
---|
| 188 | #ifdef NC_DOUBLE |
---|
| 189 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv) |
---|
| 190 | #else |
---|
| 191 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv) |
---|
| 192 | #endif |
---|
| 193 | c |
---|
| 194 | ierr = NF_REDEF (nid) |
---|
| 195 | #ifdef NC_DOUBLE |
---|
| 196 | ierr = NF_DEF_VAR (nid,"nivsigs",NF_DOUBLE,1,idim_s,nvarid) |
---|
| 197 | #else |
---|
| 198 | ierr = NF_DEF_VAR (nid,"nivsigs",NF_FLOAT,1,idim_s,nvarid) |
---|
| 199 | #endif |
---|
| 200 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 28, |
---|
| 201 | . "Numero naturel des couches s") |
---|
| 202 | ierr = NF_ENDDEF(nid) |
---|
| 203 | #ifdef NC_DOUBLE |
---|
| 204 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsigs) |
---|
| 205 | #else |
---|
| 206 | ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsigs) |
---|
| 207 | #endif |
---|
| 208 | c |
---|
| 209 | ierr = NF_REDEF (nid) |
---|
| 210 | #ifdef NC_DOUBLE |
---|
| 211 | ierr = NF_DEF_VAR (nid,"nivsig",NF_DOUBLE,1,idim_sig,nvarid) |
---|
| 212 | #else |
---|
| 213 | ierr = NF_DEF_VAR (nid,"nivsig",NF_FLOAT,1,idim_sig,nvarid) |
---|
| 214 | #endif |
---|
| 215 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 32, |
---|
| 216 | . "Numero naturel des couches sigma") |
---|
| 217 | ierr = NF_ENDDEF(nid) |
---|
| 218 | #ifdef NC_DOUBLE |
---|
| 219 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsig) |
---|
| 220 | #else |
---|
| 221 | ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsig) |
---|
| 222 | #endif |
---|
| 223 | c |
---|
| 224 | ierr = NF_REDEF (nid) |
---|
| 225 | #ifdef NC_DOUBLE |
---|
| 226 | ierr = NF_DEF_VAR (nid,"ap",NF_DOUBLE,1,idim_sig,nvarid) |
---|
| 227 | #else |
---|
| 228 | ierr = NF_DEF_VAR (nid,"ap",NF_FLOAT,1,idim_sig,nvarid) |
---|
| 229 | #endif |
---|
| 230 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 26, |
---|
| 231 | . "Coefficient A pour hybride") |
---|
| 232 | ierr = NF_ENDDEF(nid) |
---|
| 233 | #ifdef NC_DOUBLE |
---|
| 234 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap) |
---|
| 235 | #else |
---|
| 236 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ap) |
---|
| 237 | #endif |
---|
| 238 | c |
---|
| 239 | ierr = NF_REDEF (nid) |
---|
| 240 | #ifdef NC_DOUBLE |
---|
| 241 | ierr = NF_DEF_VAR (nid,"bp",NF_DOUBLE,1,idim_sig,nvarid) |
---|
| 242 | #else |
---|
| 243 | ierr = NF_DEF_VAR (nid,"bp",NF_FLOAT,1,idim_sig,nvarid) |
---|
| 244 | #endif |
---|
| 245 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 26, |
---|
| 246 | . "Coefficient B pour hybride") |
---|
| 247 | ierr = NF_ENDDEF(nid) |
---|
| 248 | #ifdef NC_DOUBLE |
---|
| 249 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp) |
---|
| 250 | #else |
---|
| 251 | ierr = NF_PUT_VAR_REAL (nid,nvarid,bp) |
---|
| 252 | #endif |
---|
| 253 | c |
---|
| 254 | ierr = NF_REDEF (nid) |
---|
| 255 | #ifdef NC_DOUBLE |
---|
| 256 | ierr = NF_DEF_VAR (nid,"presnivs",NF_DOUBLE,1,idim_s,nvarid) |
---|
| 257 | #else |
---|
| 258 | ierr = NF_DEF_VAR (nid,"presnivs",NF_FLOAT,1,idim_s,nvarid) |
---|
| 259 | #endif |
---|
| 260 | ierr = NF_ENDDEF(nid) |
---|
| 261 | #ifdef NC_DOUBLE |
---|
| 262 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,presnivs) |
---|
| 263 | #else |
---|
| 264 | ierr = NF_PUT_VAR_REAL (nid,nvarid,presnivs) |
---|
| 265 | #endif |
---|
| 266 | c |
---|
| 267 | c Coefficients de passage cov. <-> contra. <--> naturel |
---|
| 268 | c |
---|
| 269 | ierr = NF_REDEF (nid) |
---|
| 270 | dims2(1) = idim_rlonu |
---|
| 271 | dims2(2) = idim_rlatu |
---|
| 272 | #ifdef NC_DOUBLE |
---|
| 273 | ierr = NF_DEF_VAR (nid,"cu",NF_DOUBLE,2,dims2,nvarid) |
---|
| 274 | #else |
---|
| 275 | ierr = NF_DEF_VAR (nid,"cu",NF_FLOAT,2,dims2,nvarid) |
---|
| 276 | #endif |
---|
| 277 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 29, |
---|
| 278 | . "Coefficient de passage pour U") |
---|
| 279 | ierr = NF_ENDDEF(nid) |
---|
| 280 | #ifdef NC_DOUBLE |
---|
| 281 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) |
---|
| 282 | #else |
---|
| 283 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) |
---|
| 284 | #endif |
---|
| 285 | c |
---|
| 286 | ierr = NF_REDEF (nid) |
---|
| 287 | dims2(1) = idim_rlonv |
---|
| 288 | dims2(2) = idim_rlatv |
---|
| 289 | #ifdef NC_DOUBLE |
---|
| 290 | ierr = NF_DEF_VAR (nid,"cv",NF_DOUBLE,2,dims2,nvarid) |
---|
| 291 | #else |
---|
| 292 | ierr = NF_DEF_VAR (nid,"cv",NF_FLOAT,2,dims2,nvarid) |
---|
| 293 | #endif |
---|
| 294 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 29, |
---|
| 295 | . "Coefficient de passage pour V") |
---|
| 296 | ierr = NF_ENDDEF(nid) |
---|
| 297 | #ifdef NC_DOUBLE |
---|
| 298 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) |
---|
| 299 | #else |
---|
| 300 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) |
---|
| 301 | #endif |
---|
| 302 | c |
---|
| 303 | c Aire de chaque maille: |
---|
| 304 | c |
---|
| 305 | ierr = NF_REDEF (nid) |
---|
| 306 | dims2(1) = idim_rlonv |
---|
| 307 | dims2(2) = idim_rlatu |
---|
| 308 | #ifdef NC_DOUBLE |
---|
| 309 | ierr = NF_DEF_VAR (nid,"aire",NF_DOUBLE,2,dims2,nvarid) |
---|
| 310 | #else |
---|
| 311 | ierr = NF_DEF_VAR (nid,"aire",NF_FLOAT,2,dims2,nvarid) |
---|
| 312 | #endif |
---|
| 313 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
| 314 | . "Aires de chaque maille") |
---|
| 315 | ierr = NF_ENDDEF(nid) |
---|
| 316 | #ifdef NC_DOUBLE |
---|
| 317 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire) |
---|
| 318 | #else |
---|
| 319 | ierr = NF_PUT_VAR_REAL (nid,nvarid,aire) |
---|
| 320 | #endif |
---|
| 321 | c |
---|
| 322 | c Geopentiel au sol: |
---|
| 323 | c |
---|
| 324 | ierr = NF_REDEF (nid) |
---|
| 325 | dims2(1) = idim_rlonv |
---|
| 326 | dims2(2) = idim_rlatu |
---|
| 327 | #ifdef NC_DOUBLE |
---|
| 328 | ierr = NF_DEF_VAR (nid,"phisinit",NF_DOUBLE,2,dims2,nvarid) |
---|
| 329 | #else |
---|
| 330 | ierr = NF_DEF_VAR (nid,"phisinit",NF_FLOAT,2,dims2,nvarid) |
---|
| 331 | #endif |
---|
| 332 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 19, |
---|
| 333 | . "Geopotentiel au sol") |
---|
| 334 | ierr = NF_ENDDEF(nid) |
---|
| 335 | #ifdef NC_DOUBLE |
---|
| 336 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis) |
---|
| 337 | #else |
---|
| 338 | ierr = NF_PUT_VAR_REAL (nid,nvarid,phis) |
---|
| 339 | #endif |
---|
| 340 | c |
---|
| 341 | c Definir les variables pour pouvoir les enregistrer plus tard: |
---|
| 342 | c |
---|
| 343 | ierr = NF_REDEF (nid) ! entrer dans le mode de definition |
---|
| 344 | c |
---|
| 345 | #ifdef NC_DOUBLE |
---|
| 346 | ierr = NF_DEF_VAR (nid,"temps",NF_DOUBLE,1,idim_tim,nvarid) |
---|
| 347 | #else |
---|
| 348 | ierr = NF_DEF_VAR (nid,"temps",NF_FLOAT,1,idim_tim,nvarid) |
---|
| 349 | #endif |
---|
| 350 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 19, |
---|
| 351 | . "Temps de simulation") |
---|
| 352 | c |
---|
| 353 | dims4(1) = idim_rlonu |
---|
| 354 | dims4(2) = idim_rlatu |
---|
| 355 | dims4(3) = idim_s |
---|
| 356 | dims4(4) = idim_tim |
---|
| 357 | #ifdef NC_DOUBLE |
---|
| 358 | ierr = NF_DEF_VAR (nid,"ucov",NF_DOUBLE,4,dims4,nvarid) |
---|
| 359 | #else |
---|
| 360 | ierr = NF_DEF_VAR (nid,"ucov",NF_FLOAT,4,dims4,nvarid) |
---|
| 361 | #endif |
---|
| 362 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9, |
---|
| 363 | . "Vitesse U") |
---|
| 364 | c |
---|
| 365 | dims4(1) = idim_rlonv |
---|
| 366 | dims4(2) = idim_rlatv |
---|
| 367 | dims4(3) = idim_s |
---|
| 368 | dims4(4) = idim_tim |
---|
| 369 | #ifdef NC_DOUBLE |
---|
| 370 | ierr = NF_DEF_VAR (nid,"vcov",NF_DOUBLE,4,dims4,nvarid) |
---|
| 371 | #else |
---|
| 372 | ierr = NF_DEF_VAR (nid,"vcov",NF_FLOAT,4,dims4,nvarid) |
---|
| 373 | #endif |
---|
| 374 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9, |
---|
| 375 | . "Vitesse V") |
---|
| 376 | c |
---|
| 377 | dims4(1) = idim_rlonv |
---|
| 378 | dims4(2) = idim_rlatu |
---|
| 379 | dims4(3) = idim_s |
---|
| 380 | dims4(4) = idim_tim |
---|
| 381 | #ifdef NC_DOUBLE |
---|
| 382 | ierr = NF_DEF_VAR (nid,"teta",NF_DOUBLE,4,dims4,nvarid) |
---|
| 383 | #else |
---|
| 384 | ierr = NF_DEF_VAR (nid,"teta",NF_FLOAT,4,dims4,nvarid) |
---|
| 385 | #endif |
---|
| 386 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 11, |
---|
| 387 | . "Temperature") |
---|
| 388 | c |
---|
| 389 | dims4(1) = idim_rlonv |
---|
| 390 | dims4(2) = idim_rlatu |
---|
| 391 | dims4(3) = idim_s |
---|
| 392 | dims4(4) = idim_tim |
---|
| 393 | IF(nq.GE.1) THEN |
---|
| 394 | DO iq=1,nq |
---|
| 395 | IF (iq.GT.99) THEN |
---|
| 396 | PRINT*, "Trop de traceurs" |
---|
| 397 | CALL abort |
---|
| 398 | ELSE |
---|
| 399 | str3(1:1)='q' |
---|
| 400 | WRITE(str3(2:3),'(i2.2)') iq |
---|
| 401 | #ifdef NC_DOUBLE |
---|
| 402 | ierr = NF_DEF_VAR (nid,str3,NF_DOUBLE,4,dims4,nvarid) |
---|
| 403 | #else |
---|
| 404 | ierr = NF_DEF_VAR (nid,str3,NF_FLOAT,4,dims4,nvarid) |
---|
| 405 | #endif |
---|
| 406 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 12, |
---|
| 407 | . "Traceurs "//str3) |
---|
| 408 | ENDIF |
---|
| 409 | ENDDO |
---|
| 410 | ENDIF |
---|
| 411 | c |
---|
| 412 | dims4(1) = idim_rlonv |
---|
| 413 | dims4(2) = idim_rlatu |
---|
| 414 | dims4(3) = idim_s |
---|
| 415 | dims4(4) = idim_tim |
---|
| 416 | #ifdef NC_DOUBLE |
---|
| 417 | ierr = NF_DEF_VAR (nid,"masse",NF_DOUBLE,4,dims4,nvarid) |
---|
| 418 | #else |
---|
| 419 | ierr = NF_DEF_VAR (nid,"masse",NF_FLOAT,4,dims4,nvarid) |
---|
| 420 | #endif |
---|
| 421 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 12, |
---|
| 422 | . "C est quoi ?") |
---|
| 423 | c |
---|
| 424 | dims3(1) = idim_rlonv |
---|
| 425 | dims3(2) = idim_rlatu |
---|
| 426 | dims3(3) = idim_tim |
---|
| 427 | #ifdef NC_DOUBLE |
---|
| 428 | ierr = NF_DEF_VAR (nid,"ps",NF_DOUBLE,3,dims3,nvarid) |
---|
| 429 | #else |
---|
| 430 | ierr = NF_DEF_VAR (nid,"ps",NF_FLOAT,3,dims3,nvarid) |
---|
| 431 | #endif |
---|
| 432 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 15, |
---|
| 433 | . "Pression au sol") |
---|
| 434 | c |
---|
| 435 | ierr = NF_ENDDEF(nid) ! sortir du mode de definition |
---|
| 436 | ierr = NF_CLOSE(nid) ! fermer le fichier |
---|
| 437 | |
---|
| 438 | PRINT*,'iim,jjm,llm,idayref',iim,jjm,llm,idayref |
---|
| 439 | PRINT*,'rad,omeg,g,cpp,kappa', |
---|
| 440 | , rad,omeg,g,cpp,kappa |
---|
| 441 | |
---|
| 442 | RETURN |
---|
| 443 | END |
---|
| 444 | SUBROUTINE dynhist1(fichnom,time, |
---|
| 445 | . vcov,ucov,teta,q,nq,masse,ps) |
---|
| 446 | IMPLICIT NONE |
---|
| 447 | c================================================================= |
---|
| 448 | c Ecriture du fichier de redemarrage sous format NetCDF |
---|
| 449 | c================================================================= |
---|
| 450 | #include "dimensions.h" |
---|
| 451 | #include "paramet.h" |
---|
| 452 | #include "description.h" |
---|
| 453 | #include "netcdf.inc" |
---|
| 454 | #include "comvert.h" |
---|
| 455 | #include "comgeom.h" |
---|
| 456 | |
---|
| 457 | INTEGER nq, l |
---|
| 458 | REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) |
---|
| 459 | REAL teta(ip1jmp1,llm) |
---|
| 460 | REAL ps(ip1jmp1),masse(ip1jmp1,llm) |
---|
| 461 | REAL q(ip1jmp1,llm,nq) |
---|
| 462 | CHARACTER*(*) fichnom |
---|
| 463 | |
---|
| 464 | REAL time |
---|
| 465 | INTEGER nid, nvarid |
---|
| 466 | INTEGER ierr |
---|
| 467 | INTEGER iq |
---|
| 468 | CHARACTER str3*3 |
---|
| 469 | c |
---|
| 470 | INTEGER nb |
---|
| 471 | SAVE nb |
---|
| 472 | DATA nb / 0 / |
---|
| 473 | |
---|
| 474 | ierr = NF_OPEN(fichnom, NF_WRITE, nid) |
---|
| 475 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 476 | PRINT*, "Pb. d ouverture "//fichnom |
---|
| 477 | CALL abort |
---|
| 478 | ENDIF |
---|
| 479 | |
---|
| 480 | c Ecriture/extension de la coordonnee temps |
---|
| 481 | |
---|
| 482 | nb = nb + 1 |
---|
| 483 | ierr = NF_INQ_VARID(nid, "temps", nvarid) |
---|
| 484 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 485 | PRINT*, "Variable temps n est pas definie" |
---|
| 486 | CALL abort |
---|
| 487 | ENDIF |
---|
| 488 | #ifdef NC_DOUBLE |
---|
| 489 | ierr = NF_PUT_VAR1_DOUBLE (nid,nvarid,nb,time) |
---|
| 490 | #else |
---|
| 491 | ierr = NF_PUT_VAR1_REAL (nid,nvarid,nb,time) |
---|
| 492 | #endif |
---|
| 493 | PRINT*, "Enregistrement pour ", nb, time |
---|
| 494 | |
---|
| 495 | c Ecriture des champs |
---|
| 496 | c |
---|
| 497 | ierr = NF_INQ_VARID(nid, "ucov", nvarid) |
---|
| 498 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 499 | PRINT*, "Variable ucov n est pas definie" |
---|
| 500 | CALL abort |
---|
| 501 | ENDIF |
---|
| 502 | #ifdef NC_DOUBLE |
---|
| 503 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ucov) |
---|
| 504 | #else |
---|
| 505 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ucov) |
---|
| 506 | #endif |
---|
| 507 | |
---|
| 508 | ierr = NF_INQ_VARID(nid, "vcov", nvarid) |
---|
| 509 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 510 | PRINT*, "Variable vcov n est pas definie" |
---|
| 511 | CALL abort |
---|
| 512 | ENDIF |
---|
| 513 | #ifdef NC_DOUBLE |
---|
| 514 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,vcov) |
---|
| 515 | #else |
---|
| 516 | ierr = NF_PUT_VAR_REAL (nid,nvarid,vcov) |
---|
| 517 | #endif |
---|
| 518 | |
---|
| 519 | ierr = NF_INQ_VARID(nid, "teta", nvarid) |
---|
| 520 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 521 | PRINT*, "Variable teta n est pas definie" |
---|
| 522 | CALL abort |
---|
| 523 | ENDIF |
---|
| 524 | #ifdef NC_DOUBLE |
---|
| 525 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,teta) |
---|
| 526 | #else |
---|
| 527 | ierr = NF_PUT_VAR_REAL (nid,nvarid,teta) |
---|
| 528 | #endif |
---|
| 529 | |
---|
| 530 | IF(nq.GE.1) THEN |
---|
| 531 | DO iq=1,nq |
---|
| 532 | IF (iq.GT.99) THEN |
---|
| 533 | PRINT*, "Trop de traceurs" |
---|
| 534 | CALL abort |
---|
| 535 | ELSE |
---|
| 536 | str3(1:1)='q' |
---|
| 537 | WRITE(str3(2:3),'(i2.2)') iq |
---|
| 538 | ierr = NF_INQ_VARID(nid, str3, nvarid) |
---|
| 539 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 540 | PRINT*, "Variable "//str3//" n est pas definie" |
---|
| 541 | CALL abort |
---|
| 542 | ENDIF |
---|
| 543 | #ifdef NC_DOUBLE |
---|
| 544 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) |
---|
| 545 | #else |
---|
| 546 | ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) |
---|
| 547 | #endif |
---|
| 548 | ENDIF |
---|
| 549 | ENDDO |
---|
| 550 | ENDIF |
---|
| 551 | c |
---|
| 552 | ierr = NF_INQ_VARID(nid, "masse", nvarid) |
---|
| 553 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 554 | PRINT*, "Variable masse n est pas definie" |
---|
| 555 | CALL abort |
---|
| 556 | ENDIF |
---|
| 557 | #ifdef NC_DOUBLE |
---|
| 558 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,masse) |
---|
| 559 | #else |
---|
| 560 | ierr = NF_PUT_VAR_REAL (nid,nvarid,masse) |
---|
| 561 | #endif |
---|
| 562 | c |
---|
| 563 | ierr = NF_INQ_VARID(nid, "ps", nvarid) |
---|
| 564 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 565 | PRINT*, "Variable ps n est pas definie" |
---|
| 566 | CALL abort |
---|
| 567 | ENDIF |
---|
| 568 | #ifdef NC_DOUBLE |
---|
| 569 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ps) |
---|
| 570 | #else |
---|
| 571 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ps) |
---|
| 572 | #endif |
---|
| 573 | |
---|
| 574 | ierr = NF_CLOSE(nid) |
---|
| 575 | c |
---|
| 576 | RETURN |
---|
| 577 | END |
---|
| 578 | |
---|