Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flexible restart file update breaks IAU in DA #785

Closed
jswhit opened this issue Sep 2, 2021 · 20 comments · Fixed by #782
Closed

flexible restart file update breaks IAU in DA #785

jswhit opened this issue Sep 2, 2021 · 20 comments · Fixed by #782
Labels
bug Something isn't working

Comments

@jswhit
Copy link
Contributor

jswhit commented Sep 2, 2021

PR #691 adds the iau_offset to the restart_interval specified in model_configure to determine when restarts are dumped. Currently the DA cycle uses iau_offset=6 and restart_interval=6, which means that restarts will be dumped 12 hours into the forecast instead of 6. In fact, there appears to be no way to get a restart dumped 6 hours into the forecast since that would require setting restart_interval=0, which the model interprets as a restart at the end of the forecast.

Suggested fix: remove the logic that adds iau_offset to the restart time (around line 366 here)

@RussTreadon-NOAA

@jswhit jswhit added the bug Something isn't working label Sep 2, 2021
@junwang-noaa
Copy link
Collaborator

junwang-noaa commented Sep 2, 2021 via email

@junwang-noaa
Copy link
Collaborator

@jswhit I talked to Rahul. workflow will be updated with this model change, basically the restart interval for DA will be unified to "3,6" with or without IAU. Please let me know if you still have issues.

@jswhit
Copy link
Contributor Author

jswhit commented Sep 2, 2021

@junwang-noaa @aerorahul I don't think that will work - I think you need 0,3 not 3,6 (since iau_offset=6 is added)? Testing now..

@jswhit
Copy link
Contributor Author

jswhit commented Sep 2, 2021

Don't think the logic for restart frequency works with nonzero iau_offset. If I specify "3,-1" with iauoffset=6 and nhours_fcst=15 (for a forecast that whose initial time is 3 hours before the current start time) I get frestart=9 and a restart is not written until 9 hours into the forecast (fhour 12) instead of 3 hours in (fhour=6).

@aerorahul
Copy link
Contributor

aerorahul commented Sep 2, 2021

@jswhit
Should the iau_offset be 3, since it is an offset from the "analysis time" (middle of the 6 hour window)?
I am not sure if that is what iau_offset is supposed to mean.

Per the conversation with @junwang-noaa this AM, the restart_interval is now relative to the "analysis time", and thus restart_interval=3 would produce the restarts at 3 hours past the analysis time, which is the beginning of the next assimilation window.

The restart_interval in this case refers to the explicit time (relative to the "analysis time") at which the restarts will be written out.

@jswhit
Copy link
Contributor Author

jswhit commented Sep 2, 2021

@aerorahul the forecast start time is the previous nominal analysis time, and the initial time is at the beginning of the assim window (so 3 hours into the forecast). The nominal analysis time is 6 hours into the forecast, so iau_offset=6 so that a fh=0 history file is dumped at that time.

@jswhit
Copy link
Contributor Author

jswhit commented Sep 2, 2021

setting restart_interval=3 does not produce a restart at the nominal analysis time, since iau_offset is added you get a restart at the next analysis time (the middle of the next assimilation window). What we want is a restart at the end of the current assimilation window (which would appear to require restart_interval=-3)

@jswhit
Copy link
Contributor Author

jswhit commented Sep 2, 2021

Setting restart_interval="0,3" does not work either - you end up with a restart at the end of the forecast only (the end of the next assimilation window). With the current logic there does not appear to be any way to dump a restart 6 hours into the forecast (at fhour=9) with iau_offset=6.

@junwang-noaa
Copy link
Collaborator

junwang-noaa commented Sep 2, 2021 via email

@jswhit
Copy link
Contributor Author

jswhit commented Sep 2, 2021

Yes, we need restart files regardless of whether we are using IAU (at 6 hours into the forecast for both IAU and no-IAU). For the no-IAU case this should produce a restart at the nominal analysis time for the next analysis window, for the IAU case it should produce a restart at the beginning of the next analysis window (nominal analysis time - 3h).

I think the fundamental problem is that FMS writes the restarts, and it does not know anything about the iau_offset. The iau_offset logic is only applied to the history files, so that F00 is at the nominal analysis time. I have created a patch that removes iau_offset from the frestart logic and things seem to be working again. I can create a PR if need be.

@junwang-noaa
Copy link
Collaborator

junwang-noaa commented Sep 3, 2021 via email

@junwang-noaa
Copy link
Collaborator

junwang-noaa commented Sep 3, 2021 via email

@jswhit
Copy link
Contributor Author

jswhit commented Sep 3, 2021

