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