Skip to content

Commit

Permalink
Update to UWM hash
Browse files Browse the repository at this point in the history
  • Loading branch information
NickSzapiro-NOAA authored Sep 25, 2024
2 parents 44c5998 + 635d9a1 commit 16392f0
Show file tree
Hide file tree
Showing 27 changed files with 418 additions and 298 deletions.
2 changes: 1 addition & 1 deletion cice.setup
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ EOF
endif
# from basic script dir to case
foreach file (cice.build cice.settings Makefile ice_in makdep.c setup_run_dirs.csh timeseries.csh timeseries.py)
foreach file (cice.build cice.settings Makefile ice_in makdep.c setup_run_dirs.csh ciceplots.csh ciceplots2d.py timeseries.py)
if !(-e ${ICE_SCRIPTS}/$file) then
echo "${0}: ERROR, ${ICE_SCRIPTS}/$file not found"
exit -1
Expand Down
3 changes: 3 additions & 0 deletions cicecore/cicedyn/general/ice_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2276,6 +2276,9 @@ subroutine JRA55_files(yr)
enddo

if (.not.exists) then
write(nu_diag,*) subname,' atm_data_dir = ',trim(atm_data_dir)
write(nu_diag,*) subname,' atm_data_type_prefix = ',trim(atm_data_type_prefix)
write(nu_diag,*) subname,' atm_data_version = ',trim(atm_data_version)
call abort_ice(error_message=subname//' could not find forcing file')
endif

Expand Down
9 changes: 6 additions & 3 deletions cicecore/cicedyn/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ subroutine input_data

character (len=char_len) :: shortwave, albedo_type, conduct, fbot_xfer_type, &
tfrz_option, saltflux_option, frzpnd, atmbndy, wave_spec_type, snwredist, snw_aging_table, &
capping_method, snw_ssp_table
congel_freeze, capping_method, snw_ssp_table

logical (kind=log_kind) :: calc_Tsfc, formdrag, highfreq, calc_strair, wave_spec, &
sw_redist, calc_dragio, use_smliq_pnd, snwgrain
Expand Down Expand Up @@ -280,7 +280,7 @@ subroutine input_data
highfreq, natmiter, atmiter_conv, calc_dragio, &
ustar_min, emissivity, iceruf, iceruf_ocn, &
fbot_xfer_type, update_ocn_f, l_mpond_fresh, tfrz_option, &
saltflux_option,ice_ref_salinity,cpl_frazil, &
saltflux_option,ice_ref_salinity,cpl_frazil, congel_freeze, &
oceanmixed_ice, restore_ice, restore_ocn, trestore, &
precip_units, default_season, wave_spec_type,nfreq, &
atm_data_type, ocn_data_type, bgc_data_type, fe_data_type, &
Expand Down Expand Up @@ -537,6 +537,7 @@ subroutine input_data
atmiter_conv = c0 ! ustar convergence criteria
precip_units = 'mks' ! 'mm_per_month' or
! 'mm_per_sec' = 'mks' = kg/m^2 s
congel_freeze = 'two-step'! congelation freezing method
tfrz_option = 'mushy' ! freezing temp formulation
saltflux_option = 'constant' ! saltflux calculation
ice_ref_salinity = 4.0_dbl_kind ! Ice reference salinity for coupling
Expand Down Expand Up @@ -1127,6 +1128,7 @@ subroutine input_data
call broadcast_scalar(wave_spec_type, master_task)
call broadcast_scalar(wave_spec_file, master_task)
call broadcast_scalar(nfreq, master_task)
call broadcast_scalar(congel_freeze, master_task)
call broadcast_scalar(tfrz_option, master_task)
call broadcast_scalar(saltflux_option, master_task)
call broadcast_scalar(ice_ref_salinity, master_task)
Expand Down Expand Up @@ -2313,6 +2315,7 @@ subroutine input_data
if (trim(tfrz_option) == 'constant') then
write(nu_diag,1002) ' Tocnfrz = ', Tocnfrz
endif
write(nu_diag,1030) ' congel_freeze = ', trim(congel_freeze)
if (update_ocn_f) then
tmpstr2 = ' : frazil water/salt fluxes included in ocean fluxes'
else
Expand Down Expand Up @@ -2723,7 +2726,7 @@ subroutine input_data
aspect_rapid_mode_in=aspect_rapid_mode, dSdt_slow_mode_in=dSdt_slow_mode, &
phi_c_slow_mode_in=phi_c_slow_mode, phi_i_mushy_in=phi_i_mushy, conserv_check_in=conserv_check, &
wave_spec_type_in = wave_spec_type, wave_spec_in=wave_spec, nfreq_in=nfreq, &
update_ocn_f_in=update_ocn_f, cpl_frazil_in=cpl_frazil, &
update_ocn_f_in=update_ocn_f, cpl_frazil_in=cpl_frazil, congel_freeze_in=congel_freeze, &
tfrz_option_in=tfrz_option, kalg_in=kalg, fbot_xfer_type_in=fbot_xfer_type, &
saltflux_option_in=saltflux_option, ice_ref_salinity_in=ice_ref_salinity, &
Pstar_in=Pstar, Cstar_in=Cstar, iceruf_in=iceruf, iceruf_ocn_in=iceruf_ocn, calc_dragio_in=calc_dragio, &
Expand Down
10 changes: 8 additions & 2 deletions cicecore/cicedyn/infrastructure/io/io_pio2/ice_pio.F90
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,14 @@ subroutine ice_pio_init(mode, filename, File, clobber, fformat, &
write(nu_diag,*) subname//' opening file for reading '//trim(filename)
endif
status = pio_openfile(ice_pio_subsystem, File, pio_iotype, trim(filename), pio_nowrite)
call ice_pio_check( status, subname//' ERROR: Failed to open file '//trim(filename), &
file=__FILE__,line=__LINE__)
if (status /= PIO_NOERR) then
if (my_task == master_task) then
write(nu_diag,*) subname//' opening '//trim(filename)//' as type '//trim(fformat)//' failed, retrying as type cdf1'
endif
status = pio_openfile(ice_pio_subsystem, File, PIO_IOTYPE_NETCDF, trim(filename), pio_nowrite)
call ice_pio_check( status, subname//' ERROR: Failed to open file '//trim(filename), &
file=__FILE__,line=__LINE__)
endif
else
if(my_task==master_task) then
write(nu_diag,*) subname//' ERROR: file not found '//trim(filename)
Expand Down
7 changes: 1 addition & 6 deletions cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,8 @@ subroutine init_restart_read(ice_ic)
end if

File%fh=-1
! tcraig, including fformat here causes some problems when restart_format=hdf5
! and reading non hdf5 files with spack built PIO. Excluding the fformat
! argument here defaults the PIO format to cdf1 which then reads
! any netcdf format file fine.
call ice_pio_init(mode='read', filename=trim(filename), File=File, &
! fformat=trim(restart_format), rearr=trim(restart_rearranger), &
rearr=trim(restart_rearranger), &
fformat=trim(restart_format), rearr=trim(restart_rearranger), &
iotasks=restart_iotasks, root=restart_root, stride=restart_stride, &
debug=first_call)

Expand Down
2 changes: 0 additions & 2 deletions cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions cicecore/drivers/nuopc/cmeps/cice_wrapper_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module cice_wrapper_mod

#ifdef CESMCOUPLED
use perf_mod , only : t_startf, t_stopf, t_barrierf
use shr_file_mod , only : shr_file_getlogunit, shr_file_setlogunit
use shr_log_mod , only : shr_log_getlogunit, shr_log_setlogunit

use ice_kinds_mod , only : dbl_kind, int_kind, char_len, char_len_long

Expand Down Expand Up @@ -72,7 +72,7 @@ subroutine ufs_logfhour(msg,hour)
real(dbl_kind), intent(in) :: hour
character(len=char_len) :: filename
integer(int_kind) :: nunit
write(filename,'(a,i3.3)')'log.ice.f',int(hour)
write(filename,'(a,i4.4)')'log.ice.f',int(hour)
open(newunit=nunit,file=trim(filename))
write(nunit,'(a)')'completed: cice'
write(nunit,'(a,f10.3)')'forecast hour:',hour
Expand All @@ -82,12 +82,12 @@ end subroutine ufs_logfhour

! Define stub routines that do nothing - they are just here to avoid
! having cppdefs in the main program
subroutine shr_file_setLogUnit(nunit)
subroutine shr_log_setLogUnit(nunit)
integer, intent(in) :: nunit
end subroutine shr_file_setLogUnit
subroutine shr_file_getLogUnit(nunit)
end subroutine shr_log_setLogUnit
subroutine shr_log_getLogUnit(nunit)
integer, intent(in) :: nunit
end subroutine shr_file_getLogUnit
end subroutine shr_log_getLogUnit
subroutine t_startf(string)
character(len=*) :: string
end subroutine t_startf
Expand Down
35 changes: 27 additions & 8 deletions cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module ice_comp_nuopc
use icepack_intfc , only : icepack_init_orbit, icepack_init_parameters, icepack_query_orbit
use icepack_intfc , only : icepack_query_tracer_flags, icepack_query_parameters
use cice_wrapper_mod , only : t_startf, t_stopf, t_barrierf
use cice_wrapper_mod , only : shr_file_getlogunit, shr_file_setlogunit
use cice_wrapper_mod , only : shr_log_getlogunit, shr_log_setlogunit
use cice_wrapper_mod , only : ufs_settimer, ufs_logtimer, ufs_file_setlogunit, wtime
#ifdef CESMCOUPLED
use shr_const_mod
Expand Down Expand Up @@ -95,6 +95,7 @@ module ice_comp_nuopc
logical :: profile_memory = .false.
logical :: mastertask
logical :: runtimelog = .false.
logical :: restart_eor = .false. !End of run restart flag
integer :: start_ymd ! Start date (YYYYMMDD)
integer :: start_tod ! start time of day (s)
integer :: curr_ymd ! Current date (YYYYMMDD)
Expand Down Expand Up @@ -316,6 +317,12 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
write(logmsg,*) runtimelog
call ESMF_LogWrite('CICE_cap:RunTimeLog = '//trim(logmsg), ESMF_LOGMSG_INFO)

call NUOPC_CompAttributeGet(gcomp, name="write_restart_at_endofrun", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
if (trim(cvalue) .eq. '.true.') restart_eor = .true.
endif

!----------------------------------------------------------------------------
! generate local mpi comm
!----------------------------------------------------------------------------
Expand Down Expand Up @@ -497,7 +504,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
! Note that sets the nu_diag module variable in ice_fileunits
! Set the nu_diag_set flag so it's not reset later

call shr_file_setLogUnit (shrlogunit)
call shr_log_setLogUnit (shrlogunit)
call ufs_file_setLogUnit('./log.ice.timer',nu_timer,runtimelog)

call NUOPC_CompAttributeGet(gcomp, name="diro", value=cvalue, &
Expand Down Expand Up @@ -885,7 +892,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
Expand Down Expand Up @@ -1067,8 +1074,8 @@ subroutine ModelAdvance(gcomp, rc)
! Reset shr logging to my log file
!--------------------------------

call shr_file_getLogUnit (shrlogunit)
call shr_file_setLogUnit (nu_diag)
call shr_log_getLogUnit (shrlogunit)
call shr_log_setLogUnit (nu_diag)

!--------------------------------
! Query the Component for its clock, importState and exportState
Expand Down Expand Up @@ -1139,6 +1146,8 @@ subroutine ModelAdvance(gcomp, rc)
call ESMF_ClockGetAlarm(clock, alarmname='alarm_restart', alarm=alarm, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

force_restart_now = .false.

if (ESMF_AlarmIsRinging(alarm, rc=rc)) then
if (ChkErr(rc,__LINE__,u_FILE_u)) return
force_restart_now = .true.
Expand All @@ -1152,8 +1161,18 @@ subroutine ModelAdvance(gcomp, rc)

write(restart_date,"(i4.4,a,i2.2,a,i2.2,a,i5.5)") yy, '-', mm, '-',dd,'-',tod
write(restart_filename,'(4a)') trim(restart_dir), trim(restart_file), '.', trim(restart_date)
else
force_restart_now = .false.
endif

! Handle end of run restart
if (restart_eor) then
call ESMF_ClockGetAlarm(clock, alarmname='alarm_stop', alarm=alarm, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (ESMF_AlarmIsRinging(alarm, rc=rc)) then
if (ChkErr(rc,__LINE__,u_FILE_u)) return
force_restart_now = .true.
call ESMF_AlarmRingerOff( alarm, rc=rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif
endif

!--------------------------------
Expand Down Expand Up @@ -1207,7 +1226,7 @@ subroutine ModelAdvance(gcomp, rc)
end if

! reset shr logging to my original values
call shr_file_setLogUnit (shrlogunit)
call shr_log_setLogUnit (shrlogunit)

!--------------------------------
! stop timers and print timer info
Expand Down
6 changes: 6 additions & 0 deletions cicecore/drivers/nuopc/cmeps/ice_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,7 @@ subroutine SetScalarField(field, flds_scalar_name, flds_scalar_num, rc)
! local variables
type(ESMF_Distgrid) :: distgrid
type(ESMF_Grid) :: grid
real(ESMF_KIND_R8), pointer :: fldptr2d(:,:)
character(len=*), parameter :: subname='(ice_import_export:SetScalarField)'
! ----------------------------------------------

Expand All @@ -1511,6 +1512,11 @@ subroutine SetScalarField(field, flds_scalar_name, flds_scalar_num, rc)
ungriddedLBound=(/1/), ungriddedUBound=(/flds_scalar_num/), gridToFieldMap=(/2/), rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! initialize fldptr to zero
call ESMF_FieldGet(field, farrayPtr=fldptr2d, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
fldptr2d(:,:) = 0.0

end subroutine SetScalarField

end subroutine fldlist_realize
Expand Down
Loading

0 comments on commit 16392f0

Please sign in to comment.