[1000] | 1 | ! |
---|
| 2 | ! $Header$ |
---|
| 3 | ! |
---|
| 4 | c |
---|
[1146] | 5 | SUBROUTINE dynredem0(fichnom,iday_end,phis) |
---|
[1000] | 6 | USE IOIPSL |
---|
[1146] | 7 | USE infotrac |
---|
[1000] | 8 | IMPLICIT NONE |
---|
| 9 | c======================================================================= |
---|
| 10 | c Ecriture du fichier de redemarrage sous format NetCDF (initialisation) |
---|
| 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 "temps.h" |
---|
| 20 | #include "ener.h" |
---|
| 21 | #include "logic.h" |
---|
| 22 | #include "netcdf.inc" |
---|
| 23 | #include "description.h" |
---|
| 24 | #include "serre.h" |
---|
| 25 | |
---|
| 26 | c Arguments: |
---|
| 27 | c ---------- |
---|
| 28 | INTEGER iday_end |
---|
| 29 | REAL phis(ip1jmp1) |
---|
| 30 | CHARACTER*(*) fichnom |
---|
| 31 | |
---|
| 32 | c Local: |
---|
| 33 | c ------ |
---|
| 34 | INTEGER iq,l |
---|
| 35 | INTEGER length |
---|
| 36 | PARAMETER (length = 100) |
---|
| 37 | REAL tab_cntrl(length) ! tableau des parametres du run |
---|
| 38 | INTEGER ierr |
---|
| 39 | character*20 modname |
---|
| 40 | character*80 abort_message |
---|
| 41 | |
---|
| 42 | c Variables locales pour NetCDF: |
---|
| 43 | c |
---|
| 44 | INTEGER dims2(2), dims3(3), dims4(4) |
---|
| 45 | INTEGER idim_index |
---|
| 46 | INTEGER idim_rlonu, idim_rlonv, idim_rlatu, idim_rlatv |
---|
| 47 | INTEGER idim_s, idim_sig |
---|
| 48 | INTEGER idim_tim |
---|
| 49 | INTEGER nid,nvarid |
---|
| 50 | |
---|
| 51 | REAL zan0,zjulian,hours |
---|
| 52 | INTEGER yyears0,jjour0, mmois0 |
---|
| 53 | character*30 unites |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | c----------------------------------------------------------------------- |
---|
| 57 | modname='dynredem' |
---|
| 58 | |
---|
| 59 | call ymds2ju(annee_ref, 1, iday_end, 0.0, zjulian) |
---|
| 60 | call ju2ymds(zjulian, yyears0, mmois0, jjour0, hours) |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | DO l=1,length |
---|
| 64 | tab_cntrl(l) = 0. |
---|
| 65 | ENDDO |
---|
| 66 | tab_cntrl(1) = FLOAT(iim) |
---|
| 67 | tab_cntrl(2) = FLOAT(jjm) |
---|
| 68 | tab_cntrl(3) = FLOAT(llm) |
---|
| 69 | tab_cntrl(4) = FLOAT(day_ref) |
---|
| 70 | tab_cntrl(5) = FLOAT(annee_ref) |
---|
| 71 | tab_cntrl(6) = rad |
---|
| 72 | tab_cntrl(7) = omeg |
---|
| 73 | tab_cntrl(8) = g |
---|
| 74 | tab_cntrl(9) = cpp |
---|
| 75 | tab_cntrl(10) = kappa |
---|
| 76 | tab_cntrl(11) = daysec |
---|
| 77 | tab_cntrl(12) = dtvr |
---|
| 78 | tab_cntrl(13) = etot0 |
---|
| 79 | tab_cntrl(14) = ptot0 |
---|
| 80 | tab_cntrl(15) = ztot0 |
---|
| 81 | tab_cntrl(16) = stot0 |
---|
| 82 | tab_cntrl(17) = ang0 |
---|
| 83 | tab_cntrl(18) = pa |
---|
| 84 | tab_cntrl(19) = preff |
---|
| 85 | c |
---|
| 86 | c ..... parametres pour le zoom ...... |
---|
| 87 | |
---|
| 88 | tab_cntrl(20) = clon |
---|
| 89 | tab_cntrl(21) = clat |
---|
| 90 | tab_cntrl(22) = grossismx |
---|
| 91 | tab_cntrl(23) = grossismy |
---|
| 92 | c |
---|
| 93 | IF ( fxyhypb ) THEN |
---|
| 94 | tab_cntrl(24) = 1. |
---|
| 95 | tab_cntrl(25) = dzoomx |
---|
| 96 | tab_cntrl(26) = dzoomy |
---|
| 97 | tab_cntrl(27) = 0. |
---|
| 98 | tab_cntrl(28) = taux |
---|
| 99 | tab_cntrl(29) = tauy |
---|
| 100 | ELSE |
---|
| 101 | tab_cntrl(24) = 0. |
---|
| 102 | tab_cntrl(25) = dzoomx |
---|
| 103 | tab_cntrl(26) = dzoomy |
---|
| 104 | tab_cntrl(27) = 0. |
---|
| 105 | tab_cntrl(28) = 0. |
---|
| 106 | tab_cntrl(29) = 0. |
---|
| 107 | IF( ysinus ) tab_cntrl(27) = 1. |
---|
| 108 | ENDIF |
---|
| 109 | |
---|
| 110 | tab_cntrl(30) = FLOAT(iday_end) |
---|
| 111 | tab_cntrl(31) = FLOAT(itau_dyn + itaufin) |
---|
| 112 | c |
---|
| 113 | c ......................................................... |
---|
| 114 | c |
---|
| 115 | c Creation du fichier: |
---|
| 116 | c |
---|
| 117 | ierr = NF_CREATE(fichnom, NF_CLOBBER, nid) |
---|
| 118 | IF (ierr.NE.NF_NOERR) THEN |
---|
| 119 | WRITE(6,*)" Pb d ouverture du fichier "//fichnom |
---|
| 120 | WRITE(6,*)' ierr = ', ierr |
---|
| 121 | CALL ABORT |
---|
| 122 | ENDIF |
---|
| 123 | c |
---|
| 124 | c Preciser quelques attributs globaux: |
---|
| 125 | c |
---|
| 126 | ierr = NF_PUT_ATT_TEXT (nid, NF_GLOBAL, "title", 27, |
---|
| 127 | . "Fichier demmarage dynamique") |
---|
| 128 | c |
---|
| 129 | c Definir les dimensions du fichiers: |
---|
| 130 | c |
---|
| 131 | ierr = NF_DEF_DIM (nid, "index", length, idim_index) |
---|
| 132 | ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu) |
---|
| 133 | ierr = NF_DEF_DIM (nid, "rlatu", jjp1, idim_rlatu) |
---|
| 134 | ierr = NF_DEF_DIM (nid, "rlonv", iip1, idim_rlonv) |
---|
| 135 | ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv) |
---|
| 136 | ierr = NF_DEF_DIM (nid, "sigs", llm, idim_s) |
---|
| 137 | ierr = NF_DEF_DIM (nid, "sig", llmp1, idim_sig) |
---|
| 138 | ierr = NF_DEF_DIM (nid, "temps", NF_UNLIMITED, idim_tim) |
---|
| 139 | c |
---|
| 140 | ierr = NF_ENDDEF(nid) ! sortir du mode de definition |
---|
| 141 | c |
---|
| 142 | c Definir et enregistrer certains champs invariants: |
---|
| 143 | c |
---|
| 144 | ierr = NF_REDEF (nid) |
---|
| 145 | cIM 220306 BEG |
---|
| 146 | #ifdef NC_DOUBLE |
---|
| 147 | ierr = NF_DEF_VAR (nid,"controle",NF_DOUBLE,1,idim_index,nvarid) |
---|
| 148 | #else |
---|
| 149 | ierr = NF_DEF_VAR (nid,"controle",NF_FLOAT,1,idim_index,nvarid) |
---|
| 150 | #endif |
---|
| 151 | cIM 220306 END |
---|
| 152 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
| 153 | . "Parametres de controle") |
---|
| 154 | ierr = NF_ENDDEF(nid) |
---|
| 155 | #ifdef NC_DOUBLE |
---|
| 156 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
| 157 | #else |
---|
| 158 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
| 159 | #endif |
---|
| 160 | c |
---|
| 161 | ierr = NF_REDEF (nid) |
---|
| 162 | cIM 220306 BEG |
---|
| 163 | #ifdef NC_DOUBLE |
---|
| 164 | ierr = NF_DEF_VAR (nid,"rlonu",NF_DOUBLE,1,idim_rlonu,nvarid) |
---|
| 165 | #else |
---|
| 166 | ierr = NF_DEF_VAR (nid,"rlonu",NF_FLOAT,1,idim_rlonu,nvarid) |
---|
| 167 | #endif |
---|
| 168 | cIM 220306 END |
---|
| 169 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23, |
---|
| 170 | . "Longitudes des points U") |
---|
| 171 | ierr = NF_ENDDEF(nid) |
---|
| 172 | #ifdef NC_DOUBLE |
---|
| 173 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu) |
---|
| 174 | #else |
---|
| 175 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu) |
---|
| 176 | #endif |
---|
| 177 | c |
---|
| 178 | ierr = NF_REDEF (nid) |
---|
| 179 | cIM 220306 BEG |
---|
| 180 | #ifdef NC_DOUBLE |
---|
| 181 | ierr = NF_DEF_VAR (nid,"rlatu",NF_DOUBLE,1,idim_rlatu,nvarid) |
---|
| 182 | #else |
---|
| 183 | ierr = NF_DEF_VAR (nid,"rlatu",NF_FLOAT,1,idim_rlatu,nvarid) |
---|
| 184 | #endif |
---|
| 185 | cIM 220306 END |
---|
| 186 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
| 187 | . "Latitudes des points U") |
---|
| 188 | ierr = NF_ENDDEF(nid) |
---|
| 189 | #ifdef NC_DOUBLE |
---|
| 190 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu) |
---|
| 191 | #else |
---|
| 192 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu) |
---|
| 193 | #endif |
---|
| 194 | c |
---|
| 195 | ierr = NF_REDEF (nid) |
---|
| 196 | cIM 220306 BEG |
---|
| 197 | #ifdef NC_DOUBLE |
---|
| 198 | ierr = NF_DEF_VAR (nid,"rlonv",NF_DOUBLE,1,idim_rlonv,nvarid) |
---|
| 199 | #else |
---|
| 200 | ierr = NF_DEF_VAR (nid,"rlonv",NF_FLOAT,1,idim_rlonv,nvarid) |
---|
| 201 | #endif |
---|
| 202 | cIM 220306 END |
---|
| 203 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23, |
---|
| 204 | . "Longitudes des points V") |
---|
| 205 | ierr = NF_ENDDEF(nid) |
---|
| 206 | #ifdef NC_DOUBLE |
---|
| 207 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv) |
---|
| 208 | #else |
---|
| 209 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv) |
---|
| 210 | #endif |
---|
| 211 | c |
---|
| 212 | ierr = NF_REDEF (nid) |
---|
| 213 | cIM 220306 BEG |
---|
| 214 | #ifdef NC_DOUBLE |
---|
| 215 | ierr = NF_DEF_VAR (nid,"rlatv",NF_DOUBLE,1,idim_rlatv,nvarid) |
---|
| 216 | #else |
---|
| 217 | ierr = NF_DEF_VAR (nid,"rlatv",NF_FLOAT,1,idim_rlatv,nvarid) |
---|
| 218 | #endif |
---|
| 219 | cIM 220306 END |
---|
| 220 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
| 221 | . "Latitudes des points V") |
---|
| 222 | ierr = NF_ENDDEF(nid) |
---|
| 223 | #ifdef NC_DOUBLE |
---|
| 224 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv) |
---|
| 225 | #else |
---|
| 226 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv) |
---|
| 227 | #endif |
---|
| 228 | c |
---|
| 229 | ierr = NF_REDEF (nid) |
---|
| 230 | cIM 220306 BEG |
---|
| 231 | #ifdef NC_DOUBLE |
---|
| 232 | ierr = NF_DEF_VAR (nid,"nivsigs",NF_DOUBLE,1,idim_s,nvarid) |
---|
| 233 | #else |
---|
| 234 | ierr = NF_DEF_VAR (nid,"nivsigs",NF_FLOAT,1,idim_s,nvarid) |
---|
| 235 | #endif |
---|
| 236 | cIM 220306 END |
---|
| 237 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 28, |
---|
| 238 | . "Numero naturel des couches s") |
---|
| 239 | ierr = NF_ENDDEF(nid) |
---|
| 240 | #ifdef NC_DOUBLE |
---|
| 241 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsigs) |
---|
| 242 | #else |
---|
| 243 | ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsigs) |
---|
| 244 | #endif |
---|
| 245 | c |
---|
| 246 | ierr = NF_REDEF (nid) |
---|
| 247 | cIM 220306 BEG |
---|
| 248 | #ifdef NC_DOUBLE |
---|
| 249 | ierr = NF_DEF_VAR (nid,"nivsig",NF_DOUBLE,1,idim_sig,nvarid) |
---|
| 250 | #else |
---|
| 251 | ierr = NF_DEF_VAR (nid,"nivsig",NF_FLOAT,1,idim_sig,nvarid) |
---|
| 252 | #endif |
---|
| 253 | cIM 220306 END |
---|
| 254 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 32, |
---|
| 255 | . "Numero naturel des couches sigma") |
---|
| 256 | ierr = NF_ENDDEF(nid) |
---|
| 257 | #ifdef NC_DOUBLE |
---|
| 258 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsig) |
---|
| 259 | #else |
---|
| 260 | ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsig) |
---|
| 261 | #endif |
---|
| 262 | c |
---|
| 263 | ierr = NF_REDEF (nid) |
---|
| 264 | cIM 220306 BEG |
---|
| 265 | #ifdef NC_DOUBLE |
---|
| 266 | ierr = NF_DEF_VAR (nid,"ap",NF_DOUBLE,1,idim_sig,nvarid) |
---|
| 267 | #else |
---|
| 268 | ierr = NF_DEF_VAR (nid,"ap",NF_FLOAT,1,idim_sig,nvarid) |
---|
| 269 | #endif |
---|
| 270 | cIM 220306 END |
---|
| 271 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 26, |
---|
| 272 | . "Coefficient A pour hybride") |
---|
| 273 | ierr = NF_ENDDEF(nid) |
---|
| 274 | #ifdef NC_DOUBLE |
---|
| 275 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap) |
---|
| 276 | #else |
---|
| 277 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ap) |
---|
| 278 | #endif |
---|
| 279 | c |
---|
| 280 | ierr = NF_REDEF (nid) |
---|
| 281 | cIM 220306 BEG |
---|
| 282 | #ifdef NC_DOUBLE |
---|
| 283 | ierr = NF_DEF_VAR (nid,"bp",NF_DOUBLE,1,idim_sig,nvarid) |
---|
| 284 | #else |
---|
| 285 | ierr = NF_DEF_VAR (nid,"bp",NF_FLOAT,1,idim_sig,nvarid) |
---|
| 286 | #endif |
---|
| 287 | cIM 220306 END |
---|
| 288 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 26, |
---|
| 289 | . "Coefficient B pour hybride") |
---|
| 290 | ierr = NF_ENDDEF(nid) |
---|
| 291 | #ifdef NC_DOUBLE |
---|
| 292 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp) |
---|
| 293 | #else |
---|
| 294 | ierr = NF_PUT_VAR_REAL (nid,nvarid,bp) |
---|
| 295 | #endif |
---|
| 296 | c |
---|
| 297 | ierr = NF_REDEF (nid) |
---|
| 298 | cIM 220306 BEG |
---|
| 299 | #ifdef NC_DOUBLE |
---|
| 300 | ierr = NF_DEF_VAR (nid,"presnivs",NF_DOUBLE,1,idim_s,nvarid) |
---|
| 301 | #else |
---|
| 302 | ierr = NF_DEF_VAR (nid,"presnivs",NF_FLOAT,1,idim_s,nvarid) |
---|
| 303 | #endif |
---|
| 304 | cIM 220306 END |
---|
| 305 | ierr = NF_ENDDEF(nid) |
---|
| 306 | #ifdef NC_DOUBLE |
---|
| 307 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,presnivs) |
---|
| 308 | #else |
---|
| 309 | ierr = NF_PUT_VAR_REAL (nid,nvarid,presnivs) |
---|
| 310 | #endif |
---|
| 311 | c |
---|
| 312 | c Coefficients de passage cov. <-> contra. <--> naturel |
---|
| 313 | c |
---|
| 314 | ierr = NF_REDEF (nid) |
---|
| 315 | dims2(1) = idim_rlonu |
---|
| 316 | dims2(2) = idim_rlatu |
---|
| 317 | cIM 220306 BEG |
---|
| 318 | #ifdef NC_DOUBLE |
---|
| 319 | ierr = NF_DEF_VAR (nid,"cu",NF_DOUBLE,2,dims2,nvarid) |
---|
| 320 | #else |
---|
| 321 | ierr = NF_DEF_VAR (nid,"cu",NF_FLOAT,2,dims2,nvarid) |
---|
| 322 | #endif |
---|
| 323 | cIM 220306 END |
---|
| 324 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 29, |
---|
| 325 | . "Coefficient de passage pour U") |
---|
| 326 | ierr = NF_ENDDEF(nid) |
---|
| 327 | #ifdef NC_DOUBLE |
---|
| 328 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) |
---|
| 329 | #else |
---|
| 330 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) |
---|
| 331 | #endif |
---|
| 332 | c |
---|
| 333 | ierr = NF_REDEF (nid) |
---|
| 334 | dims2(1) = idim_rlonv |
---|
| 335 | dims2(2) = idim_rlatv |
---|
| 336 | cIM 220306 BEG |
---|
| 337 | #ifdef NC_DOUBLE |
---|
| 338 | ierr = NF_DEF_VAR (nid,"cv",NF_DOUBLE,2,dims2,nvarid) |
---|
| 339 | #else |
---|
| 340 | ierr = NF_DEF_VAR (nid,"cv",NF_FLOAT,2,dims2,nvarid) |
---|
| 341 | #endif |
---|
| 342 | cIM 220306 END |
---|
| 343 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 29, |
---|
| 344 | . "Coefficient de passage pour V") |
---|
| 345 | ierr = NF_ENDDEF(nid) |
---|
| 346 | #ifdef NC_DOUBLE |
---|
| 347 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) |
---|
| 348 | #else |
---|
| 349 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) |
---|
| 350 | #endif |
---|
| 351 | c |
---|
| 352 | c Aire de chaque maille: |
---|
| 353 | c |
---|
| 354 | ierr = NF_REDEF (nid) |
---|
| 355 | dims2(1) = idim_rlonv |
---|
| 356 | dims2(2) = idim_rlatu |
---|
| 357 | cIM 220306 BEG |
---|
| 358 | #ifdef NC_DOUBLE |
---|
| 359 | ierr = NF_DEF_VAR (nid,"aire",NF_DOUBLE,2,dims2,nvarid) |
---|
| 360 | #else |
---|
| 361 | ierr = NF_DEF_VAR (nid,"aire",NF_FLOAT,2,dims2,nvarid) |
---|
| 362 | #endif |
---|
| 363 | cIM 220306 END |
---|
| 364 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
| 365 | . "Aires de chaque maille") |
---|
| 366 | ierr = NF_ENDDEF(nid) |
---|
| 367 | #ifdef NC_DOUBLE |
---|
| 368 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire) |
---|
| 369 | #else |
---|
| 370 | ierr = NF_PUT_VAR_REAL (nid,nvarid,aire) |
---|
| 371 | #endif |
---|
| 372 | c |
---|
| 373 | c Geopentiel au sol: |
---|
| 374 | c |
---|
| 375 | ierr = NF_REDEF (nid) |
---|
| 376 | dims2(1) = idim_rlonv |
---|
| 377 | dims2(2) = idim_rlatu |
---|
| 378 | cIM 220306 BEG |
---|
| 379 | #ifdef NC_DOUBLE |
---|
| 380 | ierr = NF_DEF_VAR (nid,"phisinit",NF_DOUBLE,2,dims2,nvarid) |
---|
| 381 | #else |
---|
| 382 | ierr = NF_DEF_VAR (nid,"phisinit",NF_FLOAT,2,dims2,nvarid) |
---|
| 383 | #endif |
---|
| 384 | cIM 220306 END |
---|
| 385 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 19, |
---|
| 386 | . "Geopotentiel au sol") |
---|
| 387 | ierr = NF_ENDDEF(nid) |
---|
| 388 | #ifdef NC_DOUBLE |
---|
| 389 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis) |
---|
| 390 | #else |
---|
| 391 | ierr = NF_PUT_VAR_REAL (nid,nvarid,phis) |
---|
| 392 | #endif |
---|
| 393 | c |
---|
| 394 | c Definir les variables pour pouvoir les enregistrer plus tard: |
---|
| 395 | c |
---|
| 396 | ierr = NF_REDEF (nid) ! entrer dans le mode de definition |
---|
| 397 | c |
---|
| 398 | cIM 220306 BEG |
---|
| 399 | #ifdef NC_DOUBLE |
---|
| 400 | ierr = NF_DEF_VAR (nid,"temps",NF_DOUBLE,1,idim_tim,nvarid) |
---|
| 401 | #else |
---|
| 402 | ierr = NF_DEF_VAR (nid,"temps",NF_FLOAT,1,idim_tim,nvarid) |
---|
| 403 | #endif |
---|
| 404 | cIM 220306 END |
---|
| 405 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 19, |
---|
| 406 | . "Temps de simulation") |
---|
| 407 | write(unites,200)yyears0,mmois0,jjour0 |
---|
| 408 | 200 format('days since ',i4,'-',i2.2,'-',i2.2,' 00:00:00') |
---|
| 409 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "units", 30, |
---|
| 410 | . unites) |
---|
| 411 | |
---|
| 412 | c |
---|
| 413 | dims4(1) = idim_rlonu |
---|
| 414 | dims4(2) = idim_rlatu |
---|
| 415 | dims4(3) = idim_s |
---|
| 416 | dims4(4) = idim_tim |
---|
| 417 | cIM 220306 BEG |
---|
| 418 | #ifdef NC_DOUBLE |
---|
| 419 | ierr = NF_DEF_VAR (nid,"ucov",NF_DOUBLE,4,dims4,nvarid) |
---|
| 420 | #else |
---|
| 421 | ierr = NF_DEF_VAR (nid,"ucov",NF_FLOAT,4,dims4,nvarid) |
---|
| 422 | #endif |
---|
| 423 | cIM 220306 END |
---|
| 424 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9, |
---|
| 425 | . "Vitesse U") |
---|
| 426 | c |
---|
| 427 | dims4(1) = idim_rlonv |
---|
| 428 | dims4(2) = idim_rlatv |
---|
| 429 | dims4(3) = idim_s |
---|
| 430 | dims4(4) = idim_tim |
---|
| 431 | cIM 220306 BEG |
---|
| 432 | #ifdef NC_DOUBLE |
---|
| 433 | ierr = NF_DEF_VAR (nid,"vcov",NF_DOUBLE,4,dims4,nvarid) |
---|
| 434 | #else |
---|
| 435 | ierr = NF_DEF_VAR (nid,"vcov",NF_FLOAT,4,dims4,nvarid) |
---|
| 436 | #endif |
---|
| 437 | cIM 220306 END |
---|
| 438 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9, |
---|
| 439 | . "Vitesse V") |
---|
| 440 | c |
---|
| 441 | dims4(1) = idim_rlonv |
---|
| 442 | dims4(2) = idim_rlatu |
---|
| 443 | dims4(3) = idim_s |
---|
| 444 | dims4(4) = idim_tim |
---|
| 445 | cIM 220306 BEG |
---|
| 446 | #ifdef NC_DOUBLE |
---|
| 447 | ierr = NF_DEF_VAR (nid,"teta",NF_DOUBLE,4,dims4,nvarid) |
---|
| 448 | #else |
---|
| 449 | ierr = NF_DEF_VAR (nid,"teta",NF_FLOAT,4,dims4,nvarid) |
---|
| 450 | #endif |
---|
| 451 | cIM 220306 END |
---|
| 452 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 11, |
---|
| 453 | . "Temperature") |
---|
| 454 | c |
---|
| 455 | dims4(1) = idim_rlonv |
---|
| 456 | dims4(2) = idim_rlatu |
---|
| 457 | dims4(3) = idim_s |
---|
| 458 | dims4(4) = idim_tim |
---|
[1146] | 459 | |
---|
| 460 | DO iq=1,nqtot |
---|
[1000] | 461 | cIM 220306 BEG |
---|
| 462 | #ifdef NC_DOUBLE |
---|
| 463 | ierr = NF_DEF_VAR (nid,tname(iq),NF_DOUBLE,4,dims4,nvarid) |
---|
| 464 | #else |
---|
| 465 | ierr = NF_DEF_VAR (nid,tname(iq),NF_FLOAT,4,dims4,nvarid) |
---|
| 466 | #endif |
---|
| 467 | cIM 220306 END |
---|
| 468 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 12,ttext(iq)) |
---|
| 469 | ENDDO |
---|
| 470 | c |
---|
| 471 | dims4(1) = idim_rlonv |
---|
| 472 | dims4(2) = idim_rlatu |
---|
| 473 | dims4(3) = idim_s |
---|
| 474 | dims4(4) = idim_tim |
---|
| 475 | cIM 220306 BEG |
---|
| 476 | #ifdef NC_DOUBLE |
---|
| 477 | ierr = NF_DEF_VAR (nid,"masse",NF_DOUBLE,4,dims4,nvarid) |
---|
| 478 | #else |
---|
| 479 | ierr = NF_DEF_VAR (nid,"masse",NF_FLOAT,4,dims4,nvarid) |
---|
| 480 | #endif |
---|
| 481 | cIM 220306 END |
---|
| 482 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 12, |
---|
| 483 | . "C est quoi ?") |
---|
| 484 | c |
---|
| 485 | dims3(1) = idim_rlonv |
---|
| 486 | dims3(2) = idim_rlatu |
---|
| 487 | dims3(3) = idim_tim |
---|
| 488 | cIM 220306 BEG |
---|
| 489 | #ifdef NC_DOUBLE |
---|
| 490 | ierr = NF_DEF_VAR (nid,"ps",NF_DOUBLE,3,dims3,nvarid) |
---|
| 491 | #else |
---|
| 492 | ierr = NF_DEF_VAR (nid,"ps",NF_FLOAT,3,dims3,nvarid) |
---|
| 493 | #endif |
---|
| 494 | cIM 220306 END |
---|
| 495 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 15, |
---|
| 496 | . "Pression au sol") |
---|
| 497 | c |
---|
| 498 | ierr = NF_ENDDEF(nid) ! sortir du mode de definition |
---|
| 499 | ierr = NF_CLOSE(nid) ! fermer le fichier |
---|
| 500 | |
---|
| 501 | PRINT*,'iim,jjm,llm,iday_end',iim,jjm,llm,iday_end |
---|
| 502 | PRINT*,'rad,omeg,g,cpp,kappa', |
---|
| 503 | , rad,omeg,g,cpp,kappa |
---|
| 504 | |
---|
| 505 | RETURN |
---|
| 506 | END |
---|
| 507 | SUBROUTINE dynredem1(fichnom,time, |
---|
[1146] | 508 | . vcov,ucov,teta,q,masse,ps) |
---|
| 509 | USE infotrac |
---|
[1000] | 510 | IMPLICIT NONE |
---|
| 511 | c================================================================= |
---|
| 512 | c Ecriture du fichier de redemarrage sous format NetCDF |
---|
| 513 | c================================================================= |
---|
| 514 | #include "dimensions.h" |
---|
| 515 | #include "paramet.h" |
---|
| 516 | #include "description.h" |
---|
| 517 | #include "netcdf.inc" |
---|
| 518 | #include "comvert.h" |
---|
| 519 | #include "comgeom.h" |
---|
| 520 | #include "temps.h" |
---|
| 521 | #include "control.h" |
---|
| 522 | |
---|
[1146] | 523 | INTEGER l |
---|
[1000] | 524 | REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) |
---|
| 525 | REAL teta(ip1jmp1,llm) |
---|
| 526 | REAL ps(ip1jmp1),masse(ip1jmp1,llm) |
---|
[1146] | 527 | REAL q(ip1jmp1,llm,nqtot) |
---|
[1000] | 528 | CHARACTER*(*) fichnom |
---|
| 529 | |
---|
| 530 | REAL time |
---|
| 531 | INTEGER nid, nvarid, nid_trac, nvarid_trac |
---|
| 532 | REAL trac_tmp(ip1jmp1,llm) |
---|
| 533 | INTEGER ierr, ierr_file |
---|
| 534 | INTEGER iq |
---|
| 535 | INTEGER length |
---|
| 536 | PARAMETER (length = 100) |
---|
| 537 | REAL tab_cntrl(length) ! tableau des parametres du run |
---|
| 538 | character*20 modname |
---|
| 539 | character*80 abort_message |
---|
| 540 | c |
---|
| 541 | INTEGER nb |
---|
| 542 | SAVE nb |
---|
| 543 | DATA nb / 0 / |
---|
| 544 | |
---|
| 545 | modname = 'dynredem1' |
---|
| 546 | ierr = NF_OPEN(fichnom, NF_WRITE, nid) |
---|
| 547 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 548 | PRINT*, "Pb. d ouverture "//fichnom |
---|
| 549 | CALL abort |
---|
| 550 | ENDIF |
---|
| 551 | |
---|
| 552 | c Ecriture/extension de la coordonnee temps |
---|
| 553 | |
---|
| 554 | nb = nb + 1 |
---|
| 555 | ierr = NF_INQ_VARID(nid, "temps", nvarid) |
---|
| 556 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 557 | print *, NF_STRERROR(ierr) |
---|
| 558 | abort_message='Variable temps n est pas definie' |
---|
| 559 | CALL abort_gcm(modname,abort_message,ierr) |
---|
| 560 | ENDIF |
---|
| 561 | #ifdef NC_DOUBLE |
---|
| 562 | ierr = NF_PUT_VAR1_DOUBLE (nid,nvarid,nb,time) |
---|
| 563 | #else |
---|
| 564 | ierr = NF_PUT_VAR1_REAL (nid,nvarid,nb,time) |
---|
| 565 | #endif |
---|
| 566 | PRINT*, "Enregistrement pour ", nb, time |
---|
| 567 | |
---|
| 568 | c |
---|
| 569 | c Re-ecriture du tableau de controle, itaufin n'est plus defini quand |
---|
| 570 | c on passe dans dynredem0 |
---|
| 571 | ierr = NF_INQ_VARID (nid, "controle", nvarid) |
---|
| 572 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 573 | abort_message="dynredem1: Le champ <controle> est absent" |
---|
| 574 | ierr = 1 |
---|
| 575 | CALL abort_gcm(modname,abort_message,ierr) |
---|
| 576 | ENDIF |
---|
| 577 | #ifdef NC_DOUBLE |
---|
| 578 | ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tab_cntrl) |
---|
| 579 | #else |
---|
| 580 | ierr = NF_GET_VAR_REAL(nid, nvarid, tab_cntrl) |
---|
| 581 | #endif |
---|
| 582 | tab_cntrl(31) = FLOAT(itau_dyn + itaufin) |
---|
| 583 | #ifdef NC_DOUBLE |
---|
| 584 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
| 585 | #else |
---|
| 586 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
| 587 | #endif |
---|
| 588 | |
---|
| 589 | c Ecriture des champs |
---|
| 590 | c |
---|
| 591 | ierr = NF_INQ_VARID(nid, "ucov", nvarid) |
---|
| 592 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 593 | PRINT*, "Variable ucov n est pas definie" |
---|
| 594 | CALL abort |
---|
| 595 | ENDIF |
---|
| 596 | #ifdef NC_DOUBLE |
---|
| 597 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ucov) |
---|
| 598 | #else |
---|
| 599 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ucov) |
---|
| 600 | #endif |
---|
| 601 | |
---|
| 602 | ierr = NF_INQ_VARID(nid, "vcov", nvarid) |
---|
| 603 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 604 | PRINT*, "Variable vcov n est pas definie" |
---|
| 605 | CALL abort |
---|
| 606 | ENDIF |
---|
| 607 | #ifdef NC_DOUBLE |
---|
| 608 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,vcov) |
---|
| 609 | #else |
---|
| 610 | ierr = NF_PUT_VAR_REAL (nid,nvarid,vcov) |
---|
| 611 | #endif |
---|
| 612 | |
---|
| 613 | ierr = NF_INQ_VARID(nid, "teta", nvarid) |
---|
| 614 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 615 | PRINT*, "Variable teta n est pas definie" |
---|
| 616 | CALL abort |
---|
| 617 | ENDIF |
---|
| 618 | #ifdef NC_DOUBLE |
---|
| 619 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,teta) |
---|
| 620 | #else |
---|
| 621 | ierr = NF_PUT_VAR_REAL (nid,nvarid,teta) |
---|
| 622 | #endif |
---|
| 623 | |
---|
| 624 | IF (config_inca /= 'none') THEN |
---|
| 625 | ! Ajout Anne pour lecture valeurs traceurs dans un fichier start_trac.nc |
---|
| 626 | ierr_file = NF_OPEN ("start_trac.nc", NF_NOWRITE,nid_trac) |
---|
| 627 | IF (ierr_file .NE.NF_NOERR) THEN |
---|
| 628 | write(6,*)' Pb d''ouverture du fichier start_trac.nc' |
---|
| 629 | write(6,*)' ierr = ', ierr_file |
---|
| 630 | ENDIF |
---|
| 631 | END IF |
---|
| 632 | |
---|
[1146] | 633 | do iq=1,nqtot |
---|
[1000] | 634 | |
---|
| 635 | IF (config_inca == 'none') THEN |
---|
| 636 | ierr = NF_INQ_VARID(nid, tname(iq), nvarid) |
---|
| 637 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 638 | PRINT*, "Variable tname(iq) n est pas definie" |
---|
| 639 | CALL abort |
---|
| 640 | ENDIF |
---|
| 641 | #ifdef NC_DOUBLE |
---|
| 642 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) |
---|
| 643 | #else |
---|
| 644 | ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) |
---|
| 645 | #endif |
---|
| 646 | ELSE ! config_inca = 'chem' ou 'aero' |
---|
| 647 | ! lecture de la valeur du traceur dans start_trac.nc |
---|
| 648 | IF (ierr_file .ne. 2) THEN |
---|
| 649 | ierr = NF_INQ_VARID (nid_trac, tname(iq), nvarid_trac) |
---|
| 650 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 651 | PRINT*, tname(iq),"est absent de start_trac.nc" |
---|
| 652 | ierr = NF_INQ_VARID(nid, tname(iq), nvarid) |
---|
| 653 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 654 | PRINT*, "Variable ", tname(iq)," n est pas definie" |
---|
| 655 | CALL abort |
---|
| 656 | ENDIF |
---|
| 657 | #ifdef NC_DOUBLE |
---|
| 658 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) |
---|
| 659 | #else |
---|
| 660 | ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) |
---|
| 661 | #endif |
---|
| 662 | |
---|
| 663 | ELSE |
---|
| 664 | PRINT*, tname(iq), "est present dans start_trac.nc" |
---|
| 665 | #ifdef NC_DOUBLE |
---|
| 666 | ierr = NF_GET_VAR_DOUBLE(nid_trac, nvarid_trac, trac_tmp) |
---|
| 667 | #else |
---|
| 668 | ierr = NF_GET_VAR_REAL(nid_trac, nvarid_trac, trac_tmp) |
---|
| 669 | #endif |
---|
| 670 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 671 | PRINT*, "Lecture echouee pour", tname(iq) |
---|
| 672 | CALL abort |
---|
| 673 | ENDIF |
---|
| 674 | ierr = NF_INQ_VARID(nid, tname(iq), nvarid) |
---|
| 675 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 676 | PRINT*, "Variable ", tname(iq)," n est pas definie" |
---|
| 677 | CALL abort |
---|
| 678 | ENDIF |
---|
| 679 | #ifdef NC_DOUBLE |
---|
| 680 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,trac_tmp) |
---|
| 681 | #else |
---|
| 682 | ierr = NF_PUT_VAR_REAL (nid,nvarid,trac_tmp) |
---|
| 683 | #endif |
---|
| 684 | |
---|
| 685 | ENDIF ! IF (ierr .NE. NF_NOERR) |
---|
| 686 | ! fin lecture du traceur |
---|
| 687 | ELSE ! si il n'y a pas de fichier start_trac.nc |
---|
| 688 | ! print *, 'il n y a pas de fichier start_trac' |
---|
| 689 | ierr = NF_INQ_VARID(nid, tname(iq), nvarid) |
---|
| 690 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 691 | PRINT*, "Variable tname(iq) n est pas definie" |
---|
| 692 | CALL abort |
---|
| 693 | ENDIF |
---|
| 694 | #ifdef NC_DOUBLE |
---|
| 695 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) |
---|
| 696 | #else |
---|
| 697 | ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) |
---|
| 698 | #endif |
---|
| 699 | ENDIF ! (ierr_file .ne. 2) |
---|
| 700 | END IF ! config_inca |
---|
| 701 | |
---|
| 702 | ENDDO |
---|
| 703 | c |
---|
| 704 | ierr = NF_INQ_VARID(nid, "masse", nvarid) |
---|
| 705 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 706 | PRINT*, "Variable masse n est pas definie" |
---|
| 707 | CALL abort |
---|
| 708 | ENDIF |
---|
| 709 | #ifdef NC_DOUBLE |
---|
| 710 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,masse) |
---|
| 711 | #else |
---|
| 712 | ierr = NF_PUT_VAR_REAL (nid,nvarid,masse) |
---|
| 713 | #endif |
---|
| 714 | c |
---|
| 715 | ierr = NF_INQ_VARID(nid, "ps", nvarid) |
---|
| 716 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 717 | PRINT*, "Variable ps n est pas definie" |
---|
| 718 | CALL abort |
---|
| 719 | ENDIF |
---|
| 720 | #ifdef NC_DOUBLE |
---|
| 721 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ps) |
---|
| 722 | #else |
---|
| 723 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ps) |
---|
| 724 | #endif |
---|
| 725 | |
---|
| 726 | ierr = NF_CLOSE(nid) |
---|
| 727 | c |
---|
| 728 | RETURN |
---|
| 729 | END |
---|
| 730 | |
---|