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