Skip to content

Commit

Permalink
Replace lbm to lbd (lateral boundary diffusion)
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavo-marques committed Nov 18, 2019
1 parent 486da1d commit 7f2b93e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 44 deletions.
24 changes: 12 additions & 12 deletions src/tracer/MOM_lateral_boundary_diffusion.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ logical function lateral_boundary_diffusion_init(Time, G, param_file, diag, diab

! Log this module and master switch for turning it on/off
call log_version(param_file, mdl, version, &
"This module implements lateral boundary mixing of tracers")
"This module implements lateral diffusion of tracers near boundaries")
call get_param(param_file, mdl, "USE_LATERAL_BOUNDARY_DIFFUSION", lateral_boundary_diffusion_init, &
"If true, enables the lateral boundary mixing module.", &
"If true, enables the lateral boundary tracer's diffusion module.", &
default=.false.)

if (.not. lateral_boundary_diffusion_init) then
Expand All @@ -91,12 +91,12 @@ logical function lateral_boundary_diffusion_init(Time, G, param_file, diag, diab

CS%surface_boundary_scheme = -1
if ( .not. ASSOCIATED(CS%energetic_PBL_CSp) .and. .not. ASSOCIATED(CS%KPP_CSp) ) then
call MOM_error(FATAL,"Lateral boundary mixing is true, but no valid boundary layer scheme was found")
call MOM_error(FATAL,"Lateral boundary diffusion is true, but no valid boundary layer scheme was found")
endif

! Read all relevant parameters and write them to the model log.
call get_param(param_file, mdl, "LATERAL_BOUNDARY_METHOD", CS%method, &
"Determine how to apply near-boundary lateral mixing of tracers"//&
"Determine how to apply near-boundary lateral diffusion of tracers"//&
"1. Bulk layer approach"//&
"2. Along layer approach"//&
"3. Decomposition on to pressure levels", default=1)
Expand Down Expand Up @@ -186,8 +186,8 @@ subroutine lateral_boundary_diffusion(G, GV, US, h, Coef_x, Coef_y, dt, Reg, CS)
enddo
enddo
! Post tracer bulk diags
if (tracer%id_lbm_bulk_dfx>0) call post_data(tracer%id_lbm_bulk_dfx, uFlx_bulk*Idt, CS%diag)
if (tracer%id_lbm_bulk_dfy>0) call post_data(tracer%id_lbm_bulk_dfy, vFlx_bulk*Idt, CS%diag)
if (tracer%id_lbd_bulk_dfx>0) call post_data(tracer%id_lbd_bulk_dfx, uFlx_bulk*Idt, CS%diag)
if (tracer%id_lbd_bulk_dfy>0) call post_data(tracer%id_lbd_bulk_dfy, vFlx_bulk*Idt, CS%diag)

! TODO: this is where we would filter vFlx and uFlux to get rid of checkerboard noise

Expand Down Expand Up @@ -221,22 +221,22 @@ subroutine lateral_boundary_diffusion(G, GV, US, h, Coef_x, Coef_y, dt, Reg, CS)
enddo ; enddo ; enddo

! Post the tracer diagnostics
if (tracer%id_lbm_dfx>0) call post_data(tracer%id_lbm_dfx, uFlx*Idt, CS%diag)
if (tracer%id_lbm_dfy>0) call post_data(tracer%id_lbm_dfy, vFlx*Idt, CS%diag)
if (tracer%id_lbm_dfx_2d>0) then
if (tracer%id_lbd_dfx>0) call post_data(tracer%id_lbd_dfx, uFlx*Idt, CS%diag)
if (tracer%id_lbd_dfy>0) call post_data(tracer%id_lbd_dfy, vFlx*Idt, CS%diag)
if (tracer%id_lbd_dfx_2d>0) then
uwork_2d(:,:) = 0.
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) * Idt)
enddo; enddo; enddo
call post_data(tracer%id_lbm_dfx_2d, uwork_2d, CS%diag)
call post_data(tracer%id_lbd_dfx_2d, uwork_2d, CS%diag)
endif

