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