Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update loops #446

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/marbl_ciso_diagnostics_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ subroutine marbl_ciso_diagnostics_interior_tendency_compute(&
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)
Expand All @@ -1182,7 +1182,7 @@ subroutine marbl_ciso_diagnostics_interior_tendency_compute(&
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)

Expand Down
48 changes: 24 additions & 24 deletions src/marbl_ciso_interior_tendency_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,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
Expand Down Expand Up @@ -230,10 +230,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 cell attributes
Expand All @@ -259,7 +259,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)
Expand Down Expand Up @@ -658,7 +658,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)
Expand Down Expand Up @@ -724,33 +724,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

Expand Down Expand Up @@ -1070,7 +1070,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
Expand Down Expand Up @@ -1099,8 +1099,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
Expand Down Expand Up @@ -1142,7 +1142,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

Expand Down Expand Up @@ -1209,9 +1209,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

Expand All @@ -1234,7 +1234,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)

Expand Down Expand Up @@ -1287,7 +1287,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

Expand Down
10 changes: 5 additions & 5 deletions src/marbl_diagnostics_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3909,7 +3909,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)
Expand All @@ -3924,7 +3924,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)
Expand Down Expand Up @@ -3979,7 +3979,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
Expand All @@ -3994,12 +3994,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

Expand Down
Loading
Loading