Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into mask_checks
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaeldussin authored Aug 27, 2019
2 parents 7cdcdaa + a5ef30b commit 7ddef69
Show file tree
Hide file tree
Showing 98 changed files with 3,836 additions and 3,520 deletions.
17 changes: 9 additions & 8 deletions config_src/coupled_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, US, CS, sfc
PmE_adj, & ! The adjustment to PminusE that will cause the salinity
! to be restored toward its target value [kg m-1 s-1]
net_FW, & ! The area integrated net freshwater flux into the ocean [kg s-1]
net_FW2, & ! The area integrated net freshwater flux into the ocean [kg s-1]
net_FW2, & ! The net freshwater flux into the ocean [kg m-2 s-1]
work_sum, & ! A 2-d array that is used as the work space for global sums [m2] or [kg s-1]
open_ocn_mask ! a binary field indicating where ice is present based on frazil criteria [nondim]

Expand Down Expand Up @@ -327,7 +327,7 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, US, CS, sfc
! allocation and initialization on first call to this routine
if (CS%area_surf < 0.0) then
do j=js,je ; do i=is,ie
work_sum(i,j) = G%areaT(i,j) * G%mask2dT(i,j)
work_sum(i,j) = US%L_to_m**2*G%areaT(i,j) * G%mask2dT(i,j)
enddo ; enddo
CS%area_surf = reproducing_sum(work_sum, isr, ier, jsr, jer)
endif ! endif for allocation and initialization
Expand Down Expand Up @@ -359,7 +359,7 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, US, CS, sfc
call adjust_area_mean_to_zero(fluxes%salt_flux, G, fluxes%saltFluxGlobalScl)
fluxes%saltFluxGlobalAdj = 0.
else
work_sum(is:ie,js:je) = G%areaT(is:ie,js:je)*fluxes%salt_flux(is:ie,js:je)
work_sum(is:ie,js:je) = US%L_to_m**2*G%areaT(is:ie,js:je)*fluxes%salt_flux(is:ie,js:je)
fluxes%saltFluxGlobalAdj = reproducing_sum(work_sum(:,:), isr,ier, jsr,jer)/CS%area_surf
fluxes%salt_flux(is:ie,js:je) = fluxes%salt_flux(is:ie,js:je) - fluxes%saltFluxGlobalAdj
endif
Expand All @@ -380,7 +380,7 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, US, CS, sfc
call adjust_area_mean_to_zero(fluxes%vprec, G, fluxes%vPrecGlobalScl)
fluxes%vPrecGlobalAdj = 0.
else
work_sum(is:ie,js:je) = G%areaT(is:ie,js:je)*fluxes%vprec(is:ie,js:je)
work_sum(is:ie,js:je) = US%L_to_m**2*G%areaT(is:ie,js:je)*fluxes%vprec(is:ie,js:je)
fluxes%vPrecGlobalAdj = reproducing_sum(work_sum(:,:), isr, ier, jsr, jer) / CS%area_surf
do j=js,je ; do i=is,ie
fluxes%vprec(i,j) = ( fluxes%vprec(i,j) - fluxes%vPrecGlobalAdj ) * G%mask2dT(i,j)
Expand Down Expand Up @@ -547,23 +547,24 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, US, CS, sfc
do j=js,je ; do i=is,ie
net_FW(i,j) = (((fluxes%lprec(i,j) + fluxes%fprec(i,j)) + &
(fluxes%lrunoff(i,j) + fluxes%frunoff(i,j))) + &
(fluxes%evap(i,j) + fluxes%vprec(i,j)) ) * G%areaT(i,j)
(fluxes%evap(i,j) + fluxes%vprec(i,j)) ) * US%L_to_m**2*G%areaT(i,j)
! The following contribution appears to be calculating the volume flux of sea-ice
! melt. This calculation is clearly WRONG if either sea-ice has variable
! salinity or the sea-ice is completely fresh.
! Bob thinks this is trying ensure the net fresh-water of the ocean + sea-ice system
! is constant.
! To do this correctly we will need a sea-ice melt field added to IOB. -AJA
if (associated(IOB%salt_flux) .and. (CS%ice_salt_concentration>0.0)) &
net_FW(i,j) = net_FW(i,j) + sign_for_net_FW_bug * G%areaT(i,j) * &
net_FW(i,j) = net_FW(i,j) + sign_for_net_FW_bug * US%L_to_m**2*G%areaT(i,j) * &
(IOB%salt_flux(i-i0,j-j0) / CS%ice_salt_concentration)
net_FW2(i,j) = net_FW(i,j) / G%areaT(i,j)
net_FW2(i,j) = net_FW(i,j) / (US%L_to_m**2*G%areaT(i,j))
enddo ; enddo

