Skip to content

Commit e8a69ab

Browse files
DeniseWorthenapcraigdabail10eclare108213Mariana Vertenstein
authored
Add logging features to nuopc/cmeps cap; deprecates zsalinity in cap (#856)
* merge latest master (#4) * Isotopes for CICE (#423) Co-authored-by: apcraig <anthony.p.craig@gmail.com> Co-authored-by: David Bailey <dbailey@ucar.edu> Co-authored-by: Elizabeth Hunke <eclare@lanl.gov> * updated orbital calculations needed for cesm * fixed problems in updated orbital calculations needed for cesm * update CICE6 to support coupling with UFS * put in changes so that both ufsatm and cesm requirements for potential temperature and density are satisfied * Convergence on ustar for CICE. (#452) (#5) * Add atmiter_conv to CICE * Add documentation * trigger build the docs Co-authored-by: David A. Bailey <dbailey@ucar.edu> * update icepack submodule * Revert "update icepack submodule" This reverts commit e70d1ab. * update comp_ice.backend with temporary ice_timers fix * Fix threading problem in init_bgc * Fix additional OMP problems * changes for coldstart running * Move the forapps directory * remove cesmcoupled ifdefs * Fix logging issues for NUOPC * removal of many cpp-ifdefs * fix compile errors * fixes to get cesm working * fixed white space issue * Add restart_coszen namelist option * update icepack submodule * change Orion to orion in backend remove duplicate print lines from ice_transport_driver * add -link_mpi=dbg to debug flags (#8) * cice6 compile (#6) * enable debug build. fix to remove errors * fix an error in comp_ice.backend.libcice * change Orion to orion for machine identification * changes for consistency w/ current emc-cice5 (#13) Update to emc/develop fork to current CICE consortium Co-authored-by: David A. Bailey <dbailey@ucar.edu> Co-authored-by: Tony Craig <apcraig@users.noreply.github.com> Co-authored-by: Elizabeth Hunke <eclare@lanl.gov> Co-authored-by: Mariana Vertenstein <mvertens@ucar.edu> Co-authored-by: apcraig <anthony.p.craig@gmail.com> Co-authored-by: Philippe Blain <levraiphilippeblain@gmail.com> * Fixcommit (#14) Align commit history between emc/develop and cice-consortium/master * Update CICE6 for integration to S2S * add wcoss_dell_p3 compiler macro * update to icepack w/ debug fix * replace SITE with MACHINE_ID * update compile scripts * Support TACC stampede (#19) * update icepack * add ice_dyn_vp module to CICE_InitMod * update gitmodules, update icepack * Update CICE to consortium master (#23) updates include: * deprecate upwind advection (#508) * add implicit VP solver (#491) * update icepack * switch icepack branches * update to icepack master but set abort flag in ITD routine to false * update icepack * Update CICE to latest Consortium master (#26) update CICE and Icepack * changes the criteria for aborting ice for thermo-conservation errors * updates the time manager * fixes two bugs in ice_therm_mushy * updates Icepack to Consortium master w/ flip of abort flag for troublesome IC cases * add cice changes for zlvs (#29) * update icepack and pointer * update icepack and revert gitmodules * Fix history features - Fix bug in history time axis when sec_init is not zero. - Fix issue with time_beg and time_end uninitialized values. - Add support for averaging with histfreq='1' by allowing histfreq_n to be any value in that case. Extend and clean up construct_filename for history files. More could be done, but wanted to preserve backwards compatibility. - Add new calendar_sec2hms to converts daily seconds to hh:mm:ss. Update the calchk calendar unit tester to check this method - Remove abort test in bcstchk, this was just causing problems in regression testing - Remove known problems documentation about problems writing when istep=1. This issue does not exist anymore with the updated time manager. - Add new tests with hist_avg = false. Add set_nml.histinst. * revert set_nml.histall * fix implementation error * update model log output in ice_init * Fix QC issues - Add netcdf ststus checks and aborts in ice_read_write.F90 - Check for end of file when reading records in ice_read_write.F90 for ice_read_nc methods - Update set_nml.qc to better specify the test, turn off leap years since we're cycling 2005 data - Add check in c ice.t-test.py to make sure there is at least 1825 files, 5 years of data - Add QC run to base_suite.ts to verify qc runs to completion and possibility to use those results directly for QC validation - Clean up error messages and some indentation in ice_read_write.F90 * Update testing - Add prod suite including 10 year gx1prod and qc test - Update unit test compare scripts * update documentation * reset calchk to 100000 years * update evp1d test * update icepack * update icepack * add memory profiling (#36) * add profile_memory calls to CICE cap * update icepack * fix rhoa when lowest_temp is 0.0 * provide default value for rhoa when imported temp_height_lowest (Tair) is 0.0 * resolves seg fault when frac_grid=false and do_ca=true * update icepack submodule * Update CICE for latest Consortium master (#38) * Implement advanced snow physics in icepack and CICE * Fix time-stamping of CICE history files * Fix CICE history file precision * Use CICE-Consortium/Icepack master (#40) * switch to icepack master at consortium * recreate cap update branch (#42) * add debug_model feature * add required variables and calls for tr_snow * remove 2 extraneous lines * remove two log print lines that were removed prior to merge of driver updates to consortium * duplicate gitmodule style for icepack * Update CICE to latest Consortium/main (#45) * Update CICE to Consortium/main (#48) Update OpenMP directives as needed including validation via new omp_suite. Fixed OpenMP in dynamics. Refactored eap puny/pi lookups to improve scalar performance Update Tsfc implementation to make sure land blocks don't set Tsfc to freezing temp Update for sea bed stress calculations * fix comment, fix env for orion and hera * replace save_init with step_prep in CICE_RunMod * fixes for cgrid repro * remove added haloupdates * baselines pass with these extra halo updates removed * change F->S for ocean velocities and tilts * fix debug failure when grid_ice=C * compiling in debug mode using -init=snan,arrays requires initialization of variables * respond to review comments * remove inserted whitespace for uvelE,N and vvelE,N * Add wave-cice coupling; update to Consortium main (#51) * add wave-ice fields * initialize aicen_init, which turns up as NaN in calc of floediam export * add call to icepack_init_wave to initialize wavefreq and dwavefreq * update to latest consortium main (PR 752) * add initializationsin ice_state * initialize vsnon/vsnon_init and vicen/vicen_init * Update CICE (#54) * update to include recent PRs to Consortium/main * fix for nudiag_set allow nudiag_set to be available outside of cesm; may prefer to fix in coupling interface * Update CICE for latest Consortium/main (#56) * add run time info * change real(8) to real(dbl)kind) * fix syntax * fix write unit * use cice_wrapper for ufs timer functionality * add elapsed model time for logtime * tidy up the wrapper * fix case for 'time since' at the first advance * add timer and forecast log * write timer values to timer log, not nu_diag * write log.ice.fXXX * only one time is needed * modify message written for log.ice.fXXX * change info in fXXX log file * Update CICE from Consortium/main (#62) * Fix CESMCOUPLED compile issue in icepack. (#823) * Update global reduction implementation to improve performance, fix VP bug (#824) * Update VP global sum to exclude local implementation with tripole grids * Add functionality to change hist_avg for each stream (#827) * Update Icepack to #6703bc533c968 May 22, 2023 (#829) * Fix for mesh check in CESM driver (#830) * Namelist option for time axis position. (#839) * reset timer after Advance to retrieve "wait time" * add logical control for enabling runtime info * remove zsal items from cap * fix typo --------- Co-authored-by: apcraig <anthony.p.craig@gmail.com> Co-authored-by: David Bailey <dbailey@ucar.edu> Co-authored-by: Elizabeth Hunke <eclare@lanl.gov> Co-authored-by: Mariana Vertenstein <mvertens@ucar.edu> Co-authored-by: Minsuk Ji <57227195+MinsukJi-NOAA@users.noreply.github.com> Co-authored-by: Tony Craig <apcraig@users.noreply.github.com> Co-authored-by: Philippe Blain <levraiphilippeblain@gmail.com> Co-authored-by: Jun.Wang <Jun.Wang@noaa.gov>
1 parent 933b148 commit e8a69ab

File tree

4 files changed

+127
-34
lines changed

4 files changed

+127
-34
lines changed

cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ subroutine init_restart()
232232
restart_iso, read_restart_iso, &
233233
restart_aero, read_restart_aero, &
234234
restart_hbrine, read_restart_hbrine, &
235-
restart_zsal, restart_bgc
235+
restart_bgc
236236
use ice_restart_driver, only: restartfile
237237
use ice_restart_shared, only: runtype, restart
238238
use ice_state ! almost everything
@@ -243,7 +243,7 @@ subroutine init_restart()
243243
logical(kind=log_kind) :: &
244244
tr_iage, tr_FY, tr_lvl, tr_pond_lvl, &
245245
tr_pond_topo, tr_fsd, tr_iso, tr_aero, tr_brine, tr_snow, &
246-
skl_bgc, z_tracers, solve_zsal
246+
skl_bgc, z_tracers
247247
integer(kind=int_kind) :: &
248248
ntrcr
249249
integer(kind=int_kind) :: &
@@ -259,8 +259,7 @@ subroutine init_restart()
259259
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
260260
file=__FILE__, line=__LINE__)
261261

262-
call icepack_query_parameters(skl_bgc_out=skl_bgc, &
263-
z_tracers_out=z_tracers, solve_zsal_out=solve_zsal)
262+
call icepack_query_parameters(skl_bgc_out=skl_bgc, z_tracers_out=z_tracers)
264263
call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, &
265264
tr_lvl_out=tr_lvl, tr_pond_lvl_out=tr_pond_lvl, &
266265
tr_pond_topo_out=tr_pond_topo, tr_aero_out=tr_aero, tr_brine_out=tr_brine, &
@@ -404,8 +403,6 @@ subroutine init_restart()
404403
if (trim(runtype) == 'continue') then
405404
if (tr_brine) &
406405
restart_hbrine = .true.
407-
if (solve_zsal) &
408-
restart_zsal = .true.
409406
if (skl_bgc .or. z_tracers) &
410407
restart_bgc = .true.
411408
endif
@@ -415,7 +412,7 @@ subroutine init_restart()
415412
if (tr_brine .and. restart_hbrine) call read_restart_hbrine
416413
endif
417414

418-
if (solve_zsal .or. skl_bgc .or. z_tracers) then ! biogeochemistry
415+
if (skl_bgc .or. z_tracers) then ! biogeochemistry
419416
if (tr_fsd) then
420417
write (nu_diag,*) 'FSD implementation incomplete for use with BGC'
421418
call icepack_warnings_flush(nu_diag)

cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module CICE_RunMod
1616

1717
use ice_kinds_mod
1818
use cice_wrapper_mod, only : t_startf, t_stopf, t_barrierf
19+
use cice_wrapper_mod, only : ufs_logfhour
1920
use ice_fileunits, only: nu_diag
2021
use ice_arrays_column, only: oceanmixed_ice
2122
use ice_constants, only: c0, c1
@@ -107,11 +108,13 @@ end subroutine CICE_Run
107108

108109
subroutine ice_step
109110

111+
use ice_constants, only: c3600
110112
use ice_boundary, only: ice_HaloUpdate
111113
use ice_calendar, only: dt, dt_dyn, ndtd, diagfreq, write_restart, istep
112-
use ice_calendar, only: idate, msec
114+
use ice_calendar, only: idate, myear, mmonth, mday, msec, timesecs
115+
use ice_calendar, only: calendar_sec2hms, write_history, nstreams, histfreq
113116
use ice_diagnostics, only: init_mass_diags, runtime_diags, debug_model, debug_ice
114-
use ice_diagnostics_bgc, only: hbrine_diags, zsal_diags, bgc_diags
117+
use ice_diagnostics_bgc, only: hbrine_diags, bgc_diags
115118
use ice_domain, only: halo_info, nblocks
116119
use ice_dyn_eap, only: write_restart_eap
117120
use ice_dyn_shared, only: kdyn, kridge
@@ -133,7 +136,7 @@ subroutine ice_step
133136
use ice_timers, only: ice_timer_start, ice_timer_stop, &
134137
timer_diags, timer_column, timer_thermo, timer_bound, &
135138
timer_hist, timer_readwrite
136-
use ice_communicate, only: MPI_COMM_ICE
139+
use ice_communicate, only: MPI_COMM_ICE, my_task, master_task
137140
use ice_prescribed_mod
138141

139142
integer (kind=int_kind) :: &
@@ -147,11 +150,13 @@ subroutine ice_step
147150
logical (kind=log_kind) :: &
148151
tr_iage, tr_FY, tr_lvl, tr_fsd, tr_snow, &
149152
tr_pond_lvl, tr_pond_topo, tr_brine, tr_iso, tr_aero, &
150-
calc_Tsfc, skl_bgc, solve_zsal, z_tracers, wave_spec
153+
calc_Tsfc, skl_bgc, z_tracers, wave_spec
151154

152155
character(len=*), parameter :: subname = '(ice_step)'
153156

154157
character (len=char_len) :: plabeld
158+
integer (kind=int_kind) :: hh,mm,ss,ns
159+
character (len=char_len) :: logmsg
155160

156161
if (debug_model) then
157162
plabeld = 'beginning time step'
@@ -161,8 +166,7 @@ subroutine ice_step
161166
endif
162167

163168
call icepack_query_parameters(calc_Tsfc_out=calc_Tsfc, skl_bgc_out=skl_bgc, &
164-
solve_zsal_out=solve_zsal, z_tracers_out=z_tracers, ktherm_out=ktherm, &
165-
wave_spec_out=wave_spec)
169+
z_tracers_out=z_tracers, ktherm_out=ktherm, wave_spec_out=wave_spec)
166170
call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, &
167171
tr_lvl_out=tr_lvl, tr_pond_lvl_out=tr_pond_lvl, &
168172
tr_pond_topo_out=tr_pond_topo, tr_brine_out=tr_brine, tr_aero_out=tr_aero, &
@@ -354,7 +358,6 @@ subroutine ice_step
354358
call ice_timer_start(timer_diags) ! diagnostics
355359
if (mod(istep,diagfreq) == 0) then
356360
call runtime_diags(dt) ! log file
357-
if (solve_zsal) call zsal_diags
358361
if (skl_bgc .or. z_tracers) call bgc_diags
359362
if (tr_brine) call hbrine_diags
360363
endif
@@ -376,15 +379,23 @@ subroutine ice_step
376379
if (tr_fsd) call write_restart_fsd
377380
if (tr_iso) call write_restart_iso
378381
if (tr_aero) call write_restart_aero
379-
if (solve_zsal .or. skl_bgc .or. z_tracers) &
382+
if (skl_bgc .or. z_tracers) &
380383
call write_restart_bgc
381384
if (tr_brine) call write_restart_hbrine
382385
if (kdyn == 2) call write_restart_eap
383386
call final_restart
384387
endif
385388

