-
Notifications
You must be signed in to change notification settings - Fork 155
This adds additional write restart at end of run functionality. #984
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
Changes from 4 commits
56dc381
11da279
b8232d7
6d8c7f6
a0d1a92
6074f27
1cf1268
3a77e79
e0b59fc
66b4bbf
f7552bc
8710a3a
67f96fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,9 @@ module ice_restart | |
| use ice_communicate, only: my_task, master_task | ||
| use ice_exit, only: abort_ice | ||
| use ice_fileunits, only: nu_diag, nu_restart, nu_rst_pointer | ||
| #ifdef CESMCOUPLED | ||
| use ice_fileunits, only: inst_suffix | ||
| #endif | ||
| use ice_kinds_mod | ||
| use ice_restart_shared | ||
| use ice_pio | ||
|
|
@@ -46,7 +49,6 @@ subroutine init_restart_read(ice_ic) | |
| mday, msec, npt | ||
| use ice_domain_size, only: ncat | ||
| use ice_read_write, only: ice_open | ||
|
|
||
| character(len=char_len_long), intent(in), optional :: ice_ic | ||
|
|
||
| ! local variables | ||
|
|
@@ -57,13 +59,19 @@ subroutine init_restart_read(ice_ic) | |
| integer (kind=int_kind) :: status | ||
|
|
||
| logical (kind=log_kind), save :: first_call = .true. | ||
|
|
||
| logical :: exist | ||
| character(len=*), parameter :: subname = '(init_restart_read)' | ||
|
|
||
| if (present(ice_ic)) then | ||
| filename = trim(ice_ic) | ||
| else | ||
| if (my_task == master_task) then | ||
| #ifdef CESMCOUPLED | ||
| write(pointer_file,'(a,i4.4,a,i2.2,a,i2.2,a,i5.5)') & | ||
| 'rpointer.ice'//trim(inst_suffix)//'.',myear,'-',mmonth,'-',mday,'-',msec | ||
|
dabail10 marked this conversation as resolved.
Outdated
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this duplicate https://github.com/ESCOMP/CICE/blob/6d8c7f68c2ef80da9973f27c0077e54018bdbbfe/cicecore/cicedyn/general/ice_init.F90#L1202
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. That adds the inst_suffix which allows for single executable ensembles. This adds a date stamp.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In ice_init it uses
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think either:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, our thought here is to add lpointer_file for the purposes of the multiple instances. When not in CESM: lpointer_file = pointer_file Does this work?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just this ?: The inst_suffix was already added in ice_init
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because that ends up repeating the timestamp if you are starting from a restart.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh got it - thanks both, adding lpointer_file sounds good. |
||
| inquire(file=pointer_file, exist=exist) | ||
| if (.not. exist) pointer_file = 'rpointer.ice'//trim(inst_suffix) | ||
| #endif | ||
| open(nu_rst_pointer,file=pointer_file) | ||
| read(nu_rst_pointer,'(a)') filename0 | ||
| filename = trim(filename0) | ||
|
|
@@ -220,6 +228,10 @@ subroutine init_restart_write(filename_spec) | |
|
|
||
| ! write pointer (path/file) | ||
| if (my_task == master_task) then | ||
| #ifdef CESMCOUPLED | ||
| write(pointer_file,'(a,i4.4,a,i2.2,a,i2.2,a,i5.5)') & | ||
| 'rpointer.ice'//trim(inst_suffix)//'.',myear,'-',mmonth,'-',mday,'-',msec | ||
| #endif | ||
| open(nu_rst_pointer,file=pointer_file) | ||
| write(nu_rst_pointer,'(a)') filename | ||
| close(nu_rst_pointer) | ||
|
|
@@ -740,7 +752,6 @@ subroutine read_restart_field(nu,nrec,work,atype,vname,ndim3,diag, & | |
|
|
||
| call ice_pio_check(pio_inq_varndims(File, vardesc, ndims), & | ||
| subname// " ERROR: missing varndims "//trim(vname),file=__FILE__,line=__LINE__) | ||
|
|
||
| call pio_seterrorhandling(File, PIO_INTERNAL_ERROR) | ||
|
|
||
| if (ndim3 == ncat .and. ndims == 3) then | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -684,8 +684,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) | |
| if(mastertask) write(nu_diag,*) trim(subname)//'WARNING: pio_typename from driver needs to be set for netcdf output to work' | ||
| end if | ||
|
|
||
|
|
||
|
|
||
| #else | ||
|
|
||
| ! Read the cice namelist as part of the call to cice_init1 | ||
|
|
@@ -1331,51 +1329,51 @@ subroutine ModelSetRunClock(gcomp, rc) | |
| call ESMF_LogWrite(subname//'setting alarms for ' // trim(name), ESMF_LOGMSG_INFO) | ||
|
|
||
| !---------------- | ||
| ! Restart alarm | ||
| ! Stop alarm | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No - the reason they are reordered is so that a REST_OPTION=end can be initialized using the stop alarm. If you do the rest alarm first you can not initialize this option.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See line 927 of ice_shr_methods.F90 |
||
| !---------------- | ||
| call NUOPC_CompAttributeGet(gcomp, name="restart_option", value=restart_option, rc=rc) | ||
| call NUOPC_CompAttributeGet(gcomp, name="stop_option", value=stop_option, rc=rc) | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
|
|
||
| call NUOPC_CompAttributeGet(gcomp, name="restart_n", value=cvalue, rc=rc) | ||
| call NUOPC_CompAttributeGet(gcomp, name="stop_n", value=cvalue, rc=rc) | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
| read(cvalue,*) restart_n | ||
| read(cvalue,*) stop_n | ||
|
|
||
| call NUOPC_CompAttributeGet(gcomp, name="restart_ymd", value=cvalue, rc=rc) | ||
| call NUOPC_CompAttributeGet(gcomp, name="stop_ymd", value=cvalue, rc=rc) | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
| read(cvalue,*) restart_ymd | ||
| read(cvalue,*) stop_ymd | ||
|
|
||
| call alarmInit(mclock, restart_alarm, restart_option, & | ||
| opt_n = restart_n, & | ||
| opt_ymd = restart_ymd, & | ||
| call alarmInit(mclock, stop_alarm, stop_option, & | ||
| opt_n = stop_n, & | ||
| opt_ymd = stop_ymd, & | ||
| RefTime = mcurrTime, & | ||
| alarmname = 'alarm_restart', rc=rc) | ||
| alarmname = 'alarm_stop', rc=rc) | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
|
|
||
| call ESMF_AlarmSet(restart_alarm, clock=mclock, rc=rc) | ||
| call ESMF_AlarmSet(stop_alarm, clock=mclock, rc=rc) | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
|
|
||
| !---------------- | ||
| ! Stop alarm | ||
| ! Restart alarm | ||
| !---------------- | ||
| call NUOPC_CompAttributeGet(gcomp, name="stop_option", value=stop_option, rc=rc) | ||
| call NUOPC_CompAttributeGet(gcomp, name="restart_option", value=restart_option, rc=rc) | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
|
|
||
| call NUOPC_CompAttributeGet(gcomp, name="stop_n", value=cvalue, rc=rc) | ||
| call NUOPC_CompAttributeGet(gcomp, name="restart_n", value=cvalue, rc=rc) | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
| read(cvalue,*) stop_n | ||
| read(cvalue,*) restart_n | ||
|
|
||
| call NUOPC_CompAttributeGet(gcomp, name="stop_ymd", value=cvalue, rc=rc) | ||
| call NUOPC_CompAttributeGet(gcomp, name="restart_ymd", value=cvalue, rc=rc) | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
| read(cvalue,*) stop_ymd | ||
| read(cvalue,*) restart_ymd | ||
|
|
||
| call alarmInit(mclock, stop_alarm, stop_option, & | ||
| opt_n = stop_n, & | ||
| opt_ymd = stop_ymd, & | ||
| call alarmInit(mclock, restart_alarm, restart_option, & | ||
| opt_n = restart_n, & | ||
| opt_ymd = restart_ymd, & | ||
| RefTime = mcurrTime, & | ||
| alarmname = 'alarm_stop', rc=rc) | ||
| alarmname = 'alarm_restart', rc=rc) | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
|
|
||
| call ESMF_AlarmSet(stop_alarm, clock=mclock, rc=rc) | ||
| call ESMF_AlarmSet(restart_alarm, clock=mclock, rc=rc) | ||
| if (ChkErr(rc,__LINE__,u_FILE_u)) return | ||
|
|
||
| end if | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.