if (CS%adjust_net_fresh_water_by_scaling) then
call adjust_area_mean_to_zero(net_FW2, G, fluxes%netFWGlobalScl)
do j=js,je ; do i=is,ie
fluxes%vprec(i,j) = fluxes%vprec(i,j) + (net_FW2(i,j) - net_FW(i,j)/G%areaT(i,j)) * G%mask2dT(i,j)
fluxes%vprec(i,j) = fluxes%vprec(i,j) + &
(net_FW2(i,j) - net_FW(i,j)/(US%L_to_m**2*G%areaT(i,j))) * G%mask2dT(i,j)
enddo ; enddo
else
fluxes%netFWGlobalAdj = reproducing_sum(net_FW(:,:), isr, ier, jsr, jer) / CS%area_surf
Expand Down
19 changes: 10 additions & 9 deletions config_src/coupled_driver/ocean_model_MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn)

call extract_surface_state(OS%MOM_CSp, OS%sfc_state)

call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid)
call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid, OS%US)

endif

Expand Down Expand Up @@ -505,7 +505,7 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, time_start_upda
call convert_IOB_to_forces(Ice_ocean_boundary, OS%forces, index_bnds, OS%Time_dyn, OS%grid, OS%US, &
OS%forcing_CSp, dt_forcing=dt_coupling, reset_avg=OS%fluxes%fluxes_used)
if (OS%use_ice_shelf) &
call add_shelf_forces(OS%grid, OS%Ice_shelf_CSp, OS%forces)
call add_shelf_forces(OS%grid, OS%US, OS%Ice_shelf_CSp, OS%forces)
if (OS%icebergs_alter_ocean) &
call iceberg_forces(OS%grid, OS%forces, OS%use_ice_shelf, &
OS%sfc_state, dt_coupling, OS%marine_ice_CSp)
Expand Down Expand Up @@ -659,9 +659,9 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, time_start_upda
endif

! Translate state into Ocean.
! call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid, &
! call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid, OS%US, &
! Ice_ocean_boundary%p, OS%press_to_z)
call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid)
call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid, OS%US)
Time1 = OS%Time ; if (do_dyn) Time1 = OS%Time_dyn
call coupler_type_send_data(Ocean_sfc%fields, Time1)

Expand Down Expand Up @@ -817,14 +817,15 @@ end subroutine initialize_ocean_public_type
!! code that calculates the surface state in the first place.
!! Note the offset in the arrays because the ocean_data_type has no
!! halo points in its arrays and always uses absolute indicies.
subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, patm, press_to_z)
subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, US, patm, press_to_z)
type(surface), intent(inout) :: sfc_state !< A structure containing fields that
!! describe the surface state of the ocean.
type(ocean_public_type), &
target, intent(inout) :: Ocean_sfc !< A structure containing various publicly
!! visible ocean surface fields, whose elements
!! have their data set here.
type(ocean_grid_type), intent(inout) :: G !< The ocean's grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
real, optional, intent(in) :: patm(:,:) !< The pressure at the ocean surface [Pa].
real, optional, intent(in) :: press_to_z !< A conversion factor between pressure and
!! ocean depth in m, usually 1/(rho_0*g) [m Pa-1].
Expand Down Expand Up @@ -871,12 +872,12 @@ subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, patm, press_to_z
if (present(patm)) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%sea_lev(i,j) = sfc_state%sea_lev(i+i0,j+j0) + patm(i,j) * press_to_z
Ocean_sfc%area(i,j) = G%areaT(i+i0,j+j0)
Ocean_sfc%area(i,j) = US%L_to_m**2*G%areaT(i+i0,j+j0)
enddo ; enddo
else
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%sea_lev(i,j) = sfc_state%sea_lev(i+i0,j+j0)
Ocean_sfc%area(i,j) = G%areaT(i+i0,j+j0)
Ocean_sfc%area(i,j) = US%L_to_m**2*G%areaT(i+i0,j+j0)
enddo ; enddo
endif

Expand Down Expand Up @@ -938,7 +939,7 @@ subroutine ocean_model_init_sfc(OS, Ocean_sfc)

call extract_surface_state(OS%MOM_CSp, OS%sfc_state)

call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid)
call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid, OS%US)

end subroutine ocean_model_init_sfc

Expand Down Expand Up @@ -1036,7 +1037,7 @@ subroutine ocean_model_data2D_get(OS, Ocean, name, array2D, isc, jsc)

