Changeset 999 for trunk/LMDZ.MARS/libf/phymars
- Timestamp:
- Jul 2, 2013, 9:40:28 AM (12 years ago)
- Location:
- trunk/LMDZ.MARS/libf/phymars
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/iniwrite.F
r164 r999 72 72 tab_cntrl(15) = stot0 73 73 tab_cntrl(16) = ang0 74 75 tab_cntrl(27) = hour_ini 74 76 c 75 77 c .......... P.Le Van ( ajout le 8/04/96 ) ......... -
trunk/LMDZ.MARS/libf/phymars/phyetat0.F
r697 r999 1 1 SUBROUTINE phyetat0 (fichnom,tab0,Lmodif,nsoil,nq, 2 . day_ini,time ,2 . day_ini,time0, 3 3 . tsurf,tsoil,emis,q2,qsurf,co2ice) 4 4 … … 13 13 ! r4 or r8 restarts independently of having compiled 14 14 ! the GCM in r4 or r8) 15 ! June 2013 TN : Possibility to read files with a time axis 15 16 c====================================================================== 16 17 !#include "netcdf.inc" … … 24 25 #include "comcstfi.h" 25 26 !#include "tracer.h" 26 #include"advtrac.h" 27 #include "advtrac.h" 28 #include "control.h" 27 29 c====================================================================== 28 30 INTEGER nbsrf !Mars nbsrf a 1 au lieu de 4 … … 38 40 integer nq 39 41 integer day_ini 40 real time 42 real time0 41 43 42 44 ! outputs: … … 72 74 character(len=30) :: txt ! to store some text 73 75 74 76 ! specific for time 77 REAL,ALLOCATABLE :: time(:) ! times stored in start 78 INTEGER timelen ! number of times stored in the file 79 INTEGER indextime ! index of selected time 80 81 INTEGER edges(3),corner(3) 82 83 75 84 c 76 85 c Ouvrir le fichier contenant l etat initial: … … 111 120 write(*,*) 'TABFI de phyeta0',Lmodif,tab0 112 121 call tabfi (nid,Lmodif,tab0,day_ini,lmax,p_rad, 113 . p_omeg,p_g,p_mugaz,p_daysec,time )122 . p_omeg,p_g,p_mugaz,p_daysec,time0) 114 123 c 115 124 c Read latitudes (coordinates): No need, these are provided by the dynamics … … 333 342 ENDDO 334 343 PRINT*,'<zthe>:', xmin, xmax 344 345 c 346 c Time axis 347 c 348 ierr = nf90_inq_dimid(nid,"Time",nvarid) 349 350 IF (ierr .NE. nf90_noerr) THEN 351 indextime = 1 352 print*, "phyetat0: No time axis found in "//fichnom 353 354 ELSE 355 print*, "phyetat0: Time axis found in "//fichnom 356 357 ierr = nf90_inquire_dimension(nid,nvarid,len=timelen) 358 359 ALLOCATE(time(timelen)) 360 361 ierr=nf90_inq_varid(nid,"Time",nvarid) 362 IF (ierr .NE. nf90_noerr) THEN 363 ierr=nf90_inq_varid(nid,"temps", nvarid) 364 IF (ierr .NE. nf90_noerr) THEN 365 PRINT*, "dynetat0: <Time> or <temps> absent" 366 write(*,*)trim(nf90_strerror(ierr)) 367 CALL abort 368 ENDIF 369 ENDIF 370 ierr=nf90_get_var(nid,nvarid,time) 371 IF (ierr .NE. nf90_noerr) THEN 372 PRINT*, "dynetat0: Lecture echouee <Time>/<temps>" 373 write(*,*)trim(nf90_strerror(ierr)) 374 CALL abort 375 ENDIF 376 c 377 c Select desired time 378 c 379 IF (timestart .lt. 0) THEN ! default: we use the last time value 380 indextime = timelen 381 ELSE ! else we look for the desired value in the time axis 382 indextime = 0 383 DO i=1,timelen 384 IF (abs(time(i) - timestart) .lt. 0.01) THEN 385 indextime = i 386 EXIT 387 ENDIF 388 ENDDO 389 IF (indextime .eq. 0) THEN 390 PRINT*, "Time", timestart," is not in "//fichnom//"!!" 391 PRINT*, "Stored times are:" 392 DO i=1,timelen 393 PRINT*, time(i) 394 ENDDO 395 CALL abort 396 ENDIF 397 ENDIF 398 399 ! In startfi the absolute date is day_ini + time0 + time 400 ! For now on, in the GCM physics, it is day_ini + time0 401 time0 = time(indextime) + time0 402 day_ini = day_ini + INT(time0) 403 time0 = time0 - INT(time0) 404 405 PRINT*, "phyetat0: Selected time ",time(indextime), 406 . " at index ",indextime 407 408 DEALLOCATE(time) 409 410 ENDIF ! of IF (Time not in file) 411 412 335 413 c 336 414 c CO2 ice cover 337 415 c 416 corner(1)=1 417 corner(2)=indextime 418 edges(1)=ngridmx 419 edges(2)=1 338 420 ierr=nf90_inq_varid(nid,"co2ice",nvarid) 339 421 IF (ierr.NE.nf90_noerr) THEN … … 342 424 CALL abort 343 425 ENDIF 344 ierr=nf90_get_var(nid,nvarid,co2ice )426 ierr=nf90_get_var(nid,nvarid,co2ice,corner,edges) 345 427 IF (ierr.NE.nf90_noerr) THEN 346 428 PRINT*, 'phyetat0: Lecture echouee pour <co2ice>' … … 389 471 PRINT*, ' J ignore donc les autres temperatures TS**' 390 472 !ierr=nf90_get_var(nid,nvarid,tsurf(1,1)) 391 ierr=nf90_get_var(nid,nvarid,tsurf )473 ierr=nf90_get_var(nid,nvarid,tsurf,corner,edges) 392 474 IF (ierr.NE.nf90_noerr) THEN 393 475 PRINT*, "phyetat0: Lecture echouee pour <TSURF>" … … 453 535 CALL abort 454 536 ENDIF 455 ierr=nf90_get_var(nid,nvarid,emis )537 ierr=nf90_get_var(nid,nvarid,emis,corner,edges) 456 538 IF (ierr.NE.nf90_noerr) THEN 457 539 PRINT*, 'phyetat0: Lecture echouee pour <emis>' … … 491 573 c pbl wind variance 492 574 c 575 corner(1)=1 576 corner(2)=1 577 corner(3)=indextime 578 edges(1)=ngridmx 579 edges(2)=llm+1 580 edges(3)=1 493 581 ierr=nf90_inq_varid(nid,"q2",nvarid) 494 582 IF (ierr.NE.nf90_noerr) THEN … … 497 585 CALL abort 498 586 ENDIF 499 ierr=nf90_get_var(nid,nvarid,q2 )587 ierr=nf90_get_var(nid,nvarid,q2,corner,edges) 500 588 IF (ierr.NE.nf90_noerr) THEN 501 589 PRINT*, 'phyetat0: Lecture echouee pour <q2>' … … 511 599 c tracer on surface 512 600 c 513 601 corner(1)=1 602 corner(2)=indextime 603 edges(1)=ngridmx 604 edges(2)=1 514 605 IF(nq.GE.1) THEN 515 606 nqold=nq … … 542 633 ELSE 543 634 !ierr=nf90_get_var(nid,nvarid,qsurf(1,iq)) 544 ierr=nf90_get_var(nid,nvarid,surffield )635 ierr=nf90_get_var(nid,nvarid,surffield,corner,edges) 545 636 qsurf(1:ngridmx,iq)=surffield(1:ngridmx) 546 637 IF (ierr.NE.nf90_noerr) THEN … … 583 674 ! as well as thermal inertia and volumetric heat capacity 584 675 585 call soil_settings(nid,ngridmx,nsoil,tsurf,tsoil )676 call soil_settings(nid,ngridmx,nsoil,tsurf,tsoil,indextime) 586 677 c 587 678 c Fermer le fichier: -
trunk/LMDZ.MARS/libf/phymars/physiq.F
r900 r999 162 162 163 163 REAL pday 164 REAL ptime 164 REAL ptime 165 165 logical tracerdyn 166 166 … … 214 214 REAL sky 215 215 216 SAVE day_ini, icount 216 SAVE day_ini, icount, time_phys 217 217 SAVE aerosol, tsurf,tsoil 218 218 SAVE co2ice,albedo,emis, q2 … … 478 478 #ifndef MESOSCALE 479 479 if (callslope) call getslopes(phisfi) 480 481 call physdem0("restartfi.nc",long,lati,nsoilmx,nq, 482 . ptimestep,pday,time_phys,area, 483 . albedodat,inertiedat,zmea,zstd,zsig,zgam,zthe) 484 480 485 #endif 481 486 … … 1354 1359 1355 1360 1361 1356 1362 c----------------------------------------------------------------------- 1357 1363 c 10. Write output files … … 1520 1526 c thus we store for time=time+dtvr 1521 1527 1522 IF(lastcall) THEN 1523 ztime_fin = ptime + ptimestep/(float(iphysiq)*daysec) 1524 write(*,*)'PHYSIQ: for physdem ztime_fin =',ztime_fin 1525 call physdem1("restartfi.nc",long,lati,nsoilmx,nq, 1526 . ptimestep,pday, 1527 . ztime_fin,tsurf,tsoil,co2ice,emis,q2,qsurf, 1528 . area,albedodat,inertiedat,zmea,zstd,zsig, 1529 . zgam,zthe) 1528 IF( ((ecritstart.GT.0) .and. 1529 . (MOD(icount*iphysiq,ecritstart).EQ.0)) 1530 . .or. lastcall ) THEN 1531 1532 ztime_fin = pday + ptime + ptimestep/(float(iphysiq)*daysec) 1533 . - day_ini - time_phys 1534 print*, pday,ptime,day_ini, time_phys 1535 write(*,'(A,I7,A,F12.5)') 1536 . 'PHYSIQ: Ecriture du fichier restartfi ; icount=', 1537 . icount,' date=',ztime_fin 1538 1539 1540 call physdem1("restartfi.nc",nsoilmx,nq, 1541 . ptimestep,ztime_fin, 1542 . tsurf,tsoil,co2ice,emis,q2,qsurf) 1543 1530 1544 ENDIF 1531 1545 #endif -
trunk/LMDZ.MARS/libf/phymars/soil_settings.F
r38 r999 1 subroutine soil_settings(nid,ngrid,nsoil,tsurf,tsoil )1 subroutine soil_settings(nid,ngrid,nsoil,tsurf,tsoil,indextime) 2 2 3 3 use netcdf … … 12 12 ! r4 or r8 restarts independently of having compiled 13 13 ! the GCM in r4 or r8) 14 ! June 2013 TN : Possibility to read files with a time axis 15 ! 14 16 ! 15 17 ! This subroutine reads from a NetCDF file (opened by the caller) … … 42 44 integer nsoil ! # of soil layers 43 45 real tsurf(ngrid) ! surface temperature 46 integer indextime ! position on time axis 44 47 ! output: 45 48 real tsoil(ngridmx,nsoilmx) ! soil temperature … … 53 56 integer ndims ! # of dimensions of read <inertiedat> data 54 57 integer ig,iloop ! loop counters 58 59 integer edges(3),corner(3) ! to read a specific time 55 60 56 61 logical :: olddepthdef=.false. ! flag … … 298 303 endif 299 304 else ! put values in tsoil 305 corner(1)=1 306 corner(2)=1 307 corner(3)=indextime 308 edges(1)=ngridmx 309 edges(2)=nsoilmx 310 edges(3)=1 311 !ierr=nf90_get_var(nid,nvarid,tsoil,corner,edges) 300 312 ierr=nf90_get_var(nid,nvarid,tsoil) 301 313 if (ierr.ne.nf90_noerr) then -
trunk/LMDZ.MARS/libf/phymars/testphys1d.F
r899 r999 641 641 c It is needed to transfert physics variables to "physiq"... 642 642 643 call physdem1("startfi.nc",long,lati,nsoilmx,nqmx, 644 . dtphys,float(day0),time,tsurf, 645 . tsoil,co2ice,emis,q2,qsurf,area,albedodat, 646 . inertiedat,zmea,zstd,zsig,zgam,zthe) 643 call physdem0("startfi.nc",long,lati,nsoilmx,nqmx, 644 . dtphys,float(day0),time,area, 645 . albedodat,inertiedat,zmea,zstd,zsig,zgam,zthe) 646 call physdem1("startfi.nc",nsoilmx,nqmx, 647 . dtphys,time, 648 . tsurf,tsoil,co2ice,emis,q2,qsurf) 647 649 648 650 c=======================================================================
Note: See TracChangeset
for help on using the changeset viewer.