[179] | 1 | c $Header$ |
---|
| 2 | c |
---|
[353] | 3 | SUBROUTINE dynredem0(fichnom,iday_end,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 ---------- |
---|
[353] | 25 | INTEGER iday_end |
---|
[2] | 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 | |
---|
[353] | 58 | call ymds2ju(annee_ref, 1, iday_end, 0.0, zjulian) |
---|
| 59 | call ju2ymds(zjulian, yyears0, mmois0, jjour0, hours) |
---|
[56] | 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) |
---|
[353] | 68 | tab_cntrl(4) = FLOAT(day_ref) |
---|
| 69 | tab_cntrl(5) = FLOAT(annee_ref) |
---|
[2] | 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 |
---|
[353] | 108 | |
---|
| 109 | tab_cntrl(30) = FLOAT(iday_end) |
---|
| 110 | tab_cntrl(31) = FLOAT(itau_dyn + itaufin) |
---|
[2] | 111 | c |
---|
| 112 | c ......................................................... |
---|
| 113 | c |
---|
| 114 | c Creation du fichier: |
---|
| 115 | c |
---|
| 116 | ierr = NF_CREATE(fichnom, NF_CLOBBER, nid) |
---|
| 117 | IF (ierr.NE.NF_NOERR) THEN |
---|
| 118 | WRITE(6,*)" Pb d ouverture du fichier "//fichnom |
---|
| 119 | WRITE(6,*)' ierr = ', ierr |
---|
| 120 | CALL ABORT |
---|
| 121 | ENDIF |
---|
| 122 | c |
---|
| 123 | c Preciser quelques attributs globaux: |
---|
| 124 | c |
---|
| 125 | ierr = NF_PUT_ATT_TEXT (nid, NF_GLOBAL, "title", 27, |
---|
| 126 | . "Fichier demmarage dynamique") |
---|
| 127 | c |
---|
| 128 | c Definir les dimensions du fichiers: |
---|
| 129 | c |
---|
| 130 | ierr = NF_DEF_DIM (nid, "index", length, idim_index) |
---|
| 131 | ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu) |
---|
| 132 | ierr = NF_DEF_DIM (nid, "rlatu", jjp1, idim_rlatu) |
---|
| 133 | ierr = NF_DEF_DIM (nid, "rlonv", iip1, idim_rlonv) |
---|
| 134 | ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv) |
---|
| 135 | ierr = NF_DEF_DIM (nid, "sigs", llm, idim_s) |
---|
| 136 | ierr = NF_DEF_DIM (nid, "sig", llmp1, idim_sig) |
---|
| 137 | ierr = NF_DEF_DIM (nid, "temps", NF_UNLIMITED, idim_tim) |
---|
| 138 | c |
---|
| 139 | ierr = NF_ENDDEF(nid) ! sortir du mode de definition |
---|
| 140 | c |
---|
| 141 | c Definir et enregistrer certains champs invariants: |
---|
| 142 | c |
---|
| 143 | ierr = NF_REDEF (nid) |
---|
| 144 | ierr = NF_DEF_VAR (nid,"controle",NF_FLOAT,1,idim_index,nvarid) |
---|
| 145 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
| 146 | . "Parametres de controle") |
---|
| 147 | ierr = NF_ENDDEF(nid) |
---|
| 148 | #ifdef NC_DOUBLE |
---|
| 149 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl) |
---|
| 150 | #else |
---|
| 151 | ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl) |
---|
| 152 | #endif |
---|
| 153 | c |
---|
| 154 | ierr = NF_REDEF (nid) |
---|
| 155 | ierr = NF_DEF_VAR (nid,"rlonu",NF_FLOAT,1,idim_rlonu,nvarid) |
---|
| 156 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23, |
---|
| 157 | . "Longitudes des points U") |
---|
| 158 | ierr = NF_ENDDEF(nid) |
---|
| 159 | #ifdef NC_DOUBLE |
---|
| 160 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu) |
---|
| 161 | #else |
---|
| 162 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu) |
---|
| 163 | #endif |
---|
| 164 | c |
---|
| 165 | ierr = NF_REDEF (nid) |
---|
| 166 | ierr = NF_DEF_VAR (nid,"rlatu",NF_FLOAT,1,idim_rlatu,nvarid) |
---|
| 167 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
| 168 | . "Latitudes des points U") |
---|
| 169 | ierr = NF_ENDDEF(nid) |
---|
| 170 | #ifdef NC_DOUBLE |
---|
| 171 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu) |
---|
| 172 | #else |
---|
| 173 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu) |
---|
| 174 | #endif |
---|
| 175 | c |
---|
| 176 | ierr = NF_REDEF (nid) |
---|
| 177 | ierr = NF_DEF_VAR (nid,"rlonv",NF_FLOAT,1,idim_rlonv,nvarid) |
---|
| 178 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23, |
---|
| 179 | . "Longitudes des points V") |
---|
| 180 | ierr = NF_ENDDEF(nid) |
---|
| 181 | #ifdef NC_DOUBLE |
---|
| 182 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv) |
---|
| 183 | #else |
---|
| 184 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv) |
---|
| 185 | #endif |
---|
| 186 | c |
---|
| 187 | ierr = NF_REDEF (nid) |
---|
| 188 | ierr = NF_DEF_VAR (nid,"rlatv",NF_FLOAT,1,idim_rlatv,nvarid) |
---|
| 189 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
| 190 | . "Latitudes des points V") |
---|
| 191 | ierr = NF_ENDDEF(nid) |
---|
| 192 | #ifdef NC_DOUBLE |
---|
| 193 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv) |
---|
| 194 | #else |
---|
| 195 | ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv) |
---|
| 196 | #endif |
---|
| 197 | c |
---|
| 198 | ierr = NF_REDEF (nid) |
---|
| 199 | ierr = NF_DEF_VAR (nid,"nivsigs",NF_FLOAT,1,idim_s,nvarid) |
---|
| 200 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 28, |
---|
| 201 | . "Numero naturel des couches s") |
---|
| 202 | ierr = NF_ENDDEF(nid) |
---|
| 203 | #ifdef NC_DOUBLE |
---|
| 204 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsigs) |
---|
| 205 | #else |
---|
| 206 | ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsigs) |
---|
| 207 | #endif |
---|
| 208 | c |
---|
| 209 | ierr = NF_REDEF (nid) |
---|
| 210 | ierr = NF_DEF_VAR (nid,"nivsig",NF_FLOAT,1,idim_sig,nvarid) |
---|
| 211 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 32, |
---|
| 212 | . "Numero naturel des couches sigma") |
---|
| 213 | ierr = NF_ENDDEF(nid) |
---|
| 214 | #ifdef NC_DOUBLE |
---|
| 215 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,nivsig) |
---|
| 216 | #else |
---|
| 217 | ierr = NF_PUT_VAR_REAL (nid,nvarid,nivsig) |
---|
| 218 | #endif |
---|
| 219 | c |
---|
| 220 | ierr = NF_REDEF (nid) |
---|
| 221 | ierr = NF_DEF_VAR (nid,"ap",NF_FLOAT,1,idim_sig,nvarid) |
---|
| 222 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 26, |
---|
| 223 | . "Coefficient A pour hybride") |
---|
| 224 | ierr = NF_ENDDEF(nid) |
---|
| 225 | #ifdef NC_DOUBLE |
---|
| 226 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ap) |
---|
| 227 | #else |
---|
| 228 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ap) |
---|
| 229 | #endif |
---|
| 230 | c |
---|
| 231 | ierr = NF_REDEF (nid) |
---|
| 232 | ierr = NF_DEF_VAR (nid,"bp",NF_FLOAT,1,idim_sig,nvarid) |
---|
| 233 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 26, |
---|
| 234 | . "Coefficient B pour hybride") |
---|
| 235 | ierr = NF_ENDDEF(nid) |
---|
| 236 | #ifdef NC_DOUBLE |
---|
| 237 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bp) |
---|
| 238 | #else |
---|
| 239 | ierr = NF_PUT_VAR_REAL (nid,nvarid,bp) |
---|
| 240 | #endif |
---|
| 241 | c |
---|
| 242 | ierr = NF_REDEF (nid) |
---|
| 243 | ierr = NF_DEF_VAR (nid,"presnivs",NF_FLOAT,1,idim_s,nvarid) |
---|
| 244 | ierr = NF_ENDDEF(nid) |
---|
| 245 | #ifdef NC_DOUBLE |
---|
| 246 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,presnivs) |
---|
| 247 | #else |
---|
| 248 | ierr = NF_PUT_VAR_REAL (nid,nvarid,presnivs) |
---|
| 249 | #endif |
---|
| 250 | c |
---|
| 251 | c Coefficients de passage cov. <-> contra. <--> naturel |
---|
| 252 | c |
---|
| 253 | ierr = NF_REDEF (nid) |
---|
| 254 | dims2(1) = idim_rlonu |
---|
| 255 | dims2(2) = idim_rlatu |
---|
| 256 | ierr = NF_DEF_VAR (nid,"cu",NF_FLOAT,2,dims2,nvarid) |
---|
| 257 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 29, |
---|
| 258 | . "Coefficient de passage pour U") |
---|
| 259 | ierr = NF_ENDDEF(nid) |
---|
| 260 | #ifdef NC_DOUBLE |
---|
| 261 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu) |
---|
| 262 | #else |
---|
| 263 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cu) |
---|
| 264 | #endif |
---|
| 265 | c |
---|
| 266 | ierr = NF_REDEF (nid) |
---|
| 267 | dims2(1) = idim_rlonv |
---|
| 268 | dims2(2) = idim_rlatv |
---|
| 269 | ierr = NF_DEF_VAR (nid,"cv",NF_FLOAT,2,dims2,nvarid) |
---|
| 270 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 29, |
---|
| 271 | . "Coefficient de passage pour V") |
---|
| 272 | ierr = NF_ENDDEF(nid) |
---|
| 273 | #ifdef NC_DOUBLE |
---|
| 274 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv) |
---|
| 275 | #else |
---|
| 276 | ierr = NF_PUT_VAR_REAL (nid,nvarid,cv) |
---|
| 277 | #endif |
---|
| 278 | c |
---|
| 279 | c Aire de chaque maille: |
---|
| 280 | c |
---|
| 281 | ierr = NF_REDEF (nid) |
---|
| 282 | dims2(1) = idim_rlonv |
---|
| 283 | dims2(2) = idim_rlatu |
---|
| 284 | ierr = NF_DEF_VAR (nid,"aire",NF_FLOAT,2,dims2,nvarid) |
---|
| 285 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22, |
---|
| 286 | . "Aires de chaque maille") |
---|
| 287 | ierr = NF_ENDDEF(nid) |
---|
| 288 | #ifdef NC_DOUBLE |
---|
| 289 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire) |
---|
| 290 | #else |
---|
| 291 | ierr = NF_PUT_VAR_REAL (nid,nvarid,aire) |
---|
| 292 | #endif |
---|
| 293 | c |
---|
| 294 | c Geopentiel au sol: |
---|
| 295 | c |
---|
| 296 | ierr = NF_REDEF (nid) |
---|
| 297 | dims2(1) = idim_rlonv |
---|
| 298 | dims2(2) = idim_rlatu |
---|
| 299 | ierr = NF_DEF_VAR (nid,"phisinit",NF_FLOAT,2,dims2,nvarid) |
---|
| 300 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 19, |
---|
| 301 | . "Geopotentiel au sol") |
---|
| 302 | ierr = NF_ENDDEF(nid) |
---|
| 303 | #ifdef NC_DOUBLE |
---|
| 304 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,phis) |
---|
| 305 | #else |
---|
| 306 | ierr = NF_PUT_VAR_REAL (nid,nvarid,phis) |
---|
| 307 | #endif |
---|
| 308 | c |
---|
| 309 | c Definir les variables pour pouvoir les enregistrer plus tard: |
---|
| 310 | c |
---|
| 311 | ierr = NF_REDEF (nid) ! entrer dans le mode de definition |
---|
| 312 | c |
---|
| 313 | ierr = NF_DEF_VAR (nid,"temps",NF_FLOAT,1,idim_tim,nvarid) |
---|
| 314 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 19, |
---|
| 315 | . "Temps de simulation") |
---|
[56] | 316 | write(unites,200)yyears0,mmois0,jjour0 |
---|
| 317 | 200 format('days since ',i4,'-',i2.2,'-',i2.2,' 00:00:00') |
---|
| 318 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "units", 30, |
---|
| 319 | . unites) |
---|
| 320 | |
---|
[2] | 321 | c |
---|
| 322 | dims4(1) = idim_rlonu |
---|
| 323 | dims4(2) = idim_rlatu |
---|
| 324 | dims4(3) = idim_s |
---|
| 325 | dims4(4) = idim_tim |
---|
| 326 | ierr = NF_DEF_VAR (nid,"ucov",NF_FLOAT,4,dims4,nvarid) |
---|
| 327 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9, |
---|
| 328 | . "Vitesse U") |
---|
| 329 | c |
---|
| 330 | dims4(1) = idim_rlonv |
---|
| 331 | dims4(2) = idim_rlatv |
---|
| 332 | dims4(3) = idim_s |
---|
| 333 | dims4(4) = idim_tim |
---|
| 334 | ierr = NF_DEF_VAR (nid,"vcov",NF_FLOAT,4,dims4,nvarid) |
---|
| 335 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9, |
---|
| 336 | . "Vitesse V") |
---|
| 337 | c |
---|
| 338 | dims4(1) = idim_rlonv |
---|
| 339 | dims4(2) = idim_rlatu |
---|
| 340 | dims4(3) = idim_s |
---|
| 341 | dims4(4) = idim_tim |
---|
| 342 | ierr = NF_DEF_VAR (nid,"teta",NF_FLOAT,4,dims4,nvarid) |
---|
| 343 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 11, |
---|
| 344 | . "Temperature") |
---|
| 345 | c |
---|
| 346 | dims4(1) = idim_rlonv |
---|
| 347 | dims4(2) = idim_rlatu |
---|
| 348 | dims4(3) = idim_s |
---|
| 349 | dims4(4) = idim_tim |
---|
| 350 | IF(nq.GE.1) THEN |
---|
| 351 | DO iq=1,nq |
---|
| 352 | IF (iq.GT.99) THEN |
---|
| 353 | PRINT*, "Trop de traceurs" |
---|
| 354 | CALL abort |
---|
| 355 | ELSE |
---|
| 356 | str3(1:1)='q' |
---|
| 357 | WRITE(str3(2:3),'(i2.2)') iq |
---|
| 358 | ierr = NF_DEF_VAR (nid,str3,NF_FLOAT,4,dims4,nvarid) |
---|
| 359 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 12, |
---|
| 360 | . "Traceurs "//str3) |
---|
| 361 | ENDIF |
---|
| 362 | ENDDO |
---|
| 363 | ENDIF |
---|
| 364 | c |
---|
| 365 | dims4(1) = idim_rlonv |
---|
| 366 | dims4(2) = idim_rlatu |
---|
| 367 | dims4(3) = idim_s |
---|
| 368 | dims4(4) = idim_tim |
---|
| 369 | ierr = NF_DEF_VAR (nid,"masse",NF_FLOAT,4,dims4,nvarid) |
---|
| 370 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 12, |
---|
| 371 | . "C est quoi ?") |
---|
| 372 | c |
---|
| 373 | dims3(1) = idim_rlonv |
---|
| 374 | dims3(2) = idim_rlatu |
---|
| 375 | dims3(3) = idim_tim |
---|
| 376 | ierr = NF_DEF_VAR (nid,"ps",NF_FLOAT,3,dims3,nvarid) |
---|
| 377 | ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 15, |
---|
| 378 | . "Pression au sol") |
---|
| 379 | c |
---|
| 380 | ierr = NF_ENDDEF(nid) ! sortir du mode de definition |
---|
| 381 | ierr = NF_CLOSE(nid) ! fermer le fichier |
---|
| 382 | |
---|
[353] | 383 | PRINT*,'iim,jjm,llm,iday_end',iim,jjm,llm,iday_end |
---|
[2] | 384 | PRINT*,'rad,omeg,g,cpp,kappa', |
---|
| 385 | , rad,omeg,g,cpp,kappa |
---|
| 386 | |
---|
| 387 | RETURN |
---|
| 388 | END |
---|
| 389 | SUBROUTINE dynredem1(fichnom,time, |
---|
| 390 | . vcov,ucov,teta,q,nq,masse,ps) |
---|
| 391 | IMPLICIT NONE |
---|
| 392 | c================================================================= |
---|
| 393 | c Ecriture du fichier de redemarrage sous format NetCDF |
---|
| 394 | c================================================================= |
---|
| 395 | #include "dimensions.h" |
---|
| 396 | #include "paramet.h" |
---|
| 397 | #include "description.h" |
---|
| 398 | #include "netcdf.inc" |
---|
| 399 | #include "comvert.h" |
---|
| 400 | #include "comgeom.h" |
---|
| 401 | |
---|
| 402 | INTEGER nq, l |
---|
| 403 | REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) |
---|
| 404 | REAL teta(ip1jmp1,llm) |
---|
| 405 | REAL ps(ip1jmp1),masse(ip1jmp1,llm) |
---|
| 406 | REAL q(ip1jmp1,llm,nq) |
---|
| 407 | CHARACTER*(*) fichnom |
---|
| 408 | |
---|
| 409 | REAL time |
---|
| 410 | INTEGER nid, nvarid |
---|
| 411 | INTEGER ierr |
---|
| 412 | INTEGER iq |
---|
| 413 | CHARACTER str3*3 |
---|
| 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 | |
---|
| 444 | c Ecriture des champs |
---|
| 445 | c |
---|
| 446 | ierr = NF_INQ_VARID(nid, "ucov", nvarid) |
---|
| 447 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 448 | PRINT*, "Variable ucov n est pas definie" |
---|
| 449 | CALL abort |
---|
| 450 | ENDIF |
---|
| 451 | #ifdef NC_DOUBLE |
---|
| 452 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ucov) |
---|
| 453 | #else |
---|
| 454 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ucov) |
---|
| 455 | #endif |
---|
| 456 | |
---|
| 457 | ierr = NF_INQ_VARID(nid, "vcov", nvarid) |
---|
| 458 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 459 | PRINT*, "Variable vcov n est pas definie" |
---|
| 460 | CALL abort |
---|
| 461 | ENDIF |
---|
| 462 | #ifdef NC_DOUBLE |
---|
| 463 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,vcov) |
---|
| 464 | #else |
---|
| 465 | ierr = NF_PUT_VAR_REAL (nid,nvarid,vcov) |
---|
| 466 | #endif |
---|
| 467 | |
---|
| 468 | ierr = NF_INQ_VARID(nid, "teta", nvarid) |
---|
| 469 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 470 | PRINT*, "Variable teta n est pas definie" |
---|
| 471 | CALL abort |
---|
| 472 | ENDIF |
---|
| 473 | #ifdef NC_DOUBLE |
---|
| 474 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,teta) |
---|
| 475 | #else |
---|
| 476 | ierr = NF_PUT_VAR_REAL (nid,nvarid,teta) |
---|
| 477 | #endif |
---|
| 478 | |
---|
| 479 | IF(nq.GE.1) THEN |
---|
| 480 | DO iq=1,nq |
---|
| 481 | IF (iq.GT.99) THEN |
---|
| 482 | PRINT*, "Trop de traceurs" |
---|
| 483 | CALL abort |
---|
| 484 | ELSE |
---|
| 485 | str3(1:1)='q' |
---|
| 486 | WRITE(str3(2:3),'(i2.2)') iq |
---|
| 487 | ierr = NF_INQ_VARID(nid, str3, nvarid) |
---|
| 488 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 489 | PRINT*, "Variable "//str3//" n est pas definie" |
---|
| 490 | CALL abort |
---|
| 491 | ENDIF |
---|
| 492 | #ifdef NC_DOUBLE |
---|
| 493 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) |
---|
| 494 | #else |
---|
| 495 | ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) |
---|
| 496 | #endif |
---|
| 497 | ENDIF |
---|
| 498 | ENDDO |
---|
| 499 | ENDIF |
---|
| 500 | c |
---|
| 501 | ierr = NF_INQ_VARID(nid, "masse", nvarid) |
---|
| 502 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 503 | PRINT*, "Variable masse n est pas definie" |
---|
| 504 | CALL abort |
---|
| 505 | ENDIF |
---|
| 506 | #ifdef NC_DOUBLE |
---|
| 507 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,masse) |
---|
| 508 | #else |
---|
| 509 | ierr = NF_PUT_VAR_REAL (nid,nvarid,masse) |
---|
| 510 | #endif |
---|
| 511 | c |
---|
| 512 | ierr = NF_INQ_VARID(nid, "ps", nvarid) |
---|
| 513 | IF (ierr .NE. NF_NOERR) THEN |
---|
| 514 | PRINT*, "Variable ps n est pas definie" |
---|
| 515 | CALL abort |
---|
| 516 | ENDIF |
---|
| 517 | #ifdef NC_DOUBLE |
---|
| 518 | ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,ps) |
---|
| 519 | #else |
---|
| 520 | ierr = NF_PUT_VAR_REAL (nid,nvarid,ps) |
---|
| 521 | #endif |
---|
| 522 | |
---|
| 523 | ierr = NF_CLOSE(nid) |
---|
| 524 | c |
---|
| 525 | RETURN |
---|
| 526 | END |
---|
| 527 | |
---|