select case(name)
case('area')
array2D(isc:,jsc:) = OS%grid%areaT(g_isc:g_iec,g_jsc:g_jec)
array2D(isc:,jsc:) = OS%US%L_to_m**2*OS%grid%areaT(g_isc:g_iec,g_jsc:g_jec)
case('mask')
array2D(isc:,jsc:) = OS%grid%mask2dT(g_isc:g_iec,g_jsc:g_jec)
!OR same result
Expand Down
4 changes: 2 additions & 2 deletions config_src/ice_solo_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -693,12 +693,12 @@ subroutine buoyancy_forcing_from_files(sfc_state, fluxes, day, dt, G, CS)
call MOM_read_data(trim(CS%inputdir)//trim(CS%freshdischarge_file), "disch_w", &
temp(:,:), G%Domain, timelevel=time_lev_monthly)
do j=js,je ; do i=is,ie
fluxes%lrunoff(i,j) = temp(i,j)*G%IareaT(i,j)
fluxes%lrunoff(i,j) = temp(i,j)*US%m_to_L**2*G%IareaT(i,j)
enddo ; enddo
call MOM_read_data(trim(CS%inputdir)//trim(CS%freshdischarge_file), "disch_s", &
temp(:,:), G%Domain, timelevel=time_lev_monthly)
do j=js,je ; do i=is,ie
fluxes%frunoff(i,j) = temp(i,j)*G%IareaT(i,j)
fluxes%frunoff(i,j) = temp(i,j)*US%m_to_L**2*G%IareaT(i,j)
enddo ; enddo

! Read the SST and SSS fields for damping.
Expand Down
15 changes: 8 additions & 7 deletions config_src/mct_driver/mom_ocean_model_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i

call extract_surface_state(OS%MOM_CSp, OS%sfc_state)

call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid)
call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid, OS%US)
endif

call close_param_file(param_file)
Expand Down Expand Up @@ -684,7 +684,7 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &
! Translate state into Ocean.
! call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid, &
! Ice_ocean_boundary%p, OS%press_to_z)
call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid)
call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid, OS%US)
call coupler_type_send_data(Ocean_sfc%fields, OS%Time)

call callTree_leave("update_ocean_model()")
Expand Down Expand Up @@ -858,14 +858,15 @@ end subroutine initialize_ocean_public_type
!! code that calculates the surface state in the first place.
!! Note the offset in the arrays because the ocean_data_type has no
!! halo points in its arrays and always uses absolute indicies.
subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, patm, press_to_z)
subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, US, patm, press_to_z)
type(surface), intent(inout) :: sfc_state !< A structure containing fields that
!! describe the surface state of the ocean.
type(ocean_public_type), &
target, intent(inout) :: Ocean_sfc !< A structure containing various publicly
!! visible ocean surface fields, whose elements
!! have their data set here.
type(ocean_grid_type), intent(inout) :: G !< The ocean's grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
real, optional, intent(in) :: patm(:,:) !< The pressure at the ocean surface, in Pa.
real, optional, intent(in) :: press_to_z !< A conversion factor between pressure and
!! ocean depth in m, usually 1/(rho_0*g), in m Pa-1.
Expand Down Expand Up @@ -913,12 +914,12 @@ subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, patm, press_to_z
if (present(patm)) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%sea_lev(i,j) = sfc_state%sea_lev(i+i0,j+j0) + patm(i,j) * press_to_z
Ocean_sfc%area(i,j) = G%areaT(i+i0,j+j0)
Ocean_sfc%area(i,j) = US%L_to_m**2*G%areaT(i+i0,j+j0)
enddo ; enddo
else
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%sea_lev(i,j) = sfc_state%sea_lev(i+i0,j+j0)
Ocean_sfc%area(i,j) = G%areaT(i+i0,j+j0)
Ocean_sfc%area(i,j) = US%L_to_m**2*G%areaT(i+i0,j+j0)
enddo ; enddo
endif

Expand Down Expand Up @@ -992,7 +993,7 @@ subroutine ocean_model_init_sfc(OS, Ocean_sfc)

call extract_surface_state(OS%MOM_CSp, OS%sfc_state)

call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid)
call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid, OS%US)

end subroutine ocean_model_init_sfc

Expand Down Expand Up @@ -1090,7 +1091,7 @@ subroutine ocean_model_data2D_get(OS,Ocean, name, array2D,isc,jsc)