if (tracer%id_lbm_dfy_2d>0) then
if (tracer%id_lbd_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) * Idt)
enddo; enddo; enddo
call post_data(tracer%id_lbm_dfy_2d, vwork_2d, CS%diag)
call post_data(tracer%id_lbd_dfy_2d, vwork_2d, CS%diag)
endif
enddo

Expand Down
64 changes: 32 additions & 32 deletions src/tracer/MOM_tracer_registry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ 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_dfx => NULL() !< diagnostic array for x-diffusive tracer flux
real, dimension(:,:,:), pointer :: lbd_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_dfy => NULL() !< diagnostic array for y-diffusive tracer flux
real, dimension(:,:,:), pointer :: lbd_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_dfx_2d => NULL() !< diagnostic array for x-diffusive tracer flux
real, dimension(:,:), pointer :: lbd_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_dfy_2d => NULL() !< diagnostic array for y-diffusive tracer flux
real, dimension(:,:), pointer :: lbd_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
real, dimension(:,:), pointer :: lbd_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]
real, dimension(:,:), pointer :: lbm_bulk_df_y => NULL() !< diagnostic array for y-diffusive tracer flux
real, dimension(:,:), pointer :: lbd_bulk_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 :: df2d_x => NULL() !< diagnostic vertical sum x-diffusive flux
!! [conc H m2 s-1 ~> conc m3 s-1 or conc kg s-1]
Expand Down Expand Up @@ -121,8 +121,8 @@ module MOM_tracer_registry
!>@{ Diagnostic IDs
integer :: id_tr = -1
integer :: id_adx = -1, id_ady = -1, id_dfx = -1, id_dfy = -1
integer :: id_lbm_bulk_dfx = -1, id_lbm_bulk_dfy = -1, id_lbm_dfx = -1, id_lbm_dfy = -1
integer :: id_lbm_dfx_2d, id_lbm_dfy_2d
integer :: id_lbd_bulk_dfx = -1, id_lbd_bulk_dfy = -1, id_lbd_dfx = -1, id_lbd_dfy = -1
integer :: id_lbd_dfx_2d, id_lbd_dfy_2d
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
Expand Down Expand Up @@ -414,19 +414,19 @@ subroutine register_tracer_diagnostics(Reg, h, Time, diag, G, GV, use_ALE)
Tr%id_dfy = register_diag_field("ocean_model", trim(shortnm)//"_dfy", &
diag%axesCvL, Time, trim(flux_longname)//" diffusive merdional flux" , &
trim(flux_units), v_extensive = .true., x_cell_method = 'sum')
Tr%id_lbm_dfx = register_diag_field("ocean_model", trim(shortnm)//"_lbm_dfx", &
diag%axesCuL, Time, trim(flux_longname)//" diffusive zonal flux from the near-boundary mixing scheme" , &
Tr%id_lbd_dfx = register_diag_field("ocean_model", trim(shortnm)//"_lbd_dfx", &
diag%axesCuL, Time, trim(flux_longname)//" diffusive zonal flux from the near-boundary diffusion scheme" , &
trim(flux_units), v_extensive = .true., y_cell_method = 'sum')
Tr%id_lbm_dfy = register_diag_field("ocean_model", trim(shortnm)//"_lbm_dfy", &
diag%axesCvL, Time, trim(flux_longname)//" diffusive meridional flux from the near-boundary mixing scheme" , &
Tr%id_lbd_dfy = register_diag_field("ocean_model", trim(shortnm)//"_lbd_dfy", &
diag%axesCvL, Time, trim(flux_longname)//" diffusive meridional flux from the near-boundary diffusion scheme" , &
trim(flux_units), v_extensive = .true., x_cell_method = 'sum')
Tr%id_lbm_dfx_2d = register_diag_field("ocean_model", trim(shortnm)//"_lbm_dfx_2d", &
Tr%id_lbd_dfx_2d = register_diag_field("ocean_model", trim(shortnm)//"_lbd_dfx_2d", &
diag%axesCu1, Time, trim(flux_longname)//&
" diffusive zonal flux from the near-boundary mixing scheme vertically integrated" , &
" diffusive zonal flux from the near-boundary diffusion scheme vertically integrated" , &
trim(flux_units), v_extensive = .true., y_cell_method = 'sum')
Tr%id_lbm_dfy_2d = register_diag_field("ocean_model", trim(shortnm)//"_lbm_dfy_2d", &
Tr%id_lbd_dfy_2d = register_diag_field("ocean_model", trim(shortnm)//"_lbd_dfy_2d", &
diag%axesCv1, Time, trim(flux_longname)//&
" diffusive meridional flux from the near-boundary mixing scheme vertically integrated" , &
" diffusive meridional flux from the near-boundary diffusion scheme vertically integrated" , &
trim(flux_units), v_extensive = .true., x_cell_method = 'sum')
else
Tr%id_adx = register_diag_field("ocean_model", trim(shortnm)//"_adx", &
Expand All @@ -441,27 +441,27 @@ subroutine register_tracer_diagnostics(Reg, h, Time, diag, G, GV, use_ALE)
Tr%id_dfy = register_diag_field("ocean_model", trim(shortnm)//"_diffy", &
diag%axesCvL, Time, "Diffusive Meridional Flux of "//trim(flux_longname), &
flux_units, v_extensive=.true., conversion=Tr%flux_scale, x_cell_method = 'sum')
Tr%id_lbm_dfx = register_diag_field("ocean_model", trim(shortnm)//"_lbm_diffx", &
diag%axesCuL, Time, "Boundary Diffusive Zonal Flux of "//trim(flux_longname), &
Tr%id_lbd_dfx = register_diag_field("ocean_model", trim(shortnm)//"_lbd_diffx", &
diag%axesCuL, Time, "Lateral Boundary Diffusive Zonal Flux of "//trim(flux_longname), &
flux_units, v_extensive=.true., conversion=Tr%flux_scale, y_cell_method = 'sum')
Tr%id_lbm_dfy = register_diag_field("ocean_model", trim(shortnm)//"_lbm_diffy", &
diag%axesCvL, Time, "Boundary Diffusive Meridional Flux of "//trim(flux_longname), &
Tr%id_lbd_dfy = register_diag_field("ocean_model", trim(shortnm)//"_lbd_diffy", &
diag%axesCvL, Time, "Lateral Boundary Diffusive Meridional Flux of "//trim(flux_longname), &
flux_units, v_extensive=.true., conversion=Tr%flux_scale, x_cell_method = 'sum')
Tr%id_lbm_dfx_2d = register_diag_field("ocean_model", trim(shortnm)//"_lbm_diffx_2d", &
diag%axesCu1, Time, "Vertically integrated Boundary Diffusive Zonal Flux of "//trim(flux_longname), &
Tr%id_lbd_dfx_2d = register_diag_field("ocean_model", trim(shortnm)//"_lbd_diffx_2d", &
diag%axesCu1, Time, "Vertically integrated Lateral Boundary Diffusive Zonal Flux of "//trim(flux_longname), &
flux_units, v_extensive=.true., conversion=Tr%flux_scale, y_cell_method = 'sum')
Tr%id_lbm_dfy_2d = register_diag_field("ocean_model", trim(shortnm)//"_lbm_diffy_2d", &
diag%axesCv1, Time, "Vertically integrated Boundary Diffusive Meridional Flux of "//trim(flux_longname), &
Tr%id_lbd_dfy_2d = register_diag_field("ocean_model", trim(shortnm)//"_lbd_diffy_2d", &
diag%axesCv1, Time, "Vertically integrated Lateral Boundary Diffusive Meridional Flux of "//trim(flux_longname), &
flux_units, v_extensive=.true., conversion=Tr%flux_scale, x_cell_method = 'sum')
endif
if (Tr%id_adx > 0) call safe_alloc_ptr(Tr%ad_x,IsdB,IedB,jsd,jed,nz)
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_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)
if (Tr%id_lbd_dfx > 0) call safe_alloc_ptr(Tr%lbd_dfx,IsdB,IedB,jsd,jed,nz)
if (Tr%id_lbd_dfy > 0) call safe_alloc_ptr(Tr%lbd_dfy,isd,ied,JsdB,JedB,nz)
if (Tr%id_lbd_dfx_2d > 0) call safe_alloc_ptr(Tr%lbd_dfx_2d,IsdB,IedB,jsd,jed)
if (Tr%id_lbd_dfy_2d > 0) call safe_alloc_ptr(Tr%lbd_dfy_2d,isd,ied,JsdB,JedB)

Tr%id_adx_2d = register_diag_field("ocean_model", trim(shortnm)//"_adx_2d", &
diag%axesCu1, Time, &
Expand All @@ -479,11 +479,11 @@ subroutine register_tracer_diagnostics(Reg, h, Time, diag, G, GV, use_ALE)
diag%axesCv1, Time, &
"Vertically Integrated Diffusive Meridional Flux of "//trim(flux_longname), &
flux_units, conversion=Tr%flux_scale, x_cell_method = 'sum')
Tr%id_lbm_bulk_dfx = register_diag_field("ocean_model", trim(shortnm)//"_lbm_bulk_diffx", &
Tr%id_lbd_bulk_dfx = register_diag_field("ocean_model", trim(shortnm)//"_lbd_bulk_diffx", &
diag%axesCu1, Time, &
"Total Bulk Diffusive Zonal Flux of "//trim(flux_longname), &
flux_units, conversion=Tr%flux_scale, y_cell_method = 'sum')
Tr%id_lbm_bulk_dfy = register_diag_field("ocean_model", trim(shortnm)//"_lbm_bulk_diffy", &
Tr%id_lbd_bulk_dfy = register_diag_field("ocean_model", trim(shortnm)//"_lbd_bulk_diffy", &
diag%axesCv1, Time, &
"Vertically Integrated Diffusive Meridional Flux of "//trim(flux_longname), &
flux_units, conversion=Tr%flux_scale, x_cell_method = 'sum')
Expand All @@ -492,8 +492,8 @@ subroutine register_tracer_diagnostics(Reg, h, Time, diag, G, GV, use_ALE)
if (Tr%id_ady_2d > 0) call safe_alloc_ptr(Tr%ad2d_y,isd,ied,JsdB,JedB)
if (Tr%id_dfx_2d > 0) call safe_alloc_ptr(Tr%df2d_x,IsdB,IedB,jsd,jed)
if (Tr%id_dfy_2d > 0) call safe_alloc_ptr(Tr%df2d_y,isd,ied,JsdB,JedB)
if (Tr%id_lbm_bulk_dfx > 0) call safe_alloc_ptr(Tr%lbm_bulk_df_x,IsdB,IedB,jsd,jed)
if (Tr%id_lbm_bulk_dfy > 0) call safe_alloc_ptr(Tr%lbm_bulk_df_y,isd,ied,JsdB,JedB)
if (Tr%id_lbd_bulk_dfx > 0) call safe_alloc_ptr(Tr%lbd_bulk_df_x,IsdB,IedB,jsd,jed)
if (Tr%id_lbd_bulk_dfy > 0) call safe_alloc_ptr(Tr%lbd_bulk_df_y,isd,ied,JsdB,JedB)

Tr%id_adv_xy = register_diag_field('ocean_model', trim(shortnm)//"_advection_xy", &
diag%axesTL, Time, &
Expand Down

0 comments on commit 7f2b93e

Please sign in to comment.