From c8805391f88f2e9ca14f63df5f6a1104bab7d0a3 Mon Sep 17 00:00:00 2001 From: Andrew Shao Date: Mon, 23 Sep 2019 16:34:53 -0600 Subject: [PATCH] Update LBM flux names and fix posting of 2d diags 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. --- src/tracer/MOM_lateral_boundary_mixing.F90 | 4 ++-- src/tracer/MOM_tracer_registry.F90 | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/tracer/MOM_lateral_boundary_mixing.F90 b/src/tracer/MOM_lateral_boundary_mixing.F90 index f7ec2ad09d..a8aaa85452 100644 --- a/src/tracer/MOM_lateral_boundary_mixing.F90 +++ b/src/tracer/MOM_lateral_boundary_mixing.F90 @@ -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 diff --git a/src/tracer/MOM_tracer_registry.F90 b/src/tracer/MOM_tracer_registry.F90 index 9ccd5f887a..977e78cf99 100644 --- a/src/tracer/MOM_tracer_registry.F90 +++ b/src/tracer/MOM_tracer_registry.F90 @@ -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] @@ -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, &