Skip to content

Commit

Permalink
cleanup phytoplankton uptake section (#58)
Browse files Browse the repository at this point in the history
* cleanup phytoplankton uptake section

* complete removal of net_phyto_resp by removing registration and sending

* fix typo

---------

Co-authored-by: Yi-Cheng Teng - NOAA GFDL <143743249+yichengt900@users.noreply.github.com>
  • Loading branch information
charliestock and yichengt900 authored May 17, 2024
1 parent 37e3d95 commit e62cd4c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 35 deletions.
10 changes: 1 addition & 9 deletions generic_tracers/cobalt_reg_diag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,6 @@ subroutine cobalt_reg_diagnostics(diag_list,axes,init_time,phyto,zoo,bact,cobalt
phyto(LARGE)%id_jprod_n = register_diag_field(package_name, vardesc_temp%name, axes(1:3),&
init_time, vardesc_temp%longname,vardesc_temp%units, missing_value = missing_value1)

vardesc_temp = vardesc("net_phyto_resp","Net phytoplankton respiration layer integral",'h','L','s','mol m-2 s-1','f')
cobalt%id_net_phyto_resp = register_diag_field(package_name, vardesc_temp%name, axes(1:3),&
init_time, vardesc_temp%longname,vardesc_temp%units, missing_value = missing_value1)

!
! Register zooplankton diagnostics, starting with losses of zooplankton to ingestion by zooplankton
!
Expand Down Expand Up @@ -1916,7 +1912,7 @@ subroutine cobalt_reg_diagnostics(diag_list,axes,init_time,phyto,zoo,bact,cobalt
cobalt%id_btm_omega_calc = register_diag_field(package_name, vardesc_temp%name, axes(1:2),&
init_time, vardesc_temp%longname,vardesc_temp%units, missing_value = missing_value1)

vardesc_temp = vardesc("cased_2d","calcium carbonite in sediment",'h','1','s','mol m-3','f')
vardesc_temp = vardesc("cased_2d","calcium carbonate in sediment",'h','1','s','mol m-3','f')
cobalt%id_cased_2d = register_diag_field(package_name, vardesc_temp%name, axes(1:2),&
init_time, vardesc_temp%longname,vardesc_temp%units, missing_value = missing_value1)

Expand Down Expand Up @@ -2401,10 +2397,6 @@ subroutine cobalt_reg_diagnostics(diag_list,axes,init_time,phyto,zoo,bact,cobalt
cobalt%id_wc_vert_int_chemoautopp = register_diag_field(package_name, vardesc_temp%name, axes(1:2),&
init_time, vardesc_temp%longname,vardesc_temp%units, missing_value = missing_value1)

vardesc_temp = vardesc("wc_vert_int_net_phyto_resp","Water column net phyto respiration vertical integral",'h','1','s','mol N m-2 s-1','f')
cobalt%id_wc_vert_int_net_phyto_resp = register_diag_field(package_name, vardesc_temp%name, axes(1:2),&
init_time, vardesc_temp%longname,vardesc_temp%units, missing_value = missing_value1)

vardesc_temp = vardesc("wc_vert_int_npp","Water column net primary production vertical integral",'h','1','s','mol N m-2 s-1','f')
cobalt%id_wc_vert_int_npp = register_diag_field(package_name, vardesc_temp%name, axes(1:2),&
init_time, vardesc_temp%longname,vardesc_temp%units, missing_value = missing_value1)
Expand Down
6 changes: 0 additions & 6 deletions generic_tracers/cobalt_send_diag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,6 @@ subroutine cobalt_send_diagnostics(model_time,grid_tmask,Temp,rho_dzt,dzt,&
used = g_send_data(cobalt%id_jprod_po4, cobalt%jprod_po4*rho_dzt, &
model_time, rmask = grid_tmask,&
is_in=isc, js_in=jsc, ks_in=1,ie_in=iec, je_in=jec, ke_in=nk)
used = g_send_data(cobalt%id_net_phyto_resp, cobalt%net_phyto_resp*rho_dzt, &
model_time, rmask = grid_tmask,&
is_in=isc, js_in=jsc, ks_in=1,ie_in=iec, je_in=jec, ke_in=nk)
used = g_send_data(cobalt%id_jprod_fed, cobalt%jprod_fed*rho_dzt, &
model_time, rmask = grid_tmask,&
is_in=isc, js_in=jsc, ks_in=1,ie_in=iec, je_in=jec, ke_in=nk)
Expand Down Expand Up @@ -1172,9 +1169,6 @@ subroutine cobalt_send_diagnostics(model_time,grid_tmask,Temp,rho_dzt,dzt,&
used = g_send_data(cobalt%id_wc_vert_int_chemoautopp, cobalt%wc_vert_int_chemoautopp, &
model_time, rmask = grid_tmask(:,:,1),&
is_in=isc, js_in=jsc, ie_in=iec, je_in=jec)
used = g_send_data(cobalt%id_wc_vert_int_net_phyto_resp, cobalt%wc_vert_int_net_phyto_resp, &
model_time, rmask = grid_tmask(:,:,1),&
is_in=isc, js_in=jsc, ie_in=iec, je_in=jec)
used = g_send_data(cobalt%id_wc_vert_int_npp, cobalt%wc_vert_int_npp, &
model_time, rmask = grid_tmask(:,:,1),&
is_in=isc, js_in=jsc, ie_in=iec, je_in=jec)
Expand Down
4 changes: 0 additions & 4 deletions generic_tracers/cobalt_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,6 @@ module cobalt_types
jprod_nh4,&
jprod_nh4_plus_btm,&
jprod_po4,&
net_phyto_resp,&
det_jzloss_n,&
det_jzloss_p,&
det_jzloss_fe,&
Expand Down Expand Up @@ -885,7 +884,6 @@ module cobalt_types
wc_vert_int_o2,&
wc_vert_int_alk,&
wc_vert_int_chemoautopp,&
wc_vert_int_net_phyto_resp,&
wc_vert_int_npp, &
wc_vert_int_jdiss_sidet,&
wc_vert_int_jdiss_cadet,&
Expand Down Expand Up @@ -1017,7 +1015,6 @@ module cobalt_types
id_jprod_po4 = -1, &
id_jprod_nh4 = -1, &
id_jprod_nh4_plus_btm = -1, &
id_net_phyto_resp = -1, &
id_det_jzloss_n = -1, &
id_det_jhploss_n = -1, &
id_jdiss_sidet = -1, &
Expand Down Expand Up @@ -1187,7 +1184,6 @@ module cobalt_types
id_wc_vert_int_alk = -1, &
id_wc_vert_int_chemoautopp = -1, &
id_wc_vert_int_npp = -1, &
id_wc_vert_int_net_phyto_resp = -1, &
id_wc_vert_int_jdiss_sidet = -1, &
id_wc_vert_int_jdiss_cadet = -1, &
id_wc_vert_int_jo2resp = -1, &
Expand Down
25 changes: 9 additions & 16 deletions generic_tracers/generic_COBALT.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2465,7 +2465,6 @@ subroutine generic_COBALT_update_from_source(tracer_list,Temp,Salt,rho_dzt,dzt,h
cobalt%jno3denit_wc(i,j,k) = 0.0
cobalt%jremin_ndet(i,j,k) = 0.0
cobalt%jo2resp_wc(i,j,k) = 0.0
cobalt%net_phyto_resp(i,j,k) = 0.0
enddo; enddo ; enddo !} i,j,k
!
!-----------------------------------------------------------------------------------
Expand Down Expand Up @@ -2876,22 +2875,20 @@ subroutine generic_COBALT_update_from_source(tracer_list,Temp,Salt,rho_dzt,dzt,h
phyto(n)%mu(i,j,k)*phyto(n)%f_n(i,j,k))
phyto(n)%juptake_nh4(i,j,k) = max(0.0,phyto(n)%nh4lim(i,j,k)* phyto(n)%mu(i,j,k)*phyto(n)%f_n(i,j,k))
phyto(n)%juptake_no3(i,j,k) = max(0.0,phyto(n)%no3lim(i,j,k)* phyto(n)%mu(i,j,k)*phyto(n)%f_n(i,j,k))
! uncomment for "no mass change" test (next 2 lines)
! phyto(n)%juptake_nh4(i,j,k) = phyto(n)%juptake_nh4(i,j,k) + phyto(n)%juptake_n2(i,j,k)
! phyto(n)%juptake_n2(i,j,k) = 0.0

! If growth is negative, results in net respiration and production of nh4, aerobic loss in all cases
! jo2resp_wc is a cumulative variable that tracks the total oxygen consumption in the water column
cobalt%jprod_nh4(i,j,k) = cobalt%jprod_nh4(i,j,k) - min(0.0,phyto(n)%mu(i,j,k)*phyto(n)%f_n(i,j,k))
cobalt%jo2resp_wc(i,j,k) = cobalt%jo2resp_wc(i,j,k) - min(0.0,phyto(n)%mu(i,j,k)*phyto(n)%f_n(i,j,k))*cobalt%o2_2_nh4
cobalt%net_phyto_resp(i,j,k) = cobalt%net_phyto_resp(i,j,k) - min(0.0,phyto(n)%mu(i,j,k)*phyto(n)%f_n(i,j,k))
do n = 2, NUM_PHYTO !{
! Nitrate versus ammonia uptake proportional to their relative limitations
phyto(n)%juptake_no3(i,j,k) = max( 0.0, phyto(n)%mu(i,j,k)*phyto(n)%f_n(i,j,k)* &
phyto(n)%no3lim(i,j,k)/(phyto(n)%no3lim(i,j,k)+phyto(n)%nh4lim(i,j,k)+epsln) )
phyto(n)%juptake_nh4(i,j,k) = max( 0.0, phyto(n)%mu(i,j,k)*phyto(n)%f_n(i,j,k)* &
phyto(n)%nh4lim(i,j,k)/(phyto(n)%no3lim(i,j,k)+phyto(n)%nh4lim(i,j,k)+epsln) )
! If growth is negative, results in net respiration and production of nh4, aerobic loss in all cases
cobalt%jprod_nh4(i,j,k) = cobalt%jprod_nh4(i,j,k) - min(0.0,phyto(n)%mu(i,j,k)*phyto(n)%f_n(i,j,k))
cobalt%jo2resp_wc(i,j,k) = cobalt%jo2resp_wc(i,j,k) - min(0.0,phyto(n)%mu(i,j,k)*phyto(n)%f_n(i,j,k))*cobalt%o2_2_nh4
cobalt%net_phyto_resp(i,j,k) = cobalt%net_phyto_resp(i,j,k) - min(0.0,phyto(n)%mu(i,j,k)*phyto(n)%f_n(i,j,k))
enddo !} n
enddo; enddo ; enddo !} i,j,k
!
Expand All @@ -2901,11 +2898,13 @@ subroutine generic_COBALT_update_from_source(tracer_list,Temp,Salt,rho_dzt,dzt,h
n=DIAZO
phyto(n)%juptake_po4(i,j,k) = (phyto(n)%juptake_n2(i,j,k)+phyto(n)%juptake_nh4(i,j,k) + &
phyto(n)%juptake_no3(i,j,k))*phyto(n)%uptake_p_2_n(i,j,k)
! If growth is negative, results in net release of po4
cobalt%jprod_po4(i,j,k) = cobalt%jprod_po4(i,j,k) - &
min(0.0,phyto(n)%mu(i,j,k)*phyto(n)%f_p(i,j,k))
do n = 2, NUM_PHYTO
phyto(n)%juptake_po4(i,j,k) = (phyto(n)%juptake_nh4(i,j,k)+phyto(n)%juptake_no3(i,j,k))* &
phyto(n)%uptake_p_2_n(i,j,k)
! If growth is negative, results in net release of po4
cobalt%jprod_po4(i,j,k) = cobalt%jprod_po4(i,j,k) - &
min(0.0,phyto(n)%mu(i,j,k)*phyto(n)%f_p(i,j,k))
enddo !} n
Expand All @@ -2916,12 +2915,14 @@ subroutine generic_COBALT_update_from_source(tracer_list,Temp,Salt,rho_dzt,dzt,h
do k = 1, nk ; do j = jsc, jec ; do i = isc, iec !{
do n = 1, NUM_PHYTO !{
if (phyto(n)%q_fe_2_n(i,j,k).lt.phyto(n)%fe_2_n_max) then
! Scaling fe uptake with the maximum iron-limited photosynthesis allows for luxury iron uptake
! when other nutrients are limiting but iron is not
phyto(n)%juptake_fe(i,j,k) = phyto(n)%P_C_max(i,j,k)*cobalt%expkT(i,j,k)*phyto(n)%f_n(i,j,k)* &
phyto(n)%felim(i,j,k)*cobalt%fe_2_n_upt_fac
phyto(n)%jexuloss_fe(i,j,k) = 0.0
else
! if you've exceeded the maximum quota, stop uptake and exude extra
phyto(n)%juptake_fe(i,j,k) = 0.0
!phyto(n)%jexuloss_fe(i,j,k) = (phyto(n)%q_fe_2_n(i,j,k)-phyto(n)%fe_2_n_max)*phyto(n)%f_n(i,j,k)/dt
phyto(n)%jexuloss_fe(i,j,k) = cobalt%expkT(i,j,k)*phyto(n)%bresp(i,j,k)*phyto(n)%f_fe(i,j,k)
endif
enddo !} n
Expand All @@ -2946,9 +2947,8 @@ subroutine generic_COBALT_update_from_source(tracer_list,Temp,Salt,rho_dzt,dzt,h
! Note that this is si_2_n in large phytoplankton pool, not in diatoms themselves (q_si_2_n_lg_diatoms)
phyto(LARGE)%q_si_2_n(i,j,k) = cobalt%f_silg(i,j,k)/(phyto(LARGE)%f_n(i,j,k)+epsln)
phyto(MEDIUM)%q_si_2_n(i,j,k) = cobalt%f_simd(i,j,k)/(phyto(MEDIUM)%f_n(i,j,k)+epsln)

enddo; enddo ; enddo !} i,j,k
!

call mpp_clock_end(id_clock_phyto_growth)
!
!-----------------------------------------------------------------------
Expand Down Expand Up @@ -5092,7 +5092,6 @@ subroutine generic_COBALT_update_from_source(tracer_list,Temp,Salt,rho_dzt,dzt,h
cobalt%wc_vert_int_o2(i,j) = 0.0
cobalt%wc_vert_int_alk(i,j) = 0.0
cobalt%wc_vert_int_chemoautopp(i,j) = 0.0
cobalt%wc_vert_int_net_phyto_resp(i,j) = 0.0
cobalt%wc_vert_int_npp(i,j) = 0.0
cobalt%wc_vert_int_jdiss_sidet(i,j) = 0.0
cobalt%wc_vert_int_jdiss_cadet(i,j) = 0.0
Expand Down Expand Up @@ -5122,8 +5121,6 @@ subroutine generic_COBALT_update_from_source(tracer_list,Temp,Salt,rho_dzt,dzt,h
cobalt%wc_vert_int_alk(i,j) = cobalt%wc_vert_int_alk(i,j) + cobalt%tot_layer_int_alk(i,j,k)*grid_tmask(i,j,k)
cobalt%wc_vert_int_chemoautopp(i,j) = cobalt%wc_vert_int_chemoautopp(i,j) + &
(bact(1)%jprod_n_nitrif(i,j,k) + bact(1)%jprod_n_amx(i,j,k)) * rho_dzt(i,j,k) * grid_tmask(i,j,k)
cobalt%wc_vert_int_net_phyto_resp(i,j) = cobalt%wc_vert_int_net_phyto_resp(i,j) + &
cobalt%net_phyto_resp(i,j,k) * rho_dzt(i,j,k) * grid_tmask(i,j,k)
cobalt%wc_vert_int_npp(i,j) = cobalt%wc_vert_int_npp(i,j) + (phyto(SMALL)%jprod_n(i,j,k) + &
phyto(MEDIUM)%jprod_n(i,j,k) + phyto(LARGE)%jprod_n(i,j,k) + phyto(DIAZO)%jprod_n(i,j,k))* &
rho_dzt(i,j,k)*grid_tmask(i,j,k)
Expand Down Expand Up @@ -6511,7 +6508,6 @@ subroutine user_allocate_arrays
allocate(cobalt%jprod_nh4(isd:ied, jsd:jed, 1:nk)) ; cobalt%jprod_nh4=0.0
allocate(cobalt%jprod_nh4_plus_btm(isd:ied, jsd:jed, 1:nk)) ; cobalt%jprod_nh4_plus_btm=0.0
allocate(cobalt%jprod_po4(isd:ied, jsd:jed, 1:nk)) ; cobalt%jprod_po4=0.0
allocate(cobalt%net_phyto_resp(isd:ied, jsd:jed, 1:nk)) ; cobalt%net_phyto_resp=0.0
allocate(cobalt%det_jzloss_n(isd:ied, jsd:jed, 1:nk)) ; cobalt%det_jzloss_n=0.0
allocate(cobalt%det_jzloss_p(isd:ied, jsd:jed, 1:nk)) ; cobalt%det_jzloss_p=0.0
allocate(cobalt%det_jzloss_fe(isd:ied, jsd:jed, 1:nk)); cobalt%det_jzloss_fe=0.0
Expand Down Expand Up @@ -6640,7 +6636,6 @@ subroutine user_allocate_arrays
allocate(cobalt%wc_vert_int_o2(isd:ied, jsd:jed)) ; cobalt%wc_vert_int_o2=0.0
allocate(cobalt%wc_vert_int_alk(isd:ied, jsd:jed)) ; cobalt%wc_vert_int_alk=0.0
allocate(cobalt%wc_vert_int_chemoautopp(isd:ied, jsd:jed)) ; cobalt%wc_vert_int_chemoautopp=0.0
allocate(cobalt%wc_vert_int_net_phyto_resp(isd:ied, jsd:jed)) ; cobalt%wc_vert_int_net_phyto_resp=0.0
allocate(cobalt%wc_vert_int_npp(isd:ied, jsd:jed)) ; cobalt%wc_vert_int_npp=0.0
allocate(cobalt%wc_vert_int_jdiss_sidet(isd:ied, jsd:jed)) ; cobalt%wc_vert_int_jdiss_sidet=0.0
allocate(cobalt%wc_vert_int_jdiss_cadet(isd:ied, jsd:jed)) ; cobalt%wc_vert_int_jdiss_cadet=0.0
Expand Down Expand Up @@ -7079,7 +7074,6 @@ subroutine user_deallocate_arrays
deallocate(cobalt%jprod_nh4)
deallocate(cobalt%jprod_nh4_plus_btm)
deallocate(cobalt%jprod_po4)
deallocate(cobalt%net_phyto_resp)
deallocate(cobalt%det_jzloss_n)
deallocate(cobalt%det_jzloss_p)
deallocate(cobalt%det_jzloss_fe)
Expand Down Expand Up @@ -7275,7 +7269,6 @@ subroutine user_deallocate_arrays
deallocate(cobalt%wc_vert_int_o2)
deallocate(cobalt%wc_vert_int_alk)
deallocate(cobalt%wc_vert_int_chemoautopp)
deallocate(cobalt%wc_vert_int_net_phyto_resp)
deallocate(cobalt%wc_vert_int_npp)
deallocate(cobalt%wc_vert_int_jdiss_sidet)
deallocate(cobalt%wc_vert_int_jdiss_cadet)
Expand Down

0 comments on commit e62cd4c

Please sign in to comment.