Skip to content

Commit

Permalink
Fix code consistency issues in Fortran
Browse files Browse the repository at this point in the history
Cleaned up some trailing white space, converted hard tabs to soft, and added a
few missing _r8 modifiers
  • Loading branch information
mnlevy1981 committed May 23, 2024
1 parent 97bbb1b commit 9422a43
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/marbl_ciso_interior_tendency_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ subroutine marbl_ciso_interior_tendency_compute( &
autotroph_derived_terms, &
temperature, &
marbl_tracer_indices, &
denitrif_C_N, &
denitrif_C_N, &
interior_tendencies, &
marbl_interior_diags, &
marbl_status_log)
Expand All @@ -82,7 +82,7 @@ subroutine marbl_ciso_interior_tendency_compute( &
type(autotroph_derived_terms_type), intent(in) :: autotroph_derived_terms
real (r8), intent(in) :: temperature(:)
type(marbl_tracer_index_type), intent(in) :: marbl_tracer_indices
real (r8), intent(in) :: denitrif_C_N(:)
real (r8), intent(in) :: denitrif_C_N(:)
real (r8), intent(inout) :: interior_tendencies(:,:) ! computed source/sink terms (inout because we don't touch non-ciso tracers)
type(marbl_diagnostics_type), intent(inout) :: marbl_interior_diags
type(marbl_log_type), intent(inout) :: marbl_status_log
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 @@ -4066,7 +4066,7 @@ subroutine store_diagnostics_dissolved_organic_matter(marbl_domain, &
diags(ind%DON_prod)%field_3d(:, 1) = dissolved_organic_matter%DON_prod(:)
diags(ind%DON_remin)%field_3d(:, 1) = dissolved_organic_matter%DON_remin(:)
diags(ind%DONr_remin)%field_3d(:, 1) = dissolved_organic_matter%DONr_remin(:)
diags(ind%DON_loss_N_bal)%field_3d(:, 1) = dissolved_organic_matter%DON_loss_N_bal(:)
diags(ind%DON_loss_N_bal)%field_3d(:, 1) = dissolved_organic_matter%DON_loss_N_bal(:)
diags(ind%DOP_prod)%field_3d(:, 1) = dissolved_organic_matter%DOP_prod(:)
diags(ind%DOP_remin)%field_3d(:, 1) = dissolved_organic_matter%DOP_remin(:)
diags(ind%DOPr_remin)%field_3d(:, 1) = dissolved_organic_matter%DOPr_remin(:)
Expand Down Expand Up @@ -4246,7 +4246,7 @@ subroutine store_diagnostics_nitrogen_fluxes(marbl_domain, PON, &
type(marbl_domain_type), intent(in) :: marbl_domain
type(column_sinking_particle_type), intent(in) :: PON
real(r8), intent(in) :: denitrif(:) ! km
real(r8), intent(in) :: sed_denitrif(:) ! km
real(r8), intent(in) :: sed_denitrif(:) ! km
type(autotroph_derived_terms_type), intent(in) :: autotroph_derived_terms
real(r8), intent(in) :: interior_tendencies(:,:) ! tracer_cnt, km
type(marbl_tracer_index_type), intent(in) :: marbl_tracer_indices
Expand Down Expand Up @@ -4490,7 +4490,7 @@ end subroutine store_diagnostics_silicon_fluxes
!***********************************************************************

subroutine store_diagnostics_iron_fluxes(marbl_domain, P_iron, dust, &
fesedflux, feRedsedflux, feventflux, interior_tendencies, &
fesedflux, feRedsedflux, feventflux, interior_tendencies, &
marbl_tracer_indices, marbl_diags, marbl_status_log)

use marbl_settings_mod, only : Qfe_zoo
Expand Down Expand Up @@ -4533,10 +4533,10 @@ subroutine store_diagnostics_iron_fluxes(marbl_domain, P_iron, dust, &


! vertical integrals
work = interior_tendencies(fe_ind, :) &
work = interior_tendencies(fe_ind, :) &
+ sum(interior_tendencies(marbl_tracer_indices%auto_inds(:)%Fe_ind, :),dim=1) &
+ (Qfe_zoo * sum(interior_tendencies(marbl_tracer_indices%zoo_inds(:)%C_ind, :),dim=1))


call marbl_diagnostics_share_compute_vertical_integrals(work, delta_z, kmt, &
full_depth_integral=diags(ind%Jint_Fetot)%field_2d(1), &
Expand Down
2 changes: 1 addition & 1 deletion src/marbl_init_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ subroutine marbl_init_autotroph_tracer_metadata(marbl_tracer_metadata, &
marbl_tracer_metadata(n)%units = 'mmol/m^3'
marbl_tracer_metadata(n)%tend_units = 'mmol/m^3/s'
marbl_tracer_metadata(n)%flux_units = 'mmol/m^3 cm/s'
endif
endif

n = marbl_tracer_indices%auto_inds(auto_ind)%Fe_ind
marbl_tracer_metadata(n)%short_name = trim(autotroph_settings(auto_ind)%sname) // 'Fe'
Expand Down
2 changes: 1 addition & 1 deletion src/marbl_interface_private_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module marbl_interface_private_types
real(r8), allocatable :: thetaC(:,:) ! current Chl/C ratio (mg Chl/mmol C)
real(r8), allocatable :: QCaCO3(:,:) ! current CaCO3/C ratio (mmol CaCO3/mmol C)
real(r8), allocatable :: Qp(:,:) ! current P/C ratio (mmol P/mmol C)
real(r8), allocatable :: gQp(:,:) ! P/C for growth
real(r8), allocatable :: gQp(:,:) ! P/C for growth
real(r8), allocatable :: Qn(:,:) ! Current N/C ratio (mmol N/mmol C)
real(r8), allocatable :: gQn(:,:) ! N/C for growth
real(r8), allocatable :: Qfe(:,:) ! current Fe/C ratio (mmol Fe/mmol C)
Expand Down
32 changes: 16 additions & 16 deletions src/marbl_interior_tendency_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ subroutine compute_autotroph_elemental_ratios(km, autotroph_local, marbl_tracer_
! Modify these initial ratios under low ambient iron conditions
! Modify the inital Si/C ratio under low ambient Si conditions
!-----------------------------------------------------------------------

Qfe(auto_ind,:) = auto_Fe(auto_ind,:) / (auto_C(auto_ind,:) + epsC)
gQfe(auto_ind,:) = autotroph_settings(auto_ind)%gQfe_max
where (Fe_loc(:) < autotroph_settings(auto_ind)%FeOpt)
Expand Down Expand Up @@ -1265,14 +1265,14 @@ subroutine compute_autotroph_elemental_ratios(km, autotroph_local, marbl_tracer_
!------------------------------------------------------------------------
if (lvariable_PtoC) then
Qp(auto_ind,:) = auto_P(auto_ind,:) / (auto_C(auto_ind,:) + epsC)

!!-----------------------------------------------------------------------
!!-- Calculate Qp for new growth based on Galbraith and Martiny (2015), with min. N/P
!! - 14= 0.00976801, 14.5 = 0.00944239 15= 0.00911677 15.5=0.00882272 16= 0.00854701
!! - std intercept 6.0 = 166.66maxCP, 5.26=190, 4.0 = 250, 3.0 = 333.33 (commented out)
!!-----------------------------------------------------------------------
!gQp(auto_ind,:) = min((((PquotaSlope * PO4_loc(:)) + PquotaIntercept) * 0.001_r8), PquotaMinNP)

gQp(auto_ind,:) = autotroph_settings(auto_ind)%gQp_max

where ((PO4_loc(:) + DOP_loc(:)) < autotroph_settings(auto_ind)%POpt)
Expand Down Expand Up @@ -2741,7 +2741,7 @@ subroutine compute_large_detritus_prod(k, domain, marbl_tracer_indices, &
! Iron
!-----------------------------------------------------------------------

P_iron%prod(k) = (sum(zoo_loss_poc(:)) + sum(zoo_graze_poc(:))) * Qfe_zoo &
P_iron%prod(k) = (sum(zoo_loss_poc(:)) + sum(zoo_graze_poc(:))) * Qfe_zoo &
+ Fe_scavenge(k) + sum(remaining_Fe_pfe(:))


Expand All @@ -2753,7 +2753,7 @@ subroutine compute_large_detritus_prod(k, domain, marbl_tracer_indices, &
P_CaCO3%prod(k) = c0
do auto_ind = 1, autotroph_cnt
if (marbl_tracer_indices%auto_inds(auto_ind)%CaCO3_ind > 0) then
P_CaCO3%prod(k) = P_CaCO3%prod(k) &
P_CaCO3%prod(k) = P_CaCO3%prod(k) &
+ ((c1 - f_graze_CaCO3_remin) * auto_graze(auto_ind) &
+ auto_loss(auto_ind) + auto_agg(auto_ind)) * QCaCO3(auto_ind)
endif
Expand All @@ -2775,7 +2775,7 @@ subroutine compute_large_detritus_prod(k, domain, marbl_tracer_indices, &
end do

!-----------------------------------------------------------------------
! Dust prod now set in compute_scavenging
! Dust prod now set in compute_scavenging
!-----------------------------------------------------------------------

! dust%prod(k) = c0
Expand Down Expand Up @@ -2874,7 +2874,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, &
type(carbonate_type) , intent(in) :: carbonate
real (r8) , intent(in) :: fesedflux(domain%km) ! sedimentary Fe input
real (r8) , intent(in) :: feRedsedflux(domain%km) ! sedimentary Red Fe input
real (r8) , intent(in) :: feventflux(domain%km) ! vent Fe input
real (r8) , intent(in) :: feventflux(domain%km) ! vent Fe input
real (r8), dimension(:) , intent(inout) :: Lig_prod ! vent ligand inputs
type(column_sinking_particle_type), intent(inout) :: POC ! base units = nmol C
type(column_sinking_particle_type), intent(inout) :: POP ! base units = nmol P
Expand Down Expand Up @@ -2980,15 +2980,15 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, &
if (k <= column_kmt) then

dzr_loc = c1 / dz_loc
dzr_mod = ((dz_loc * 0.01)**(-0.343))
dzr_mod = ((dz_loc * 0.01_r8)**(-0.343_r8))

poc_diss = POC%diss
sio2_diss = P_SiO2%diss
caco3_diss = P_CaCO3%diss
dust_diss = dust%diss

!-----------------------------------------------------------------------
! increase POC diss length scale where O2 concentrations are low
! increase POC diss length scale where O2 concentrations are low
!-----------------------------------------------------------------------

if (O2_loc < o2_sf_o2_range_hi) then
Expand Down Expand Up @@ -3049,7 +3049,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, &

dust%sflux_out(k) = dust%sflux_in(k) * decay_dust

dust%hflux_in(k) = dust%hflux_in(k) + dust%prod(k)
dust%hflux_in(k) = dust%hflux_in(k) + dust%prod(k)

dust%hflux_out(k) = dust%hflux_in(k) * DECAY_HardDust

Expand Down Expand Up @@ -3125,7 +3125,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, &
POC_PROD_avail * ((c1 - decay_POC_E) * poc_diss)

!-----------------------------------------------------------------------
! Compute remineralization terms
! Compute remineralization terms
!-----------------------------------------------------------------------

P_CaCO3%remin(k) = P_CaCO3%prod(k) + &
Expand Down Expand Up @@ -3188,7 +3188,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, &
P_iron%remin(k) = P_iron%remin(k) &
+ (dust%remin(k) * dust_to_Fe) &
+ (fesedflux(k) * dzr_loc) &
+ (feRedsedflux(k) * dzr_loc) &
+ (feRedsedflux(k) * dzr_loc) &
+ (feventflux(k) * dzr_loc)


Expand All @@ -3199,7 +3199,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, &
! add ligand source from vents, proportional to Fe input
!-----------------------------------------------------------------------

Lig_prod(k) = feventflux(k) * dzr_loc * 0.22
Lig_prod(k) = feventflux(k) * dzr_loc * 0.22_r8

!------------------------------------------------------------------------
! compute POP and PON remin and flux out, following code for iron
Expand Down Expand Up @@ -3519,7 +3519,7 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, &

dust%to_floor = dust%sflux_out(k) + dust%hflux_out(k)
dust%sed_loss(k) = dust%to_floor

endif

if (poc_error) then
Expand Down Expand Up @@ -3763,7 +3763,7 @@ subroutine compute_local_tendencies(km, marbl_tracer_indices, autotroph_derived_
thetaC => autotroph_derived_terms%thetaC(:,:), & ! current Chl/C ratio (mg Chl/mmol C)
QCaCO3 => autotroph_derived_terms%QCaCO3(:,:), & ! current CaCO3/C ratio (mmol CaCO3/mmol C)
Qp => autotroph_derived_terms%Qp(:,:), & ! current P/C ratio (mmol P/mmol C)
Qn => autotroph_derived_terms%Qn(:,:), & ! current N/C ratio (mmol N/mmol C)
Qn => autotroph_derived_terms%Qn(:,:), & ! current N/C ratio (mmol N/mmol C)
Qfe => autotroph_derived_terms%Qfe(:,:), & ! current Fe/C ratio (mmol Fe/mmol C)
Qsi => autotroph_derived_terms%Qsi(:,:), & ! current Si/C ratio (mmol Si/mmol C)
NO3_V => autotroph_derived_terms%NO3_V(:,:), & ! nitrate uptake (mmol NO3/m^3/sec)
Expand Down Expand Up @@ -3838,7 +3838,7 @@ subroutine compute_local_tendencies(km, marbl_tracer_indices, autotroph_derived_

interior_tendencies(no3_ind,k) = nitrif(k) - denitrif(k) - sed_denitrif(k) - sum(NO3_V(:,k))


interior_tendencies(nh4_ind,k) = DON_remin(k) + DONr_remin(k) - sum(NH4_V(:,k)) - nitrif(k) &
+ ((c1 - PONremin_refract) * PON_remin(k)) + sum(remaining_N_din(:,k)) &
+ Qn_zoo * (sum(zoo_loss_dic(:,k)) + sum(zoo_graze_dic(:,k)))
Expand Down
6 changes: 3 additions & 3 deletions src/marbl_pft_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ module marbl_pft_mod
!****************************************************************************

! Public parameters
real(r8), public, parameter :: Qp_zoo = c1 / 117.0_r8 ! P/C ratio (mmol/mmol) zoo
real(r8), public, parameter :: Qn_zoo = 16.0 / 117.0_r8 ! N/C ratio (mmol/mmol) zoo
real(r8), public, parameter :: Qp_zoo = c1 / 117.0_r8 ! P/C ratio (mmol/mmol) zoo
real(r8), public, parameter :: Qn_zoo = 16.0_r8 / 117.0_r8 ! N/C ratio (mmol/mmol) zoo

! grazing functions
integer(int_kind), public, parameter :: grz_fnc_michaelis_menten = 1
Expand Down Expand Up @@ -267,7 +267,7 @@ subroutine autotroph_set_to_default(self, autotroph_id, marbl_status_log)
self%POpt = UnsetValue
self%gQn_max = UnsetValue
self%gQn_min = UnsetValue
self%NOpt = UnsetValue
self%NOpt = UnsetValue
self%alphaPI_per_day = UnsetValue
self%PCref_per_day = UnsetValue
self%thetaN_max = UnsetValue
Expand Down
6 changes: 3 additions & 3 deletions src/marbl_settings_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ subroutine marbl_settings_define_general_parms(this, marbl_status_log)
rptr => gQsi_min
call this%add_var(sname, lname, units, datatype, category, &
marbl_status_log, rptr=rptr)
call check_and_log_add_var_error(marbl_status_log, sname, subname, labort_marbl_loc)
call check_and_log_add_var_error(marbl_status_log, sname, subname, labort_marbl_loc)

sname = 'gQ_Si_kSi_thres'
lname = 'Si:kSi ratio threshold in uptake ratio computations'
Expand Down Expand Up @@ -864,7 +864,7 @@ subroutine marbl_settings_define_general_parms(this, marbl_status_log)
! rptr => parm_init_PON_bury_coeff
! call this%add_var(sname, lname, units, datatype, category, &
! marbl_status_log, rptr=rptr)
! call check_and_log_add_var_error(marbl_status_log, sname, subname, labort_marbl_loc)
! call check_and_log_add_var_error(marbl_status_log, sname, subname, labort_marbl_loc)

sname = 'parm_init_bSi_bury_coeff'
lname = 'initial scale factor for burial of bSi'
Expand Down Expand Up @@ -1473,7 +1473,7 @@ subroutine marbl_settings_define_PFT_derived_types(this, marbl_status_log)
marbl_status_log, rptr=rptr, &
nondefault_required=(PFT_defaults .eq. 'user-specified'))
call check_and_log_add_var_error(marbl_status_log, sname, subname, labort_marbl_loc)

write(sname, "(2A)") trim(prefix), 'FeOpt'
lname = 'Fe threshold in uptake ratio computations'
units = 'nM'
Expand Down

0 comments on commit 9422a43

Please sign in to comment.