386389
call ice_timer_stop(timer_readwrite) ! reading/writing
387-
390+
if (my_task == master_task) then
391+
do ns = 1,nstreams
392+
if (write_history(ns) .and. histfreq(ns) .eq. 'h') then
393+
call calendar_sec2hms(msec,hh,mm,ss)
394+
write(logmsg,'(6(i4,2x))')myear,mmonth,mday,hh,mm,ss
395+
call ufs_logfhour(trim(logmsg),timesecs/c3600)
396+
end if
397+
end do
398+
end if
388399
end subroutine ice_step
389400

390401
!=======================================================================
@@ -396,7 +407,7 @@ end subroutine ice_step
396407
subroutine coupling_prep (iblk)
397408

398409
use ice_arrays_column, only: alvdfn, alidfn, alvdrn, alidrn, &
399-
albicen, albsnon, albpndn, apeffn, fzsal_g, fzsal, snowfracn
410+
albicen, albsnon, albpndn, apeffn, snowfracn
400411
use ice_blocks, only: nx_block, ny_block, get_block, block
401412
use ice_domain, only: blocks_ice
402413
use ice_calendar, only: dt, nstreams
@@ -411,9 +422,8 @@ subroutine coupling_prep (iblk)
411422
fsens, flat, fswabs, flwout, evap, Tref, Qref, &
412423
scale_fluxes, frzmlt_init, frzmlt, Uref, wind
413424
use ice_flux_bgc, only: faero_ocn, fiso_ocn, Qref_iso, fiso_evap, &
414-
fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai, &
415-
fnit, fsil, famm, fdmsp, fdms, fhum, fdust, falgalN, &
416-
fdoc, fdic, fdon, ffep, ffed, bgcflux_ice_to_ocn
425+
flux_bio, flux_bio_ai, fnit, fsil, famm, fdmsp, fdms, fhum, &
426+
fdust, falgalN, fdoc, fdic, fdon, ffep, ffed, bgcflux_ice_to_ocn
417427
use ice_grid, only: tmask
418428
use ice_state, only: aicen, aice
419429
use ice_state, only: aice_init
@@ -566,8 +576,6 @@ subroutine coupling_prep (iblk)
566576
fsalt_ai (i,j,iblk) = fsalt (i,j,iblk)
567577
fhocn_ai (i,j,iblk) = fhocn (i,j,iblk)
568578
fswthru_ai(i,j,iblk) = fswthru(i,j,iblk)
569-
fzsal_ai (i,j,iblk) = fzsal (i,j,iblk)
570-
fzsal_g_ai(i,j,iblk) = fzsal_g(i,j,iblk)
571579

