Changeset 907 for trunk/LMDZ.COMMON/libf/dyn3d/dynredem.F
- Timestamp:
- Mar 22, 2013, 10:45:24 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/dyn3d/dynredem.F
r776 r907 9 9 USE infotrac 10 10 use netcdf95, only: NF95_PUT_VAR 11 11 use control_mod, only : planet_type 12 12 13 IMPLICIT NONE 13 14 c======================================================================= … … 58 59 character*30 unites 59 60 61 character(len=12) :: start_file_type="earth" ! default start file type 62 INTEGER idecal 60 63 61 64 c----------------------------------------------------------------------- … … 71 74 jjour0=1 72 75 #endif 76 77 !!! AS: idecal is a hack to be able to read planeto starts... 78 !!! .... while keeping everything OK for LMDZ EARTH 79 if ((planet_type.eq."generic").or.(planet_type.eq."mars")) then 80 write(lunout,*) trim(modname),' : Planeto-like start file' 81 start_file_type="planeto" 82 idecal = 4 83 else 84 write(lunout,*) trim(modname),' : Earth-like start file' 85 idecal = 5 86 endif 73 87 74 88 DO l=1,length … … 78 92 tab_cntrl(2) = REAL(jjm) 79 93 tab_cntrl(3) = REAL(llm) 80 tab_cntrl(4) = REAL(day_ref) 94 if (start_file_type.eq."earth") then 95 tab_cntrl(4)=REAL(day_ref) 96 else 97 tab_cntrl(4)=REAL(day_end) 98 endif 81 99 tab_cntrl(5) = REAL(annee_ref) 82 tab_cntrl( 6) = rad83 tab_cntrl( 7) = omeg84 tab_cntrl( 8) = g85 tab_cntrl( 9) = cpp86 tab_cntrl( 10) = kappa87 tab_cntrl( 11) = daysec88 tab_cntrl( 12) = dtvr89 tab_cntrl( 13) = etot090 tab_cntrl( 14) = ptot091 tab_cntrl( 15) = ztot092 tab_cntrl( 16) = stot093 tab_cntrl( 17) = ang094 tab_cntrl( 18) = pa95 tab_cntrl( 19) = preff100 tab_cntrl(idecal+1) = rad 101 tab_cntrl(idecal+2) = omeg 102 tab_cntrl(idecal+3) = g 103 tab_cntrl(idecal+4) = cpp 104 tab_cntrl(idecal+5) = kappa 105 tab_cntrl(idecal+6) = daysec 106 tab_cntrl(idecal+7) = dtvr 107 tab_cntrl(idecal+8) = etot0 108 tab_cntrl(idecal+9) = ptot0 109 tab_cntrl(idecal+10) = ztot0 110 tab_cntrl(idecal+11) = stot0 111 tab_cntrl(idecal+12) = ang0 112 tab_cntrl(idecal+13) = pa 113 tab_cntrl(idecal+14) = preff 96 114 c 97 115 c ..... parametres pour le zoom ...... 98 116 99 tab_cntrl( 20) = clon100 tab_cntrl( 21) = clat101 tab_cntrl( 22) = grossismx102 tab_cntrl( 23) = grossismy117 tab_cntrl(idecal+15) = clon 118 tab_cntrl(idecal+16) = clat 119 tab_cntrl(idecal+17) = grossismx 120 tab_cntrl(idecal+18) = grossismy 103 121 c 104 122 IF ( fxyhypb ) THEN 105 tab_cntrl( 24) = 1.106 tab_cntrl( 25) = dzoomx107 tab_cntrl( 26) = dzoomy108 tab_cntrl( 27) = 0.109 tab_cntrl( 28) = taux110 tab_cntrl( 29) = tauy123 tab_cntrl(idecal+19) = 1. 124 tab_cntrl(idecal+20) = dzoomx 125 tab_cntrl(idecal+21) = dzoomy 126 tab_cntrl(idecal+22) = 0. 127 tab_cntrl(idecal+23) = taux 128 tab_cntrl(idecal+24) = tauy 111 129 ELSE 112 tab_cntrl(24) = 0. 113 tab_cntrl(25) = dzoomx 114 tab_cntrl(26) = dzoomy 115 tab_cntrl(27) = 0. 116 tab_cntrl(28) = 0. 117 tab_cntrl(29) = 0. 118 IF( ysinus ) tab_cntrl(27) = 1. 119 ENDIF 120 121 tab_cntrl(30) = REAL(iday_end) 122 tab_cntrl(31) = REAL(itau_dyn + itaufin) 130 tab_cntrl(idecal+19) = 0. 131 tab_cntrl(idecal+20) = dzoomx 132 tab_cntrl(idecal+21) = dzoomy 133 tab_cntrl(idecal+22) = 0. 134 tab_cntrl(idecal+23) = 0. 135 tab_cntrl(idecal+24) = 0. 136 IF( ysinus ) tab_cntrl(idecal+22) = 1. 137 ENDIF 138 139 if (start_file_type.eq."earth") then 140 tab_cntrl(idecal+25) = REAL(iday_end) 141 tab_cntrl(idecal+26) = REAL(itau_dyn + itaufin) 123 142 c start_time: start_time of simulation (not necessarily 0.) 124 tab_cntrl(32) = start_time 143 tab_cntrl(idecal+27) = start_time 144 endif 125 145 c 126 146 c ......................................................... … … 143 163 c Definir les dimensions du fichiers: 144 164 c 145 ierr = NF_DEF_DIM (nid, "index", length, idim_index) 146 ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu) 147 ierr = NF_DEF_DIM (nid, "rlatu", jjp1, idim_rlatu) 148 ierr = NF_DEF_DIM (nid, "rlonv", iip1, idim_rlonv) 149 ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv) 150 ierr = NF_DEF_DIM (nid, "sigs", llm, idim_s) 151 ierr = NF_DEF_DIM (nid, "sig", llmp1, idim_sig) 152 ierr = NF_DEF_DIM (nid, "temps", NF_UNLIMITED, idim_tim) 165 if (start_file_type.eq."earth") then 166 ierr = NF_DEF_DIM (nid, "index", length, idim_index) 167 ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu) 168 ierr = NF_DEF_DIM (nid, "rlatu", jjp1, idim_rlatu) 169 ierr = NF_DEF_DIM (nid, "rlonv", iip1, idim_rlonv) 170 ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv) 171 ierr = NF_DEF_DIM (nid, "sigs", llm, idim_s) 172 ierr = NF_DEF_DIM (nid, "sig", llmp1, idim_sig) 173 ierr = NF_DEF_DIM (nid, "temps", NF_UNLIMITED, idim_tim) 174 else 175 ierr = NF_DEF_DIM (nid, "index", length, idim_index) 176 ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu) 177 ierr = NF_DEF_DIM (nid, "latitude", jjp1, idim_rlatu) 178 ierr = NF_DEF_DIM (nid, "longitude", iip1, idim_rlonv) 179 ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv) 180 ierr = NF_DEF_DIM (nid, "altitude", llm, idim_s) 181 ierr = NF_DEF_DIM (nid, "interlayer", llmp1, idim_sig) 182 ierr = NF_DEF_DIM (nid, "Time", NF_UNLIMITED, idim_tim) 183 endif 153 184 c 154 185 ierr = NF_ENDDEF(nid) ! sortir du mode de definition … … 221 252 call NF95_PUT_VAR(nid,nvarid,rlatv) 222 253 c 223 ierr = NF_REDEF (nid) 224 cIM 220306 BEG 225 #ifdef NC_DOUBLE 226 ierr = NF_DEF_VAR (nid,"nivsigs",NF_DOUBLE,1,idim_s,nvarid) 227 #else 228 ierr = NF_DEF_VAR (nid,"nivsigs",NF_FLOAT,1,idim_s,nvarid) 229 #endif 230 cIM 220306 END 231 ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 28, 254 if (start_file_type.eq."earth") then 255 ierr = NF_REDEF (nid) 256 cIM 220306 BEG 257 #ifdef NC_DOUBLE 258 ierr = NF_DEF_VAR (nid,"nivsigs",NF_DOUBLE,1,idim_s,nvarid) 259 #else 260 ierr = NF_DEF_VAR (nid,"nivsigs",NF_FLOAT,1,idim_s,nvarid) 261 #endif 262 cIM 220306 END 263 ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 28, 232 264 . "Numero naturel des couches s") 233 ierr = NF_ENDDEF(nid)234 call NF95_PUT_VAR(nid,nvarid,nivsigs)235 c 236 ierr = NF_REDEF (nid)237 cIM 220306 BEG 238 #ifdef NC_DOUBLE 239 ierr = NF_DEF_VAR (nid,"nivsig",NF_DOUBLE,1,idim_sig,nvarid)240 #else 241 ierr = NF_DEF_VAR (nid,"nivsig",NF_FLOAT,1,idim_sig,nvarid)242 #endif 243 cIM 220306 END 244 ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 32,265 ierr = NF_ENDDEF(nid) 266 call NF95_PUT_VAR(nid,nvarid,nivsigs) 267 c 268 ierr = NF_REDEF (nid) 269 cIM 220306 BEG 270 #ifdef NC_DOUBLE 271 ierr = NF_DEF_VAR (nid,"nivsig",NF_DOUBLE,1,idim_sig,nvarid) 272 #else 273 ierr = NF_DEF_VAR (nid,"nivsig",NF_FLOAT,1,idim_sig,nvarid) 274 #endif 275 cIM 220306 END 276 ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 32, 245 277 . "Numero naturel des couches sigma") 246 ierr = NF_ENDDEF(nid) 247 call NF95_PUT_VAR(nid,nvarid,nivsig) 278 ierr = NF_ENDDEF(nid) 279 call NF95_PUT_VAR(nid,nvarid,nivsig) 280 endif ! of if (start_file_type.eq."earth") 248 281 c 249 282 ierr = NF_REDEF (nid) … … 273 306 call NF95_PUT_VAR(nid,nvarid,bp) 274 307 c 308 if (start_file_type.ne."earth") then 309 ierr = NF_REDEF (nid) 310 cIM 220306 BEG 311 #ifdef NC_DOUBLE 312 ierr = NF_DEF_VAR (nid,"aps",NF_DOUBLE,1,idim_s,nvarid) 313 #else 314 ierr = NF_DEF_VAR (nid,"aps",NF_FLOAT,1,idim_s,nvarid) 315 #endif 316 cIM 220306 END 317 ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 37, 318 . "Coef AS: hybrid pressure at midlayers") 319 ierr = NF_ENDDEF(nid) 320 call NF95_PUT_VAR(nid,nvarid,aps) 321 c 322 ierr = NF_REDEF (nid) 323 cIM 220306 BEG 324 #ifdef NC_DOUBLE 325 ierr = NF_DEF_VAR (nid,"bps",NF_DOUBLE,1,idim_s,nvarid) 326 #else 327 ierr = NF_DEF_VAR (nid,"bps",NF_FLOAT,1,idim_s,nvarid) 328 #endif 329 cIM 220306 END 330 ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 34, 331 . "Coef BS: hybrid sigma at midlayers") 332 ierr = NF_ENDDEF(nid) 333 call NF95_PUT_VAR(nid,nvarid,bps) 334 endif ! of if (start_file_type.ne."earth") 335 c 275 336 ierr = NF_REDEF (nid) 276 337 cIM 220306 BEG … … 283 344 ierr = NF_ENDDEF(nid) 284 345 call NF95_PUT_VAR(nid,nvarid,presnivs) 346 c 347 if (start_file_type.ne."earth") then 348 ierr = NF_REDEF (nid) 349 #ifdef NC_DOUBLE 350 ierr = NF_DEF_VAR(nid,"latitude",NF_DOUBLE,1,idim_rlatu,nvarid) 351 #else 352 ierr = NF_DEF_VAR(nid,"latitude",NF_FLOAT,1,idim_rlatu,nvarid) 353 #endif 354 ierr =NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north") 355 ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14, 356 . "North latitude") 357 ierr = NF_ENDDEF(nid) 358 call NF95_PUT_VAR(nid,nvarid,rlatu*180/pi) 359 c 360 ierr = NF_REDEF (nid) 361 #ifdef NC_DOUBLE 362 ierr=NF_DEF_VAR(nid,"longitude",NF_DOUBLE,1,idim_rlonv,nvarid) 363 #else 364 ierr=NF_DEF_VAR(nid,"longitude",NF_FLOAT,1,idim_rlonv,nvarid) 365 #endif 366 ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14, 367 . "East longitude") 368 ierr = NF_PUT_ATT_TEXT(nid,nvarid,'units',12,"degrees_east") 369 ierr = NF_ENDDEF(nid) 370 call NF95_PUT_VAR(nid,nvarid,rlonv*180/pi) 371 c 372 ierr = NF_REDEF (nid) 373 #ifdef NC_DOUBLE 374 ierr = NF_DEF_VAR (nid, "altitude", NF_DOUBLE, 1, 375 . idim_s,nvarid) 376 #else 377 ierr = NF_DEF_VAR (nid, "altitude", NF_FLOAT, 1, 378 . idim_s,nvarid) 379 #endif 380 ierr = NF_PUT_ATT_TEXT(nid,nvarid,"long_name",10,"pseudo-alt") 381 ierr = NF_PUT_ATT_TEXT (nid,nvarid,'units',2,"km") 382 ierr = NF_PUT_ATT_TEXT (nid,nvarid,'positive',2,"up") 383 ierr = NF_ENDDEF(nid) 384 call NF95_PUT_VAR(nid,nvarid,pseudoalt) 385 endif ! of if (start_file_type.ne."earth") 285 386 c 286 387 c Coefficients de passage cov. <-> contra. <--> naturel … … 354 455 ierr = NF_REDEF (nid) ! entrer dans le mode de definition 355 456 c 356 cIM 220306 BEG 357 #ifdef NC_DOUBLE 358 ierr = NF_DEF_VAR (nid,"temps",NF_DOUBLE,1,idim_tim,nvarid) 359 #else 360 ierr = NF_DEF_VAR (nid,"temps",NF_FLOAT,1,idim_tim,nvarid) 361 #endif 362 cIM 220306 END 457 if (start_file_type.eq."earth") then 458 cIM 220306 BEG 459 #ifdef NC_DOUBLE 460 ierr = NF_DEF_VAR (nid,"temps",NF_DOUBLE,1,idim_tim,nvarid) 461 #else 462 ierr = NF_DEF_VAR (nid,"temps",NF_FLOAT,1,idim_tim,nvarid) 463 #endif 464 cIM 220306 END 465 else ! start_file_type=="planeto" 466 #ifdef NC_DOUBLE 467 ierr = NF_DEF_VAR (nid,"Time",NF_DOUBLE,1,idim_tim,nvarid) 468 #else 469 ierr = NF_DEF_VAR (nid,"Time",NF_FLOAT,1,idim_tim,nvarid) 470 #endif 471 endif ! of if (start_file_type.eq."earth") 363 472 ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 19, 364 473 . "Temps de simulation") … … 465 574 RETURN 466 575 END 576 577 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 578 467 579 SUBROUTINE dynredem1(fichnom,time, 468 580 . vcov,ucov,teta,q,masse,ps) 469 581 USE infotrac 470 USE control_mod 582 USE control_mod, only : planet_type 471 583 use netcdf, only: NF90_get_VAR 472 584 use netcdf95, only: NF95_PUT_VAR … … 501 613 PARAMETER (length = 100) 502 614 REAL tab_cntrl(length) ! tableau des parametres du run 503 character *20 modname615 character(len=*),parameter :: modname='dynredem1' 504 616 character*80 abort_message 505 617 c … … 507 619 SAVE nb 508 620 DATA nb / 0 / 509 510 modname = 'dynredem1' 621 character(len=12) :: start_file_type="earth" ! default start file type 622 623 if ((planet_type.eq."generic").or.(planet_type.eq."mars")) then 624 write(lunout,*) trim(modname),' : Planeto-like start file' 625 start_file_type="planeto" 626 else 627 write(lunout,*) trim(modname),' : Earth-like start file' 628 endif 629 511 630 ierr = NF_OPEN(fichnom, NF_WRITE, nid) 512 631 IF (ierr .NE. NF_NOERR) THEN 513 write(lunout,*)"dynredem1: Pb. d ouverture "//trim(fichnom)632 PRINT*, "dynredem1: Pb. d ouverture "//trim(fichnom) 514 633 CALL abort 515 634 ENDIF … … 518 637 519 638 nb = nb + 1 520 ierr = NF_INQ_VARID(nid, "temps", nvarid) 521 IF (ierr .NE. NF_NOERR) THEN 522 write(lunout,*) NF_STRERROR(ierr) 523 abort_message='Variable temps n est pas definie' 524 CALL abort_gcm(modname,abort_message,ierr) 525 ENDIF 639 if (start_file_type.eq."earth") then 640 ierr = NF_INQ_VARID(nid, "temps", nvarid) 641 IF (ierr .NE. NF_NOERR) THEN 642 write(lunout,*) NF_STRERROR(ierr) 643 abort_message='Variable temps n est pas definie' 644 CALL abort_gcm(modname,abort_message,ierr) 645 ENDIF 646 else 647 ierr = NF_INQ_VARID(nid,"Time", nvarid) 648 IF (ierr .NE. NF_NOERR) THEN 649 write(lunout,*) NF_STRERROR(ierr) 650 abort_message='Variable Time not found' 651 CALL abort_gcm(modname,abort_message,ierr) 652 ENDIF 653 endif ! of if (start_file_type.eq."earth") 526 654 call NF95_PUT_VAR(nid,nvarid,time,start=(/nb/)) 527 655 write(lunout,*) "dynredem1: Enregistrement pour ", nb, time … … 537 665 ENDIF 538 666 ierr = NF90_GET_VAR(nid, nvarid, tab_cntrl) 539 tab_cntrl(31) = REAL(itau_dyn + itaufin) 667 if (start_file_type=="earth") then 668 tab_cntrl(31) = REAL(itau_dyn + itaufin) 669 else 670 tab_cntrl(31) = 0 671 endif 540 672 call NF95_PUT_VAR(nid,nvarid,tab_cntrl) 541 673
Note: See TracChangeset
for help on using the changeset viewer.