Skip to content

Commit

Permalink
Update LBM flux names and fix posting of 2d diags
Browse files Browse the repository at this point in the history
The 2d diagnostics associated with the lateral boundary mixing were
occuring outside the `if (CS%id_lbm_dfx_2d)` statements and were
thus leading to segfaults if the diagnostic was not requested.

Additionally the array variable names were refactored to be consistent
with the `id_` names and the diagnostic names.
  • Loading branch information
Andrew Shao committed Sep 23, 2019
1 parent 66a8f0a commit c880539
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/tracer/MOM_lateral_boundary_mixing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,16 @@ subroutine lateral_boundary_mixing(G, GV, US, h, Coef_x, Coef_y, dt, Reg, CS)
do k=1,GV%ke; do j=G%jsc,G%jec; do I=G%isc-1,G%iec
uwork_2d(I,j) = uwork_2d(I,j) + uFlx(I,j,k)
enddo; enddo; enddo
call post_data(tracer%id_lbm_dfx_2d, uwork_2d, CS%diag)
endif
call post_data(tracer%id_lbm_dfx_2d, uwork_2d, CS%diag)

if (tracer%id_lbm_dfy_2d>0) then
vwork_2d(:,:) = 0.
do k=1,GV%ke; do J=G%jsc-1,G%jec; do i=G%isc,G%iec
vwork_2d(i,J) = vwork_2d(i,J) + vFlx(i,J,k)
enddo; enddo; enddo
call post_data(tracer%id_lbm_dfy_2d, vwork_2d, CS%diag)
endif
call post_data(tracer%id_lbm_dfy_2d, vwork_2d, CS%diag)
enddo

end subroutine lateral_boundary_mixing
Expand Down
16 changes: 8 additions & 8 deletions src/tracer/MOM_tracer_registry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ module MOM_tracer_registry
!! [conc H m2 s-1 ~> conc m3 s-1 or conc kg s-1]
real, dimension(:,:,:), pointer :: df_y => NULL() !< diagnostic array for y-diffusive tracer flux
!! [conc H m2 s-1 ~> conc m3 s-1 or conc kg s-1]
real, dimension(:,:,:), pointer :: lbm_df_x => NULL() !< diagnostic array for x-diffusive tracer flux
real, dimension(:,:,:), pointer :: lbm_dfx => NULL() !< diagnostic array for x-diffusive tracer flux
!! [conc H m2 s-1 ~> conc m3 s-1 or conc kg s-1]
real, dimension(:,:,:), pointer :: lbm_df_y => NULL() !< diagnostic array for y-diffusive tracer flux
real, dimension(:,:,:), pointer :: lbm_dfy => NULL() !< diagnostic array for y-diffusive tracer flux
!! [conc H m2 s-1 ~> conc m3 s-1 or conc kg s-1]
real, dimension(:,:), pointer :: lbm_df_x_2d => NULL() !< diagnostic array for x-diffusive tracer flux
real, dimension(:,:), pointer :: lbm_dfx_2d => NULL() !< diagnostic array for x-diffusive tracer flux
!! [conc H m2 s-1 ~> conc m3 s-1 or conc kg s-1]
real, dimension(:,:), pointer :: lbm_df_y_2d => NULL() !< diagnostic array for y-diffusive tracer flux
real, dimension(:,:), pointer :: lbm_dfy_2d => NULL() !< diagnostic array for y-diffusive tracer flux
!! [conc H m2 s-1 ~> conc m3 s-1 or conc kg s-1]
real, dimension(:,:), pointer :: lbm_bulk_df_x => NULL() !< diagnostic array for x-diffusive tracer flux
!! [conc H m2 s-1 ~> conc m3 s-1 or conc kg s-1]
Expand Down Expand Up @@ -458,10 +458,10 @@ subroutine register_tracer_diagnostics(Reg, h, Time, diag, G, GV, use_ALE)
if (Tr%id_ady > 0) call safe_alloc_ptr(Tr%ad_y,isd,ied,JsdB,JedB,nz)
if (Tr%id_dfx > 0) call safe_alloc_ptr(Tr%df_x,IsdB,IedB,jsd,jed,nz)
if (Tr%id_dfy > 0) call safe_alloc_ptr(Tr%df_y,isd,ied,JsdB,JedB,nz)
if (Tr%id_lbm_dfx > 0) call safe_alloc_ptr(Tr%lbm_df_x,IsdB,IedB,jsd,jed,nz)
if (Tr%id_lbm_dfy > 0) call safe_alloc_ptr(Tr%lbm_df_y,isd,ied,JsdB,JedB,nz)
if (Tr%id_lbm_dfx_2d > 0) call safe_alloc_ptr(Tr%lbm_df_x_2d,IsdB,IedB,jsd,jed)
if (Tr%id_lbm_dfy_2d > 0) call safe_alloc_ptr(Tr%lbm_df_y_2d,isd,ied,JsdB,JedB)
if (Tr%id_lbm_dfx > 0) call safe_alloc_ptr(Tr%lbm_dfx,IsdB,IedB,jsd,jed,nz)
if (Tr%id_lbm_dfy > 0) call safe_alloc_ptr(Tr%lbm_dfy,isd,ied,JsdB,JedB,nz)
if (Tr%id_lbm_dfx_2d > 0) call safe_alloc_ptr(Tr%lbm_dfx_2d,IsdB,IedB,jsd,jed)
if (Tr%id_lbm_dfy_2d > 0) call safe_alloc_ptr(Tr%lbm_dfy_2d,isd,ied,JsdB,JedB)

Tr%id_adx_2d = register_diag_field("ocean_model", trim(shortnm)//"_adx_2d", &
diag%axesCu1, Time, &
Expand Down

0 comments on commit c880539

Please sign in to comment.