@junwang-noaa I don't think the change to the restart_interval logic achieves what you want to achieve. For the history files, the iau_offset is applied to the time since the original start time of the forecast, so iau_offset=6 causes F09 to become F03 For the restart times, you are applying iau_offset to the time since the initialization of the current forecast, so with iau_offset=6 and restart_interval=3, the first restart is written 9 hours into the forecast (instead of 6).

@junwang-noaa
Copy link
Collaborator

junwang-noaa commented Sep 3, 2021

@jswhit To clearify, with iau_offset=6 and restart_interval=3, the restart is written after 6 hour integration. Please see:
/scratch1/NCEPDEV/stmp2/Jun.Wang/FV3_RT/rt_152668/control_c384gdastest1/RESTART

The time stamps for restart files are saved in coupler$RESTART_WRITTEN_TIME.res, with model initialization time (which is previous cycle time) and current model time when restart is written. It does not know if it is an IAU run or not. With the code changes I proposed, we can still use restart frequency feature for long forecast IAU runs. E.g. set restart_interval: 24 -1 (second element -1 means frequency) to write out restart files every 24 hours relative to current cycle time. This feature was broken with previous coding for IAU.

@jswhit
Copy link
Contributor Author

jswhit commented Sep 3, 2021

@junwang-noaa Here's what I am seeing that is problematic for the GDAS with IAU. I have a coupler.res with this:

    2        (Calendar: no_calendar=0, thirty_day_months=1, julian=2, gregorian=3, noleap=4)
  2015  12  05  18     0     0        Model start time:   year, month, day, hour, minute, second
  2015  12  05  21     0     0        Current model time: year, month, day, hour, minute, second

and model_configure with this

start_year:              2015
start_month:             12
start_day:               05
start_hour:              18
start_minute:            0
start_second:            0
nhours_fcst:             15
restart_interval:        3 -1
iau_offset :                6

The nominal analysis time is 2015120600 and I need to dump a restart at 2015120600 and 2015120603 (3 and 6 hours into the integration, where history file will be labelled f000 and f006). However, I end up with

frestart= 9 12 15 0 0

and the model dumps a restart at 2015120606.


ls -l RESTART/*fv_core*tile1*

-rw-r--r-- 1 Jeffrey.S.Whitaker esrl 684110455 Sep  3 15:32 RESTART/20151206.060000.fv_core.res.tile1.nc
-rw-r--r-- 1 Jeffrey.S.Whitaker esrl 684343647 Sep  3 15:42 RESTART/fv_core.res.tile1.nc

This is the problem I'm having and the only solution I have found is to revert your changes to how frestart is calculated.

Seems like frestart is hours relative to the current time at the start of the forecast, not hours relative to the initial forecast start time.

@junwang-noaa
Copy link
Collaborator

junwang-noaa commented Sep 4, 2021

@jswhit Sorry, I fotgot to mention, as you noticed there are some issues with IAU restart in current develop branch. I made an fv3 PR380, and the runs I made are with the fix. In this PR frestart is the forecast time relative to the model start time, meanwhile:

  1. restart_interval: 0 will write out restart at the end of forecast, as before
  2. restart_interval: 0 -1 will write out restart at forecast hour 0 relative to current cycle (3 hour into integration) only,
  3. restart_interval: 3 -1 will write out restart at forecast hour 3, 6, 9 relative to current cycle.
    e.g. with the test run:
start_year:              2021
start_month:             03
start_day:               21
start_hour:              18
start_minute:            0
start_second:            0
nhours_fcst:             15
fhrot:                   3

dt_atmos:                225
calendar:                'julian'
restart_interval:        3 -1

frestart=           9          12          15           0           0 

20210322.030000.coupler.res  20210322.060000.coupler.res  coupler.res

4) restart_interval: 0 3 will write out the restart at forecast hour 0 and 3 relative to current cycle time. 
5) When forecast length is set to 48, restart_interval: 24 -1 will write out restart at fh=24 and 48 relative to current cycle.

@jswhit
Copy link
Contributor Author

jswhit commented Sep 5, 2021

Thank you @junwang-noaa - I can confirm that your PR works as advertised. This should solve all the problems I was having with restarts and iau_offeset.

@junwang-noaa
Copy link
Collaborator

Thanks for the conformation. We plan to commit this PR next week, will let you know when it is done.

@junwang-noaa
Copy link
Collaborator

@jswhit @KateFriedman-NOAA The restart_interval fix for IAU is committed in PR#782

@KateFriedman-NOAA
Copy link

@junwang-noaa Awesome, thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants