Changeset 1760 for trunk


Ignore:
Timestamp:
Jul 28, 2017, 12:54:31 PM (7 years ago)
Author:
emillour
Message:

Venus and Generic GCMS:
Corrections for the XIOS calendar; it must first be defined and operations
(e.g. definition of start_date) must come afterwards.
Note that for the Generic model where number of month/year and
number of days per month may vary from one simulation to the next, it
might be better to define the calendar via the XML file than in the code.
EM

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/phystd/xios_output_mod.F90

    r1682 r1760  
    101101!$OMP MASTER
    102102    ! 3. Declare calendar and time step
    103     if (prt_level>=10) write(lunout,*) "initialize_xios_output: build calendar"
     103    if (prt_level>=10) then
     104     write(lunout,*) "initialize_xios_output: build calendar"
     105    endif
    104106    timestep%second=dtphys
    105     ! time origin of the simulation (default: 1st year/1st month/1st day, Ls=0)
    106     time_origin=xios_date(1,1,1,0,0,0)
    107     ! start date of the simulation (i.e time elapsed since last Ls=0)
    108     start_date=xios_date(1,1,1,0,0,nint((day+timeofday)*daysec))
     107    if (nint(dtphys).ne.dtphys) then
     108      write(*,*) "initialize_xios_output: warning physics timestep is not an integer!"
     109    endif
     110    if (nint(daysec).ne.daysec) then
     111      write(*,*) "initialize_xios_output: warning day length is not an integer!"
     112    endif
     113    ! Important: do no operations involving dates and calendars
     114    ! before defining the calendar!
    109115    CALL xios_define_calendar(type="user_defined", &
    110116                              timestep=timestep, &
    111117                              day_length=nint(daysec), &
    112                               start_date=start_date, &
    113                               time_origin=time_origin, &
    114118                              month_lengths=[30,30,30,30,30,30,30,30,30,30,30,30])
    115    
     119    !NB: it would make more sense to define months and their length in the
     120    ! xml files and not to have them hard coded here.... to be improved...
     121   
     122    ! time origin of the simulation (default: 1st year/1st month/1st day, Ls=0)
     123    time_origin=xios_date(1,1,1,0,0,0)
     124    CALL xios_set_time_origin(time_origin=time_origin)
     125!    if (prt_level>=10) then
     126     write(lunout,*) "initialize_xios_output: time_origin=",time_origin
     127!    endif
     128
     129    ! Now define the start time of this simulation
     130    ! NB: we substract dtphys because we want to set the origin of the time axis
     131    start_date=time_origin+xios_duration(0,0,day,0,0,timeofday*daysec-dtphys)
     132    call xios_set_start_date(start_date=start_date)
     133    if (prt_level>=10) then
     134     write(lunout,*) "initialize_xios_output: start_date=",start_date
     135    endif
     136
    116137    ! 4. Finalize the context:
    117138    if (prt_level>=10) write(*,*) "initialize_xios_output: call wxios_closedef"
  • trunk/LMDZ.VENUS/libf/phyvenus/xios_output_mod.F90

    r1682 r1760  
    102102!$OMP MASTER
    103103    ! 3. Declare calendar and time step
    104     if (prt_level>=10) write(lunout,*) "initialize_xios_output: build calendar"
    105     timestep%second=dtphys
    106     ! time origin of the simulation (default: 1st year/1st month/1st day, Ls=0)
    107     time_origin=xios_date(1,1,1,0,0,0)
    108     ! start date of the simulation (i.e time elapsed since last Ls=0)
    109     start_date=xios_date(1,1,1,0,0,nint((day+timeofday)*daysec))
     104    if (prt_level>=10) then
     105     write(lunout,*) "initialize_xios_output: build calendar"
     106    endif
     107    timestep%second=nint(dtphys)
     108    if (nint(dtphys).ne.dtphys) then
     109      write(*,*) "initialize_xios_output: warning physics timestep is not an integer!"
     110    endif
     111    if (nint(daysec).ne.daysec) then
     112      write(*,*) "initialize_xios_output: warning day length is not an integer!"
     113    endif
     114    ! Important: do no operations involving dates and calendars
     115    ! before defining the calendar!
    110116    CALL xios_define_calendar(type="user_defined", &
    111117                              timestep=timestep, &
    112118                              day_length=nint(daysec), &
    113                               start_date=start_date, &
    114                               time_origin=time_origin, &
    115                               month_lengths=[2])
     119                              month_lengths=[2]) ! one month, 2 days long
     120
     121    ! time origin of the simulation (default: 1st year/1st month/1st day, Ls=0)
     122    time_origin=xios_date(1,1,1,0,0,0)
     123    CALL xios_set_time_origin(time_origin=time_origin)
     124    if (prt_level>=10) then
     125     write(lunout,*) "initialize_xios_output: time_origin=",time_origin
     126    endif
     127
     128    ! Now define the start time of this simulation
     129    ! NB: we substract dtphys because we want to set the origin of the time axis
     130    start_date=time_origin+xios_duration(0,0,day,0,0,timeofday*daysec-dtphys)
     131    call xios_set_start_date(start_date=start_date)
     132    if (prt_level>=10) then
     133     write(lunout,*) "initialize_xios_output: start_date=",start_date
     134    endif
    116135   
    117136    ! 4. Finalize the context:
Note: See TracChangeset for help on using the changeset viewer.