Skip to content

Commit

Permalink
Merge branch 'near_surface_fluxes' of github.com:ashao/MOM6 into near…
Browse files Browse the repository at this point in the history
…_surface_fluxes
  • Loading branch information
Andrew Shao committed Jan 10, 2020
2 parents 31d2941 + 4fe0191 commit 408bd2f
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 9 deletions.
40 changes: 40 additions & 0 deletions src/tracer/MOM_lateral_boundary_diffusion.F90
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ subroutine lateral_boundary_diffusion(G, GV, US, h, Coef_x, Coef_y, dt, Reg, CS)
real, dimension(SZI_(G),SZJB_(G)) :: vFlx_bulk !< Total calculated bulk-layer v-flux for the tracer
real, dimension(SZIB_(G),SZJ_(G)) :: uwork_2d !< Layer summed u-flux transport
real, dimension(SZI_(G),SZJB_(G)) :: vwork_2d !< Layer summed v-flux transport
real, dimension(SZI_(G),SZJ_(G),G%ke) :: tendency ! tendency array for diagn
real, dimension(SZI_(G),SZJ_(G)) :: tendency_2d ! depth integrated content tendency for diagn
type(tracer_type), pointer :: Tracer => NULL() !< Pointer to the current tracer
integer :: remap_method !< Reconstruction method
integer :: i,j,k,m !< indices to loop over
Expand All @@ -156,6 +158,12 @@ subroutine lateral_boundary_diffusion(G, GV, US, h, Coef_x, Coef_y, dt, Reg, CS)

do m = 1,Reg%ntr
tracer => Reg%tr(m)

! for diagnostics
if (tracer%id_lbdxy_conc > 0 .or. tracer%id_lbdxy_cont > 0 .or. tracer%id_lbdxy_cont_2d > 0) then
tendency(:,:,:) = 0.0
endif

do j = G%jsc-1, G%jec+1
! Interpolate state to interface
do i = G%isc-1, G%iec+1
Expand Down Expand Up @@ -224,6 +232,11 @@ subroutine lateral_boundary_diffusion(G, GV, US, h, Coef_x, Coef_y, dt, Reg, CS)
if (G%mask2dT(i,j)>0.) then
tracer%t(i,j,k) = tracer%t(i,j,k) + (( (uFlx(I-1,j,k)-uFlx(I,j,k)) ) + ( (vFlx(i,J-1,k)-vFlx(i,J,k) ) ))* &
(G%IareaT(i,j)/( h(i,j,k) + GV%H_subroundoff))

if (tracer%id_lbdxy_conc > 0 .or. tracer%id_lbdxy_cont > 0 .or. tracer%id_lbdxy_cont_2d > 0 ) then
tendency(i,j,k) = (( (uFlx(I-1,j,k)-uFlx(I,j,k)) ) + ( (vFlx(i,J-1,k)-vFlx(i,J,k) ) )) * G%IareaT(i,j) * Idt
endif

endif
enddo ; enddo ; enddo

Expand All @@ -245,6 +258,33 @@ subroutine lateral_boundary_diffusion(G, GV, US, h, Coef_x, Coef_y, dt, Reg, CS)
enddo; enddo; enddo
call post_data(tracer%id_lbd_dfy_2d, vwork_2d, CS%diag)
endif

! post tendency of tracer content
if (tracer%id_lbdxy_cont > 0) then
call post_data(tracer%id_lbdxy_cont, tendency(:,:,:), CS%diag)
endif

! post depth summed tendency for tracer content
if (tracer%id_lbdxy_cont_2d > 0) then
tendency_2d(:,:) = 0.
do j = G%jsc,G%jec ; do i = G%isc,G%iec
do k = 1, GV%ke
tendency_2d(i,j) = tendency_2d(i,j) + tendency(i,j,k)
enddo
enddo ; enddo
call post_data(tracer%id_lbdxy_cont_2d, tendency_2d(:,:), CS%diag)
endif

! post tendency of tracer concentration; this step must be
! done after posting tracer content tendency, since we alter
! the tendency array.
if (tracer%id_lbdxy_conc > 0) then
do k = 1, GV%ke ; do j = G%jsc,G%jec ; do i = G%isc,G%iec
tendency(i,j,k) = tendency(i,j,k) / ( h(i,j,k) + GV%H_subroundoff )
enddo ; enddo ; enddo
call post_data(tracer%id_lbdxy_conc, tendency, CS%diag)
endif

enddo

end subroutine lateral_boundary_diffusion
Expand Down
42 changes: 33 additions & 9 deletions src/tracer/MOM_tracer_registry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ module MOM_tracer_registry
integer :: id_adx_2d = -1, id_ady_2d = -1, id_dfx_2d = -1, id_dfy_2d = -1
integer :: id_adv_xy = -1, id_adv_xy_2d = -1
integer :: id_dfxy_cont = -1, id_dfxy_cont_2d = -1, id_dfxy_conc = -1
integer :: id_lbdxy_cont = -1, id_lbdxy_cont_2d = -1, id_lbdxy_conc = -1
integer :: id_remap_conc = -1, id_remap_cont = -1, id_remap_cont_2d = -1
integer :: id_tendency = -1, id_trxh_tendency = -1, id_trxh_tendency_2d = -1
integer :: id_tr_vardec = -1
Expand Down Expand Up @@ -532,37 +533,60 @@ subroutine register_tracer_diagnostics(Reg, h, Time, diag, G, GV, US, use_ALE)
enddo ; enddo ; enddo
endif

