Skip to content

Commit

Permalink
Merge pull request #27 from NOAA-GFDL/dev/gfdl
Browse files Browse the repository at this point in the history
Merge in latest dev/gfdl updates
  • Loading branch information
wrongkindofdoctor authored Aug 28, 2019
2 parents f9b5a7f + a5ef30b commit 22c5865
Show file tree
Hide file tree
Showing 101 changed files with 5,247 additions and 4,860 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 @@ -512,23 +512,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
Loading

0 comments on commit 22c5865

Please sign in to comment.