select case(name)
case('area')
array2D(isc:,jsc:) = OS%grid%areaT(g_isc:g_iec,g_jsc:g_jec)
array2D(isc:,jsc:) = OS%US%L_to_m**2*OS%grid%areaT(g_isc:g_iec,g_jsc:g_jec)
case('mask')
array2D(isc:,jsc:) = OS%grid%mask2dT(g_isc:g_iec,g_jsc:g_jec)
!OR same result
Expand Down
13 changes: 7 additions & 6 deletions config_src/mct_driver/mom_surface_forcing_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, US, CS, &
! allocation and initialization on first call to this routine
if (CS%area_surf < 0.0) then
do j=js,je ; do i=is,ie
work_sum(i,j) = G%areaT(i,j) * G%mask2dT(i,j)
work_sum(i,j) = US%L_to_m**2*G%areaT(i,j) * G%mask2dT(i,j)
enddo; enddo
CS%area_surf = reproducing_sum(work_sum, isr, ier, jsr, jer)
endif ! endif for allocation and initialization
Expand Down Expand Up @@ -363,7 +363,7 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, US, CS, &
call adjust_area_mean_to_zero(fluxes%salt_flux, G, fluxes%saltFluxGlobalScl)
fluxes%saltFluxGlobalAdj = 0.
else
work_sum(is:ie,js:je) = G%areaT(is:ie,js:je)*fluxes%salt_flux(is:ie,js:je)
work_sum(is:ie,js:je) = US%L_to_m**2*G%areaT(is:ie,js:je)*fluxes%salt_flux(is:ie,js:je)
fluxes%saltFluxGlobalAdj = reproducing_sum(work_sum(:,:), isr,ier, jsr,jer)/CS%area_surf
fluxes%salt_flux(is:ie,js:je) = fluxes%salt_flux(is:ie,js:je) - fluxes%saltFluxGlobalAdj
endif
Expand All @@ -384,7 +384,7 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, US, CS, &
call adjust_area_mean_to_zero(fluxes%vprec, G, fluxes%vPrecGlobalScl)
fluxes%vPrecGlobalAdj = 0.
else
work_sum(is:ie,js:je) = G%areaT(is:ie,js:je)*fluxes%vprec(is:ie,js:je)
work_sum(is:ie,js:je) = US%L_to_m**2*G%areaT(is:ie,js:je)*fluxes%vprec(is:ie,js:je)
fluxes%vPrecGlobalAdj = reproducing_sum(work_sum(:,:), isr, ier, jsr, jer) / CS%area_surf
do j=js,je ; do i=is,ie
fluxes%vprec(i,j) = ( fluxes%vprec(i,j) - fluxes%vPrecGlobalAdj ) * G%mask2dT(i,j)
Expand Down Expand Up @@ -535,15 +535,16 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, US, CS, &
do j=js,je ; do i=is,ie
net_FW(i,j) = (((fluxes%lprec(i,j) + fluxes%fprec(i,j) + fluxes%seaice_melt(i,j)) + &
(fluxes%lrunoff(i,j) + fluxes%frunoff(i,j))) + &
(fluxes%evap(i,j) + fluxes%vprec(i,j)) ) * G%areaT(i,j)
(fluxes%evap(i,j) + fluxes%vprec(i,j)) ) * US%L_to_m**2*G%areaT(i,j)

net_FW2(i,j) = net_FW(i,j)/G%areaT(i,j)
net_FW2(i,j) = net_FW(i,j) / (US%L_to_m**2*G%areaT(i,j))
enddo; enddo

if (CS%adjust_net_fresh_water_by_scaling) then
call adjust_area_mean_to_zero(net_FW2, G, fluxes%netFWGlobalScl)
do j=js,je ; do i=is,ie
fluxes%vprec(i,j) = fluxes%vprec(i,j) + (net_FW2(i,j) - net_FW(i,j)/G%areaT(i,j)) * G%mask2dT(i,j)
fluxes%vprec(i,j) = fluxes%vprec(i,j) + &
(net_FW2(i,j) - net_FW(i,j)/(US%L_to_m**2*G%areaT(i,j))) * G%mask2dT(i,j)
enddo; enddo
else
fluxes%netFWGlobalAdj = reproducing_sum(net_FW(:,:), isr, ier, jsr, jer) / CS%area_surf
Expand Down
8 changes: 4 additions & 4 deletions config_src/mct_driver/ocn_cap_methods.F90
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ subroutine ocn_export(ind, ocn_public, grid, o2x, dt_int, ncouple_per_day)
! d/dx ssh
do j=grid%jsc, grid%jec ; do i=grid%isc,grid%iec
! This is a simple second-order difference
! o2x(ind%o2x_So_dhdx, n) = 0.5 * (ssh(i+1,j) - ssh(i-1,j)) * grid%IdxT(i,j) * grid%mask2dT(i,j)
! o2x(ind%o2x_So_dhdx, n) = 0.5 * (ssh(i+1,j) - ssh(i-1,j)) * grid%US%m_to_L*grid%IdxT(i,j) * grid%mask2dT(i,j)
! This is a PLM slope which might be less prone to the A-grid null mode
slp_L = (ssh(I,j) - ssh(I-1,j)) * grid%mask2dCu(I-1,j)
if (grid%mask2dCu(I-1,j)==0.) slp_L = 0.
Expand All @@ -230,14 +230,14 @@ subroutine ocn_export(ind, ocn_public, grid, o2x, dt_int, ncouple_per_day)
! larger extreme values.
slope = 0.0
endif
sshx(i,j) = slope * grid%IdxT(i,j) * grid%mask2dT(i,j)
sshx(i,j) = slope * grid%US%m_to_L*grid%IdxT(i,j) * grid%mask2dT(i,j)
if (grid%mask2dT(i,j)==0.) sshx(i,j) = 0.0
enddo; enddo

