Skip to content

Commit

Permalink
more updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariana Vertenstein committed Jun 15, 2018
1 parent 9e25780 commit c4f2a5e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
26 changes: 14 additions & 12 deletions config_src/mct_driver/ocn_cap_methods.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module ocn_cap_methods
public :: ocn_import
public :: ocn_export

logical, parameter :: debug=.true.

!=======================================================================
contains
!=======================================================================
Expand Down Expand Up @@ -63,32 +65,32 @@ subroutine ocn_import(x2o, ind, grid, ice_ocean_boundary, c1, c2, c3, c4)
ice_ocean_boundary%latent_flux(i,j) = x2o(ind%x2o_Foxx_lat,k) !???TODO: should this be a minus sign

! liquid runoff
ice_ocean_boundary%rofl_flux(i,j) = x2o(ind%x2o_Foxx_rofl,k)
ice_ocean_boundary%rofl_flux(i,j) = x2o(ind%x2o_Foxx_rofl,k) * GRID%mask2dT(ig,jg)

! ice runoff
ice_ocean_boundary%rofi_flux(i,j) = x2o(ind%x2o_Foxx_rofi,k)
ice_ocean_boundary%rofi_flux(i,j) = x2o(ind%x2o_Foxx_rofi,k) * GRID%mask2dT(ig,jg)

! surface pressure
ice_ocean_boundary%p(i,j) = x2o(ind%x2o_Sa_pslv,k)
ice_ocean_boundary%p(i,j) = x2o(ind%x2o_Sa_pslv,k) * GRID%mask2dT(ig,jg)

! salt flux
ice_ocean_boundary%salt_flux(i,j) = x2o(ind%x2o_Fioi_salt,k)
ice_ocean_boundary%salt_flux(i,j) = x2o(ind%x2o_Fioi_salt,k) * GRID%mask2dT(ig,jg)

! 1) visible, direct shortwave (W/m2)
! 2) visible, diffuse shortwave (W/m2)
! 3) near-IR, direct shortwave (W/m2)
! 4) near-IR, diffuse shortwave (W/m2)
if (present(c1) .and. present(c2) .and. present(c3) .and. present(c4)) then
! Use runtime coefficients to decompose net short-wave heat flux into 4 components
ice_ocean_boundary%sw_flux_vis_dir(i,j) = x2o(ind%x2o_Foxx_swnet,k) * c1
ice_ocean_boundary%sw_flux_vis_dif(i,j) = x2o(ind%x2o_Foxx_swnet,k) * c2
ice_ocean_boundary%sw_flux_nir_dir(i,j) = x2o(ind%x2o_Foxx_swnet,k) * c3
ice_ocean_boundary%sw_flux_nir_dif(i,j) = x2o(ind%x2o_Foxx_swnet,k) * c4
ice_ocean_boundary%sw_flux_vis_dir(i,j) = x2o(ind%x2o_Foxx_swnet,k) * c1 * GRID%mask2dT(ig,jg)
ice_ocean_boundary%sw_flux_vis_dif(i,j) = x2o(ind%x2o_Foxx_swnet,k) * c2 * GRID%mask2dT(ig,jg)
ice_ocean_boundary%sw_flux_nir_dir(i,j) = x2o(ind%x2o_Foxx_swnet,k) * c3 * GRID%mask2dT(ig,jg)
ice_ocean_boundary%sw_flux_nir_dif(i,j) = x2o(ind%x2o_Foxx_swnet,k) * c4 * GRID%mask2dT(ig,jg)
else
ice_ocean_boundary%sw_flux_vis_dir(i,j) = x2o(ind%x2o_Faxa_swvdr,k)
ice_ocean_boundary%sw_flux_vis_dif(i,j) = x2o(ind%x2o_Faxa_swvdf,k)
ice_ocean_boundary%sw_flux_nir_dir(i,j) = x2o(ind%x2o_Faxa_swndr,k)
ice_ocean_boundary%sw_flux_nir_dif(i,j) = x2o(ind%x2o_Faxa_swndf,k)
ice_ocean_boundary%sw_flux_vis_dir(i,j) = x2o(ind%x2o_Faxa_swvdr,k) * GRID%mask2dT(ig,jg)
ice_ocean_boundary%sw_flux_vis_dif(i,j) = x2o(ind%x2o_Faxa_swvdf,k) * GRID%mask2dT(ig,jg)
ice_ocean_boundary%sw_flux_nir_dir(i,j) = x2o(ind%x2o_Faxa_swndr,k) * GRID%mask2dT(ig,jg)
ice_ocean_boundary%sw_flux_nir_dif(i,j) = x2o(ind%x2o_Faxa_swndf,k) * GRID%mask2dT(ig,jg)
end if
end do
end do
Expand Down
2 changes: 2 additions & 0 deletions config_src/mct_driver/ocn_comp_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o)
call seq_cdata_setptrs(cdata_o, infodata=glb%infodata)

! Translate import fields to ice_ocean_boundary
! TODO: make this an input variable
glb%sw_decomp = .false.
if (glb%sw_decomp) then
call ocn_import(x2o_o%rattr, glb%ind, glb%grid, Ice_ocean_boundary, c1=glb%c1, c2=glb%c2, c3=glb%c3, c4=glb%c4)
else
Expand Down
19 changes: 12 additions & 7 deletions config_src/nuopc_driver/mom_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -441,13 +441,14 @@ module mom_cap_mod
real(ESMF_KIND_R8), dimension(:,:), pointer :: farrayPtr
end type fld_list_type

integer,parameter :: fldsMax = 100
integer :: fldsToOcn_num = 0
integer,parameter :: fldsMax = 100
integer :: fldsToOcn_num = 0
type (fld_list_type) :: fldsToOcn(fldsMax)
integer :: fldsFrOcn_num = 0
integer :: fldsFrOcn_num = 0
type (fld_list_type) :: fldsFrOcn(fldsMax)
#endif

integer :: debug = 0
integer :: import_slice = 1
integer :: export_slice = 1
character(len=256) :: tmpstr
Expand Down Expand Up @@ -935,10 +936,12 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
allocate(xb(ntiles),xe(ntiles),yb(ntiles),ye(ntiles),pe(ntiles))
call mpp_get_compute_domains(ocean_public%domain, xbegin=xb, xend=xe, ybegin=yb, yend=ye)
call mpp_get_pelist(ocean_public%domain, pe)
do n = 1,ntiles
write(tmpstr,'(a,6i6)') subname//' tiles ',n,pe(n),xb(n),xe(n),yb(n),ye(n)
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc)
enddo
if (debug > 0) then
do n = 1,ntiles
write(tmpstr,'(a,6i6)') subname//' tiles ',n,pe(n),xb(n),xe(n),yb(n),ye(n)
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc)
enddo
end if

!---------------------------------
! create delayout and distgrid
Expand Down Expand Up @@ -971,6 +974,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
return ! bail out

allocate(connectionList(2))

! bipolar boundary condition at top row: nyg
call ESMF_DistGridConnectionSet(connectionList(1), tileIndexA=1, &
tileIndexB=1, positionVector=(/nxg+1, 2*nyg+1/), &
Expand All @@ -979,6 +983,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
line=__LINE__, &
file=__FILE__)) &
return ! bail out

! periodic boundary condition along first dimension
call ESMF_DistGridConnectionSet(connectionList(2), tileIndexA=1, &
tileIndexB=1, positionVector=(/nxg, 0/), rc=rc)
Expand Down

0 comments on commit c4f2a5e

Please sign in to comment.