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