! d/dy ssh
do j=grid%jsc, grid%jec ; do i=grid%isc,grid%iec
! This is a simple second-order difference
! o2x(ind%o2x_So_dhdy, n) = 0.5 * (ssh(i,j+1) - ssh(i,j-1)) * grid%IdyT(i,j) * grid%mask2dT(i,j)
! o2x(ind%o2x_So_dhdy, n) = 0.5 * (ssh(i,j+1) - ssh(i,j-1)) * grid%US%m_to_L*grid%IdyT(i,j) * grid%mask2dT(i,j)
! This is a PLM slope which might be less prone to the A-grid null mode
slp_L = ssh(i,J) - ssh(i,J-1) * grid%mask2dCv(i,J-1)
if (grid%mask2dCv(i,J-1)==0.) slp_L = 0.
Expand All @@ -257,7 +257,7 @@ subroutine ocn_export(ind, ocn_public, grid, o2x, dt_int, ncouple_per_day)
! larger extreme values.
slope = 0.0
endif
sshy(i,j) = slope * grid%IdyT(i,j) * grid%mask2dT(i,j)
sshy(i,j) = slope * grid%US%m_to_L*grid%IdyT(i,j) * grid%mask2dT(i,j)
if (grid%mask2dT(i,j)==0.) sshy(i,j) = 0.0
enddo; enddo

Expand Down
8 changes: 4 additions & 4 deletions config_src/mct_driver/ocn_comp_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ subroutine ocn_domain_mct( lsize, gsMap_ocn, dom_ocn)
integer, pointer :: idata(:)
integer :: i,j,k
real(kind=SHR_REAL_R8), pointer :: data(:)
real(kind=SHR_REAL_R8) :: m2_to_rad2
real(kind=SHR_REAL_R8) :: L2_to_rad2
type(ocean_grid_type), pointer :: grid => NULL() ! A pointer to a grid structure

grid => glb%grid ! for convenience
Expand Down Expand Up @@ -681,11 +681,11 @@ subroutine ocn_domain_mct( lsize, gsMap_ocn, dom_ocn)
call mct_gGrid_importRattr(dom_ocn,"lat",data,lsize)

k = 0
m2_to_rad2 = 1./grid%Rad_Earth**2
L2_to_rad2 = grid%US%L_to_m**2 / grid%Rad_Earth**2
do j = grid%jsc, grid%jec
do i = grid%isc, grid%iec
k = k + 1 ! Increment position within gindex
data(k) = grid%AreaT(i,j) * m2_to_rad2
data(k) = grid%AreaT(i,j) * L2_to_rad2
enddo
enddo
call mct_gGrid_importRattr(dom_ocn,"area",data,lsize)
Expand Down Expand Up @@ -743,7 +743,7 @@ subroutine ocean_model_init_sfc(OS, Ocean_sfc)

call extract_surface_state(OS%MOM_CSp, OS%sfc_state)

call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid)
call convert_state_to_ocean_type(OS%sfc_state, Ocean_sfc, OS%grid, OS%US)

end subroutine ocean_model_init_sfc

Expand Down
2 changes: 1 addition & 1 deletion config_src/nuopc_driver/mom_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
dataPtr_xcen(i1,j1) = ocean_grid%geolonT(ig,jg)
dataPtr_ycen(i1,j1) = ocean_grid%geolatT(ig,jg)
if(grid_attach_area) then
dataPtr_area(i1,j1) = ocean_grid%areaT(ig,jg)
dataPtr_area(i1,j1) = ocean_grid%US%L_to_m**2 * ocean_grid%areaT(ig,jg)
endif
enddo
enddo
Expand Down
Loading

0 comments on commit 7ddef69

Please sign in to comment.