Changeset 1710


Ignore:
Timestamp:
May 18, 2017, 2:45:16 PM (8 years ago)
Author:
aslmd
Message:

corrected starting day bug. either no startfi.nc then starting day is read in *.def; or there is a startfi and starting day is read in startfi. AS+EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ICOSA_LMDZ/src/phystd/interface_icosa_lmdz.f90

    r1698 r1710  
    197197  USE inifis_mod, ONLY : inifis
    198198!  USE phyaqua_mod, ONLY : iniaqua
    199    
     199 
     200  USE netcdf 
    200201 
    201202  IMPLICIT NONE
     
    239240  INTEGER :: iflag_phys   
    240241  INTEGER :: nq
     242
     243  !! to get starting date
     244  !! --------------------
     245  logical :: startphy_file
     246  ! NetCDF stuff
     247  integer :: status ! NetCDF return code
     248  integer :: ncid ! NetCDF file ID
     249  integer :: varid ! NetCDF variable ID
     250  real :: tab_cntrl(100)
    241251
    242252    CALL init_distrib_icosa_lmdz
     
    339349!    CALL inifis(klon_omp,nlayer,nqtot,pdayref,punjours,nday,ptimestep, &
    340350!            latitude,longitude,cell_area,prad,pg,pr,pcpp)
    341     start_day=0
    342     CALL getin('start_day',start_day)
     351!$OMP MASTER
     352
     353    startphy_file=.true.
     354    CALL getin('startphy_file',startphy_file)
     355
     356    IF (startphy_file) THEN
     357
     358      status=nf90_open('startfi.nc',NF90_NOWRITE,ncid)
     359      if (status.ne.nf90_noerr) then
     360        write(*,*)"Failed to open startfi.nc"
     361        write(*,*)trim(nf90_strerror(status))
     362        stop
     363      endif
     364
     365      status=nf90_inq_varid(ncid,"controle",varid)
     366      if (status.ne.nf90_noerr) then
     367        write(*,*)"Failed to find controle variable"
     368        write(*,*)trim(nf90_strerror(status))
     369        stop
     370      endif
     371
     372      status=nf90_get_var(ncid,varid,tab_cntrl)
     373      start_day=tab_cntrl(3)
     374      print*,"start_day YORGL",start_day
     375      status=nf90_close(ncid)
     376
     377    ELSE
     378
     379      start_day=0
     380      CALL getin('start_day',start_day)
     381
     382    ENDIF
     383
    343384    day_length=86400
    344385    CALL getin('day_length',day_length)
     386    year_length = 31557600 ! 365.25 * 86400
     387    CALL getin('year_length',year_length)
    345388    ndays=nint(itaumax*(dt/day_length))! number of days to run
    346389    physics_timestep=dt*itau_physics
     390!$OMP END MASTER
     391!$OMP BARRIER
    347392    CALL inifis(klon_omp,llm,nqtot,start_day,day_length,ndays,physics_timestep, &
    348393            latfi,lonfi,airefi,radius,g,kappa*cpp,cpp)
     
    373418    ! Initialize "calendar"
    374419!$OMP MASTER
    375     day_length=86400
    376     CALL getin('day_length',day_length)
    377     year_length = 31557600 ! 365.25 * 86400
    378     CALL getin('year_length',year_length)
    379     start_day = 0
    380     CALL getin('start_day',start_day)
    381420    ! initialize pday and ptime
    382421    pday = start_day
Note: See TracChangeset for help on using the changeset viewer.