572580
if (nbtrcr > 0) then
573581
do k = 1, nbtrcr
@@ -613,7 +621,6 @@ subroutine coupling_prep (iblk)
613621
faero_ocn(:,:,:,iblk), &
614622
alvdr (:,:,iblk), alidr (:,:,iblk), &
615623
alvdf (:,:,iblk), alidf (:,:,iblk), &
616-
fzsal (:,:,iblk), fzsal_g (:,:,iblk), &
617624
flux_bio (:,:,1:nbtrcr,iblk), &
618625
Qref_iso =Qref_iso (:,:,:,iblk), &
619626
fiso_evap=fiso_evap(:,:,:,iblk), &

cicecore/drivers/nuopc/cmeps/cice_wrapper_mod.F90

Lines changed: 76 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,93 @@
11
module cice_wrapper_mod
22

33
#ifdef CESMCOUPLED
4-
use perf_mod , only : t_startf, t_stopf, t_barrierf
5-
use shr_file_mod , only : shr_file_getlogunit, shr_file_setlogunit
4+
use perf_mod , only : t_startf, t_stopf, t_barrierf
5+
use shr_file_mod , only : shr_file_getlogunit, shr_file_setlogunit
66

7+
use ice_kinds_mod , only : dbl_kind, int_kind, char_len, char_len_long
8+
9+
implicit none
10+
11+
real(dbl_kind) :: wtime = 0.0
12+
contains
13+
! Define stub routines that do nothing - they are just here to avoid
14+
! having cppdefs in the main program
15+
subroutine ufs_settimer(timevalue)
16+
real(dbl_kind), intent(inout) :: timevalue
17+
end subroutine ufs_settimer
18+
subroutine ufs_logtimer(nunit,elapsedsecs,string,runtimelog,time0)
19+
integer, intent(in) :: nunit
20+
integer(int_kind), intent(in) :: elapsedsecs
21+
character(len=*), intent(in) :: string
22+
logical, intent(in) :: runtimelog
23+
real(dbl_kind), intent(in) :: time0
24+
end subroutine ufs_logtimer
25+
subroutine ufs_file_setLogUnit(filename,nunit,runtimelog)
26+
character(len=*), intent(in) :: filename
27+
logical, intent(in) :: runtimelog
28+
integer, intent(out) :: nunit
29+
end subroutine ufs_file_setLogUnit
30+
subroutine ufs_logfhour(msg,hour)
31+
character(len=*), intent(in) :: msg
32+
real(dbl_kind), intent(in) :: hour
33+
end subroutine ufs_logfhour
734
#else
35+
36+
use ice_kinds_mod , only : dbl_kind, int_kind, char_len, char_len_long
37+
38+
implicit none
39+
40+
real(dbl_kind) :: wtime = 0.0
841
contains
42+
subroutine ufs_settimer(timevalue)
43+
real(dbl_kind), intent(inout) :: timevalue
44+
real(dbl_kind) :: MPI_Wtime
45+
timevalue = MPI_Wtime()
46+
end subroutine ufs_settimer
47+
48+
subroutine ufs_logtimer(nunit,elapsedsecs,string,runtimelog,time0)
49+
integer, intent(in) :: nunit
50+
integer(int_kind), intent(in) :: elapsedsecs
51+
character(len=*), intent(in) :: string
52+
logical, intent(in) :: runtimelog
53+
real(dbl_kind), intent(in) :: time0
54+
real(dbl_kind) :: MPI_Wtime, timevalue
55+
if (.not. runtimelog) return
56+
if (time0 > 0.) then
57+
timevalue = MPI_Wtime()-time0
58+
write(nunit,*)elapsedsecs,' CICE '//trim(string),timevalue
59+
end if
60+
end subroutine ufs_logtimer
961

