Skip to content

Commit

Permalink
Add minimum thickness used in imbalance check
Browse files Browse the repository at this point in the history
Use minimum thickness to skip imbalance checks in vanished layers.
  • Loading branch information
Theresa Morrison authored and Theresa Morrison committed Jan 29, 2025
1 parent 154cd59 commit 8cc97b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions generic_tracers/cobalt_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ module cobalt_types
! as is the case with MOM6 THERMO_SPANS_COUPLING option
cased_steady, & ! steady state approximation for cased
tracer_debug
real :: &
min_thickness ! minimum thickness of a layer that will be checked for source/sink imbalances

real :: &
atm_co2_flux, &
Expand Down
7 changes: 7 additions & 0 deletions generic_tracers/generic_COBALT.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1632,6 +1632,9 @@ subroutine user_add_params(param_file)
! Unused?
call get_param(param_file, "generic_COBALT", "tracer_debug", cobalt%tracer_debug, &
"flag for tracer debug operations", default=.false.)
call get_param(param_file, "generic_COBALT", "min_thickness_for_imbalance", cobalt%min_thickness, &
"minimum thickness of a layer that will be checked for source/sink imbalances", &
units="m", default= 0.001)

call g_tracer_end_param_list(package_name)
end subroutine user_add_params
Expand Down Expand Up @@ -2861,6 +2864,7 @@ subroutine generic_COBALT_update_from_source(tracer_list,Temp,Salt,rho_dzt,dzt,h

real :: tr,ltr
real :: imbal
real :: min_thick
integer :: stdoutunit, imbal_flag, outunit
type(g_tracer_type), pointer :: g_tracer,g_tracer_next
real :: KD_SMOOTH = 1.0E-05
Expand Down Expand Up @@ -5540,12 +5544,14 @@ subroutine generic_COBALT_update_from_source(tracer_list,Temp,Salt,rho_dzt,dzt,h
! CAS calculate totals after source/sinks have been applied
imbal_flag = 0;
stdoutunit = stdout();
min_thick = cobalt%min_thickness
allocate(post_totn(isc:iec,jsc:jec,1:nk))
allocate(post_totc(isc:iec,jsc:jec,1:nk))
allocate(post_totp(isc:iec,jsc:jec,1:nk))
allocate(post_totsi(isc:iec,jsc:jec,1:nk))
allocate(post_totfe(isc:iec,jsc:jec,1:nk))
do k = 1, nk ; do j = jsc, jec ; do i = isc, iec !{
if (dzt(i,j,k).gt. min_thick) then
post_totn(i,j,k) = (cobalt%p_no3(i,j,k,tau) + cobalt%p_nh4(i,j,k,tau) + &
cobalt%p_ndi(i,j,k,tau) + cobalt%p_nlg(i,j,k,tau) + cobalt%p_nmd(i,j,k,tau) + &
cobalt%p_nsm(i,j,k,tau) + cobalt%p_nbact(i,j,k,tau) + &
Expand Down Expand Up @@ -5603,6 +5609,7 @@ subroutine generic_COBALT_update_from_source(tracer_list,Temp,Salt,rho_dzt,dzt,h
call mpp_error(FATAL,&
'==>biological source/sink imbalance (generic_COBALT_update_from_source): Silica')
endif
endif
enddo; enddo ; enddo !} i,j,k


Expand Down

0 comments on commit 8cc97b4

Please sign in to comment.