-
Notifications
You must be signed in to change notification settings - Fork 139
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
Enable prescribed ice for UFS #964
Changes from all commits
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 |
---|---|---|
|
@@ -6,34 +6,20 @@ module ice_prescribed_mod | |
! prescribed. Air/ice fluxes are computed to get surface temperature, | ||
! Ice/ocean fluxes are set to zero, and ice dynamics are not calculated. | ||
! Regridding and data cycling capabilities are included. | ||
|
||
! Note (8/8/2024): This code is dependent on CDEPS (to input ice data). | ||
! In the interests of cleaner code, drivers/nuopc/cmeps now is too. | ||
! If problematic, please see https://github.com/CICE-Consortium/CICE/pull/964 for alternatives. | ||
|
||
use ESMF, only : ESMF_Clock, ESMF_Mesh, ESMF_SUCCESS, ESMF_FAILURE | ||
use ESMF, only : ESMF_GridComp, ESMF_Clock, ESMF_Mesh, ESMF_SUCCESS, ESMF_FAILURE | ||
use ESMF, only : ESMF_LogFoundError, ESMF_LOGERR_PASSTHRU, ESMF_Finalize, ESMF_END_ABORT | ||
|
||
#ifndef CESMCOUPLED | ||
|
||
use ice_kinds_mod | ||
implicit none | ||
private ! except | ||
public :: ice_prescribed_init ! initialize input data stream | ||
logical(kind=log_kind), parameter, public :: prescribed_ice = .false. ! true if prescribed ice | ||
contains | ||
! This is a stub routine for now | ||
subroutine ice_prescribed_init(clock, mesh, rc) | ||
type(ESMF_Clock) , intent(in) :: clock | ||
type(ESMF_Mesh) , intent(in) :: mesh | ||
integer , intent(out) :: rc | ||
! do nothing | ||
rc = ESMF_SUCCESS | ||
end subroutine ice_prescribed_init | ||
|
||
#else | ||
|
||
use ice_kinds_mod | ||
use shr_nl_mod , only : shr_nl_find_group_name | ||
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_print | ||
use dshr_strdata_mod , only : shr_strdata_init_from_inline, shr_strdata_advance | ||
use dshr_methods_mod , only : dshr_fldbun_getfldptr | ||
use dshr_mod , only : dshr_pio_init | ||
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. These come from the CIME shr stuff I believe. This is how we do the reading from stream files. |
||
use ice_broadcast | ||
use ice_communicate , only : my_task, master_task, MPI_COMM_ICE | ||
use ice_fileunits | ||
|
@@ -43,7 +29,7 @@ end subroutine ice_prescribed_init | |
use ice_blocks , only : nx_block, ny_block, block, get_block | ||
use ice_domain , only : nblocks, distrb_info, blocks_ice | ||
use ice_grid , only : TLAT, TLON, hm, tmask, tarea, grid_type, ocn_gridcell_frac | ||
use ice_calendar , only : idate, calendar_type | ||
use ice_calendar , only : idate, msec, calendar_type | ||
use ice_arrays_column , only : hin_max | ||
use ice_read_write | ||
use ice_exit , only: abort_ice | ||
|
@@ -74,13 +60,17 @@ end subroutine ice_prescribed_init | |
contains | ||
!=============================================================================== | ||
|
||
subroutine ice_prescribed_init(clock, mesh, rc) | ||
subroutine ice_prescribed_init(gcomp, clock, mesh, rc) | ||
|
||
! Prescribed ice initialization | ||
|
||
include 'mpif.h' | ||
#ifndef SERIAL_REMOVE_MPI | ||
!TODO: add 1d character array to cicecore/cicedyn/infrastructure/comm/mpi/ice_broadcast.F90 | ||
use mpi ! MPI Fortran module | ||
#endif | ||
|
||
! input/output parameters | ||
type(ESMF_GridComp) , intent(in) :: gcomp | ||
type(ESMF_Clock) , intent(in) :: clock | ||
type(ESMF_Mesh) , intent(in) :: mesh | ||
integer , intent(out) :: rc | ||
|
@@ -93,6 +83,7 @@ subroutine ice_prescribed_init(clock, mesh, rc) | |
character(len=char_len_long) :: stream_dataFiles(nFilesMaximum) | ||
character(len=char_len_long) :: stream_varname | ||
character(len=char_len_long) :: stream_mapalgo | ||
character(len=char_len_long) :: stream_taxmode | ||
integer(kind=int_kind) :: stream_yearfirst ! first year in stream to use | ||
integer(kind=int_kind) :: stream_yearlast ! last year in stream to use | ||
integer(kind=int_kind) :: stream_yearalign ! align stream_year_first | ||
|
@@ -110,6 +101,7 @@ subroutine ice_prescribed_init(clock, mesh, rc) | |
stream_varname , & | ||
stream_datafiles, & | ||
stream_mapalgo, & | ||
stream_taxmode, & | ||
stream_yearalign, & | ||
stream_yearfirst , & | ||
stream_yearlast | ||
|
@@ -125,6 +117,7 @@ subroutine ice_prescribed_init(clock, mesh, rc) | |
stream_meshfile = ' ' | ||
stream_datafiles(:) = ' ' | ||
stream_mapalgo = 'bilinear' | ||
stream_taxmode = 'cycle' | ||
|
||
! read namelist on master task | ||
if (my_task == master_task) then | ||
|
@@ -155,6 +148,7 @@ subroutine ice_prescribed_init(clock, mesh, rc) | |
call broadcast_scalar(stream_yearlast , master_task) | ||
call broadcast_scalar(stream_meshfile , master_task) | ||
call broadcast_scalar(stream_mapalgo , master_task) | ||
call broadcast_scalar(stream_taxmode , master_task) | ||
call broadcast_scalar(stream_varname , master_task) | ||
call mpi_bcast(stream_dataFiles, len(stream_datafiles(1))*NFilesMaximum, MPI_CHARACTER, 0, MPI_COMM_ICE, ierr) | ||
|
||
|
@@ -172,12 +166,18 @@ subroutine ice_prescribed_init(clock, mesh, rc) | |
write(nu_diag,F00) ' stream_meshfile = ',trim(stream_meshfile) | ||
write(nu_diag,F00) ' stream_varname = ',trim(stream_varname) | ||
write(nu_diag,F00) ' stream_mapalgo = ',trim(stream_mapalgo) | ||
write(nu_diag,F00) ' stream_taxmode = ',trim(stream_taxmode) | ||
do n = 1,nFile | ||
write(nu_diag,F00) ' stream_datafiles = ',trim(stream_dataFiles(n)) | ||
end do | ||
write(nu_diag,*) ' ' | ||
endif | ||
|
||
#ifndef CESMCOUPLED | ||
!CESM does this elsewhere | ||
call dshr_pio_init(gcomp, sdat, nu_diag, rc) | ||
#endif | ||
|
||
! initialize sdat | ||
call shr_strdata_init_from_inline(sdat, & | ||
my_task = my_task, & | ||
|
@@ -189,13 +189,13 @@ subroutine ice_prescribed_init(clock, mesh, rc) | |
stream_lev_dimname = 'null', & | ||
stream_mapalgo = trim(stream_mapalgo), & | ||
stream_filenames = stream_datafiles(1:nfile), & | ||
stream_fldlistFile = (/'ice_cov'/), & | ||
stream_fldListModel = (/'ice_cov'/), & | ||
stream_fldlistFile = (/trim(stream_varname)/), & | ||
stream_fldListModel = (/trim(stream_varname)/), & | ||
stream_yearFirst = stream_yearFirst, & | ||
stream_yearLast = stream_yearLast, & | ||
stream_yearAlign = stream_yearAlign , & | ||
stream_offset = 0, & | ||
stream_taxmode = 'cycle', & | ||
stream_taxmode = trim(stream_taxmode), & | ||
stream_dtlimit = 1.5_dbl_kind, & | ||
stream_tintalgo = 'linear', & | ||
rc = rc) | ||
|
@@ -211,6 +211,11 @@ subroutine ice_prescribed_init(clock, mesh, rc) | |
hin_max(1) = 999._dbl_kind | ||
end if | ||
|
||
#ifndef CESMCOUPLED | ||
! If need initial cice values for coupling | ||
call ice_prescribed_run(idate, msec) | ||
#endif | ||
Comment on lines
+214
to
+217
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. UFS needed this call ice_prescribed_run at the end of ice_prescribed_init. I don't know if it's a bug for CESM not to. Presumably, the CICE state should be initialized in init, but it may depend on the components' run sequence. We left the #ifndef CESMCOUPLED so as not to impact CESM @dabail10 |
||
|
||
end if ! end of if prescribed ice mode | ||
|
||
end subroutine ice_prescribed_init | ||
|
@@ -489,6 +494,4 @@ subroutine ice_prescribed_phys() | |
|
||
end subroutine ice_prescribed_phys | ||
|
||
#endif | ||
|
||
end module ice_prescribed_mod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should leave this section, and add a UFSCOUPLED or a NO_CDEPS FLAG .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems cleaner to admit the dependency on CDEPS. Is this ok @anton-seaice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consensus seems to be to go with the PR as currently written