diff --git a/config_src/mct_driver/coupler_indices.F90 b/config_src/mct_driver/coupler_indices.F90 index 24e52fa059..177da71120 100644 --- a/config_src/mct_driver/coupler_indices.F90 +++ b/config_src/mct_driver/coupler_indices.F90 @@ -9,6 +9,7 @@ module coupler_indices ! MOM types use MOM_grid, only : ocean_grid_type + use MOM_surface_forcing, only: ice_ocean_boundary_type ! MOM functions use MOM_domains, only : pass_var use MOM_variables, only : surface @@ -20,6 +21,7 @@ module coupler_indices public alloc_sbuffer public coupler_indices_init public time_avg_state + public fill_ice_ocean_bnd type, public :: cpl_indices @@ -358,4 +360,78 @@ subroutine ocn_export(ind, grid, o2x) end subroutine ocn_export + + subroutine fill_ice_ocean_bnd(ice_ocean_boundary, grid, x2o_o, ind) + type(ice_ocean_boundary_type), intent(in) :: ice_ocean_boundary !< A type for the ice ocean boundary + type(ocean_grid_type), intent(in) :: grid + !type(mct_aVect), intent(in) :: x2o_o + real(kind=8), intent(in) :: x2o_o(:,:) + type(cpl_indices), intent(inout) :: ind + + ! local variables + integer :: i, j, k, var + + ! variable that are not in ice_ocean_boundary: + ! latent (x2o_Foxx_lat) + ! surface Stokes drift, x-comp. (x2o_Sw_ustokes) + ! surface Stokes drift, y-comp. (x2o_Sw_vstokes) + ! wave model langmuir multiplier (x2o_Sw_lamult) + + ! biogeochemistry + ! Black Carbon hydrophobic release from sea ice component (x2o_Fioi_bcpho) + ! Black Carbon hydrophilic release from sea ice component (x2o_Fioi_bcphi) + ! dust release from sea ice component (x2o_Fioi_flxdst) + ! Black Carbon hydrophilic dry deposition (x2o_Faxa_bcphidry) + ! Black Carbon hydrophobic dry deposition (x2o_Faxa_bcphodry) + ! Black Carbon hydrophobic wet deposition (x2o_Faxa_bcphiwet) + ! Organic Carbon hydrophilic dry deposition (x2o_Faxa_ocphidry) + ! Organic Carbon hydrophobic dry deposition (x2o_Faxa_ocphodry) + ! Organic Carbon hydrophilic dry deposition (x2o_Faxa_ocphiwet) + ! Sizes 1 to 4 dust - wet deposition (x2o_Faxa_dstwet?) + ! Sizes 1 to 4 dust - dry deposition (x2o_Faxa_dstdry?) + + + ! need wind_stress_multiplier? + + write(*,*) 'max. k is:', (grid%jec-grid%jsc) * (grid%iec-grid%isc) + ! zonal wind stress (taux) + var = ind%x2o_Foxx_taux + write(*,*) 'taux', SIZE(x2o_o(:,var)) + write(*,*) 'ice_ocean_boundary%u_flux', SIZE(ice_ocean_boundary%u_flux(:,:)) + k = 0 + do j = grid%jsc, grid%jec + do i = grid%isc, grid%iec + k = k + 1 ! Increment position within gindex + ! zonal wind stress (taux) + ice_ocean_boundary%u_flux(i,j) = x2o_o(k,ind%x2o_Foxx_taux) + ! meridional wind stress (tauy) + ice_ocean_boundary%v_flux(i,j) = x2o_o(k,ind%x2o_Foxx_tauy) + ! sensible heat flux + ice_ocean_boundary%t_flux(i,j) = x2o_o(k,ind%x2o_Foxx_sen) + ! salt flux + ice_ocean_boundary%salt_flux(i,j) = x2o_o(k,ind%x2o_Fioi_salt) + ! heat flux from snow & ice melt + ice_ocean_boundary%calving_hflx(i,j) = x2o_o(k,ind%x2o_Fioi_melth) + ! snow melt flux + ice_ocean_boundary%fprec(i,j) = x2o_o(k,ind%x2o_Fioi_meltw) + ! river runoff flux + ice_ocean_boundary%runoff(i,j) = x2o_o(k,ind%x2o_Foxx_rofl) + ! ice runoff flux + ice_ocean_boundary%calving(i,j) = x2o_o(k,ind%x2o_Foxx_rofi) + ! liquid precipitation (rain) + ice_ocean_boundary%lprec(i,j) = x2o_o(k,ind%x2o_Faxa_rain) + ! froze precipitation (snow) + ice_ocean_boundary%fprec(i,j) = x2o_o(k,ind%x2o_Faxa_snow) + !!!!!!! LONGWAVE NEEDS TO BE FIXED !!!!!!! + ! longwave radiation (up) + ice_ocean_boundary%lw_flux(i,j) = x2o_o(k,ind%x2o_Foxx_lwup) + ! longwave radiation (down) + ice_ocean_boundary%lw_flux(i,j) = x2o_o(k,ind%x2o_Faxa_lwdn) + !!!!!!! SHORTWAVE NEEDS TO BE COMBINED !!!!!!! + ! net short-wave heat flux + ice_ocean_boundary%u_flux(i,j) = x2o_o(k,ind%x2o_Foxx_swnet) + enddo + enddo + + end subroutine fill_ice_ocean_bnd end module coupler_indices diff --git a/config_src/mct_driver/ocn_comp_mct.F90 b/config_src/mct_driver/ocn_comp_mct.F90 index ae944a30fc..69deabfce8 100644 --- a/config_src/mct_driver/ocn_comp_mct.F90 +++ b/config_src/mct_driver/ocn_comp_mct.F90 @@ -11,40 +11,41 @@ module ocn_comp_mct ! !REVISION HISTORY: ! ! !USES: - use ESMF, only: ESMF_clock, ESMF_time, ESMF_timeInterval - use ESMF, only: ESMF_ClockGet, ESMF_TimeGet, ESMF_TimeIntervalGet - use seq_cdata_mod, only: seq_cdata - use seq_cdata_mod, only: seq_cdata_setptrs - use mct_mod, only: mct_gsMap, mct_gsmap_init, mct_gsMap_lsize, mct_gsmap_orderedpoints - use mct_mod, only: mct_aVect, mct_aVect_init, mct_aVect_zero, mct_aVect_nRattr - use mct_mod, only: mct_gGrid, mct_gGrid_init, mct_gGrid_importRAttr, mct_gGrid_importIAttr - use seq_flds_mod, only: seq_flds_x2o_fields, & + use ESMF, only: ESMF_clock, ESMF_time, ESMF_timeInterval + use ESMF, only: ESMF_ClockGet, ESMF_TimeGet, ESMF_TimeIntervalGet + use seq_cdata_mod, only: seq_cdata + use seq_cdata_mod, only: seq_cdata_setptrs + use mct_mod, only: mct_gsMap, mct_gsmap_init, mct_gsMap_lsize, mct_gsmap_orderedpoints + use mct_mod, only: mct_aVect, mct_aVect_init, mct_aVect_zero, mct_aVect_nRattr + use mct_mod, only: mct_gGrid, mct_gGrid_init, mct_gGrid_importRAttr, mct_gGrid_importIAttr + use seq_flds_mod, only: seq_flds_x2o_fields, & seq_flds_o2x_fields, & SEQ_FLDS_DOM_COORD, & SEQ_FLDS_DOM_other - use seq_infodata_mod, only: seq_infodata_type, & + use seq_infodata_mod, only: seq_infodata_type, & seq_infodata_GetData, & seq_infodata_start_type_start, & seq_infodata_start_type_cont, & seq_infodata_start_type_brnch, & seq_infodata_PutData - use seq_comm_mct, only: seq_comm_name, seq_comm_inst, seq_comm_suffix - use seq_timemgr_mod, only: seq_timemgr_EClockGetData, seq_timemgr_RestartAlarmIsOn - use perf_mod, only: t_startf, t_stopf - use shr_kind_mod, only: SHR_KIND_R8 + use seq_comm_mct, only: seq_comm_name, seq_comm_inst, seq_comm_suffix + use seq_timemgr_mod, only: seq_timemgr_EClockGetData, seq_timemgr_RestartAlarmIsOn + use perf_mod, only: t_startf, t_stopf + use shr_kind_mod, only: SHR_KIND_R8 ! From MOM6 - use ocean_model_mod, only: ocean_state_type, ocean_public_type, ocean_model_init_sfc - use ocean_model_mod, only: ocean_model_init, get_state_pointers - use ocean_model_mod, only: ice_ocean_boundary_type, update_ocean_model - use MOM_domains, only: MOM_infra_init, num_pes, root_pe, pe_here - use MOM_grid, only: ocean_grid_type, get_global_grid_size - use MOM_variables, only: surface - use MOM_error_handler, only: MOM_error, FATAL, is_root_pe - use MOM_time_manager, only: time_type, set_date, set_calendar_type, NOLEAP - use coupler_indices, only: coupler_indices_init, cpl_indices, alloc_sbuffer, time_avg_state - use ocn_import_export, only: ocn_Export + use ocean_model_mod, only: ocean_state_type, ocean_public_type, ocean_model_init_sfc + use ocean_model_mod, only: ocean_model_init, get_state_pointers, update_ocean_model + use MOM_surface_forcing, only: ice_ocean_boundary_type + use MOM_domains, only: MOM_infra_init, num_pes, root_pe, pe_here + use MOM_grid, only: ocean_grid_type, get_global_grid_size + use MOM_variables, only: surface + use MOM_error_handler, only: MOM_error, FATAL, is_root_pe + use MOM_time_manager, only: time_type, set_date, set_calendar_type, NOLEAP + use coupler_indices, only: coupler_indices_init, cpl_indices, alloc_sbuffer + use coupler_indices, only: time_avg_state, fill_ice_ocean_bnd + use ocn_import_export, only: ocn_Export ! ! !PUBLIC MEMBER FUNCTIONS: @@ -70,9 +71,9 @@ module ocn_comp_mct type MCT_MOM_Data type(ocean_state_type), pointer :: ocn_state => NULL() !< Private state of ocean type(ocean_public_type), pointer :: ocn_public => NULL() !< Public state of ocean - type(ocean_grid_type), pointer :: grid => NULL() ! A pointer to a grid structure + type(ocean_grid_type), pointer :: grid => NULL() !< A pointer to a grid structure type(surface), pointer :: ocn_surface => NULL() !< A pointer to the ocean surface state - + type(ice_ocean_boundary_type) :: ice_ocean_boundary !< A pointer to the ice ocean boundary type type(seq_infodata_type), pointer :: infodata type(cpl_indices), public :: ind !< Variable IDs @@ -124,7 +125,8 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename ) integer :: lsize, nsend, nrecv logical :: ldiag_cpl = .false. integer :: ni, nj - + integer :: isc, iec, jsc, jec !< Indices for the start and end of the domain + !! in the x and y dir., respectively. ! mct variables (these are local for now) integer :: MOM_MCT_ID type(mct_gsMap), pointer :: MOM_MCT_gsMap => NULL() ! 2d, points to cdata @@ -241,6 +243,7 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename ) call t_stopf('MOM_init') + !--------------------------------------------------------------------- ! Initialize MCT attribute vectors and indices !--------------------------------------------------------------------- @@ -321,6 +324,29 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename ) ! Size of global domain call get_global_grid_size(glb%grid, ni, nj) + ! allocate ice_ocean_boundary + isc = glb%grid%isc; iec = glb%grid%iec; + jsc = glb%grid%jsc; jec = glb%grid%jec; + allocate(glb%ice_ocean_boundary%u_flux(isc:iec,jsc:jec)); glb%ice_ocean_boundary%u_flux(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%v_flux(isc:iec,jsc:jec)); glb%ice_ocean_boundary%v_flux(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%t_flux(isc:iec,jsc:jec)); glb%ice_ocean_boundary%t_flux(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%q_flux(isc:iec,jsc:jec)); glb%ice_ocean_boundary%q_flux(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%salt_flux(isc:iec,jsc:jec)); glb%ice_ocean_boundary%salt_flux(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%lw_flux(isc:iec,jsc:jec)); glb%ice_ocean_boundary%lw_flux(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%sw_flux_vis_dir(isc:iec,jsc:jec)); glb%ice_ocean_boundary%sw_flux_vis_dir(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%sw_flux_vis_dif(isc:iec,jsc:jec)); glb%ice_ocean_boundary%sw_flux_vis_dif(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%sw_flux_nir_dir(isc:iec,jsc:jec)); glb%ice_ocean_boundary%sw_flux_nir_dir(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%sw_flux_nir_dif(isc:iec,jsc:jec)); glb%ice_ocean_boundary%sw_flux_nir_dif(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%lprec(isc:iec,jsc:jec)); glb%ice_ocean_boundary%lprec(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%fprec(isc:iec,jsc:jec)); glb%ice_ocean_boundary%fprec(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%runoff(isc:iec,jsc:jec)); glb%ice_ocean_boundary%runoff(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%calving(isc:iec,jsc:jec)); glb%ice_ocean_boundary%calving(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%runoff_hflx(isc:iec,jsc:jec)); glb%ice_ocean_boundary%runoff_hflx(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%calving_hflx(isc:iec,jsc:jec)); glb%ice_ocean_boundary%calving_hflx(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%p(isc:iec,jsc:jec)); glb%ice_ocean_boundary%p(:,:) = 0.0 + allocate(glb%ice_ocean_boundary%mi(isc:iec,jsc:jec)); glb%ice_ocean_boundary%mi(:,:) = 0.0 + + if (debug .and. root_pe().eq.pe_here()) print *, "calling seq_infodata_putdata" call seq_infodata_PutData( glb%infodata, & @@ -351,9 +377,6 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o) type(time_type) :: coupling_timestep ! Coupled time interval to pass to MOM6 character(len=128) :: err_msg - ! Might need to be in glb to live on heap - type(ice_ocean_boundary_type) :: Ice_ocean_boundary - ! Translate the current time (start of coupling interval) call ESMF_ClockGet(EClock, currTime=current_time, rc=rc) call ESMF_TimeGet(current_time, yy=year, mm=month, dd=day, h=hour, m=minute, s=seconds, rc=rc) @@ -390,9 +413,11 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o) ! \todo Let MOM6 know to write restart... if (debug .and. is_root_pe()) write(6,*) 'ocn_run_mct, write_restart_at_eod=', write_restart_at_eod - !call ocn_imprt goes her + ! fill ice ocean boundary + call fill_ice_ocean_bnd(glb%ice_ocean_boundary, glb%grid, x2o_o%rattr, glb%ind) + if (debug .and. is_root_pe()) write(6,*) 'fill_ice_ocean_bnd' - !call update_ocean_model(ice_ocean_boundary, glb%ocn_state, glb%ocn_public, & + !call update_ocean_model(glb%ice_ocean_boundary, glb%ocn_state, glb%ocn_public, & ! time_start, coupling_timestep) end subroutine ocn_run_mct