From 6d31e5da64a7c964262fa6103ed196e5343687cf Mon Sep 17 00:00:00 2001 From: Nicholas Szapiro <149816583+NickSzapiro-NOAA@users.noreply.github.com> Date: Wed, 17 Apr 2024 19:20:16 -0400 Subject: [PATCH 01/11] Remove #ifdef CESMCOUPLED from cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 --- cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 b/cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 index 483048051..d03eeed18 100644 --- a/cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 +++ b/cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 @@ -191,14 +191,12 @@ subroutine ice_step call init_history_bgc call ice_timer_stop(timer_diags) ! diagnostics/history -#ifdef CESMCOUPLED if (prescribed_ice) then ! read prescribed ice call t_barrierf('cice_run_presc_BARRIER',MPI_COMM_ICE) call t_startf ('cice_run_presc') call ice_prescribed_run(idate, msec) call t_stopf ('cice_run_presc') endif -#endif call step_prep From 95c2a5317b0503aa3e570154fae1903d3bc51c2b Mon Sep 17 00:00:00 2001 From: Nicholas Szapiro <149816583+NickSzapiro-NOAA@users.noreply.github.com> Date: Wed, 17 Apr 2024 19:23:04 -0400 Subject: [PATCH 02/11] Remove #ifdef CESMCOUPLED from cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 --- .../nuopc/cmeps/ice_prescribed_mod.F90 | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 index b46f22ff7..b16f7cb9b 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 @@ -10,25 +10,6 @@ module ice_prescribed_mod use ESMF, only : 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 @@ -489,6 +470,4 @@ subroutine ice_prescribed_phys() end subroutine ice_prescribed_phys -#endif - end module ice_prescribed_mod From cc85eaa90a4451981ddb91dbd7baccf2180c7c1d Mon Sep 17 00:00:00 2001 From: Nick Szapiro Date: Fri, 19 Apr 2024 18:10:21 +0000 Subject: [PATCH 03/11] Testing changing stream_taxmode from cycle to extend --- cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 index b16f7cb9b..906d2af12 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 @@ -176,7 +176,7 @@ subroutine ice_prescribed_init(clock, mesh, rc) stream_yearLast = stream_yearLast, & stream_yearAlign = stream_yearAlign , & stream_offset = 0, & - stream_taxmode = 'cycle', & + stream_taxmode = 'extend', & stream_dtlimit = 1.5_dbl_kind, & stream_tintalgo = 'linear', & rc = rc) From 116fc5b4f65325342c421326bb45c2b1c98b0dbe Mon Sep 17 00:00:00 2001 From: Nicholas Szapiro <149816583+NickSzapiro-NOAA@users.noreply.github.com> Date: Mon, 22 Apr 2024 03:23:19 -0400 Subject: [PATCH 04/11] Change include mpif.h to use mpi in ice_prescribed_mod.F90 --- cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 index 906d2af12..e07622b48 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 @@ -59,7 +59,10 @@ subroutine ice_prescribed_init(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_Clock) , intent(in) :: clock From eaec8c1d02d372279892b7071eb2364fc9b423ed Mon Sep 17 00:00:00 2001 From: Nick Szapiro Date: Thu, 25 Apr 2024 21:34:56 +0000 Subject: [PATCH 05/11] Call dshr_pio_init from ice_prescribed_init --- cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 | 2 +- cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 index efadabbda..60fab3bf0 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 @@ -870,7 +870,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Prescribed ice initialization !----------------------------------------------------------------- - call ice_prescribed_init(clock, ice_mesh, rc) + call ice_prescribed_init(gcomp, clock, ice_mesh, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return #ifdef CESMCOUPLED diff --git a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 index e07622b48..b95ca6299 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 @@ -7,7 +7,7 @@ module ice_prescribed_mod ! Ice/ocean fluxes are set to zero, and ice dynamics are not calculated. ! Regridding and data cycling capabilities are included. - 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 use ice_kinds_mod @@ -15,6 +15,7 @@ module ice_prescribed_mod 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 use ice_broadcast use ice_communicate , only : my_task, master_task, MPI_COMM_ICE use ice_fileunits @@ -55,7 +56,7 @@ module ice_prescribed_mod contains !=============================================================================== - subroutine ice_prescribed_init(clock, mesh, rc) + subroutine ice_prescribed_init(gcomp, clock, mesh, rc) ! Prescribed ice initialization @@ -65,6 +66,7 @@ subroutine ice_prescribed_init(clock, mesh, rc) #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 @@ -162,6 +164,10 @@ subroutine ice_prescribed_init(clock, mesh, rc) write(nu_diag,*) ' ' endif +#ifndef CESMCOUPLED + call dshr_pio_init(gcomp, sdat, nu_diag, rc) +#endif + ! initialize sdat call shr_strdata_init_from_inline(sdat, & my_task = my_task, & From eee289ac34efe1cbdc7dd489e5c327e4db411734 Mon Sep 17 00:00:00 2001 From: Nick Szapiro Date: Sat, 27 Apr 2024 05:07:16 +0000 Subject: [PATCH 06/11] Call ice_prescribed_run after ice_prescribed_init --- cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 index b95ca6299..9a3479397 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 @@ -25,7 +25,7 @@ module ice_prescribed_mod 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 @@ -201,6 +201,10 @@ subroutine ice_prescribed_init(gcomp, 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 end if ! end of if prescribed ice mode end subroutine ice_prescribed_init From 446bc5c5bfd1c8b68799881d9a52243a5f5bd288 Mon Sep 17 00:00:00 2001 From: Nicholas Szapiro <149816583+NickSzapiro-NOAA@users.noreply.github.com> Date: Thu, 2 May 2024 15:12:15 -0400 Subject: [PATCH 07/11] Incorporate ice_prescribed_nml in ice_prescribed_mod.F90 --- cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 index 9a3479397..45f607128 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 @@ -79,6 +79,7 @@ subroutine ice_prescribed_init(gcomp, 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 @@ -96,6 +97,7 @@ subroutine ice_prescribed_init(gcomp, clock, mesh, rc) stream_varname , & stream_datafiles, & stream_mapalgo, & + stream_taxmode, & stream_yearalign, & stream_yearfirst , & stream_yearlast @@ -111,6 +113,7 @@ subroutine ice_prescribed_init(gcomp, clock, mesh, rc) stream_meshfile = ' ' stream_datafiles(:) = ' ' stream_mapalgo = 'bilinear' + stream_mapalgo = 'cycle' ! read namelist on master task if (my_task == master_task) then @@ -141,6 +144,7 @@ subroutine ice_prescribed_init(gcomp, 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) @@ -179,13 +183,13 @@ subroutine ice_prescribed_init(gcomp, 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 = 'extend', & + stream_taxmode = trim(stream_taxmode), & stream_dtlimit = 1.5_dbl_kind, & stream_tintalgo = 'linear', & rc = rc) From 444b1a36d349260006a0cd3f37a94b8adc234eb0 Mon Sep 17 00:00:00 2001 From: Nicholas Szapiro <149816583+NickSzapiro-NOAA@users.noreply.github.com> Date: Thu, 2 May 2024 15:15:54 -0400 Subject: [PATCH 08/11] write stream_taxmode to log. typo in ice_prescribed_mod.F90. --- cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 index 45f607128..5d50a65b4 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 @@ -113,7 +113,7 @@ subroutine ice_prescribed_init(gcomp, clock, mesh, rc) stream_meshfile = ' ' stream_datafiles(:) = ' ' stream_mapalgo = 'bilinear' - stream_mapalgo = 'cycle' + stream_taxmode = 'cycle' ! read namelist on master task if (my_task == master_task) then @@ -162,6 +162,7 @@ subroutine ice_prescribed_init(gcomp, 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 From 4132d493d311eb53330cedbb8161022bbec65a43 Mon Sep 17 00:00:00 2001 From: Nick Szapiro Date: Tue, 14 May 2024 01:46:13 +0000 Subject: [PATCH 09/11] Remove CESMCOUPLED so models initialize ice_prescribed at end of ice_prescribed_init --- cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 index 5d50a65b4..d33e5f44b 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 @@ -170,6 +170,7 @@ subroutine ice_prescribed_init(gcomp, clock, mesh, rc) endif #ifndef CESMCOUPLED + !CESM does this elsewhere call dshr_pio_init(gcomp, sdat, nu_diag, rc) #endif @@ -206,10 +207,9 @@ subroutine ice_prescribed_init(gcomp, 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 + end if ! end of if prescribed ice mode end subroutine ice_prescribed_init From 180f60fd5c9f76d5656a68f8d478f0155f0dc695 Mon Sep 17 00:00:00 2001 From: Nick Szapiro Date: Thu, 16 May 2024 20:49:19 +0000 Subject: [PATCH 10/11] Change indent for #ifndef for gnu debug --- cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 index d33e5f44b..7461f2609 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 @@ -60,10 +60,10 @@ subroutine ice_prescribed_init(gcomp, clock, mesh, rc) ! Prescribed ice initialization - #ifndef SERIAL_REMOVE_MPI +#ifndef SERIAL_REMOVE_MPI !TODO: add 1d character array to cicecore/cicedyn/infrastructure/comm/mpi/ice_broadcast.F90 use mpi ! MPI Fortran module - #endif +#endif ! input/output parameters type(ESMF_GridComp) , intent(in) :: gcomp From a7a379a75f46f1400dfe7e8cd601e6b22f7bb839 Mon Sep 17 00:00:00 2001 From: Nicholas Szapiro <149816583+NickSzapiro-NOAA@users.noreply.github.com> Date: Wed, 29 May 2024 19:08:11 -0400 Subject: [PATCH 11/11] Only call ice_prescribed_run in ice_prescribed_init #ifndef CESMCOUPLED --- cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 index 7461f2609..5a2ec4bb2 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 @@ -207,8 +207,10 @@ subroutine ice_prescribed_init(gcomp, 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 end if ! end of if prescribed ice mode