Opened 5 years ago
Last modified 2 years ago
#550 assigned defect
stomate_cforcing wrong timestep calculation (gregorian calendar)
Reported by: | ajornet | Owned by: | bguenet |
---|---|---|---|
Priority: | major | Milestone: | Not scheduled yet |
Component: | Biogeochemical processes | Version: | trunc |
Keywords: | days_since_beg one_year gegorian | Cc: |
Description
The calculation of the timestep (iatt) for the stomate_Cforcing file is sometimes not correct when using the gregorian calendar.
In stomate.f90:
! ::nbyear Number of years saved for carbon spinup sf_time = MODULO(REAL(days_since_beg,r_std)-1,one_year*REAL(nbyear,r_std)) iatt=FLOOR(sf_time/dt_forcesoil) + 1
days_since_beg is a variable that counts the total number of days ran in an experiment. The value is passed throughout the stomate_restart files. So it accumulates the days between multiple simulations.
Given the example:
From 1979 to 2048 (also included) there are 25568 days (gregorian!). The very last day of 2048 (leap) is calculated as:
sf_time = MODULO((25568 - 1) , (365.2425 * 1)) = int(0.02499) = 0 iatt=floor(0/dt_forcesoil) + 1 = 0 + 1 = 1 -> timestep
Data will be placed at the 1st timestep of the output stomate_Cforcing.nc file. That's not correct, it should be placed at the very last time step. Afterwards, it will reinitialize value to zero for the data to place in the stomate_Cforcing file:
IF ((iatt<iatt_old) .and. (.not. cumul_Cforcing)) THEN nforce(:)=0 soilcarbon_input(:,:,:,:) = zero control_moist(:,:,:) = zero
So forcesoil won't properly work due to zero's timesteps.
I attach a couple of Python scripts to simulate days_since_beg across multiple years. It also calculates the timestep at the end of the year when FORCESOIL_STEP_PER_YEAR=12. Check below the output:
current year, leap, days since beg= 1979 False 365 ite years, leftover days, timestep= 0 364 12.0 ... ... ... current year, leap, days since beg= 2046 False 24837 ite years, leftover days, timestep= 67 364 12.0 current year, leap, days since beg= 2047 False 25202 ite years, leftover days, timestep= 68 364 12.0 current year, leap, days since beg= 2048 True 25568 ite years, leftover days, timestep= 70 0 1.0 ---> wrong timestep
The method to calculate the current day of the year is not sufficient when using a Gregorian calendar.
Attachments (2)
Change History (5)
Changed 5 years ago by ajornet
Changed 5 years ago by ajornet
comment:1 Changed 5 years ago by ajornet
comment:2 Changed 3 years ago by luyssaert
- Milestone changed from ORCHIDEE 4.0 to Not scheduled yet
comment:3 Changed 2 years ago by jgipsl
- Owner changed from somebody to bguenet
- Status changed from new to assigned
Proposed fix: [5849/branches/ORCHIDEE-MICT/ORCHIDEE]