10-
! These are just stub routines put in place to remove
62+
subroutine ufs_file_setLogUnit(filename,nunit,runtimelog)
63+
character(len=*), intent(in) :: filename
64+
logical, intent(in) :: runtimelog
65+
integer, intent(out) :: nunit
66+
if (.not. runtimelog) return
67+
open (newunit=nunit, file=trim(filename))
68+
end subroutine ufs_file_setLogUnit
1169

70+
subroutine ufs_logfhour(msg,hour)
71+
character(len=*), intent(in) :: msg
72+
real(dbl_kind), intent(in) :: hour
73+
character(len=char_len) :: filename
74+
integer(int_kind) :: nunit
75+
write(filename,'(a,i3.3)')'log.ice.f',int(hour)
76+
open(newunit=nunit,file=trim(filename))
77+
write(nunit,'(a)')'completed: cice'
78+
write(nunit,'(a,f10.3)')'forecast hour:',hour
79+
write(nunit,'(a)')'valid time: '//trim(msg)
80+
close(nunit)
81+
end subroutine ufs_logfhour
82+
83+
! Define stub routines that do nothing - they are just here to avoid
84+
! having cppdefs in the main program
1285
subroutine shr_file_setLogUnit(nunit)
1386
integer, intent(in) :: nunit
14-
! do nothing for this stub - its just here to replace
15-
! having cppdefs in the main program
1687
end subroutine shr_file_setLogUnit
1788
subroutine shr_file_getLogUnit(nunit)
1889
integer, intent(in) :: nunit
19-
! do nothing for this stub - its just here to replace
20-
! having cppdefs in the main program
2190
end subroutine shr_file_getLogUnit
22-
2391
subroutine t_startf(string)
2492
character(len=*) :: string
2593
end subroutine t_startf

cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module ice_comp_nuopc
3838
use icepack_intfc , only : icepack_query_tracer_flags, icepack_query_parameters
3939
use cice_wrapper_mod , only : t_startf, t_stopf, t_barrierf
4040
use cice_wrapper_mod , only : shr_file_getlogunit, shr_file_setlogunit
41+
use cice_wrapper_mod , only : ufs_settimer, ufs_logtimer, ufs_file_setlogunit, wtime
4142
#ifdef CESMCOUPLED
4243
use shr_const_mod
4344
use shr_orb_mod , only : shr_orb_decl, shr_orb_params, SHR_ORB_UNDEF_REAL, SHR_ORB_UNDEF_INT
@@ -87,11 +88,12 @@ module ice_comp_nuopc
8788

8889
type(ESMF_Mesh) :: ice_mesh
8990

90-
integer :: nthrds ! Number of threads to use in this component
91-
91+
integer :: nthrds ! Number of threads to use in this component
92+
integer :: nu_timer = 6 ! Simple timer log, unused except by UFS
9293
integer :: dbug = 0
9394
logical :: profile_memory = .false.
9495
logical :: mastertask
96+
logical :: runtimelog = .false.
9597
integer :: start_ymd ! Start date (YYYYMMDD)
9698
integer :: start_tod ! start time of day (s)
9799
integer :: curr_ymd ! Current date (YYYYMMDD)
@@ -245,6 +247,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
245247
character(len=*), parameter :: subname=trim(modName)//':(InitializeAdvertise) '
246248
!--------------------------------
247249

250+
call ufs_settimer(wtime)
251+
248252
call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldName", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
249253
if (ChkErr(rc,__LINE__,u_FILE_u)) return
250254
if (isPresent .and. isSet) then
@@ -305,6 +309,12 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
305309
write(logmsg,'(i6)') dbug
306310
call ESMF_LogWrite('CICE_cap: dbug = '//trim(logmsg), ESMF_LOGMSG_INFO)
307311

312+
call NUOPC_CompAttributeGet(gcomp, name="RunTimeLog", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
313+
if (ChkErr(rc,__LINE__,u_FILE_u)) return
314+
if (isPresent .and. isSet) runtimelog=(trim(cvalue)=="true")
315+
write(logmsg,*) runtimelog
316+
call ESMF_LogWrite('CICE_cap:RunTimeLog = '//trim(logmsg), ESMF_LOGMSG_INFO)
317+
308318
!----------------------------------------------------------------------------
309319
! generate local mpi comm
310320
!----------------------------------------------------------------------------
@@ -487,6 +497,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
487497
! Set the nu_diag_set flag so it's not reset later
488498

489499
call shr_file_setLogUnit (shrlogunit)
500+
call ufs_file_setLogUnit('./log.ice.timer',nu_timer,runtimelog)
490501

491502
call NUOPC_CompAttributeGet(gcomp, name="diro", value=cvalue, &
492503
isPresent=isPresent, isSet=isSet, rc=rc)
@@ -699,7 +710,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
699710
end if
700711

701712
call t_stopf ('cice_init_total')
702-
713+
if (mastertask) call ufs_logtimer(nu_timer,msec,'InitializeAdvertise time: ',runtimelog,wtime)
703714
end subroutine InitializeAdvertise
704715

705716
!===============================================================================
@@ -735,6 +746,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
735746
rc = ESMF_SUCCESS
736747
if (dbug > 5) call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO)
737748

749+
call ufs_settimer(wtime)
738750
!----------------------------------------------------------------------------
739751
! Second cice initialization phase -after initializing grid info
740752
!----------------------------------------------------------------------------
@@ -912,6 +924,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
912924

913925
call flush_fileunit(nu_diag)
914926

927+
if (mastertask) call ufs_logtimer(nu_timer,msec,'InitializeRealize time: ',runtimelog,wtime)
915928
end subroutine InitializeRealize
916929

917930
!===============================================================================
@@ -957,6 +970,8 @@ subroutine ModelAdvance(gcomp, rc)
957970
!--------------------------------
958971

959972
rc = ESMF_SUCCESS
973+
if (mastertask) call ufs_logtimer(nu_timer,msec,'ModelAdvance time since last step: ',runtimelog,wtime)
974+
call ufs_settimer(wtime)
960975

961976
call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO)
962977

@@ -1177,6 +1192,9 @@ subroutine ModelAdvance(gcomp, rc)
11771192

11781193
if (dbug > 5) call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO)
11791194

1195+
if (mastertask) call ufs_logtimer(nu_timer,msec,'ModelAdvance time: ',runtimelog,wtime)
1196+
call ufs_settimer(wtime)
1197+
11801198
end subroutine ModelAdvance
11811199

11821200
!===============================================================================
@@ -1321,6 +1339,7 @@ subroutine ModelFinalize(gcomp, rc)
13211339
!--------------------------------
13221340

13231341
rc = ESMF_SUCCESS
1342+
call ufs_settimer(wtime)
13241343
if (dbug > 5) call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO)
13251344
if (my_task == master_task) then
13261345
write(nu_diag,F91)
@@ -1329,6 +1348,8 @@ subroutine ModelFinalize(gcomp, rc)
13291348
end if
13301349
if (dbug > 5) call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO)
13311350

1351+
if(mastertask) call ufs_logtimer(nu_timer,msec,'ModelFinalize time: ',runtimelog,wtime)
1352+
13321353
end subroutine ModelFinalize
13331354

13341355
!===============================================================================

0 commit comments

Comments
 (0)