diff --git a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 index 59772d6e2..9d650d1ff 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 @@ -15,125 +15,39 @@ module ice_comp_nuopc use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize use NUOPC_Model , only : NUOPC_ModelGet, SetVM -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD use ice_constants , only : ice_init_constants, c0 -======= - use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl, cs=>shr_kind_cs - use shr_sys_mod , only : shr_sys_abort, shr_sys_flush -======= -#ifdef CESMCOUPLED ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) - use shr_file_mod , only : shr_file_getlogunit, shr_file_setlogunit - use shr_orb_mod , only : shr_orb_decl, shr_orb_params, SHR_ORB_UNDEF_REAL, SHR_ORB_UNDEF_INT - use shr_const_mod - use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian -#endif -======= ->>>>>>> 46fcfbaa (changes for coldstart running) - use ice_constants , only : ice_init_constants ->>>>>>> 183218aa (updated orbital calculations needed for cesm) use ice_shr_methods , only : chkerr, state_setscalar, state_getscalar, state_diagnose, alarmInit - use ice_shr_methods , only : get_component_instance, state_flddebug - + use ice_shr_methods , only : set_component_logging, get_component_instance, state_flddebug use ice_import_export , only : ice_import, ice_export, ice_advertise_fields, ice_realize_fields use ice_domain_size , only : nx_global, ny_global -<<<<<<< HEAD - use ice_grid , only : grid_format, init_grid2 - use ice_communicate , only : init_communicate, my_task, master_task, mpi_comm_ice - use ice_calendar , only : force_restart_now, write_ic, init_calendar - use ice_calendar , only : idate, mday, mmonth, myear, year_init - use ice_calendar , only : msec, dt, calendar, calendar_type, nextsw_cday, istep - use ice_calendar , only : ice_calendar_noleap, ice_calendar_gregorian - use ice_kinds_mod , only : dbl_kind, int_kind, char_len, char_len_long - use ice_fileunits , only : nu_diag, nu_diag_set, inst_index, inst_name - use ice_fileunits , only : inst_suffix, release_all_fileunits, flush_fileunit - use ice_restart_shared , only : runid, runtype, restart, use_restart_time, restart_dir, restart_file - use ice_history , only : accum_hist -======= - use ice_domain , only : nblocks, blocks_ice, distrb_info - use ice_blocks , only : block, get_block, nx_block, ny_block, nblocks_x, nblocks_y - use ice_blocks , only : nblocks_tot, get_block_parameter - use ice_distribution , only : ice_distributiongetblockloc - use ice_grid , only : tlon, tlat, hm, tarea, ULON, ULAT + use ice_grid , only : grid_type, init_grid2 use ice_communicate , only : init_communicate, my_task, master_task, mpi_comm_ice use ice_calendar , only : force_restart_now, write_ic - use ice_calendar , only : idate, mday, mmonth, year_init, timesecs + use ice_calendar , only : idate, mday, mmonth, myear, year_init use ice_calendar , only : msec, dt, calendar, calendar_type, nextsw_cday, istep use ice_kinds_mod , only : dbl_kind, int_kind, char_len, char_len_long - use ice_scam , only : scmlat, scmlon, single_column -<<<<<<< HEAD - use ice_fileunits , only : nu_diag, nu_diag_set, inst_index, inst_name, inst_suffix, release_all_fileunits, flush_fileunit - use ice_restart_shared , only : runid, runtype, restart_dir, restart_file -======= use ice_fileunits , only : nu_diag, nu_diag_set, inst_index, inst_name use ice_fileunits , only : inst_suffix, release_all_fileunits, flush_fileunit use ice_restart_shared , only : runid, runtype, restart, use_restart_time, restart_dir, restart_file ->>>>>>> 519d3392 (Update CICE to latest Consortium master (#26)) use ice_history , only : accum_hist -<<<<<<< HEAD - use CICE_InitMod , only : CICE_Init - use CICE_RunMod , only : CICE_Run ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) -======= - use CICE_InitMod , only : cice_init - use CICE_RunMod , only : cice_run ->>>>>>> b4afd2e5 (removal of many cpp-ifdefs) use ice_exit , only : abort_ice use icepack_intfc , only : icepack_warnings_flush, icepack_warnings_aborted use icepack_intfc , only : icepack_init_orbit, icepack_init_parameters, icepack_query_orbit use icepack_intfc , only : icepack_query_tracer_flags, icepack_query_parameters -<<<<<<< HEAD -<<<<<<< HEAD - 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 : ufs_settimer, ufs_logtimer, ufs_file_setlogunit, wtime -#ifdef CESMCOUPLED - use shr_const_mod - use shr_orb_mod , only : shr_orb_decl, shr_orb_params, SHR_ORB_UNDEF_REAL, SHR_ORB_UNDEF_INT - use ice_scam , only : scmlat, scmlon, scol_mask, scol_frac, scol_ni, scol_nj, scol_area - use nuopc_shr_methods , only : set_component_logging -#else - use ice_shr_methods , only : set_component_logging -======= -======= - use ice_timers -<<<<<<< HEAD ->>>>>>> 46fcfbaa (changes for coldstart running) -======= use cice_wrapper_mod , only : t_startf, t_stopf, t_barrierf use cice_wrapper_mod , only : shr_file_getlogunit, shr_file_setlogunit ->>>>>>> b4afd2e5 (removal of many cpp-ifdefs) #ifdef CESMCOUPLED use shr_const_mod use shr_orb_mod , only : shr_orb_decl, shr_orb_params, SHR_ORB_UNDEF_REAL, SHR_ORB_UNDEF_INT -<<<<<<< HEAD - use ice_prescribed_mod , only : ice_prescribed_init -<<<<<<< HEAD - use perf_mod , only : t_startf, t_stopf, t_barrierf ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) -======= ->>>>>>> b4afd2e5 (removal of many cpp-ifdefs) + use ice_scam , only : scmlat, scmlon, scol_mask, scol_frac, scol_ni, scol_nj #endif -<<<<<<< HEAD use ice_timers -<<<<<<< HEAD use CICE_InitMod , only : cice_init1, cice_init2 use CICE_RunMod , only : cice_run use ice_mesh_mod , only : ice_mesh_set_distgrid, ice_mesh_setmask_from_maskfile, ice_mesh_check use ice_mesh_mod , only : ice_mesh_init_tlon_tlat_area_hm, ice_mesh_create_scolumn use ice_prescribed_mod , only : ice_prescribed_init use ice_scam , only : scol_valid, single_column -======= - use ice_communicate, only: init_communicate ->>>>>>> 902e8833 (Fix logging issues for NUOPC) -======= ->>>>>>> 46fcfbaa (changes for coldstart running) -======= -#endif - use ice_prescribed_mod , only : ice_prescribed_init ->>>>>>> 3a1b88bf (fix compile errors) implicit none private @@ -147,13 +61,7 @@ module ice_comp_nuopc private :: ModelAdvance private :: ModelSetRunClock private :: ModelFinalize -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD private :: ice_orbital_init ! only valid for cesm -======= - private :: ice_orbital_init ! only for cesm ->>>>>>> 183218aa (updated orbital calculations needed for cesm) character(len=char_len_long) :: flds_scalar_name = '' integer :: flds_scalar_num = 0 @@ -161,97 +69,30 @@ module ice_comp_nuopc integer :: flds_scalar_index_ny = 0 integer :: flds_scalar_index_nextsw_cday = 0 -<<<<<<< HEAD character(len=char_len_long) :: orb_mode ! attribute - orbital mode integer :: orb_iyear ! attribute - orbital year integer :: orb_iyear_align ! attribute - associated with model year real(dbl_kind) :: orb_obliq ! attribute - obliquity in degrees real(dbl_kind) :: orb_mvelp ! attribute - moving vernal equinox longitude real(dbl_kind) :: orb_eccen ! attribute and update- orbital eccentricity -======= - character(len=CL) :: orb_mode ! attribute - orbital mode - integer :: orb_iyear ! attribute - orbital year - integer :: orb_iyear_align ! attribute - associated with model year - real(R8) :: orb_obliq ! attribute - obliquity in degrees - real(R8) :: orb_mvelp ! attribute - moving vernal equinox longitude - real(R8) :: orb_eccen ! attribute and update- orbital eccentricity ->>>>>>> 183218aa (updated orbital calculations needed for cesm) -======= -#ifdef CESMCOUPLED - private :: ice_orbital_init ! only for cesm -#endif -======= - private :: ice_orbital_init ! only valid for cesm ->>>>>>> 46fcfbaa (changes for coldstart running) - - character(len=char_len_long) :: flds_scalar_name = '' - integer :: flds_scalar_num = 0 - integer :: flds_scalar_index_nx = 0 - integer :: flds_scalar_index_ny = 0 - integer :: flds_scalar_index_nextsw_cday = 0 - - character(len=char_len_long) :: orb_mode ! attribute - orbital mode -<<<<<<< HEAD - integer :: orb_iyear ! attribute - orbital year - integer :: orb_iyear_align ! attribute - associated with model year - real(dbl_kind) :: orb_obliq ! attribute - obliquity in degrees - real(dbl_kind) :: orb_mvelp ! attribute - moving vernal equinox longitude - real(dbl_kind) :: orb_eccen ! attribute and update- orbital eccentricity ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) -======= - integer :: orb_iyear ! attribute - orbital year - integer :: orb_iyear_align ! attribute - associated with model year - real(dbl_kind) :: orb_obliq ! attribute - obliquity in degrees - real(dbl_kind) :: orb_mvelp ! attribute - moving vernal equinox longitude - real(dbl_kind) :: orb_eccen ! attribute and update- orbital eccentricity ->>>>>>> 46fcfbaa (changes for coldstart running) character(len=*) , parameter :: orb_fixed_year = 'fixed_year' character(len=*) , parameter :: orb_variable_year = 'variable_year' character(len=*) , parameter :: orb_fixed_parameters = 'fixed_parameters' -<<<<<<< HEAD -<<<<<<< HEAD - type(ESMF_Mesh) :: ice_mesh - - integer :: nthrds ! Number of threads to use in this component - integer :: nu_timer = 6 ! Simple timer log, unused except by UFS - integer :: dbug = 0 - logical :: profile_memory = .false. - logical :: mastertask - logical :: runtimelog = .false. - integer :: start_ymd ! Start date (YYYYMMDD) - integer :: start_tod ! start time of day (s) - integer :: curr_ymd ! Current date (YYYYMMDD) - integer :: curr_tod ! Current time of day (s) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) - integer :: ref_ymd ! Reference date (YYYYMMDD) - integer :: ref_tod ! reference time of day (s) -======= character(len=*),parameter :: shr_cal_noleap = 'NO_LEAP' character(len=*),parameter :: shr_cal_gregorian = 'GREGORIAN' -<<<<<<< HEAD - integer , parameter :: dbug = 10 ->>>>>>> 46fcfbaa (changes for coldstart running) -======= + type(ESMF_Mesh) :: ice_mesh + + integer :: nthrds ! Number of threads to use in this component + integer :: dbug = 0 ->>>>>>> bdf1a1f6 (changes for consistency w/ current emc-cice5 (#13)) + logical :: profile_memory = .false. integer , parameter :: debug_import = 0 ! internal debug level integer , parameter :: debug_export = 0 ! internal debug level character(*), parameter :: modName = "(ice_comp_nuopc)" character(*), parameter :: u_FILE_u = & -<<<<<<< HEAD -======= - integer , parameter :: dbug = 10 - integer , parameter :: debug_import = 0 ! internal debug level - integer , parameter :: debug_export = 0 ! internal debug level - character(*), parameter :: modName = "(ice_comp_nuopc)" - character(*), parameter :: u_FILE_u = & ->>>>>>> 183218aa (updated orbital calculations needed for cesm) -======= ->>>>>>> 46fcfbaa (changes for coldstart running) __FILE__ !======================================================================= @@ -352,7 +193,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Local variables character(len=char_len_long) :: cvalue -<<<<<<< HEAD character(len=char_len_long) :: ice_meshfile character(len=char_len_long) :: ice_maskfile character(len=char_len_long) :: errmsg @@ -363,8 +203,12 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) real(kind=dbl_kind) :: atmiter_conv_driver integer (kind=int_kind) :: natmiter integer (kind=int_kind) :: natmiter_driver + character(len=char_len) :: tfrz_option_driver ! tfrz_option from driver attributes + character(len=char_len) :: tfrz_option ! tfrz_option from cice namelist + integer(int_kind) :: ktherm integer :: localPet integer :: npes + logical :: mastertask type(ESMF_VM) :: vm integer :: lmpicom ! local communicator type(ESMF_Time) :: currTime ! Current time @@ -372,7 +216,16 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) type(ESMF_Time) :: stopTime ! Stop time type(ESMF_Time) :: refTime ! Ref time type(ESMF_TimeInterval) :: timeStep ! Model timestep + type(ESMF_Calendar) :: esmf_calendar ! esmf calendar type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type + integer :: start_ymd ! Start date (YYYYMMDD) + integer :: start_tod ! start time of day (s) + integer :: curr_ymd ! Current date (YYYYMMDD) + integer :: curr_tod ! Current time of day (s) + integer :: stop_ymd ! stop date (YYYYMMDD) + integer :: stop_tod ! stop time of day (sec) + integer :: ref_ymd ! Reference date (YYYYMMDD) + integer :: ref_tod ! reference time of day (s) integer :: yy,mm,dd ! Temporaries for time query integer :: dtime ! time step integer :: shrlogunit ! original log unit @@ -382,28 +235,11 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer :: iblk, jblk ! indices integer :: ig, jg ! indices integer :: ilo, ihi, jlo, jhi ! beginning and end of physical domain - character(len=char_len_long) :: diag_filename = 'unset' character(len=char_len_long) :: logmsg - character(len=char_len_long) :: single_column_lnd_domainfile - real(dbl_kind) :: scol_lon - real(dbl_kind) :: scol_lat - real(dbl_kind) :: scol_spval - character(len=char_len) :: tfrz_option ! tfrz_option from cice namelist - character(len=char_len) :: tfrz_option_driver ! tfrz_option from cice namelist -======= - character(len=char_len_long) :: logmsg -<<<<<<< HEAD - logical :: isPresent, isSet ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) -======= - logical :: isPresent, isSet ->>>>>>> b4afd2e5 (removal of many cpp-ifdefs) character(len=*), parameter :: subname=trim(modName)//':(InitializeAdvertise) ' !-------------------------------- - call ufs_settimer(wtime) - call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldName", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent .and. isSet) then @@ -454,14 +290,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(logmsg,*) flds_scalar_index_nextsw_cday call ESMF_LogWrite(trim(subname)//' : flds_scalar_index_nextsw_cday = '//trim(logmsg), ESMF_LOGMSG_INFO) if (ChkErr(rc,__LINE__,u_FILE_u)) return -<<<<<<< HEAD -<<<<<<< HEAD -======= - else - call abort_ice(subname//'Need to set attribute ScalarFieldIdxNextSwCday') ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) -======= ->>>>>>> 46fcfbaa (changes for coldstart running) endif call NUOPC_CompAttributeGet(gcomp, name='dbug_flag', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) @@ -472,13 +300,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(logmsg,'(i6)') dbug call ESMF_LogWrite('CICE_cap: dbug = '//trim(logmsg), ESMF_LOGMSG_INFO) -<<<<<<< HEAD - call NUOPC_CompAttributeGet(gcomp, name="RunTimeLog", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) runtimelog=(trim(cvalue)=="true") - write(logmsg,*) runtimelog - call ESMF_LogWrite('CICE_cap:RunTimeLog = '//trim(logmsg), ESMF_LOGMSG_INFO) - !---------------------------------------------------------------------------- ! generate local mpi comm !---------------------------------------------------------------------------- @@ -514,8 +335,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call get_component_instance(gcomp, inst_suffix, inst_index, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return -! inst_name = "ICE"//trim(inst_suffix) - inst_name = "ICE" + inst_name = "ICE"//trim(inst_suffix) !---------------------------------------------------------------------------- ! start cice timers @@ -556,7 +376,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) depressT_in = 0.054_dbl_kind, & Tocnfrz_in = -34.0_dbl_kind*0.054_dbl_kind, & pi_in = SHR_CONST_PI, & - snowpatch_in = 0.005_dbl_kind) + snowpatch_in = 0.005_dbl_kind, & + dragio_in = 0.00536_dbl_kind) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & @@ -646,9 +467,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call ESMF_TimeGet( currTime, calkindflag=esmf_caltype, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (esmf_caltype == ESMF_CALKIND_NOLEAP) then - calendar_type = ice_calendar_noleap + calendar_type = shr_cal_noleap else if (esmf_caltype == ESMF_CALKIND_GREGORIAN) then - calendar_type = ice_calendar_gregorian + calendar_type = shr_cal_gregorian else call abort_ice( subname//'ERROR:: bad calendar for ESMF' ) end if @@ -661,7 +482,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Set the nu_diag_set flag so it's not reset later call shr_file_setLogUnit (shrlogunit) - call ufs_file_setLogUnit('./log.ice.timer',nu_timer,runtimelog) call NUOPC_CompAttributeGet(gcomp, name="diro", value=cvalue, & isPresent=isPresent, isSet=isSet, rc=rc) @@ -686,81 +506,12 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! First cice initialization phase - before initializing grid info !---------------------------------------------------------------------------- -#ifdef CESMCOUPLED - ! Determine if single column - - call NUOPC_CompAttributeGet(gcomp, name='scol_lon', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scmlon - call NUOPC_CompAttributeGet(gcomp, name='scol_lat', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scmlat - call NUOPC_CompAttributeGet(gcomp, name='scol_spval', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scol_spval - - if (scmlon > scol_spval .and. scmlat > scol_spval) then - call NUOPC_CompAttributeGet(gcomp, name='single_column_lnd_domainfile', & - value=single_column_lnd_domainfile, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (trim(single_column_lnd_domainfile) /= 'UNSET') then - single_column = .true. - else - call abort_ice('single_column_domainfile cannot be null for single column mode') - end if - call NUOPC_CompAttributeGet(gcomp, name='scol_ocnmask', value=cvalue, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scol_mask - call NUOPC_CompAttributeGet(gcomp, name='scol_ocnfrac', value=cvalue, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scol_frac - call NUOPC_CompAttributeGet(gcomp, name='scol_ni', value=cvalue, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scol_ni - call NUOPC_CompAttributeGet(gcomp, name='scol_nj', value=cvalue, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scol_nj - call NUOPC_CompAttributeGet(gcomp, name='scol_area', value=cvalue, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scol_area - - call ice_mesh_create_scolumn(scmlon, scmlat, ice_mesh, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - scol_valid = (scol_mask == 1) - if (.not. scol_valid) then - ! Read the cice namelist as part of the call to cice_init1 - ! Note that if single_column is true and scol_valid is not - will never get here - call t_startf ('cice_init1') - call cice_init1 - call t_stopf ('cice_init1') - ! Advertise fields - call ice_advertise_fields(gcomp, importState, exportState, flds_scalar_name, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call t_stopf ('cice_init_total') - - ! ******************* - ! *** RETURN HERE *** - ! ******************* - RETURN - end if - end if ! Read the cice namelist as part of the call to cice_init1 - ! Note that if single_column is true and scol_valid is not - will never get here call t_startf ('cice_init1') call cice_init1 call t_stopf ('cice_init1') - !----------------------------------------------------------------- - ! Advertise fields - !----------------------------------------------------------------- -======= ->>>>>>> bdf1a1f6 (changes for consistency w/ current emc-cice5 (#13)) - call ice_advertise_fields(gcomp, importState, exportState, flds_scalar_name, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - +#ifdef CESMCOUPLED ! Form of ocean freezing temperature ! 'minus1p8' = -1.8 C ! 'linear_salt' = -depressT * sss @@ -773,11 +524,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) end if call icepack_query_parameters( tfrz_option_out=tfrz_option) if (tfrz_option_driver /= tfrz_option) then - write(errmsg,'(a)') trim(subname)//'WARNING: tfrz_option from driver '//trim(tfrz_option_driver)//& - ' is overwriting tfrz_option from cice namelist '//trim(tfrz_option) - if (mastertask) write(nu_diag,*) trim(errmsg) - call icepack_warnings_flush(nu_diag) - call icepack_init_parameters(tfrz_option_in=tfrz_option_driver) + write(errmsg,'(a)') trim(subname)//'error: tfrz_option from driver '//trim(tfrz_option_driver)//& + ' must be the same as tfrz_option from cice namelist '//trim(tfrz_option) + call abort_ice(trim(errmsg)) endif ! Flux convergence tolerance - always use the driver attribute value @@ -788,9 +537,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) read(cvalue,*) atmiter_conv_driver call icepack_query_parameters( atmiter_conv_out=atmiter_conv) if (atmiter_conv_driver /= atmiter_conv) then - write(errmsg,'(a,d13.5,a,d13.5)') trim(subname)//'WARNING: atmiter_ from driver ',& + write(errmsg,'(a,d13.5,a,d13.5)') trim(subname)//'warning: atmiter_ from driver ',& atmiter_conv_driver,' is overwritting atmiter_conv from cice namelist ',atmiter_conv - if(mastertask) write(nu_diag,*) trim(errmsg) + write(nu_diag,*) trim(errmsg) call icepack_warnings_flush(nu_diag) call icepack_init_parameters(atmiter_conv_in=atmiter_conv_driver) end if @@ -810,26 +559,13 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ' must be the same as natmiter from cice namelist ',natmiter call abort_ice(trim(errmsg)) endif - -#else - - ! Read the cice namelist as part of the call to cice_init1 - call t_startf ('cice_init1') - call cice_init1 - call t_stopf ('cice_init1') - - !----------------------------------------------------------------- - ! Advertise fields - !----------------------------------------------------------------- - call ice_advertise_fields(gcomp, importState, exportState, flds_scalar_name, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - #endif - !---------------------------------------------------------------------------- ! Initialize grid info !---------------------------------------------------------------------------- + ! Initialize cice mesh and mask if appropriate + if (single_column .and. scol_valid) then call ice_mesh_init_tlon_tlat_area_hm() else @@ -861,7 +597,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize the cice mesh and the cice mask - if (trim(grid_format) == 'meshnc') then + if (trim(grid_type) == 'setmask') then ! In this case cap code determines the mask file call ice_mesh_setmask_from_maskfile(ice_maskfile, ice_mesh, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -875,458 +611,16 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) end if end if - call t_stopf ('cice_init_total') - if (mastertask) call ufs_logtimer(nu_timer,msec,'InitializeAdvertise time: ',runtimelog,wtime) - end subroutine InitializeAdvertise - - !=============================================================================== - - subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) - - ! Arguments - type(ESMF_GridComp) :: gcomp - type(ESMF_State) :: importState - type(ESMF_State) :: exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! Local variables -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - integer :: n - integer :: fieldcount - type(ESMF_Field) :: lfield - character(len=char_len_long) :: cvalue - real(dbl_kind) :: scol_lon - real(dbl_kind) :: scol_lat - real(dbl_kind) :: scol_spval - real(dbl_kind), pointer :: fldptr1d(:) - real(dbl_kind), pointer :: fldptr2d(:,:) - integer :: rank - character(len=char_len) :: tfrz_option ! tfrz_option from cice namelist - integer(int_kind) :: ktherm - - character(len=char_len_long) :: single_column_lnd_domainfile - character(len=char_len_long) , pointer :: lfieldnamelist(:) => null() - character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' -======= -======= - real(dbl_kind) :: eccen, obliqr, lambm0, mvelpp ->>>>>>> 46fcfbaa (changes for coldstart running) - type(ESMF_DistGrid) :: distGrid - type(ESMF_Mesh) :: Emesh, EmeshTemp - integer :: spatialDim - integer :: numOwnedElements - real(dbl_kind), pointer :: ownedElemCoords(:) - real(dbl_kind), pointer :: lat(:), latMesh(:) - real(dbl_kind), pointer :: lon(:), lonMesh(:) - integer , allocatable :: gindex_ice(:) - integer , allocatable :: gindex_elim(:) - integer , allocatable :: gindex(:) - integer :: globalID - character(ESMF_MAXSTR) :: cvalue - character(len=char_len) :: tfrz_option - character(ESMF_MAXSTR) :: convCIM, purpComp - type(ESMF_VM) :: vm - type(ESMF_Time) :: currTime ! Current time - type(ESMF_Time) :: startTime ! Start time - type(ESMF_Time) :: stopTime ! Stop time - type(ESMF_Time) :: refTime ! Ref time - type(ESMF_TimeInterval) :: timeStep ! Model timestep - type(ESMF_Calendar) :: esmf_calendar ! esmf calendar - type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type - integer :: start_ymd ! Start date (YYYYMMDD) - integer :: start_tod ! start time of day (s) - integer :: curr_ymd ! Current date (YYYYMMDD) - integer :: curr_tod ! Current time of day (s) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) - integer :: ref_ymd ! Reference date (YYYYMMDD) - integer :: ref_tod ! reference time of day (s) - integer :: yy,mm,dd ! Temporaries for time query - integer :: iyear ! yyyy - integer :: dtime ! time step - integer :: lmpicom - integer :: shrlogunit ! original log unit - character(len=char_len) :: starttype ! infodata start type - integer :: lsize ! local size of coupling array - character(len=512) :: diro - character(len=512) :: logfile - logical :: isPresent - integer :: localPet - integer :: n,c,g,i,j,m ! indices - integer :: iblk, jblk ! indices - integer :: ig, jg ! indices - integer :: ilo, ihi, jlo, jhi ! beginning and end of physical domain - type(block) :: this_block ! block information for current block - integer :: compid ! component id - character(len=char_len_long) :: tempc1,tempc2 - real(dbl_kind) :: diff_lon - integer :: npes - integer :: num_elim_global - integer :: num_elim_local - integer :: num_elim - integer :: num_ice - integer :: num_elim_gcells ! local number of eliminated gridcells - integer :: num_elim_blocks ! local number of eliminated blocks - integer :: num_total_blocks - integer :: my_elim_start, my_elim_end - real(dbl_kind) :: rad_to_deg - integer(int_kind) :: ktherm - character(*), parameter :: F00 = "('(ice_comp_nuopc) ',2a,1x,d21.14)" - character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' -<<<<<<< HEAD ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) -======= - logical :: mastertask ->>>>>>> 902e8833 (Fix logging issues for NUOPC) -======= - real(dbl_kind) :: eccen, obliqr, lambm0, mvelpp - type(ESMF_DistGrid) :: distGrid - type(ESMF_Mesh) :: Emesh, EmeshTemp - integer :: spatialDim - integer :: numOwnedElements - real(dbl_kind), pointer :: ownedElemCoords(:) - real(dbl_kind), pointer :: lat(:), latMesh(:) - real(dbl_kind), pointer :: lon(:), lonMesh(:) - integer , allocatable :: gindex_ice(:) - integer , allocatable :: gindex_elim(:) - integer , allocatable :: gindex(:) - integer :: globalID - character(ESMF_MAXSTR) :: cvalue - character(len=char_len) :: tfrz_option - character(ESMF_MAXSTR) :: convCIM, purpComp - type(ESMF_VM) :: vm - type(ESMF_Time) :: currTime ! Current time - type(ESMF_Time) :: startTime ! Start time - type(ESMF_Time) :: stopTime ! Stop time - type(ESMF_Time) :: refTime ! Ref time - type(ESMF_TimeInterval) :: timeStep ! Model timestep - type(ESMF_Calendar) :: esmf_calendar ! esmf calendar - type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type - integer :: start_ymd ! Start date (YYYYMMDD) - integer :: start_tod ! start time of day (s) - integer :: curr_ymd ! Current date (YYYYMMDD) - integer :: curr_tod ! Current time of day (s) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) - integer :: ref_ymd ! Reference date (YYYYMMDD) - integer :: ref_tod ! reference time of day (s) - integer :: yy,mm,dd ! Temporaries for time query - integer :: iyear ! yyyy - integer :: dtime ! time step - integer :: lmpicom - integer :: shrlogunit ! original log unit - character(len=char_len) :: starttype ! infodata start type - integer :: lsize ! local size of coupling array - logical :: isPresent - logical :: isSet - integer :: localPet - integer :: n,c,g,i,j,m ! indices - integer :: iblk, jblk ! indices - integer :: ig, jg ! indices - integer :: ilo, ihi, jlo, jhi ! beginning and end of physical domain - type(block) :: this_block ! block information for current block - integer :: compid ! component id - character(len=char_len_long) :: tempc1,tempc2 - real(dbl_kind) :: diff_lon - integer :: npes - integer :: num_elim_global - integer :: num_elim_local - integer :: num_elim - integer :: num_ice - integer :: num_elim_gcells ! local number of eliminated gridcells - integer :: num_elim_blocks ! local number of eliminated blocks - integer :: num_total_blocks - integer :: my_elim_start, my_elim_end - real(dbl_kind) :: rad_to_deg - integer(int_kind) :: ktherm - character(len=char_len_long) :: diag_filename = 'unset' - character(len=*), parameter :: F00 = "('(ice_comp_nuopc) ',2a,1x,d21.14)" - character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' ->>>>>>> b4afd2e5 (removal of many cpp-ifdefs) - !-------------------------------- - - rc = ESMF_SUCCESS - if (dbug > 5) call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) - - call ufs_settimer(wtime) !---------------------------------------------------------------------------- ! Second cice initialization phase -after initializing grid info !---------------------------------------------------------------------------- -<<<<<<< HEAD ! Note that cice_init2 also sets time manager info as well as mpi communicator info, -======= - - call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_VMGet(vm, mpiCommunicator=lmpicom, localPet=localPet, PetCount=npes, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - !---------------------------------------------------------------------------- - ! determine instance information - !---------------------------------------------------------------------------- - - call get_component_instance(gcomp, inst_suffix, inst_index, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - inst_name = "ICE"//trim(inst_suffix) - - !---------------------------------------------------------------------------- - ! start cice timers - !---------------------------------------------------------------------------- - - call t_startf ('cice_init_total') - - !---------------------------------------------------------------------------- - ! Initialize constants - !---------------------------------------------------------------------------- - -#ifdef CESMCOUPLED - call ice_init_constants(omega_in=SHR_CONST_OMEGA, radius_in=SHR_CONST_REARTH, & - spval_dbl_in=SHR_CONST_SPVAL) - - call icepack_init_parameters( & - secday_in = SHR_CONST_CDAY, & - rhoi_in = SHR_CONST_RHOICE, & - rhow_in = SHR_CONST_RHOSW, & - cp_air_in = SHR_CONST_CPDAIR, & - cp_ice_in = SHR_CONST_CPICE, & - cp_ocn_in = SHR_CONST_CPSW, & - gravit_in = SHR_CONST_G, & - rhofresh_in = SHR_CONST_RHOFW, & - zvir_in = SHR_CONST_ZVIR, & - vonkar_in = SHR_CONST_KARMAN, & - cp_wv_in = SHR_CONST_CPWV, & - stefan_boltzmann_in = SHR_CONST_STEBOL, & - Tffresh_in = SHR_CONST_TKFRZ, & - Lsub_in = SHR_CONST_LATSUB, & - Lvap_in = SHR_CONST_LATVAP, & - !Lfresh_in = SHR_CONST_LATICE, & ! computed in init_parameters as Lsub-Lvap - Timelt_in = SHR_CONST_TKFRZ-SHR_CONST_TKFRZ, & - Tsmelt_in = SHR_CONST_TKFRZ-SHR_CONST_TKFRZ, & - ice_ref_salinity_in = SHR_CONST_ICE_REF_SAL, & - depressT_in = 0.054_dbl_kind, & - Tocnfrz_in = -34.0_dbl_kind*0.054_dbl_kind, & - pi_in = SHR_CONST_PI, & - snowpatch_in = 0.005_dbl_kind, & - dragio_in = 0.00536_dbl_kind) - - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) -#endif - - !---------------------------------------------------------------------------- - ! Determine attributes - also needed in realize phase to get grid information - !---------------------------------------------------------------------------- - - ! Get orbital values -<<<<<<< HEAD - ! Note that these values are obtained in a call to init_orbit in ice_shortwave.F90 - ! if CESMCOUPLED is not defined -#ifdef CESMCOUPLED - mastertask = .false. - if (my_task == master_task) mastertask = .true. - call ice_orbital_init(gcomp, clock, nu_diag, mastertask, rc) -======= - call ice_orbital_init(gcomp, clock, nu_diag, my_task==master_task, rc) ->>>>>>> 46fcfbaa (changes for coldstart running) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Determine runtype and possibly nextsw_cday - call NUOPC_CompAttributeGet(gcomp, name='start_type', value=cvalue, isPresent=isPresent, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent) then - read(cvalue,*) starttype - if (trim(starttype) == trim('startup')) then - runtype = "initial" - else if (trim(starttype) == trim('continue') ) then - runtype = "continue" - restart = .true. - use_restart_time = .true. - else if (trim(starttype) == trim('branch')) then - runtype = "continue" - restart = .true. - use_restart_time = .true. - else - call abort_ice( subname//' ERROR: unknown starttype' ) - end if - - ! We assume here that on startup - nextsw_cday is just the current time - ! TOOD (mvertens, 2019-03-21): need to get the perpetual run working - if (trim(runtype) /= 'initial') then - ! Set nextsw_cday to -1 (this will skip an orbital calculation on initialization - nextsw_cday = -1.0_dbl_kind - else - call ESMF_ClockGet( clock, currTime=currTime, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeGet( currTime, dayOfYear_r8=nextsw_cday, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - else - runtype = 'initial' ! determined from the namelist in ice_init if CESMCOUPLED is not defined - end if - - ! Determine if single column - call NUOPC_CompAttributeGet(gcomp, name='single_column', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - read(cvalue,*) single_column - if (single_column) then - call NUOPC_CompAttributeGet(gcomp, name='scmlon', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scmlon - call NUOPC_CompAttributeGet(gcomp, name='scmlat', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scmlat - end if - else - single_column = .false. - end if - - ! Determine runid - call NUOPC_CompAttributeGet(gcomp, name='case_name', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) - if (isPresent .and. isSet) then - read(cvalue,*) runid - else - ! read in from the namelist in ice_init.F90 if this is not an attribute passed from the driver - runid = 'unknown' - end if - - ! Get clock information before call to cice_init - call ESMF_ClockGet( clock, & - currTime=currTime, startTime=startTime, stopTime=stopTime, refTime=RefTime, & - timeStep=timeStep, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_TimeGet( currTime, yy=yy, mm=mm, dd=dd, s=curr_tod, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ice_cal_ymd2date(yy,mm,dd,curr_ymd) - - call ESMF_TimeGet( startTime, yy=yy, mm=mm, dd=dd, s=start_tod, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ice_cal_ymd2date(yy,mm,dd,start_ymd) - - call ESMF_TimeGet( stopTime, yy=yy, mm=mm, dd=dd, s=stop_tod, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ice_cal_ymd2date(yy,mm,dd,stop_ymd) - - call ESMF_TimeGet( refTime, yy=yy, mm=mm, dd=dd, s=ref_tod, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ice_cal_ymd2date(yy,mm,dd,ref_ymd) - - call ESMF_TimeIntervalGet( timeStep, s=dtime, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - dt = real(dtime) - - call ESMF_TimeGet( currTime, calkindflag=esmf_caltype, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (esmf_caltype == ESMF_CALKIND_NOLEAP) then - calendar_type = shr_cal_noleap - else if (esmf_caltype == ESMF_CALKIND_GREGORIAN) then - calendar_type = shr_cal_gregorian - else - call abort_ice( subname//'ERROR:: bad calendar for ESMF' ) - end if - - !---------------------------------------------------------------------------- - ! Initialize cice communicators - !---------------------------------------------------------------------------- - - call init_communicate(lmpicom) ! initial setup for message passing - - !---------------------------------------------------------------------------- - ! Set cice logging - !---------------------------------------------------------------------------- - ! Note - this must be done AFTER the communicators are set - ! Note that sets the nu_diag module variable in ice_fileunits - ! Set the nu_diag_set flag so it's not reset later - -<<<<<<< HEAD -<<<<<<< HEAD - call init_communicate(lmpicom) ! initial setup for message passing - -<<<<<<< HEAD - mastertask = .false. - if (my_task == master_task) mastertask = .true. - call set_component_logging(gcomp, mastertask, nu_diag, shrlogunit, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return -======= -#ifdef CESMCOUPLED -======= ->>>>>>> b4afd2e5 (removal of many cpp-ifdefs) - if (my_task == master_task) then - call NUOPC_CompAttributeGet(gcomp, name="diro", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - diag_filename = trim(cvalue) - end if - call NUOPC_CompAttributeGet(gcomp, name="logfile", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - diag_filename = trim(diag_filename) // '/' // trim(cvalue) - end if - if (trim(diag_filename) /= 'unset') then - open(newunit=nu_diag, file=trim(diag_filename)) - nu_diag_set = .true. - end if -======= - call NUOPC_CompAttributeGet(gcomp, name="diro", value=cvalue, & - isPresent=isPresent, isSet=isSet, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - diag_filename = trim(cvalue) - end if - call NUOPC_CompAttributeGet(gcomp, name="logfile", value=cvalue, & - isPresent=isPresent, isSet=isSet, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - diag_filename = trim(diag_filename) // '/' // trim(cvalue) - end if - - if (trim(diag_filename) /= 'unset') then - call set_component_logging(gcomp, mastertask, nu_diag, shrlogunit, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - nu_diag_set = .true. ->>>>>>> 519d3392 (Update CICE to latest Consortium master (#26)) - end if -<<<<<<< HEAD ->>>>>>> 46fcfbaa (changes for coldstart running) - nu_diag_set = .true. -======= ->>>>>>> b4afd2e5 (removal of many cpp-ifdefs) - - !---------------------------------------------------------------------------- - ! Initialize cice - !---------------------------------------------------------------------------- - - ! Note that cice_init also sets time manager info as well as mpi communicator info, ->>>>>>> 183218aa (updated orbital calculations needed for cesm) ! including master_task and my_task -<<<<<<< HEAD ! Note that cice_init2 calls ice_init() which in turn calls icepack_init_parameters ! which sets the tfrz_option call t_startf ('cice_init2') call cice_init2() call t_stopf ('cice_init2') -======= - - call t_startf ('cice_init') -<<<<<<< HEAD -<<<<<<< HEAD -#endif - call cice_init -#ifdef CESMCOUPLED -======= - call cice_init( lmpicom ) ->>>>>>> 46fcfbaa (changes for coldstart running) -======= - call cice_init() ->>>>>>> b4afd2e5 (removal of many cpp-ifdefs) - call t_stopf ('cice_init') !---------------------------------------------------------------------------- ! reset shr logging to my log file @@ -1339,18 +633,17 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) file=__FILE__, line=__LINE__) ! Now write output to nu_diag - this must happen AFTER call to cice_init - if (localPet == 0) then - write(nu_diag,F00) trim(subname),' cice init nextsw_cday = ',nextsw_cday - write(nu_diag,*) trim(subname),' tfrz_option = ',trim(tfrz_option) + if (mastertask) then + write(nu_diag,'(a,d21.14)') trim(subname)//' cice init nextsw_cday = ',nextsw_cday + write(nu_diag,'(a)') trim(subname)//' tfrz_option = '//trim(tfrz_option) if (ktherm == 2 .and. trim(tfrz_option) /= 'mushy') then write(nu_diag,*) trim(subname),' Warning: Using ktherm = 2 and tfrz_option = ', trim(tfrz_option) endif - write(nu_diag,*) trim(subname),' inst_name = ',trim(inst_name) - write(nu_diag,*) trim(subname),' inst_index = ',inst_index - write(nu_diag,*) trim(subname),' inst_suffix = ',trim(inst_suffix) + write(nu_diag,'(a )') trim(subname)//' inst_name = '//trim(inst_name) + write(nu_diag,'(a,i8 )') trim(subname)//' inst_index = ',inst_index + write(nu_diag,'(a )') trim(subname)//' inst_suffix = ',trim(inst_suffix) endif ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) !--------------------------------------------------------------------------- ! use EClock to reset calendar information on initial start !--------------------------------------------------------------------------- @@ -1386,82 +679,21 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) end if call abort_ice(subname//' :: ERROR idate lt zero') endif -<<<<<<< HEAD myear = (idate/10000) ! integer year of basedate mmonth= (idate-myear*10000)/100 ! integer month of basedate mday = idate-myear*10000-mmonth*100 ! day of month of basedate -======= - iyear = (idate/10000) ! integer year of basedate - mmonth= (idate-iyear*10000)/100 ! integer month of basedate - mday = idate-iyear*10000-mmonth*100 ! day of month of basedate ->>>>>>> 519d3392 (Update CICE to latest Consortium master (#26)) if (my_task == master_task) then write(nu_diag,*) trim(subname),' curr_ymd = ',curr_ymd write(nu_diag,*) trim(subname),' cice year_init = ',year_init write(nu_diag,*) trim(subname),' cice start date = ',idate -<<<<<<< HEAD -<<<<<<< HEAD write(nu_diag,*) trim(subname),' cice start ymds = ',myear,mmonth,mday,start_tod write(nu_diag,*) trim(subname),' cice calendar_type = ',trim(calendar_type) endif -======= - write(nu_diag,*) trim(subname),' cice start ymds = ',iyear,month,mday,start_tod -======= - write(nu_diag,*) trim(subname),' cice start ymds = ',iyear,mmonth,mday,start_tod ->>>>>>> 519d3392 (Update CICE to latest Consortium master (#26)) - write(nu_diag,*) trim(subname),' cice calendar_type = ',trim(calendar_type) - endif - -#ifdef CESMCOUPLED - if (calendar_type == "GREGORIAN" .or. & - calendar_type == "Gregorian" .or. & - calendar_type == "gregorian") then - call time2sec(iyear-(year_init-1),mmonth,mday,time) - else - call time2sec(iyear-year_init,mmonth,mday,time) - endif -#endif -<<<<<<< HEAD - time = time+start_tod ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) end if call calendar() ! update calendar info -======= - timesecs = timesecs+start_tod - end if - - call calendar() ! update calendar info - if (write_ic) then - call accum_hist(dt) ! write initial conditions - end if ->>>>>>> 519d3392 (Update CICE to latest Consortium master (#26)) - - !---------------------------------------------------------------------------- - ! reset shr logging to my log file - !---------------------------------------------------------------------------- - - call icepack_query_parameters(ktherm_out=ktherm) - call icepack_query_parameters(tfrz_option_out=tfrz_option) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - ! Now write output to nu_diag - this must happen AFTER call to cice_init - if (mastertask) then - write(nu_diag,'(a,d21.14)') trim(subname)//' cice init nextsw_cday = ',nextsw_cday - write(nu_diag,'(a)') trim(subname)//' tfrz_option = '//trim(tfrz_option) - if (ktherm == 2 .and. trim(tfrz_option) /= 'mushy') then - write(nu_diag,*) trim(subname),' Warning: Using ktherm = 2 and tfrz_option = ', trim(tfrz_option) - endif - write(nu_diag,'(a )') trim(subname)//' inst_name = '//trim(inst_name) - write(nu_diag,'(a,i8 )') trim(subname)//' inst_index = ',inst_index - write(nu_diag,'(a )') trim(subname)//' inst_suffix = ',trim(inst_suffix) - endif - - if (write_ic) then call accum_hist(dt) ! write initial conditions end if @@ -1473,71 +705,129 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call ice_prescribed_init(clock, ice_mesh, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + !----------------------------------------------------------------- + ! Advertise fields + !----------------------------------------------------------------- + + ! NOTE: the advertise phase needs to be called after the ice + ! initialization since the number of ice categories is needed for + ! ice_fraction_n and mean_sw_pen_to_ocn_ifrac_n + call ice_advertise_fields(gcomp, importState, exportState, flds_scalar_name, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call t_stopf ('cice_init_total') + + end subroutine InitializeAdvertise + + !=============================================================================== + + subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) + + ! Arguments + type(ESMF_GridComp) :: gcomp + type(ESMF_State) :: importState + type(ESMF_State) :: exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + ! Local variables + integer :: n + integer :: fieldcount + type(ESMF_Field) :: lfield + character(len=char_len_long) :: cvalue + real(dbl_kind) :: scol_lon + real(dbl_kind) :: scol_lat + real(dbl_kind) :: scol_spval + real(dbl_kind), pointer :: fldptr1d(:) + real(dbl_kind), pointer :: fldptr2d(:,:) + integer :: rank + character(len=char_len_long) :: single_column_lnd_domainfile + character(len=char_len_long) , pointer :: lfieldnamelist(:) => null() + character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' + !-------------------------------- + + rc = ESMF_SUCCESS + if (dbug > 5) call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) + #ifdef CESMCOUPLED - ! if single column is not valid - set all export state fields to zero and return - if (single_column .and. .not. scol_valid) then - write(nu_diag,'(a)')' (ice_comp_nuopc) single column mode point does not contain any ocn/ice '& - //' - setting all export data to 0' - call ice_realize_fields(gcomp, mesh=ice_mesh, & - flds_scalar_name=flds_scalar_name, flds_scalar_num=flds_scalar_num, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name='scol_lon', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) scmlon + call NUOPC_CompAttributeGet(gcomp, name='scol_lat', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) scmlat + call NUOPC_CompAttributeGet(gcomp, name='scol_spval', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) scol_spval + + if (scmlon > scol_spval .and. scmlat > scol_spval) then + call NUOPC_CompAttributeGet(gcomp, name='single_column_lnd_domainfile', & + value=single_column_lnd_domainfile, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) + if (trim(single_column_lnd_domainfile) /= 'UNSET') then + single_column = .true. + else + call abort_ice('single_column_domainfile cannot be null for single column mode') + end if + call NUOPC_CompAttributeGet(gcomp, name='scol_ocnmask', value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) scol_mask + call NUOPC_CompAttributeGet(gcomp, name='scol_ocnfrac', value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) scol_frac + call NUOPC_CompAttributeGet(gcomp, name='scol_ni', value=cvalue, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(lfieldnamelist(fieldCount)) - call ESMF_StateGet(exportState, itemNameList=lfieldnamelist, rc=rc) + read(cvalue,*) scol_ni + call NUOPC_CompAttributeGet(gcomp, name='scol_nj', value=cvalue, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - do n = 1, fieldCount - if (trim(lfieldnamelist(n)) /= flds_scalar_name) then - call ESMF_StateGet(exportState, itemName=trim(lfieldnamelist(n)), field=lfield, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldGet(lfield, rank=rank, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (rank == 2) then - call ESMF_FieldGet(lfield, farrayPtr=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr2d(:,:) = 0._dbl_kind - else - call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._dbl_kind + read(cvalue,*) scol_nj + + call ice_mesh_create_scolumn(scmlon, scmlat, ice_mesh, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + scol_valid = (scol_mask == 1) + if (.not. scol_valid) then + ! if single column is not valid - set all export state fields to zero and return + write(nu_diag,'(a)')' (ice_comp_nuopc) single column mode point does not contain any ocn/ice '& + //' - setting all export data to 0' + call ice_realize_fields(gcomp, mesh=ice_mesh, & + flds_scalar_name=flds_scalar_name, flds_scalar_num=flds_scalar_num, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + call ESMF_StateGet(exportState, itemNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1, fieldCount + if (trim(lfieldnamelist(n)) /= flds_scalar_name) then + call ESMF_StateGet(exportState, itemName=trim(lfieldnamelist(n)), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(lfield, rank=rank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (rank == 2) then + call ESMF_FieldGet(lfield, farrayPtr=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr2d(:,:) = 0._dbl_kind + else + call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._dbl_kind + end if end if - end if - enddo -<<<<<<< HEAD - deallocate(lfieldnamelist) - ! ******************* - ! *** RETURN HERE *** - ! ******************* - RETURN - else if(single_column) then - write(nu_diag,'(a,3(f10.5,2x))')' (ice_comp_nuopc) single column mode lon/lat/frac is ',& - scmlon,scmlat,scol_frac + enddo + deallocate(lfieldnamelist) + ! ******************* + ! *** RETURN HERE *** + ! ******************* + RETURN + else + write(nu_diag,'(a,3(f10.5,2x))')' (ice_comp_nuopc) single column mode lon/lat/frac is ',& + scmlon,scmlat,scol_frac + end if + else + single_column = .false. end if #endif -======= - enddo - - ! error check differences between internally generated lons and those read in - do n = 1,lsize - diff_lon = abs(lonMesh(n) - lon(n)) - if ( (diff_lon > 1.e2 .and. abs(diff_lon - 360_dbl_kind) > 1.e-1) .or.& - (diff_lon > 1.e-3 .and. diff_lon < 1._dbl_kind) ) then - !write(6,100)n,lonMesh(n),lon(n), diff_lon -100 format('ERROR: CICE n, lonmesh(n), lon(n), diff_lon = ',i6,2(f21.13,3x),d21.5) - !call abort_ice() - end if - if (abs(latMesh(n) - lat(n)) > 1.e-1) then - !write(6,101)n,latMesh(n),lat(n), abs(latMesh(n)-lat(n)) -101 format('ERROR: CICE n, latmesh(n), lat(n), diff_lat = ',i6,2(f21.13,3x),d21.5) - !call abort_ice() - end if - end do - - ! deallocate memory - deallocate(ownedElemCoords) - deallocate(lon, lonMesh) - deallocate(lat, latMesh) ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) !----------------------------------------------------------------- ! Realize the actively coupled fields @@ -1547,26 +837,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) flds_scalar_name=flds_scalar_name, flds_scalar_num=flds_scalar_num, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return -<<<<<<< HEAD -<<<<<<< HEAD -======= -#ifdef CESMCOUPLED -======= ->>>>>>> b4afd2e5 (removal of many cpp-ifdefs) - !----------------------------------------------------------------- - ! Prescribed ice initialization - first get compid - !----------------------------------------------------------------- - - call NUOPC_CompAttributeGet(gcomp, name='MCTID', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - read(cvalue,*) compid ! convert from string to integer - else - compid = 0 - end if - call ice_prescribed_init(lmpicom, compid, gindex_ice) - ->>>>>>> 183218aa (updated orbital calculations needed for cesm) !----------------------------------------------------------------- ! Create cice export state !----------------------------------------------------------------- @@ -1581,28 +851,16 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return -<<<<<<< HEAD -======= - ! TODO (mvertens, 2018-12-21): fill in iceberg_prognostic as .false. - if (debug_export > 0 .and. my_task==master_task) then - call State_fldDebug(exportState, flds_scalar_name, 'cice_export:', & - idate, msec, nu_diag, rc=rc) - end if - ->>>>>>> b4afd2e5 (removal of many cpp-ifdefs) !-------------------------------- ! diagnostics !-------------------------------- -<<<<<<< HEAD ! TODO (mvertens, 2018-12-21): fill in iceberg_prognostic as .false. if (debug_export > 0 .and. my_task==master_task) then call State_fldDebug(exportState, flds_scalar_name, 'cice_export:', & idate, msec, nu_diag, rc=rc) end if -======= ->>>>>>> bdf1a1f6 (changes for consistency w/ current emc-cice5 (#13)) if (dbug > 0) then call state_diagnose(exportState,subname//':ES',rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -1610,21 +868,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (dbug > 5) call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) -<<<<<<< HEAD -<<<<<<< HEAD -======= -#ifdef CESMCOUPLED -======= ->>>>>>> 46fcfbaa (changes for coldstart running) - call t_stopf ('cice_init_total') - - deallocate(gindex_ice) - deallocate(gindex) - ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) call flush_fileunit(nu_diag) - if (mastertask) call ufs_logtimer(nu_timer,msec,'InitializeRealize time: ',runtimelog,wtime) end subroutine InitializeRealize !=============================================================================== @@ -1664,32 +909,13 @@ subroutine ModelAdvance(gcomp, rc) integer :: tod_sync ! Sync current time of day (sec) character(char_len_long) :: restart_date character(char_len_long) :: restart_filename -<<<<<<< HEAD -<<<<<<< HEAD - logical :: isPresent, isSet -======= - logical :: isPresent -======= logical :: isPresent, isSet ->>>>>>> 46fcfbaa (changes for coldstart running) - character(*) , parameter :: F00 = "('(ice_comp_nuopc) ',2a,i8,d21.14)" ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) ' character(char_len_long) :: msgString !-------------------------------- rc = ESMF_SUCCESS - if (mastertask) call ufs_logtimer(nu_timer,msec,'ModelAdvance time since last step: ',runtimelog,wtime) - call ufs_settimer(wtime) - - call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) - - if (single_column .and. .not. scol_valid) then - ! ******************* - ! *** RETURN HERE *** - ! ******************* - RETURN - end if + if(profile_memory) call ESMF_VMLogMemInfo("Entering CICE Model_ADVANCE: ") if (dbug > 5) call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) @@ -1757,54 +983,8 @@ subroutine ModelAdvance(gcomp, rc) !-------------------------------- ! Obtain orbital values !-------------------------------- -<<<<<<< HEAD -<<<<<<< HEAD - call ice_orbital_init(gcomp, clock, nu_diag, my_task==master_task, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return -======= -#ifdef CESMCOUPLED - call ice_orbital_init(gcomp, clock, nu_diag, my_task==master_task, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return -#else - ! Start with icepack values then update with values defined in configure file if they exist - ! tcx, This should be identical with initialization, why do it again? Get rid of it - call icepack_query_orbit(eccen_out=eccen, mvelpp_out=mvelpp, lambm0_out=lambm0, obliqr_out=obliqr) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - call NUOPC_CompAttributeGet(gcomp, name='orb_eccen', value=cvalue, isPresent=isPresent, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent) then - read(cvalue,*) eccen - end if - call NUOPC_CompAttributeGet(gcomp, name='orb_obliqr', value=cvalue, isPresent=isPresent, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent) then - read(cvalue,*) obliqr - end if - call NUOPC_CompAttributeGet(gcomp, name='orb_lambm0', value=cvalue, isPresent=isPresent, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent) then - read(cvalue,*) lambm0 - end if - call NUOPC_CompAttributeGet(gcomp, name='orb_mvelpp', value=cvalue, isPresent=isPresent, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent) then - read(cvalue,*) mvelpp - end if - - call icepack_init_orbit(eccen_in=eccen, mvelpp_in=mvelpp, & - lambm0_in=lambm0, obliqr_in=obliqr) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) -#endif ->>>>>>> 183218aa (updated orbital calculations needed for cesm) -======= call ice_orbital_init(gcomp, clock, nu_diag, my_task==master_task, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ->>>>>>> 46fcfbaa (changes for coldstart running) !-------------------------------- ! check that cice internal time is in sync with master clock before timestep update @@ -1865,37 +1045,14 @@ subroutine ModelAdvance(gcomp, rc) call t_barrierf('cice_run_import_BARRIER',mpi_comm_ice) call t_startf ('cice_run_import') -<<<<<<< HEAD -<<<<<<< HEAD - call ice_import(importState, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return -======= - call ice_timer_start(timer_cplrecv) -#endif - - call ice_import(importState, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - -#ifdef CESMCOUPLED - call ice_timer_stop(timer_cplrecv) ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) -======= call ice_import(importState, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ->>>>>>> 46fcfbaa (changes for coldstart running) call t_stopf ('cice_run_import') ! write Debug output if (debug_import > 0 .and. my_task==master_task) then call State_fldDebug(importState, flds_scalar_name, 'cice_import:', & idate, msec, nu_diag, rc=rc) -<<<<<<< HEAD - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - if (dbug > 0) then - call state_diagnose(importState,subname//':IS',rc=rc) -======= ->>>>>>> 519d3392 (Update CICE to latest Consortium master (#26)) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if if (dbug > 0) then @@ -1907,13 +1064,9 @@ subroutine ModelAdvance(gcomp, rc) ! Advance cice and timestep update !-------------------------------- -<<<<<<< HEAD if(profile_memory) call ESMF_VMLogMemInfo("Entering CICE_Run : ") call CICE_Run() if(profile_memory) call ESMF_VMLogMemInfo("Leaving CICE_Run : ") -======= - call CICE_Run() ->>>>>>> 46fcfbaa (changes for coldstart running) !-------------------------------- ! Create export state @@ -1921,37 +1074,14 @@ subroutine ModelAdvance(gcomp, rc) call t_barrierf('cice_run_export_BARRIER',mpi_comm_ice) call t_startf ('cice_run_export') -<<<<<<< HEAD -<<<<<<< HEAD - call ice_export(exportState, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return -======= - call ice_timer_start(timer_cplsend) -#endif - - call ice_export(exportState, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - -#ifdef CESMCOUPLED - call ice_timer_stop(timer_cplsend) ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) -======= call ice_export(exportState, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ->>>>>>> 46fcfbaa (changes for coldstart running) call t_stopf ('cice_run_export') ! write Debug output if (debug_export > 0 .and. my_task==master_task) then call State_fldDebug(exportState, flds_scalar_name, 'cice_export:', & idate, msec, nu_diag, rc=rc) -<<<<<<< HEAD - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - if (dbug > 0) then - call state_diagnose(exportState,subname//':ES',rc=rc) -======= ->>>>>>> 519d3392 (Update CICE to latest Consortium master (#26)) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if if (dbug > 0) then @@ -1997,8 +1127,7 @@ subroutine ModelAdvance(gcomp, rc) if (dbug > 5) call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) - if (mastertask) call ufs_logtimer(nu_timer,msec,'ModelAdvance time: ',runtimelog,wtime) - call ufs_settimer(wtime) + if(profile_memory) call ESMF_VMLogMemInfo("Leaving CICE Model_ADVANCE: ") end subroutine ModelAdvance @@ -2144,7 +1273,6 @@ subroutine ModelFinalize(gcomp, rc) !-------------------------------- rc = ESMF_SUCCESS - call ufs_settimer(wtime) if (dbug > 5) call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) if (my_task == master_task) then write(nu_diag,F91) @@ -2153,13 +1281,10 @@ subroutine ModelFinalize(gcomp, rc) end if if (dbug > 5) call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) - if(mastertask) call ufs_logtimer(nu_timer,msec,'ModelFinalize time: ',runtimelog,wtime) - end subroutine ModelFinalize !=============================================================================== -#ifdef CESMCOUPLED subroutine ice_orbital_init(gcomp, clock, logunit, mastertask, rc) !---------------------------------------------------------- @@ -2174,33 +1299,6 @@ subroutine ice_orbital_init(gcomp, clock, logunit, mastertask, rc) integer , intent(out) :: rc ! output error ! local variables -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - real(dbl_kind) :: eccen, obliqr, lambm0, mvelpp - character(len=char_len_long) :: msgstr ! temporary - character(len=char_len_long) :: cvalue ! temporary - type(ESMF_Time) :: CurrTime ! current time - integer :: year ! model year at current time - integer :: orb_year ! orbital year for current orbital computation - logical :: lprint - logical :: first_time = .true. -======= - real(r8) :: eccen, obliqr, lambm0, mvelpp - character(len=CL) :: msgstr ! temporary - character(len=CL) :: cvalue ! temporary -======= - real(dbl_kind) :: eccen, obliqr, lambm0, mvelpp - character(len=char_len_long) :: msgstr ! temporary - character(len=char_len_long) :: cvalue ! temporary ->>>>>>> ce8e5a97 (update CICE6 to support coupling with UFS) - type(ESMF_Time) :: CurrTime ! current time - integer :: year ! model year at current time - integer :: orb_year ! orbital year for current orbital computation - logical :: lprint - logical :: first_time = .true. ->>>>>>> 183218aa (updated orbital calculations needed for cesm) -======= real(dbl_kind) :: eccen, obliqr, lambm0, mvelpp character(len=char_len_long) :: msgstr ! temporary character(len=char_len_long) :: cvalue ! temporary @@ -2209,18 +1307,14 @@ subroutine ice_orbital_init(gcomp, clock, logunit, mastertask, rc) integer :: orb_year ! orbital year for current orbital computation logical :: lprint logical :: first_time = .true. ->>>>>>> b4afd2e5 (removal of many cpp-ifdefs) character(len=*) , parameter :: subname = "(cice_orbital_init)" !------------------------------------------------------------------------------- rc = ESMF_SUCCESS -<<<<<<< HEAD #ifndef CESMCOUPLED return #else -======= ->>>>>>> 183218aa (updated orbital calculations needed for cesm) if (first_time) then ! Determine orbital attributes from input @@ -2327,8 +1421,6 @@ subroutine ice_orbital_init(gcomp, clock, logunit, mastertask, rc) file=__FILE__, line=__LINE__) first_time = .false. -<<<<<<< HEAD -<<<<<<< HEAD #endif end subroutine ice_orbital_init @@ -2351,99 +1443,4 @@ subroutine ice_cal_ymd2date(year, month, day, date) end subroutine ice_cal_ymd2date -======= -======= - end subroutine ice_orbital_init - -#else - - subroutine ice_orbital_init(gcomp, clock, logunit, mastertask, rc) - - ! dummy input/output arguments - type(ESMF_GridComp) :: gcomp - type(ESMF_Clock) , intent(in) :: clock - integer , intent(in) :: logunit - logical , intent(in) :: mastertask - integer , intent(out) :: rc ! output error - - ! local variables - real(dbl_kind) :: eccen, obliqr, lambm0, mvelpp - logical :: first_time = .true. - character(len=*) , parameter :: subname = "(cice_orbital_init)" - !-------------------------------- - - rc = ESMF_SUCCESS - - if (first_time) then - ! Start with icepack values then update with values defined in configure file if they exist - ! tcx, This should be identical with initialization, why do it again? Get rid of it - call icepack_query_orbit(eccen_out=eccen, mvelpp_out=mvelpp, lambm0_out=lambm0, obliqr_out=obliqr) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - first_time = .false. - end if ->>>>>>> 46fcfbaa (changes for coldstart running) - - end subroutine ice_orbital_init - -#endif - !=============================================================================== - - subroutine ice_cal_ymd2date(year, month, day, date) - - implicit none - - ! !INPUT/OUTPUT PARAMETERS: - - integer,intent(in ) :: year,month,day ! calendar year,month,day - integer,intent(out) :: date ! coded (yyyymmdd) calendar date - - !--- local --- - character(*),parameter :: subName = "(ice_cal_ymd2date)" - - !------------------------------------------------------------------------------- - ! NOTE: - ! this calendar has a year zero (but no day or month zero) - !------------------------------------------------------------------------------- - - date = abs(year)*10000 + month*100 + day ! coded calendar date - if (year < 0) date = -date - - end subroutine ice_cal_ymd2date - - !=============================================================================== - -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> 183218aa (updated orbital calculations needed for cesm) -======= -#ifndef CESMCOUPLED - subroutine shr_file_setLogUnit(nunit) - integer, intent(in) :: nunit - ! do nothing for this stub - its just here to replace - ! having cppdefs in the main program - end subroutine shr_file_setLogUnit - subroutine shr_file_getLogUnit(nunit) - integer, intent(in) :: nunit - ! do nothing for this stub - its just here to replace - ! having cppdefs in the main program - end subroutine shr_file_getLogUnit - - subroutine t_startf(string) - character(len=*) :: string - end subroutine t_startf - subroutine t_stopf(string) - character(len=*) :: string - end subroutine t_stopf - subroutine t_barrierf(string, comm) - character(len=*) :: string - integer:: comm - end subroutine t_barrierf -#endif -======= ->>>>>>> b4afd2e5 (removal of many cpp-ifdefs) - ->>>>>>> 46fcfbaa (changes for coldstart running) end module ice_comp_nuopc