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