From fad41d7225d637a3d1ce912ab38b453c45e1b8eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CDafydd?= <“dafydd_stephenson@hotmail.com”> Date: Tue, 26 Sep 2023 17:09:44 -0600 Subject: [PATCH 1/2] change loops to avoid continuing past bed (issue 176) --- src/marbl_ciso_diagnostics_mod.F90 | 6 +- src/marbl_ciso_interior_tendency_mod.F90 | 48 +-- src/marbl_diagnostics_mod.F90 | 10 +- src/marbl_interior_tendency_mod.F90 | 409 +++++++++++----------- src/marbl_interior_tendency_share_mod.F90 | 15 +- 5 files changed, 250 insertions(+), 238 deletions(-) diff --git a/src/marbl_ciso_diagnostics_mod.F90 b/src/marbl_ciso_diagnostics_mod.F90 index 685beb1e..e6155267 100644 --- a/src/marbl_ciso_diagnostics_mod.F90 +++ b/src/marbl_ciso_diagnostics_mod.F90 @@ -968,7 +968,7 @@ subroutine marbl_ciso_diagnostics_surface_flux_compute( & end subroutine marbl_ciso_diagnostics_surface_flux_compute !***************************************************************************** - + ! changed loop limits from km to kmt subroutine store_diagnostics_ciso_interior(& marbl_domain, & autotroph_d13C, & @@ -1158,7 +1158,7 @@ subroutine store_diagnostics_ciso_interior(& full_depth_integral=diags(ind%CISO_Ca14CO3_form_zint(n))%field_2d(1)) end do - do k = 1,km + do k = 1,kmt !! do n = 1, autotroph_cnt diags(ind%CISO_d13C(n))%field_3d(k, 1) = autotroph_d13C(n,k) diags(ind%CISO_d14C(n))%field_3d(k, 1) = autotroph_d14C(n,k) @@ -1182,7 +1182,7 @@ subroutine store_diagnostics_ciso_interior(& end do ! end loop over autotroph_cnt end do ! end loop over km - do k = 1,km + do k = 1,kmt !! diags(ind%CISO_DIC_d13C)%field_3d(k, 1) = DIC_d13C(k) diags(ind%CISO_DIC_d14C)%field_3d(k, 1) = DIC_d14C(k) diff --git a/src/marbl_ciso_interior_tendency_mod.F90 b/src/marbl_ciso_interior_tendency_mod.F90 index d4b8d888..13f5287b 100644 --- a/src/marbl_ciso_interior_tendency_mod.F90 +++ b/src/marbl_ciso_interior_tendency_mod.F90 @@ -180,8 +180,8 @@ subroutine marbl_ciso_interior_tendency_compute( & if (.not. ciso_on) return associate( & - column_km => marbl_domain%km, & - column_kmt => marbl_domain%kmt, & + km => marbl_domain%km, & + kmt => marbl_domain%kmt, & CO3 => interior_tendency_share%CO3_fields, & ! INPUT carbonate ion HCO3 => interior_tendency_share%HCO3_fields, & ! INPUT bicarbonate ion @@ -237,10 +237,10 @@ subroutine marbl_ciso_interior_tendency_compute( & !----------------------------------------------------------------------- ! Allocate memory for column_sinking_particle data types !----------------------------------------------------------------------- - call PO13C%construct(num_levels=column_km) - call PO14C%construct(num_levels=column_km) - call P_Ca13CO3%construct(num_levels=column_km) - call P_Ca14CO3%construct(num_levels=column_km) + call PO13C%construct(num_levels=km) + call PO14C%construct(num_levels=km) + call P_Ca13CO3%construct(num_levels=km) + call P_Ca14CO3%construct(num_levels=km) !----------------------------------------------------------------------- ! Set module variables @@ -273,7 +273,7 @@ subroutine marbl_ciso_interior_tendency_compute( & ! Set ratios !----------------------------------------------------------------------- - do k = 1, column_km + do k = 1, kmt !----------------------------------------------------------------------- ! set local 13C/12C ratios, assuming ecosystem carries 12C (C=C12+C13+C14) @@ -672,7 +672,7 @@ subroutine marbl_ciso_interior_tendency_compute( & ! Update particulate terms from prior level for next level !----------------------------------------------------------------------- - if (k < column_km) then + if (k < km) then !!20230926 - DS - redundant conditional now loop is to kmt? call update_particulate_terms_from_prior_level(k+1, PO13C, P_Ca13CO3) call update_particulate_terms_from_prior_level(k+1, PO14C, P_Ca14CO3) @@ -738,33 +738,33 @@ end subroutine marbl_ciso_interior_tendency_compute !*********************************************************************** - subroutine marbl_ciso_interior_tendency_autotroph_zero_consistency_enforce(auto_ind, column_kmt, zero_mask, & + subroutine marbl_ciso_interior_tendency_autotroph_zero_consistency_enforce(auto_ind, kmt, zero_mask, & autotroph_tracer_indices, autotroph_local) use marbl_interface_private_types, only : marbl_living_tracer_index_type integer, intent(in) :: auto_ind - integer, intent(in) :: column_kmt - logical, intent(in) :: zero_mask(column_kmt) + integer, intent(in) :: kmt + logical, intent(in) :: zero_mask(kmt) type(marbl_living_tracer_index_type), intent(in) :: autotroph_tracer_indices type(autotroph_local_type), intent(inout) :: autotroph_local if (.not. ciso_on) return where (zero_mask) - autotroph_local%C13(auto_ind,1:column_kmt) = c0 - autotroph_local%C14(auto_ind,1:column_kmt) = c0 + autotroph_local%C13(auto_ind,1:kmt) = c0 + autotroph_local%C14(auto_ind,1:kmt) = c0 end where if (autotroph_tracer_indices%Ca13CO3_ind > 0) then where (zero_mask) - autotroph_local%Ca13CO3(auto_ind,1:column_kmt) = c0 + autotroph_local%Ca13CO3(auto_ind,1:kmt) = c0 end where end if if (autotroph_tracer_indices%Ca14CO3_ind > 0) then where (zero_mask) - autotroph_local%Ca14CO3(auto_ind,1:column_kmt) = c0 + autotroph_local%Ca14CO3(auto_ind,1:kmt) = c0 end where end if @@ -1084,7 +1084,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, tracer_local, use marbl_settings_mod , only : caco3_bury_thres_iopt_fixed_depth use marbl_settings_mod , only : caco3_bury_thres_depth use marbl_settings_mod , only : caco3_bury_thres_omega_calc - use marbl_interior_tendency_share_mod, only : marbl_interior_tendency_share_set_used_particle_terms_to_zero + use marbl_interior_tendency_share_mod, only : marbl_interior_tendency_share_subfloor_particle_terms_to_zero integer (int_kind), intent(in) :: k ! vertical model level type(marbl_domain_type), intent(in) :: domain @@ -1113,8 +1113,8 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, tracer_local, !----------------------------------------------------------------------- associate( & - column_km => domain%km , & ! IN - column_kmt => domain%kmt , & ! IN + km => domain%km , & ! IN + kmt => domain%kmt , & ! IN column_delta_z => domain%delta_z(k) , & ! IN column_zw => domain%zw(k) , & ! IN O2_loc => tracer_local(marbl_tracer_indices%O2_ind,k) , & ! IN @@ -1156,7 +1156,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, tracer_local, dz_loc = column_delta_z - if (k <= column_kmt) then + if (k <= kmt) then dzr_loc = c1 / dz_loc @@ -1223,9 +1223,9 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, tracer_local, ((POC_ciso%sflux_in(k) - POC_ciso%sflux_out(k)) + & (POC_ciso%hflux_in(k) - POC_ciso%hflux_out(k))) * dzr_loc - else ! k > column_kmt - call marbl_interior_tendency_share_set_used_particle_terms_to_zero(k, POC_ciso) - call marbl_interior_tendency_share_set_used_particle_terms_to_zero(k, P_CaCO3_ciso) + else ! k > kmt + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(k, POC_ciso) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(k, P_CaCO3_ciso) dzr_loc = c0 endif @@ -1248,7 +1248,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, tracer_local, ! Here a constant depth is used for lysocline. !----------------------------------------------------------------------- - if (k == column_kmt) then + if (k == kmt) then POC_ciso%to_floor = POC_ciso%sflux_out(k) + POC_ciso%hflux_out(k) @@ -1301,7 +1301,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, tracer_local, POC_ciso%remin(1:k) = POC_ciso%remin(1:k) & + ((POC_ciso%to_floor - POC_ciso%sed_loss(k)) * bot_flux_to_tend(1:k)) endif - endif ! k == column_kmt + endif ! k == kmt end associate diff --git a/src/marbl_diagnostics_mod.F90 b/src/marbl_diagnostics_mod.F90 index 46a76f2c..10cf2b0e 100644 --- a/src/marbl_diagnostics_mod.F90 +++ b/src/marbl_diagnostics_mod.F90 @@ -3859,7 +3859,7 @@ subroutine store_diagnostics_particulates(marbl_domain, & diags(ind%calcToFloor)%field_2d(1) = P_CaCO3%to_floor diags(ind%calcToSed)%field_2d(1) = sum(P_CaCO3%sed_loss) diags(ind%calcToSed_ALT_CO2)%field_2d(1) = sum(P_CaCO3_ALT_CO2%sed_loss) - diags(ind%bsiToSed)%field_2d(1) = sum(P_SiO2%sed_loss) + diags(ind%bsiToSed)%field_2d(1) = sum(P_SiO2%sed_loss(1:kmt)) !!20230926 diags(ind%pocToFloor)%field_2d(1) = POC%to_floor diags(ind%pocToSed)%field_2d(1) = sum(POC%sed_loss) diags(ind%SedDenitrif)%field_2d(1) = sum(sed_denitrif * delta_z) @@ -3874,7 +3874,7 @@ subroutine store_diagnostics_particulates(marbl_domain, & end subroutine store_diagnostics_particulates !*********************************************************************** - + ! changed loop limit from km to kmt subroutine store_diagnostics_oxygen(marbl_domain, & interior_tendency_forcing_ind, interior_tendency_forcings, potemp, salinity, & column_o2, o2_production, o2_consumption, marbl_interior_diags) @@ -3929,7 +3929,7 @@ subroutine store_diagnostics_oxygen(marbl_domain, & end subroutine store_diagnostics_oxygen !*********************************************************************** - + ! changed loop limit from km to kmt subroutine store_diagnostics_PAR( marbl_domain, PAR_col_frac, PAR_avg, marbl_interior_diags) type(marbl_domain_type) , intent(in) :: marbl_domain @@ -3944,12 +3944,12 @@ subroutine store_diagnostics_PAR( marbl_domain, PAR_col_frac, PAR_avg, marbl_int !----------------------------------------------------------------------- associate( & - km => marbl_domain%km, & + kmt => marbl_domain%kmt, & diags => marbl_interior_diags%diags, & ind => marbl_interior_tendency_diag_ind & ) - do k=1,km + do k=1,kmt diags(ind%PAR_avg)%field_3d(k, 1) = sum(PAR_col_frac(:)*PAR_avg(k,:)) end do diff --git a/src/marbl_interior_tendency_mod.F90 b/src/marbl_interior_tendency_mod.F90 index 7f7aeec5..40128ae0 100644 --- a/src/marbl_interior_tendency_mod.F90 +++ b/src/marbl_interior_tendency_mod.F90 @@ -92,8 +92,10 @@ module marbl_interior_tendency_mod contains !*********************************************************************** - - subroutine marbl_interior_tendency_compute( & + ! Changed calls with "km" as an argument to call with "kmt". + ! Added call to marbl_interior_tendency_share_subfloor_particle_terms_to_zero to make sure no mem re-use issues + ! Changed main do loop from 1,km to 1,kmt + subroutine marbl_interior_tendency_compute( & !! complete domain, & bot_flux_to_tend, & interior_tendency_forcings, & @@ -134,6 +136,7 @@ subroutine marbl_interior_tendency_compute( & use marbl_interface_public_types, only : marbl_diagnostics_type use marbl_interior_tendency_share_mod, only : marbl_interior_tendency_share_export_variables use marbl_interior_tendency_share_mod, only : marbl_interior_tendency_share_export_zooplankton + use marbl_interior_tendency_share_mod, only : marbl_interior_tendency_share_subfloor_particle_terms_to_zero !! use marbl_restore_mod, only : marbl_restore_compute_interior_restore use marbl_settings_mod, only : lo2_consumption_scalef use marbl_settings_mod, only : lp_remin_scalef @@ -347,8 +350,8 @@ subroutine marbl_interior_tendency_compute( & call compute_PAR(domain, interior_tendency_forcings, interior_tendency_forcing_indices, & totalChl_local, unit_system, PAR) - call compute_autotroph_elemental_ratios(km, autotroph_local, marbl_tracer_indices, tracer_local, & - autotroph_derived_terms) + call compute_autotroph_elemental_ratios(kmt, autotroph_local, marbl_tracer_indices, tracer_local, & + autotroph_derived_terms) !!! tested call compute_temperature_functional_form(temperature(:), autotroph_settings(:)%Tref, & autotroph_settings(:)%temp_func_form_iopt, autotroph_settings(:)%Ea, Tfunc_auto(:,:)) @@ -356,36 +359,44 @@ subroutine marbl_interior_tendency_compute( & call compute_temperature_functional_form(temperature(:), zooplankton_settings(:)%Tref, & zooplankton_settings(:)%temp_func_form_iopt, zooplankton_settings(:)%Ea, Tfunc_zoo(:,:)) - call compute_Pprime(km, domain%zt, autotroph_local, temperature, autotroph_derived_terms%Pprime) + call compute_Pprime(kmt, domain%zt, autotroph_local, temperature, autotroph_derived_terms%Pprime) !! tested call compute_autotroph_uptake(km, marbl_tracer_indices, tracer_local(:, :), carbonate, autotroph_derived_terms) - call compute_autotroph_photosynthesis(km, num_PAR_subcols, autotroph_local, temperature(:), & - Tfunc_auto(:,:), PAR%col_frac(:), PAR%avg(:,:), autotroph_derived_terms) + call compute_autotroph_photosynthesis(kmt, num_PAR_subcols, autotroph_local, temperature(1:kmt), & + Tfunc_auto(:,1:kmt), PAR%col_frac(:), PAR%avg(1:kmt,:), autotroph_derived_terms) !!! tested - passed!! call compute_autotroph_nutrient_uptake(marbl_tracer_indices, autotroph_derived_terms) - call compute_autotroph_calcification(km, autotroph_local, temperature, carbonate, autotroph_derived_terms) + call compute_autotroph_calcification(kmt, autotroph_local, temperature, carbonate, autotroph_derived_terms) !! tested - call compute_autotroph_nfixation(km, autotroph_derived_terms) + call compute_autotroph_nfixation(kmt, autotroph_derived_terms) !! tested - call compute_autotroph_loss(km, Tfunc_auto(:,:), autotroph_derived_terms) + call compute_autotroph_loss(kmt, Tfunc_auto(:,:), autotroph_derived_terms) !! tested call compute_Zprime(km, domain%zt, zooplankton_local%C, Tfunc_zoo(:,:), zooplankton_derived_terms) - call compute_grazing(km, Tfunc_zoo(:,:), zooplankton_local, zooplankton_derived_terms, autotroph_derived_terms) + call compute_grazing(kmt, Tfunc_zoo(:,:), zooplankton_local, zooplankton_derived_terms, autotroph_derived_terms) !! tested call compute_routing(km, zooplankton_derived_terms, autotroph_derived_terms) - call compute_dissolved_organic_matter (km, marbl_tracer_indices, num_PAR_subcols, & + call compute_dissolved_organic_matter (kmt, marbl_tracer_indices, num_PAR_subcols, & PAR, zooplankton_derived_terms, autotroph_derived_terms, & - delta_z1, tracer_local(:, :), unit_system, dissolved_organic_matter) - - do k = 1, km - - call compute_scavenging(k, km, marbl_tracer_indices, tracer_local(:,:), & - POC, P_CaCO3, P_SiO2, dust, Fefree(:), Fe_scavenge_rate(:), & - Fe_scavenge(:), Lig_scavenge(:), marbl_status_log) + delta_z1, tracer_local(:, :), unit_system, dissolved_organic_matter) !! + + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(kmt, P_CaCO3) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(kmt, P_CaCO3_ALT_CO2) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(kmt, P_SiO2) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(kmt, dust) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(kmt, POC) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(kmt, P_iron) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(kmt, POP) + PON_remin(kmt+1:km) = c0 + + do k = 1, kmt !! tested + call compute_scavenging(k, kmt, marbl_tracer_indices, tracer_local(:,1:kmt), & + POC, P_CaCO3, P_SiO2, dust, Fefree(1:kmt), Fe_scavenge_rate(1:kmt), & + Fe_scavenge(1:kmt), Lig_scavenge(1:kmt), marbl_status_log) if (marbl_status_log%labort_marbl) then call marbl_status_log%log_error_trace('compute_scavenging()', subname) @@ -406,30 +417,28 @@ subroutine marbl_interior_tendency_compute( & marbl_particulate_share, glo_avg_fields_interior_tendency, PON_sed_loss(k), & marbl_status_log) - if (marbl_status_log%labort_marbl) then + if (marbl_status_log%labort_marbl) then call marbl_status_log%log_error_trace('compute_particulate_terms()', subname) return - end if + end if - if (k < km) then - call update_particulate_terms_from_prior_level(k+1, POC, POP, P_CaCO3, & - P_CaCO3_ALT_CO2, P_SiO2, dust, P_iron, QA_dust_def(:)) - endif + call update_particulate_terms_from_prior_level(k+1, POC, POP, P_CaCO3, & + P_CaCO3_ALT_CO2, P_SiO2, dust, P_iron, QA_dust_def(:)) end do ! k - call compute_Lig_terms(km, num_PAR_subcols, marbl_tracer_indices, & + call compute_Lig_terms(kmt, num_PAR_subcols, marbl_tracer_indices, & !! tested POC%remin(:), dissolved_organic_matter%DOC_prod(:), PAR, delta_z1, tracer_local, Lig_scavenge(:), & autotroph_derived_terms%photoFe(:,:), unit_system, Lig_prod(:), Lig_photochem(:), Lig_deg(:), Lig_loss(:)) call compute_nitrif(kmt, km, num_PAR_subcols, marbl_tracer_indices, PAR, tracer_local(:,:), nitrif(:)) - call compute_denitrif(km, marbl_tracer_indices, tracer_local(:, :), & + call compute_denitrif(kmt, marbl_tracer_indices, tracer_local(:, :), & !! tested dissolved_organic_matter%DOC_remin(:), & dissolved_organic_matter%DOCr_remin(:), & POC%remin(:), other_remin(:), sed_denitrif(:), denitrif(:)) - call compute_local_tendencies(km, marbl_tracer_indices, autotroph_derived_terms, & + call compute_local_tendencies(kmt, marbl_tracer_indices, autotroph_derived_terms, & !! tested zooplankton_derived_terms, & dissolved_organic_matter, & nitrif(:), denitrif(:), sed_denitrif(:), & @@ -480,7 +489,7 @@ subroutine marbl_interior_tendency_compute( & ! Store any variables needed in other tracer modules ! FIXME #28: need to pull particulate share out ! of compute_particulate_terms! - call marbl_interior_tendency_share_export_variables(km, marbl_tracer_indices, & + call marbl_interior_tendency_share_export_variables(kmt, marbl_tracer_indices, & !! tested tracer_local(:,:), carbonate, dissolved_organic_matter, & QA_dust_def(:), interior_tendency_share) @@ -518,7 +527,8 @@ subroutine marbl_interior_tendency_compute( & end subroutine marbl_interior_tendency_compute !*********************************************************************** - + ! changed "column_kmt" to "kmt" + ! changed "dkm" to "km" subroutine compute_PAR(domain, interior_tendency_forcings, interior_tendency_forcing_ind, & totalChl_local, unit_system, PAR) @@ -552,8 +562,8 @@ subroutine compute_PAR(domain, interior_tendency_forcings, interior_tendency_for !----------------------------------------------------------------------- associate( & - dkm => domain%km, & - column_kmt => domain%kmt, & + km => domain%km, & + kmt => domain%kmt, & delta_z => domain%delta_z, & PAR_nsubcols => domain%num_PAR_subcols & ) @@ -598,8 +608,8 @@ subroutine compute_PAR(domain, interior_tendency_forcings, interior_tendency_for ! compute attenuation coefficient over column !----------------------------------------------------------------------- - WORK1(:) = max(totalChl_local(1:column_kmt), 0.02_r8) - do k = 1, column_kmt + WORK1(:) = max(totalChl_local(1:kmt), 0.02_r8) + do k = 1, kmt if (WORK1(k) < 0.13224_r8) then PAR%KPARdz(k) = (0.0919_r8*unit_system%len2m)*(WORK1(k)**0.3536_r8) else @@ -607,35 +617,35 @@ subroutine compute_PAR(domain, interior_tendency_forcings, interior_tendency_for end if PAR%KPARdz(k) = PAR%KPARdz(k) * delta_z(k) end do - PAR%KPARdz(column_kmt+1:dkm) = c0 + PAR%KPARdz(kmt+1:km) = c0 !----------------------------------------------------------------------- ! propagate PAR values through column, only on subcolumns with PAR>0 ! note that if col_frac is 0, then so is PAR !----------------------------------------------------------------------- - WORK1(:) = exp(-PAR%KPARdz(1:column_kmt)) + WORK1(:) = exp(-PAR%KPARdz(1:kmt)) do subcol_ind = 1, PAR_nsubcols if (PAR%interface(0,subcol_ind) > c0) then ! this loop will probably not vectorize - do k = 1, column_kmt + do k = 1, kmt PAR%interface(k,subcol_ind) = PAR%interface(k-1,subcol_ind) * WORK1(k) if (PAR%interface(k,subcol_ind) < PAR_threshold) then - PAR%interface(k:column_kmt,subcol_ind) = c0 + PAR%interface(k:kmt,subcol_ind) = c0 exit end if end do - PAR%interface(column_kmt+1:dkm,subcol_ind) = c0 + PAR%interface(kmt+1:km,subcol_ind) = c0 - do k = 1, column_kmt + do k = 1, kmt PAR%avg(k,subcol_ind) = PAR%interface(k-1,subcol_ind) * (c1 - WORK1(k)) / PAR%KPARdz(k) end do - PAR%avg(column_kmt+1:dkm,subcol_ind) = c0 + PAR%avg(kmt+1:km,subcol_ind) = c0 else - PAR%interface(1:dkm,subcol_ind) = c0 - PAR%avg(1:dkm,subcol_ind) = c0 + PAR%interface(1:km,subcol_ind) = c0 + PAR%avg(1:km,subcol_ind) = c0 end if end do end associate @@ -724,8 +734,8 @@ subroutine marbl_interior_tendency_adjust_bury_coeff(marbl_particulate_share, & end subroutine marbl_interior_tendency_adjust_bury_coeff !*********************************************************************** - - subroutine setup_local_tracers(column_kmt, marbl_tracer_indices, tracers, & + ! changed "column_kmt" to "kmt" + subroutine setup_local_tracers(kmt, marbl_tracer_indices, tracers, & autotroph_local, tracer_local, zooplankton_local, totalChl_local) !----------------------------------------------------------------------- @@ -733,7 +743,7 @@ subroutine setup_local_tracers(column_kmt, marbl_tracer_indices, tracers, & ! treat negative values as zero, apply mask to local copies !----------------------------------------------------------------------- - integer(int_kind) , intent(in) :: column_kmt + integer(int_kind) , intent(in) :: kmt type(marbl_tracer_index_type), intent(in) :: marbl_tracer_indices real (r8) , intent(in) :: tracers(:,:) type(autotroph_local_type) , intent(inout) :: autotroph_local @@ -748,11 +758,11 @@ subroutine setup_local_tracers(column_kmt, marbl_tracer_indices, tracers, & integer (int_kind) :: zoo_ind, auto_ind, n ! tracer indices !----------------------------------------------------------------------- - do k = 1, column_kmt + do k = 1, kmt tracer_local(:,k) = max(c0, tracers(1:size(tracer_local,1),k)) end do - do k = column_kmt+1, size(tracer_local,2) + do k = kmt+1, size(tracer_local,2) tracer_local(:,k) = c0 end do @@ -818,7 +828,7 @@ subroutine setup_local_tracers(column_kmt, marbl_tracer_indices, tracers, & end do ! autotroph consistency check - call autotroph_zero_consistency_enforce(column_kmt, marbl_tracer_indices, autotroph_local) + call autotroph_zero_consistency_enforce(kmt, marbl_tracer_indices, autotroph_local) ! set totalChl_local totalChl_local = sum(autotroph_local%Chl(:,:), dim=1) @@ -952,7 +962,8 @@ subroutine set_surface_particulate_terms(surface_flux_forcing_indices, unit_syst end subroutine set_surface_particulate_terms !*********************************************************************** - + ! renamed dkm to km + ! changed loop limits to kmt subroutine compute_carbonate_chemistry(domain, temperature, press_bar, & salinity, tracer_local, marbl_tracer_indices, unit_system, & co2calc_coeffs, co2calc_state, carbonate, ph_prev_col, & @@ -1000,8 +1011,8 @@ subroutine compute_carbonate_chemistry(domain, temperature, press_bar, & sio3_loc = tracer_local(marbl_tracer_indices%sio3_ind,:) associate( & - dkm => domain%km, & - column_kmt => domain%kmt, & + km => domain%km, & + kmt => domain%kmt, & co3 => carbonate%CO3(:), & hco3 => carbonate%HCO3(:), & h2co3 => carbonate%H2CO3(:), & @@ -1014,7 +1025,7 @@ subroutine compute_carbonate_chemistry(domain, temperature, press_bar, & ph_alt_co2 => carbonate%pH_ALT_CO2(:) & ) - do k=1,dkm + do k=1,kmt !! if (ph_prev_col(k) /= c0) then ph_lower_bound(k) = ph_prev_col(k) - del_ph ph_upper_bound(k) = ph_prev_col(k) + del_ph @@ -1025,7 +1036,7 @@ subroutine compute_carbonate_chemistry(domain, temperature, press_bar, & end do call marbl_co2calc_interior(& - dkm, column_kmt, .true., unit_system, co2calc_coeffs, co2calc_state, & + km, kmt, .true., unit_system, co2calc_coeffs, co2calc_state, & temperature, salinity, press_bar, dic_loc, alk_loc, po4_loc, sio3_loc, & ph_lower_bound, ph_upper_bound, ph, h2co3, hco3, co3, marbl_status_log) @@ -1038,7 +1049,7 @@ subroutine compute_carbonate_chemistry(domain, temperature, press_bar, & call marbl_status_log%log_warning_trace('marbl_co2calc_interior() with dic', subname) end if - do k=1,dkm + do k=1,kmt !! ph_prev_col(k) = pH(k) if (ph_prev_alt_co2_col(k) /= c0) then ph_lower_bound(k) = ph_prev_alt_co2_col(k) - del_ph @@ -1050,7 +1061,7 @@ subroutine compute_carbonate_chemistry(domain, temperature, press_bar, & end do call marbl_co2calc_interior(& - dkm, column_kmt, .false., unit_system, co2calc_coeffs, co2calc_state, & + km, kmt, .false., unit_system, co2calc_coeffs, co2calc_state, & temperature, salinity, press_bar, dic_alt_co2_loc, alk_alt_co2_loc, po4_loc, & sio3_loc, ph_lower_bound, ph_upper_bound, ph_alt_co2, h2co3_alt_co2, & hco3_alt_co2, co3_alt_co2, marbl_status_log) @@ -1067,7 +1078,7 @@ subroutine compute_carbonate_chemistry(domain, temperature, press_bar, & ph_prev_alt_co2_col = ph_alt_co2 call marbl_co2calc_co3_sat_vals(& - dkm, column_kmt, temperature, salinity, & + km, kmt, temperature, salinity, & press_bar, unit_system, co3_sat_calcite, & co3_sat_aragonite) @@ -1076,8 +1087,8 @@ subroutine compute_carbonate_chemistry(domain, temperature, press_bar, & end subroutine compute_carbonate_chemistry !*********************************************************************** - - subroutine autotroph_zero_consistency_enforce(column_kmt, marbl_tracer_indices, autotroph_local) + ! changed "column_kmt" to "kmt" + subroutine autotroph_zero_consistency_enforce(kmt, marbl_tracer_indices, autotroph_local) use marbl_ciso_interior_tendency_mod, only : marbl_ciso_interior_tendency_autotroph_zero_consistency_enforce @@ -1085,7 +1096,7 @@ subroutine autotroph_zero_consistency_enforce(column_kmt, marbl_tracer_indices, ! If any phyto box are zero, set others to zeros. !----------------------------------------------------------------------- - integer(int_kind), intent(in) :: column_kmt ! number of active model layers + integer(int_kind), intent(in) :: kmt ! number of active model layers type(marbl_tracer_index_type), intent(in) :: marbl_tracer_indices type(autotroph_local_type), intent(inout) :: autotroph_local @@ -1093,11 +1104,11 @@ subroutine autotroph_zero_consistency_enforce(column_kmt, marbl_tracer_indices, ! local variables !----------------------------------------------------------------------- integer (int_kind) :: auto_ind, k - logical (log_kind) :: zero_mask(column_kmt) + logical (log_kind) :: zero_mask(kmt) !----------------------------------------------------------------------- do auto_ind = 1, autotroph_cnt - do k = 1, column_kmt + do k = 1, kmt zero_mask(k) = (autotroph_local%Chl(auto_ind,k) == c0 & .or. autotroph_local%C(auto_ind,k) == c0 & @@ -1109,33 +1120,33 @@ subroutine autotroph_zero_consistency_enforce(column_kmt, marbl_tracer_indices, end if end do where (zero_mask) - autotroph_local%Chl(auto_ind,1:column_kmt) = c0 - autotroph_local%C(auto_ind,1:column_kmt) = c0 - autotroph_local%P(auto_ind,1:column_kmt) = c0 - autotroph_local%Fe(auto_ind,1:column_kmt) = c0 + autotroph_local%Chl(auto_ind,1:kmt) = c0 + autotroph_local%C(auto_ind,1:kmt) = c0 + autotroph_local%P(auto_ind,1:kmt) = c0 + autotroph_local%Fe(auto_ind,1:kmt) = c0 end where if (marbl_tracer_indices%auto_inds(auto_ind)%Si_ind > 0) then where (zero_mask) - autotroph_local%Si(auto_ind,1:column_kmt) = c0 + autotroph_local%Si(auto_ind,1:kmt) = c0 end where end if if (marbl_tracer_indices%auto_inds(auto_ind)%CaCO3_ind > 0) then where (zero_mask) - autotroph_local%CaCO3(auto_ind,1:column_kmt) = c0 + autotroph_local%CaCO3(auto_ind,1:kmt) = c0 end where end if ! carbon isotope components of autotroph_local_type ! FIXME #278: this interface will change when logical checks are not index-based - call marbl_ciso_interior_tendency_autotroph_zero_consistency_enforce(auto_ind, column_kmt, zero_mask, & + call marbl_ciso_interior_tendency_autotroph_zero_consistency_enforce(auto_ind, kmt, zero_mask, & marbl_tracer_indices%auto_inds(auto_ind), autotroph_local) end do end subroutine autotroph_zero_consistency_enforce !*********************************************************************** - - subroutine compute_autotroph_elemental_ratios(km, autotroph_local, marbl_tracer_indices, tracer_local, & + ! renamed km to kmt in argument list + subroutine compute_autotroph_elemental_ratios(kmt, autotroph_local, marbl_tracer_indices, tracer_local, & autotroph_derived_terms) use marbl_constants_mod, only : epsC @@ -1148,10 +1159,10 @@ subroutine compute_autotroph_elemental_ratios(km, autotroph_local, marbl_tracer_ use marbl_settings_mod, only : PquotaSlope, PquotaIntercept, PquotaMinNP use marbl_settings_mod, only : QCaCO3_max - integer, intent(in) :: km + integer, intent(in) :: kmt type(autotroph_local_type), intent(in) :: autotroph_local type(marbl_tracer_index_type), intent(in) :: marbl_tracer_indices - real (r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt,km) + real (r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt,kmt) type(autotroph_derived_terms_type), intent(inout) :: autotroph_derived_terms !----------------------------------------------------------------------- @@ -1298,24 +1309,24 @@ subroutine compute_temperature_functional_form(temperature, Tref, temp_func_form end subroutine compute_temperature_functional_form !*********************************************************************** - - subroutine compute_Pprime(km, zt, autotroph_local, temperature, Pprime) + ! renamed km to kmt in argument list + subroutine compute_Pprime(kmt, zt, autotroph_local, temperature, Pprime) use marbl_settings_mod, only : thres_z1_auto use marbl_settings_mod, only : thres_z2_auto - integer, intent(in) :: km - real(r8), intent(in) :: zt(km) + integer, intent(in) :: kmt + real(r8), intent(in) :: zt(kmt) type(autotroph_local_type), intent(in) :: autotroph_local - real(r8), intent(in) :: temperature(km) - real(r8), intent(out) :: Pprime(autotroph_cnt, km) + real(r8), intent(in) :: temperature(kmt) + real(r8), intent(out) :: Pprime(autotroph_cnt, kmt) !----------------------------------------------------------------------- ! local variables !----------------------------------------------------------------------- integer :: auto_ind - real(r8) :: f_loss_thres(km) - real(r8) :: C_loss_thres(km) + real(r8) :: f_loss_thres(kmt) + real(r8) :: C_loss_thres(kmt) !----------------------------------------------------------------------- ! calculate the loss threshold interpolation factor @@ -1334,8 +1345,8 @@ subroutine compute_Pprime(km, zt, autotroph_local, temperature, Pprime) end subroutine compute_Pprime !*********************************************************************** - - subroutine compute_autotroph_photosynthesis(km, PAR_nsubcols, & + ! renamed km to kmt in argument list + subroutine compute_autotroph_photosynthesis(kmt, PAR_nsubcols, & autotroph_local, temperature, Tfunc_auto, PAR_col_frac, PAR_avg, & autotroph_derived_terms) @@ -1345,13 +1356,13 @@ subroutine compute_autotroph_photosynthesis(km, PAR_nsubcols, & use marbl_constants_mod, only : epsTinv - integer(int_kind), intent(in) :: km + integer(int_kind), intent(in) :: kmt integer(int_kind), intent(in) :: PAR_nsubcols type(autotroph_local_type), intent(in) :: autotroph_local - real(r8), intent(in) :: temperature(km) - real(r8), intent(in) :: Tfunc_auto(autotroph_cnt,km) + real(r8), intent(in) :: temperature(kmt) + real(r8), intent(in) :: Tfunc_auto(autotroph_cnt,kmt) real(r8), intent(in) :: PAR_col_frac(PAR_nsubcols) - real(r8), intent(in) :: PAR_avg(km,PAR_nsubcols) + real(r8), intent(in) :: PAR_avg(kmt,PAR_nsubcols) type(autotroph_derived_terms_type), intent(inout) :: autotroph_derived_terms !----------------------------------------------------------------------- @@ -1377,7 +1388,7 @@ subroutine compute_autotroph_photosynthesis(km, PAR_nsubcols, & ) do auto_ind = 1, autotroph_cnt - do k=1,km + do k=1,kmt if (temperature(k) < autotroph_settings(auto_ind)%temp_thres) then PCmax = c0 @@ -1422,8 +1433,8 @@ subroutine compute_autotroph_photosynthesis(km, PAR_nsubcols, & end subroutine compute_autotroph_photosynthesis !*********************************************************************** - - subroutine compute_autotroph_calcification(km, autotroph_local, temperature, carbonate, autotroph_derived_terms) + ! renamed km to kmt in argument list + subroutine compute_autotroph_calcification(kmt, autotroph_local, temperature, carbonate, autotroph_derived_terms) !----------------------------------------------------------------------- ! CaCO3 Production, parameterized as function of small phyto production @@ -1438,9 +1449,9 @@ subroutine compute_autotroph_calcification(km, autotroph_local, temperature, car use marbl_settings_mod, only : CaCO3_temp_thres2 use marbl_settings_mod, only : f_photosp_CaCO3 - integer, intent(in) :: km + integer, intent(in) :: kmt type(autotroph_local_type), intent(in) :: autotroph_local - real(r8), intent(in) :: temperature(km) + real(r8), intent(in) :: temperature(kmt) type(carbonate_type), intent(in) :: carbonate type(autotroph_derived_terms_type), intent(inout) :: autotroph_derived_terms @@ -1448,7 +1459,7 @@ subroutine compute_autotroph_calcification(km, autotroph_local, temperature, car ! local variables !----------------------------------------------------------------------- integer :: auto_ind - real(r8) :: picpoc(km) + real(r8) :: picpoc(kmt) !----------------------------------------------------------------------- associate( & @@ -1499,12 +1510,12 @@ subroutine compute_autotroph_calcification(km, autotroph_local, temperature, car end subroutine compute_autotroph_calcification !*********************************************************************** + ! renamed km to kmt in argument list + subroutine compute_autotroph_uptake(kmt, marbl_tracer_indices, tracer_local, carbonate, autotroph_derived_terms) - subroutine compute_autotroph_uptake(km, marbl_tracer_indices, tracer_local, carbonate, autotroph_derived_terms) - - integer, intent(in) :: km + integer, intent(in) :: kmt type(marbl_tracer_index_type), intent(in) :: marbl_tracer_indices - real(r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt,km) + real(r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt,kmt) type(carbonate_type), intent(in) :: carbonate type(autotroph_derived_terms_type), intent(inout) :: autotroph_derived_terms @@ -1584,8 +1595,8 @@ subroutine compute_autotroph_uptake(km, marbl_tracer_indices, tracer_local, carb end subroutine compute_autotroph_uptake !*********************************************************************** - - subroutine compute_autotroph_nfixation(km, autotroph_derived_terms) + ! renamed km to kmt in argument list + subroutine compute_autotroph_nfixation(kmt, autotroph_derived_terms) !----------------------------------------------------------------------- ! Get N fixation by diazotrophs based on C fixation, @@ -1595,14 +1606,14 @@ subroutine compute_autotroph_nfixation(km, autotroph_derived_terms) use marbl_settings_mod, only : Q use marbl_settings_mod, only : r_Nfix_photo - integer, intent(in) :: km + integer, intent(in) :: kmt type(autotroph_derived_terms_type), intent(inout) :: autotroph_derived_terms !----------------------------------------------------------------------- ! local variables !----------------------------------------------------------------------- integer :: auto_ind - real(r8) :: work1(km) + real(r8) :: work1(kmt) !----------------------------------------------------------------------- associate( & @@ -1697,8 +1708,8 @@ subroutine compute_autotroph_nutrient_uptake(marbl_tracer_indices, autotroph_der end subroutine compute_autotroph_nutrient_uptake !*********************************************************************** - - subroutine compute_autotroph_loss(km, Tfunc_auto, autotroph_derived_terms) + ! renamed km to kmt in argument list + subroutine compute_autotroph_loss(kmt, Tfunc_auto, autotroph_derived_terms) !----------------------------------------------------------------------- ! Compute autotroph-loss, autotroph aggregation loss and routine of @@ -1707,8 +1718,8 @@ subroutine compute_autotroph_loss(km, Tfunc_auto, autotroph_derived_terms) use marbl_settings_mod, only : auto_mort2_exp - integer, intent(in) :: km - real(r8), intent(in) :: Tfunc_auto(autotroph_cnt,km) + integer, intent(in) :: kmt + real(r8), intent(in) :: Tfunc_auto(autotroph_cnt,kmt) type(autotroph_derived_terms_type), intent(inout) :: autotroph_derived_terms !----------------------------------------------------------------------- @@ -1760,25 +1771,25 @@ subroutine compute_autotroph_loss(km, Tfunc_auto, autotroph_derived_terms) end subroutine compute_autotroph_loss !*********************************************************************** - - subroutine compute_Zprime(km, zt, zooC, Tfunc_zoo, zooplankton_derived_terms) + ! renamed km to kmt in argument list + subroutine compute_Zprime(kmt, zt, zooC, Tfunc_zoo, zooplankton_derived_terms) use marbl_settings_mod, only : thres_z1_zoo use marbl_settings_mod, only : thres_z2_zoo use marbl_settings_mod, only : zoo_mort2_exp - integer(int_kind), intent(in) :: km - real(r8), intent(in) :: zt(km) - real(r8), intent(in) :: zooC(zooplankton_cnt,km) - real(r8), intent(in) :: Tfunc_zoo(zooplankton_cnt,km) + integer(int_kind), intent(in) :: kmt + real(r8), intent(in) :: zt(kmt) + real(r8), intent(in) :: zooC(zooplankton_cnt,kmt) + real(r8), intent(in) :: Tfunc_zoo(zooplankton_cnt,kmt) type(zooplankton_derived_terms_type), intent(inout) :: zooplankton_derived_terms !----------------------------------------------------------------------- ! local variables !----------------------------------------------------------------------- integer :: zoo_ind - real(r8) :: f_loss_thres(km) - real(r8) :: C_loss_thres(km) + real(r8) :: f_loss_thres(kmt) + real(r8) :: C_loss_thres(kmt) !----------------------------------------------------------------------- associate( & @@ -1809,8 +1820,8 @@ subroutine compute_Zprime(km, zt, zooC, Tfunc_zoo, zooplankton_derived_terms) end subroutine compute_Zprime !*********************************************************************** - - subroutine compute_grazing(km, Tfunc_zoo, zooplankton_local, zooplankton_derived_terms, autotroph_derived_terms) + ! renamed km to kmt in argument list + subroutine compute_grazing(kmt, Tfunc_zoo, zooplankton_local, zooplankton_derived_terms, autotroph_derived_terms) !----------------------------------------------------------------------- ! CALCULATE GRAZING @@ -1829,8 +1840,8 @@ subroutine compute_grazing(km, Tfunc_zoo, zooplankton_local, zooplankton_derived use marbl_pft_mod, only : grz_fnc_michaelis_menten use marbl_pft_mod, only : grz_fnc_sigmoidal - integer, intent(in) :: km - real(r8), intent(in) :: Tfunc_zoo(zooplankton_cnt,km) + integer, intent(in) :: kmt + real(r8), intent(in) :: Tfunc_zoo(zooplankton_cnt,kmt) type(zooplankton_local_type), intent(in) :: zooplankton_local type(zooplankton_derived_terms_type), intent(inout) :: zooplankton_derived_terms type(autotroph_derived_terms_type), intent(inout) :: autotroph_derived_terms @@ -1882,7 +1893,7 @@ subroutine compute_grazing(km, Tfunc_zoo, zooplankton_local, zooplankton_derived x_graze_zoo(:,:) = c0 ! grazing gains by zooplankton at zoo_ind - do k=1, km + do k=1, kmt do pred_ind = 1, zooplankton_cnt work3 = c0 @@ -2014,13 +2025,13 @@ subroutine compute_grazing(km, Tfunc_zoo, zooplankton_local, zooplankton_derived end subroutine compute_grazing !*********************************************************************** - - subroutine compute_routing(km, zooplankton_derived_terms, autotroph_derived_terms) + ! renamed km to kmt in argument list + subroutine compute_routing(kmt, zooplankton_derived_terms, autotroph_derived_terms) use marbl_settings_mod, only : parm_labile_ratio use marbl_settings_mod, only : f_toDOP - integer, intent(in) :: km + integer, intent(in) :: kmt type(zooplankton_derived_terms_type), intent(inout) :: zooplankton_derived_terms type(autotroph_derived_terms_type), intent(inout) :: autotroph_derived_terms @@ -2060,7 +2071,7 @@ subroutine compute_routing(km, zooplankton_derived_terms, autotroph_derived_term zoo_loss_dic => zooplankton_derived_terms%zoo_loss_dic(:,:) & ! output ) - do k=1,km + do k=1,kmt !----------------------------------------------------------------------- ! compute routing to dic of grazed material !----------------------------------------------------------------------- @@ -2125,8 +2136,8 @@ subroutine compute_routing(km, zooplankton_derived_terms, autotroph_derived_term end subroutine compute_routing !*********************************************************************** - - subroutine compute_dissolved_organic_matter (km, marbl_tracer_indices, & + ! renamed km to kmt in argument list + subroutine compute_dissolved_organic_matter (kmt, marbl_tracer_indices, & PAR_nsubcols, PAR, & zooplankton_derived_terms, autotroph_derived_terms, & dz1, tracer_local, unit_system, dissolved_organic_matter) @@ -2143,14 +2154,14 @@ subroutine compute_dissolved_organic_matter (km, marbl_tracer_indices, & use marbl_settings_mod, only : DOPr_reminR0 use marbl_settings_mod, only : DOMr_reminR_photo - integer(int_kind), intent(in) :: km + integer(int_kind), intent(in) :: kmt type(marbl_tracer_index_type), intent(in) :: marbl_tracer_indices integer(int_kind), intent(in) :: PAR_nsubcols type(marbl_PAR_type), intent(in) :: PAR type(zooplankton_derived_terms_type), intent(in) :: zooplankton_derived_terms type(autotroph_derived_terms_type), intent(in) :: autotroph_derived_terms real(r8), intent(in) :: dz1 - real(r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt,km) + real(r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt,kmt) type(unit_system_type), intent(in) :: unit_system type(dissolved_organic_matter_type), intent(inout) :: dissolved_organic_matter @@ -2207,7 +2218,7 @@ subroutine compute_dissolved_organic_matter (km, marbl_tracer_indices, & DOP_prod(:) = Qp_zoo * (sum(zoo_loss_doc(:,:), dim=1) + sum(zoo_graze_doc(:,:), dim=1)) & + sum(remaining_P_dop(:,:), dim=1) - do k=1, km + do k=1, kmt !----------------------------------------------------------------------- ! Different remin rates in light and dark for semi-labile pools !----------------------------------------------------------------------- @@ -2263,11 +2274,11 @@ subroutine compute_dissolved_organic_matter (km, marbl_tracer_indices, & end subroutine compute_dissolved_organic_matter !*********************************************************************** - - subroutine compute_scavenging(k, km, marbl_tracer_indices, & + ! renamed km to kmt in argument list + subroutine compute_scavenging(k, kmt, marbl_tracer_indices, & tracer_local, POC, P_CaCO3, P_SiO2, dust, & Fefree, Fe_scavenge_rate, Fe_scavenge, Lig_scavenge, & - marbl_status_log) + marbl_status_log) !! use marbl_constants_mod, only : c3, c4 use marbl_settings_mod , only : Lig_cnt @@ -2277,17 +2288,17 @@ subroutine compute_scavenging(k, km, marbl_tracer_indices, & use marbl_settings_mod , only : dust_Fe_scavenge_scale integer, intent(in) :: k - integer, intent(in) :: km + integer, intent(in) :: kmt !! type(marbl_tracer_index_type), intent(in) :: marbl_tracer_indices - real(r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt,km) + real(r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt,kmt)!! type(column_sinking_particle_type), intent(in) :: POC type(column_sinking_particle_type), intent(in) :: P_CaCO3 type(column_sinking_particle_type), intent(in) :: P_SiO2 type(column_sinking_particle_type), intent(in) :: dust - real(r8), intent(out) :: Fefree(km) - real(r8), intent(out) :: Fe_scavenge_rate(km) ! scavenging rate of iron (1/s) - real(r8), intent(out) :: Fe_scavenge(km) - real(r8), intent(out) :: Lig_scavenge(km) + real(r8), intent(out) :: Fefree(kmt)!! + real(r8), intent(out) :: Fe_scavenge_rate(kmt)!! ! scavenging rate of iron (1/s) + real(r8), intent(out) :: Fe_scavenge(kmt)!! + real(r8), intent(out) :: Lig_scavenge(kmt)!! type(marbl_log_type), intent(inout) :: marbl_status_log !----------------------------------------------------------------------- @@ -2681,7 +2692,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, p_remin_scalef use marbl_glo_avg_mod, only : glo_avg_field_ind_interior_tendency_d_POP_bury_d_bury_coeff use marbl_glo_avg_mod, only : glo_avg_field_ind_interior_tendency_d_bSi_bury_d_bury_coeff use marbl_interior_tendency_share_mod, only : marbl_interior_tendency_share_export_particulate - use marbl_interior_tendency_share_mod, only : marbl_interior_tendency_share_set_used_particle_terms_to_zero + use marbl_interior_tendency_share_mod, only : marbl_interior_tendency_share_subfloor_particle_terms_to_zero integer (int_kind) , intent(in) :: k ! vertical model level type(marbl_domain_type) , intent(in) :: domain @@ -2745,7 +2756,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, p_remin_scalef !----------------------------------------------------------------------- associate( & - column_kmt => domain%kmt, & + kmt => domain%kmt, & delta_z => domain%delta_z, & zw => domain%zw, & O2_loc => tracer_local(marbl_tracer_indices%o2_ind,k), & @@ -2790,7 +2801,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, p_remin_scalef poc_error = .false. dz_loc = delta_z(k) - if (k <= column_kmt) then + if (k <= kmt) then dzr_loc = c1 / dz_loc poc_diss = POC%diss @@ -2995,9 +3006,9 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, p_remin_scalef P_iron%hflux_out(k) = P_iron%hflux_in(k) - !------------------------------------------------------------------------ - ! compute POP remin and flux out, following code for iron - !------------------------------------------------------------------------ + !------------------------------------------------------------------------ + ! compute POP remin and flux out, following code for iron + !------------------------------------------------------------------------ POP%remin(k) = c0 if (POC%sflux_in(k) + POC%hflux_in(k) > c0) then @@ -3019,15 +3030,15 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, p_remin_scalef POP%hflux_out(k) = POP%hflux_in(k) - else ! k > column_kmt + else ! k > kmt - call marbl_interior_tendency_share_set_used_particle_terms_to_zero(k, P_CaCO3) - call marbl_interior_tendency_share_set_used_particle_terms_to_zero(k, P_CaCO3_ALT_CO2) - call marbl_interior_tendency_share_set_used_particle_terms_to_zero(k, P_SiO2) - call marbl_interior_tendency_share_set_used_particle_terms_to_zero(k, dust) - call marbl_interior_tendency_share_set_used_particle_terms_to_zero(k, POC) - call marbl_interior_tendency_share_set_used_particle_terms_to_zero(k, P_iron) - call marbl_interior_tendency_share_set_used_particle_terms_to_zero(k, POP) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(k, P_CaCO3) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(k, P_CaCO3_ALT_CO2) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(k, P_SiO2) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(k, dust) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(k, POC) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(k, P_iron) + call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(k, POP) PON_remin(k) = c0 dzr_loc = c0 @@ -3045,7 +3056,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, p_remin_scalef ztop = c0 end if if (ztop .le. particulate_flux_ref_depth .and. particulate_flux_ref_depth .lt. zw(k)) then - if (k <= column_kmt) then + if (k <= kmt) then if (particulate_flux_ref_depth .eq. ztop) then ! expressions are simplified if particulate_flux_ref_depth is exactly the top of the layer POC%flux_at_ref_depth = POC%sflux_in(k) + POC%hflux_in(k) @@ -3114,7 +3125,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, p_remin_scalef PON_sed_loss = c0 - if (k == column_kmt) then + if (k == kmt) then POC%to_floor = POC%sflux_out(k) + POC%hflux_out(k) @@ -3285,29 +3296,29 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, p_remin_scalef end subroutine compute_particulate_terms !*********************************************************************** - - subroutine compute_Lig_terms(km, PAR_nsubcols, marbl_tracer_indices, & + ! renamed km to kmt in argument list + subroutine compute_Lig_terms(kmt, PAR_nsubcols, marbl_tracer_indices, & POC_remin, DOC_prod, PAR, dz1, tracer_local, Lig_scavenge, & photoFe, unit_system, Lig_prod, Lig_photochem, Lig_deg, Lig_loss) use marbl_settings_mod, only : remin_to_Lig use marbl_settings_mod, only : parm_Lig_degrade_rate0 - integer(int_kind), intent(in) :: km + integer(int_kind), intent(in) :: kmt integer(int_kind), intent(in) :: PAR_nsubcols type(marbl_tracer_index_type), intent(in) :: marbl_tracer_indices - real(r8), intent(in) :: POC_remin(km) - real(r8), intent(in) :: DOC_prod(km) + real(r8), intent(in) :: POC_remin(kmt) + real(r8), intent(in) :: DOC_prod(kmt) type(marbl_PAR_type), intent(in) :: PAR real(r8), intent(in) :: dz1 - real(r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt, km) - real(r8), intent(in) :: Lig_scavenge(km) - real(r8), intent(in) :: photoFe(autotroph_cnt,km) + real(r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt, kmt) + real(r8), intent(in) :: Lig_scavenge(kmt) + real(r8), intent(in) :: photoFe(autotroph_cnt,kmt) type(unit_system_type), intent(in) :: unit_system - real(r8), intent(out) :: Lig_prod(km) - real(r8), intent(out) :: Lig_photochem(km) - real(r8), intent(out) :: Lig_deg(km) - real(r8), intent(out) :: Lig_loss(km) + real(r8), intent(out) :: Lig_prod(kmt) + real(r8), intent(out) :: Lig_photochem(kmt) + real(r8), intent(out) :: Lig_deg(kmt) + real(r8), intent(out) :: Lig_loss(kmt) !----------------------------------------------------------------------- ! local variables @@ -3421,23 +3432,23 @@ subroutine compute_nitrif(kmt, km, PAR_nsubcols, marbl_tracer_indices, PAR, trac end subroutine compute_nitrif !*********************************************************************** - - subroutine compute_denitrif(km, marbl_tracer_indices, tracer_local, DOC_remin, DOCr_remin, & - POC_remin, other_remin, sed_denitrif, denitrif) + ! renamed km to kmt in argument list + subroutine compute_denitrif(kmt, marbl_tracer_indices, tracer_local, DOC_remin, DOCr_remin, & + POC_remin, other_remin, sed_denitrif, denitrif) !! changed km > kmt throughout, tested !----------------------------------------------------------------------- ! Compute denitrification under low O2 conditions !----------------------------------------------------------------------- - integer, intent(in) :: km + integer, intent(in) :: kmt type(marbl_tracer_index_type), intent(in) :: marbl_tracer_indices - real(r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt, km) - real(r8), intent(in) :: DOC_remin(km) - real(r8), intent(in) :: DOCr_remin(km) - real(r8), intent(in) :: POC_remin(km) - real(r8), intent(in) :: other_remin(km) - real(r8), intent(inout) :: sed_denitrif(km) - real(r8), intent(out) :: denitrif(km) + real(r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt, kmt) + real(r8), intent(in) :: DOC_remin(kmt) + real(r8), intent(in) :: DOCr_remin(kmt) + real(r8), intent(in) :: POC_remin(kmt) + real(r8), intent(in) :: other_remin(kmt) + real(r8), intent(inout) :: sed_denitrif(kmt) + real(r8), intent(out) :: denitrif(kmt) !----------------------------------------------------------------------- ! local variables @@ -3450,7 +3461,7 @@ subroutine compute_denitrif(km, marbl_tracer_indices, tracer_local, DOC_remin, D O2_loc => tracer_local(marbl_tracer_indices%o2_ind,:), & NO3_loc => tracer_local(marbl_tracer_indices%no3_ind,:) & ) - do k=1,km + do k=1,kmt work = ((parm_o2_min + parm_o2_min_delta) - O2_loc(k)) / parm_o2_min_delta work = min(max(work, c0), c1) denitrif(k) = work * ((DOC_remin(k) + DOCr_remin(k) + POC_remin(k) * (c1 - POCremin_refract) & @@ -3469,37 +3480,37 @@ subroutine compute_denitrif(km, marbl_tracer_indices, tracer_local, DOC_remin, D end subroutine compute_denitrif !*********************************************************************** - - subroutine compute_local_tendencies(km, marbl_tracer_indices, autotroph_derived_terms, & + ! renamed km to kmt in argument list + subroutine compute_local_tendencies(kmt, marbl_tracer_indices, autotroph_derived_terms, & zooplankton_derived_terms, dissolved_organic_matter, nitrif, denitrif, sed_denitrif, & Fe_scavenge, Lig_prod, Lig_loss, P_iron_remin, POC_remin, POP_remin, P_SiO2_remin, & P_CaCO3_remin, P_CaCO3_ALT_CO2_remin, other_remin, PON_remin, tracer_local, & o2_consumption_scalef, o2_production, o2_consumption, interior_tendencies) - integer, intent(in) :: km + integer, intent(in) :: kmt type(marbl_tracer_index_type), intent(in) :: marbl_tracer_indices type(autotroph_derived_terms_type), intent(in) :: autotroph_derived_terms type(zooplankton_derived_terms_type), intent(in) :: zooplankton_derived_terms type(dissolved_organic_matter_type), intent(in) :: dissolved_organic_matter - real(r8), intent(in) :: nitrif(km) - real(r8), intent(in) :: denitrif(km) - real(r8), intent(in) :: sed_denitrif(km) - real(r8), intent(in) :: Fe_scavenge(km) - real(r8), intent(in) :: Lig_prod(km) - real(r8), intent(in) :: Lig_loss(km) - real(r8), intent(in) :: P_iron_remin(km) - real(r8), intent(in) :: POC_remin(km) - real(r8), intent(in) :: POP_remin(km) - real(r8), intent(in) :: P_SiO2_remin(km) - real(r8), intent(in) :: P_CaCO3_remin(km) - real(r8), intent(in) :: P_CaCO3_ALT_CO2_remin(km) - real(r8), intent(in) :: other_remin(km) - real(r8), intent(in) :: PON_remin(km) - real(r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt, km) - real(r8), intent(in) :: o2_consumption_scalef(km) - real(r8), intent(out) :: o2_production(km) - real(r8), intent(out) :: o2_consumption(km) - real(r8), intent(inout) :: interior_tendencies(marbl_tracer_indices%total_cnt, km) + real(r8), intent(in) :: nitrif(kmt) + real(r8), intent(in) :: denitrif(kmt) + real(r8), intent(in) :: sed_denitrif(kmt) + real(r8), intent(in) :: Fe_scavenge(kmt) + real(r8), intent(in) :: Lig_prod(kmt) + real(r8), intent(in) :: Lig_loss(kmt) + real(r8), intent(in) :: P_iron_remin(kmt) + real(r8), intent(in) :: POC_remin(kmt) + real(r8), intent(in) :: POP_remin(kmt) + real(r8), intent(in) :: P_SiO2_remin(kmt) + real(r8), intent(in) :: P_CaCO3_remin(kmt) + real(r8), intent(in) :: P_CaCO3_ALT_CO2_remin(kmt) + real(r8), intent(in) :: other_remin(kmt) + real(r8), intent(in) :: PON_remin(kmt) + real(r8), intent(in) :: tracer_local(marbl_tracer_indices%total_cnt, kmt) + real(r8), intent(in) :: o2_consumption_scalef(kmt) + real(r8), intent(out) :: o2_production(kmt) + real(r8), intent(out) :: o2_consumption(kmt) + real(r8), intent(inout) :: interior_tendencies(marbl_tracer_indices%total_cnt, kmt) !----------------------------------------------------------------------- ! local variables @@ -3576,7 +3587,7 @@ subroutine compute_local_tendencies(km, marbl_tracer_indices, autotroph_derived_ docr_ind => marbl_tracer_indices%docr_ind & ) - do k=1, km + do k=1, kmt !----------------------------------------------------------------------- ! nitrate & ammonium !----------------------------------------------------------------------- diff --git a/src/marbl_interior_tendency_share_mod.F90 b/src/marbl_interior_tendency_share_mod.F90 index b818cd2b..af4dda8c 100644 --- a/src/marbl_interior_tendency_share_mod.F90 +++ b/src/marbl_interior_tendency_share_mod.F90 @@ -9,7 +9,7 @@ module marbl_interior_tendency_share_mod private public :: marbl_interior_tendency_share_update_particle_flux_from_above - public :: marbl_interior_tendency_share_set_used_particle_terms_to_zero + public :: marbl_interior_tendency_share_subfloor_particle_terms_to_zero public :: marbl_interior_tendency_share_export_variables public :: marbl_interior_tendency_share_export_zooplankton public :: marbl_interior_tendency_share_export_particulate @@ -33,18 +33,19 @@ end subroutine marbl_interior_tendency_share_update_particle_flux_from_above !*********************************************************************** - subroutine marbl_interior_tendency_share_set_used_particle_terms_to_zero(k, sinking_particle) + subroutine marbl_interior_tendency_share_subfloor_particle_terms_to_zero(kmt, sinking_particle) use marbl_interface_private_types, only : column_sinking_particle_type - integer (int_kind), intent(in) :: k + integer (int_kind), intent(in) :: kmt type(column_sinking_particle_type), intent(inout) :: sinking_particle - sinking_particle%sflux_out(k) = c0 - sinking_particle%hflux_out(k) = c0 - sinking_particle%remin(k) = c0 + sinking_particle%sflux_out(kmt+1:) = c0 + sinking_particle%hflux_out(kmt+1:) = c0 + sinking_particle%remin(kmt+1:) = c0 + sinking_particle%sed_loss(kmt+1:) = c0 !! 20230926 - end subroutine marbl_interior_tendency_share_set_used_particle_terms_to_zero + end subroutine marbl_interior_tendency_share_subfloor_particle_terms_to_zero !*********************************************************************** From 963590110f4689f279ac5209eb832a2082e61e8b Mon Sep 17 00:00:00 2001 From: Dafydd Stephenson Date: Thu, 2 Nov 2023 17:01:23 -0600 Subject: [PATCH 2/2] properly initialise sub-bed values to 0 --- src/marbl_interior_tendency_mod.F90 | 78 +++++++++++++++++------ src/marbl_interior_tendency_share_mod.F90 | 4 ++ 2 files changed, 62 insertions(+), 20 deletions(-) diff --git a/src/marbl_interior_tendency_mod.F90 b/src/marbl_interior_tendency_mod.F90 index 37926c67..dfea72af 100644 --- a/src/marbl_interior_tendency_mod.F90 +++ b/src/marbl_interior_tendency_mod.F90 @@ -384,6 +384,10 @@ subroutine marbl_interior_tendency_compute( & !! complete call compute_temperature_functional_form(temperature(:), zooplankton_settings(:)%Tref, & zooplankton_settings(:)%temp_func_form_iopt, zooplankton_settings(:)%Ea, Tfunc_zoo(:,:)) +!!!20231101 + autotroph_derived_terms%Pprime(:,:) = c0 +!!!/20231101 + call compute_Pprime(kmt, domain%zt, autotroph_local, temperature, autotroph_derived_terms%Pprime) !! tested call compute_autotroph_uptake(km, marbl_tracer_indices, tracer_local(:, :), carbonate, autotroph_derived_terms) @@ -418,6 +422,14 @@ subroutine marbl_interior_tendency_compute( & !! complete call marbl_interior_tendency_share_subfloor_particle_terms_to_zero(kmt, POP) PON_remin(kmt+1:km) = c0 + !20231102 + denitrif(:) = c0 + sed_denitrif(:) = c0 + other_remin( :) = c0 + PON_sed_loss(:) = c0 + Fe_scavenge_rate(:) = c0 + !/20231102 + do k = 1, kmt !! tested call compute_scavenging(k, kmt, marbl_tracer_indices, tracer_local(:,1:kmt), & POC, P_CaCO3, P_SiO2, dust, Fefree(1:kmt), Fe_scavenge_rate(1:kmt), & @@ -1409,7 +1421,15 @@ subroutine compute_autotroph_photosynthesis(kmt, PAR_nsubcols, & photoacc => autotroph_derived_terms%photoacc(:,:) & ) + ! 20231101 - ML - initialise with constant value + light_lim(:,:) = c0 + PCphoto( :,:) = c0 + photoacc( :,:) = c0 + photoC( :,:) = c0 + !/20231101 + do auto_ind = 1, autotroph_cnt + do k=1,kmt if (temperature(k) < autotroph_settings(auto_ind)%temp_thres) then @@ -1419,10 +1439,12 @@ subroutine compute_autotroph_photosynthesis(kmt, PAR_nsubcols, & end if if (thetaC(auto_ind,k) > c0) then - light_lim(auto_ind,k) = c0 - PCphoto(auto_ind,k) = c0 - photoacc(auto_ind,k) = c0 - + !20231101 + !light_lim(auto_ind,k) = c0 + !PCphoto(auto_ind,k) = c0 + !photoacc(auto_ind,k) = c0 + !/20231101 + do subcol_ind = 1, PAR_nsubcols work = autotroph_settings(auto_ind)%alphaPI * thetaC(auto_ind,k) * PAR_avg(k,subcol_ind) if (work > c0) then @@ -1718,7 +1740,7 @@ subroutine compute_autotroph_nutrient_uptake(marbl_tracer_indices, autotroph_der ! Get nutrient uptake by diatoms based on C fixation !----------------------------------------------------------------------- - photoFe(auto_ind,:) = photoC(auto_ind,:) * gQfe(auto_ind,:) + photoFe(auto_ind,:) = photoC(auto_ind,:) * gQfe(auto_ind,:) ! Here's the first error if (marbl_tracer_indices%auto_inds(auto_ind)%Si_ind > 0) then photoSi(auto_ind,:) = photoC(auto_ind,:) * gQsi(auto_ind,:) @@ -1821,6 +1843,8 @@ subroutine compute_Zprime(kmt, zt, zooC, Tfunc_zoo, zooplankton_derived_terms) zoo_loss_basal => zooplankton_derived_terms%zoo_loss_basal(:,:) & !(zooplankton_cnt) output ) + zoo_loss_bulk(:,:) = c0 !20231101 + ! calculate the loss threshold interpolation factor f_loss_thres(:) = min(max((thres_z2_zoo - zt(:))/(thres_z2_zoo - thres_z1_zoo), c0), c1) @@ -1900,20 +1924,21 @@ subroutine compute_grazing(kmt, Tfunc_zoo, zooplankton_local, zooplankton_derive ) auto_graze(:,:) = c0 ! total grazing losses from autotroph pool at auto_ind - auto_graze_zoo(:,:,:) = c0 ! autotroph grazing losses routed to zooplankton at auto_ind - auto_graze_zootot(:,:) = c0 ! autotroph grazing losses routed to total zooplankton at auto_ind auto_graze_poc(:,:) = c0 ! autotroph grazing losses routed to poc - auto_graze_doc(:,:) = c0 ! autotroph grazing losses routed to doc auto_graze_dic(:,:) = c0 ! autotroph grazing losses routed to dic (computed by residual) + auto_graze_doc(:,:) = c0 ! autotroph grazing losses routed to doc + auto_graze_zoo(:,:,:) = c0 ! autotroph grazing losses routed to zooplankton at auto_ind + auto_graze_zootot(:,:) = c0 ! autotroph grazing losses routed to total zooplankton at auto_ind - zoo_graze(:,:) = c0 ! total grazing losses from zooplankton pool at zoo_ind - zoo_graze_zoo(:,:,:) = c0 ! zooplankton grazing losses routed to zooplankton at zoo_ind - zoo_graze_zootot(:,:) = c0 ! zooplankton grazing losses routed to total zooplankton at zoo_ind - zoo_graze_poc(:,:) = c0 ! zooplankton grazing losses routed to poc - zoo_graze_doc(:,:) = c0 ! zooplankton grazing losses routed to doc - zoo_graze_dic(:,:) = c0 ! zooplankton grazing losses routed to dic (computed by residual) - x_graze_zoo(:,:) = c0 ! grazing gains by zooplankton at zoo_ind + zoo_graze( :,:) = c0 ! total grazing losses from zooplankton pool at zoo_ind + zoo_graze_poc( :,:) = c0 ! zooplankton grazing losses routed to poc + zoo_graze_dic( :,:) = c0 ! zooplankton grazing losses routed to dic (computed by residual) + zoo_graze_doc( :,:) = c0 ! zooplankton grazing losses routed to doc + zoo_graze_zoo( :,:,:) = c0 ! zooplankton grazing losses routed to zooplankton at zoo_ind + zoo_graze_zootot(:,:) = c0 ! zooplankton grazing losses routed to total zooplankton at zoo_ind + x_graze_zoo( :,:) = c0 ! grazing gains by zooplankton at zoo_ind + f_zoo_detr( :,:) = c0 !20231101 do k=1, kmt do pred_ind = 1, zooplankton_cnt @@ -2093,6 +2118,18 @@ subroutine compute_routing(kmt, zooplankton_derived_terms, autotroph_derived_ter zoo_loss_dic => zooplankton_derived_terms%zoo_loss_dic(:,:) & ! output ) + !20231101 + auto_graze_dic( :,:) = c0 + remaining_P_dop(:,:) = c0 + remaining_P_pop(:,:) = c0 + remaining_P_dip(:,:) = c0 + zoo_graze_dic( :,:) = c0 + + zoo_loss_poc(:,:) = c0 + zoo_loss_doc(:,:) = c0 + zoo_loss_dic(:,:) = c0 + !/20231101 + do k=1,kmt !----------------------------------------------------------------------- ! compute routing to dic of grazed material @@ -2112,12 +2149,12 @@ subroutine compute_routing(kmt, zooplankton_derived_terms, autotroph_derived_ter ! - zooplankton linear and quadratic losses get routed to DOC, DIC, and POC ! - basal respiration losses only contribute to DIC !----------------------------------------------------------------------- - + do zoo_ind = 1, zooplankton_cnt - zoo_loss_poc(zoo_ind,k) = f_zoo_detr(zoo_ind,k) * zoo_loss_bulk(zoo_ind,k) - zoo_loss_doc(zoo_ind,k) = (c1 - parm_labile_ratio) * (c1 - f_zoo_detr(zoo_ind,k)) * zoo_loss_bulk(zoo_ind,k) - zoo_loss_dic(zoo_ind,k) = (parm_labile_ratio * (c1 - f_zoo_detr(zoo_ind,k)) * zoo_loss_bulk(zoo_ind,k)) + & - zoo_loss_basal(zoo_ind,k) + zoo_loss_poc(zoo_ind,k) = f_zoo_detr(zoo_ind,k) * zoo_loss_bulk(zoo_ind,k) ! line that throws the error + zoo_loss_doc(zoo_ind,k) = (c1 - parm_labile_ratio) * (c1 - f_zoo_detr(zoo_ind,k)) * zoo_loss_bulk(zoo_ind,k) + zoo_loss_dic(zoo_ind,k) = (parm_labile_ratio * (c1 - f_zoo_detr(zoo_ind,k)) * zoo_loss_bulk(zoo_ind,k)) + & + zoo_loss_basal(zoo_ind,k) end do @@ -3828,6 +3865,7 @@ subroutine update_particulate_terms_from_prior_level(k, POC, POP, P_CaCO3, & type(column_sinking_particle_type) , intent(inout) :: POC, POP, P_CaCO3, P_CaCO3_ALT_CO2, P_SiO2, dust, P_iron real(r8) , intent(inout) :: QA_dust_def(:) !(km) + ! NOTE(bja, 2015-04) assume that k == ksurf condition was handled by ! call to marbl_set_surface_particulate_terms() if (k > 1) then diff --git a/src/marbl_interior_tendency_share_mod.F90 b/src/marbl_interior_tendency_share_mod.F90 index af4dda8c..4579f4d6 100644 --- a/src/marbl_interior_tendency_share_mod.F90 +++ b/src/marbl_interior_tendency_share_mod.F90 @@ -40,6 +40,10 @@ subroutine marbl_interior_tendency_share_subfloor_particle_terms_to_zero(kmt, si integer (int_kind), intent(in) :: kmt type(column_sinking_particle_type), intent(inout) :: sinking_particle + !! 20231102 + sinking_particle%hflux_in(kmt+1:) = c0 + sinking_particle%sflux_in(kmt+1:) = c0 + !! /20231102 sinking_particle%sflux_out(kmt+1:) = c0 sinking_particle%hflux_out(kmt+1:) = c0 sinking_particle%remin(kmt+1:) = c0