! Lateral diffusion convergence tendencies
! Neutral/Lateral diffusion convergence tendencies
if (Tr%diag_form == 1) then
Tr%id_dfxy_cont = register_diag_field("ocean_model", trim(shortnm)//'_dfxy_cont_tendency', &
diag%axesTL, Time, "Lateral or neutral diffusion tracer content tendency for "//trim(shortnm), &
diag%axesTL, Time, "Neutral diffusion tracer content tendency for "//trim(shortnm), &
conv_units, conversion=Tr%conv_scale*US%s_to_T, x_cell_method='sum', y_cell_method='sum', v_extensive=.true.)

Tr%id_dfxy_cont_2d = register_diag_field("ocean_model", trim(shortnm)//'_dfxy_cont_tendency_2d', &
diag%axesT1, Time, "Depth integrated lateral or neutral diffusion tracer concentration "//&
diag%axesT1, Time, "Depth integrated neutral diffusion tracer content "//&
"tendency for "//trim(shortnm), conv_units, conversion=Tr%conv_scale*US%s_to_T, &
x_cell_method='sum', y_cell_method= 'sum')

Tr%id_lbdxy_cont = register_diag_field("ocean_model", trim(shortnm)//'_lbdxy_cont_tendency', &
diag%axesTL, Time, "Lateral diffusion tracer content tendency for "//trim(shortnm), &
conv_units, conversion=Tr%conv_scale*US%s_to_T, x_cell_method='sum', y_cell_method='sum', v_extensive=.true.)

Tr%id_lbdxy_cont_2d = register_diag_field("ocean_model", trim(shortnm)//'_lbdxy_cont_tendency_2d', &
diag%axesT1, Time, "Depth integrated lateral diffusion tracer content "//&
"tendency for "//trim(shortnm), conv_units, conversion=Tr%conv_scale*US%s_to_T, &
x_cell_method='sum', y_cell_method= 'sum')
else
cmor_var_lname = 'Tendency of '//trim(lowercase(cmor_longname))//&
' expressed as '//trim(lowercase(flux_longname))//&
' content due to parameterized mesoscale diffusion'
' content due to parameterized mesoscale neutral diffusion'
Tr%id_dfxy_cont = register_diag_field("ocean_model", trim(shortnm)//'_dfxy_cont_tendency', &
diag%axesTL, Time, "Lateral or neutral diffusion tracer concentration tendency for "//trim(shortnm), &
diag%axesTL, Time, "Neutral diffusion tracer content tendency for "//trim(shortnm), &
conv_units, conversion=Tr%conv_scale*US%s_to_T, cmor_field_name = trim(Tr%cmor_tendprefix)//'pmdiff', &
cmor_long_name = trim(cmor_var_lname), cmor_standard_name = trim(cmor_long_std(cmor_var_lname)), &
x_cell_method = 'sum', y_cell_method = 'sum', v_extensive = .true.)

cmor_var_lname = 'Tendency of '//trim(lowercase(cmor_longname))//' expressed as '//&
trim(lowercase(flux_longname))//' content due to parameterized mesoscale diffusion'
trim(lowercase(flux_longname))//' content due to parameterized mesoscale neutral diffusion'
Tr%id_dfxy_cont_2d = register_diag_field("ocean_model", trim(shortnm)//'_dfxy_cont_tendency_2d', &
diag%axesT1, Time, "Depth integrated lateral or neutral diffusion tracer "//&
"concentration tendency for "//trim(shortnm), conv_units, &
diag%axesT1, Time, "Depth integrated neutral diffusion tracer "//&
"content tendency for "//trim(shortnm), conv_units, &
conversion=Tr%conv_scale*US%s_to_T, cmor_field_name=trim(Tr%cmor_tendprefix)//'pmdiff_2d', &
cmor_long_name=trim(cmor_var_lname), cmor_standard_name=trim(cmor_long_std(cmor_var_lname)), &
x_cell_method='sum', y_cell_method='sum')

Tr%id_lbdxy_cont = register_diag_field("ocean_model", trim(shortnm)//'_lbdxy_cont_tendency', &
diag%axesTL, Time, "Lateral diffusion tracer content tendency for "//trim(shortnm), &
conv_units, conversion=Tr%conv_scale*US%s_to_T, &
x_cell_method = 'sum', y_cell_method = 'sum', v_extensive = .true.)

Tr%id_lbdxy_cont_2d = register_diag_field("ocean_model", trim(shortnm)//'_lbdxy_cont_tendency_2d', &
diag%axesT1, Time, "Depth integrated lateral diffusion tracer "//&
"content tendency for "//trim(shortnm), conv_units, &
conversion=Tr%conv_scale*US%s_to_T, x_cell_method='sum', y_cell_method='sum')
endif
Tr%id_dfxy_conc = register_diag_field("ocean_model", trim(shortnm)//'_dfxy_conc_tendency', &
diag%axesTL, Time, "Lateral (neutral) tracer concentration tendency for "//trim(shortnm), &
diag%axesTL, Time, "Neutral diffusion tracer concentration tendency for "//trim(shortnm), &
trim(units)//' s-1', conversion=US%s_to_T)

Tr%id_lbdxy_conc = register_diag_field("ocean_model", trim(shortnm)//'_lbdxy_conc_tendency', &
diag%axesTL, Time, "Lateral diffusion tracer concentration tendency for "//trim(shortnm), &
trim(units)//' s-1', conversion=US%s_to_T)

var_lname = "Net time tendency for "//lowercase(flux_longname)
Expand Down

0 comments on commit 408bd2f

Please sign in to comment.