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

MOM6 time #494

Closed
2 of 3 tasks
hkershaw-brown opened this issue Jun 20, 2023 · 1 comment · Fixed by #514
Closed
2 of 3 tasks

MOM6 time #494

hkershaw-brown opened this issue Jun 20, 2023 · 1 comment · Fixed by #514
Labels
mom6 Modular Ocean Model

Comments

@hkershaw-brown
Copy link
Member

hkershaw-brown commented Jun 20, 2023

The default in CESM is to run with no leap year.
For assimilating with real obs, we need to use the actual time.

Todos:

  • DART MOM6 documentation, be explicit about the need to set the calendar in CESM.
    ./xmlchange CALENDAR=GREGORIAN

Note on what happens if you don't set CALENDAR=GREGORIAN
mom6 restart file has time in days from year 1.
Starting the run at 2015-02-01:

./xmlchange RUN_STARTDATE=2015-02-01
double Time(Time) ;
                Time:long_name = "Time" ;
                Time:units = "days" ;
                Time:axis = "T" ;
...
// global attributes:
		:filename = "./c.T62_g16.Alper.ens3.mom6.r.2015-02-11-00000._0001.nc" ;
data:

 Time = 735151 ;
}

If you don't have leap years switched on you end up with inconstant time information like this:
Restart filename has the time 2015-02-11-00000.
The Time variable is Time = 735151, which is 2013/10/11

hkershaw@cisl-fisher utilities (main) $ git diff gregorian_time.c 
diff --git a/assimilation_code/modules/utilities/gregorian_time.c b/assimilation_code/modules/utilities/gregorian_time.c
index ee6a72f03..e8fccb87d 100644
--- a/assimilation_code/modules/utilities/gregorian_time.c
+++ b/assimilation_code/modules/utilities/gregorian_time.c
@@ -20,7 +20,7 @@
 #include <stdlib.h>
 
 /* the start of gregorian numbered days */
-#define BASE_YEAR 1601
+#define BASE_YEAR 1
 
 enum todo { TO_YMD, TO_DS };
 enum err  { ERROR, OK };
hkershaw@cisl-fisher utilities (main) $ icc gregorian_time.c ; ./a.out  735151 0
735151     0 == 2013/10/11 00:00:00

  • Convert MOM6 time to DART time for read_model_time
    read_model_time is used for the move_ahead calculation. MOM6 Model time is days from year 1. This needs to be DART time (days from 1601) since that is what the observation times are.

subroutine move_ahead(ens_handle, ens_size, seq, last_key_used, window_time, &
key_bounds, num_obs_in_set, curr_ens_time, next_ens_time)
! Based on the current ens time and the time of the next available
! observation, compute whether and how far the ensemble copies of the
! state need to be advanced. This returns the number of obs in the
! next assimilation window, and both the current and expected next data
! times. It NO LONGER advances the model - the calling code must call
! advance_state() itself in order to do that if next time is /= curr time.

Note the model_time for the whole ensemble is from the first ensemble member only:

! read time from input file if time not set in namelist
!>@todo Check time constistency across files? This is assuming they are consistent.
if(use_time_from_file) then
model_time = read_model_time(get_restart_filename(restart_files, 1, 1)) ! Any of the restarts?
endif

  • write_model_time, is used for dart created files: inflation, mean. Should this be MOM6 time (days from year 1) to be consistent with the model restarts? Or DART time (days from 1601) to be consistent with the observations?
@hkershaw-brown hkershaw-brown added the mom6 Modular Ocean Model label Jun 20, 2023
hkershaw-brown added a commit that referenced this issue Jun 22, 2023
see #494 for discusion.
I'm still not sure whether write_time should match the obs or the
model
@hkershaw-brown
Copy link
Member Author

Conclusion from standup July 13th 2023: write_model_time should be dart time for files created by dart.

Existing model netcdf files do not have their time overwritten by dart.

Note there is a overwrite_time_in_output_file = .false. in direct_netcdf_mod.f90 but it is hardcoded to false with this comment:

!>@todo FIXME:
!> this should be in a namelist somewhere and passed in from
!> a higher level routine.
!>
!> we had this in the ROMS branch but no one can remember why.
!> we think it's because we copied a template file into place
!> for filter to overwrite and it might not have had the right
!> analysis time in the file. it's true that filter doesn't
!> change the time in the file, but when we're doing direct
!> updates of a netcdf file it's also true that we rarely
!> update the file we read from; in case of an error you've
!> destroyed your input needed to rerun the job.
!> (but we don't remember for sure if this was the reason.)
logical :: overwrite_time_in_output_file = .false.

hkershaw-brown added a commit that referenced this issue Jul 18, 2023
see #494 for discusion.
I'm still not sure whether write_time should match the obs or the
model
@hkershaw-brown hkershaw-brown mentioned this issue Jul 18, 2023
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mom6 Modular Ocean Model
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant