Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/init_totChl' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlevy1981 committed Oct 21, 2024
2 parents 0b340da + 3263861 commit 2c04fb2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 10 deletions.
14 changes: 14 additions & 0 deletions src/marbl_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ module marbl_interface
procedure, public :: extract_timing
procedure, private :: glo_vars_init
procedure, public :: get_tracer_index
procedure, public :: compute_totChl
procedure, public :: interior_tendency_compute
procedure, public :: surface_flux_compute
procedure, public :: set_global_scalars
Expand Down Expand Up @@ -188,6 +189,7 @@ module marbl_interface
private :: reset_timers
private :: extract_timing
private :: glo_vars_init
private :: compute_totChl
private :: interior_tendency_compute
private :: surface_flux_compute
private :: shutdown
Expand Down Expand Up @@ -972,6 +974,18 @@ end subroutine glo_vars_init

!***********************************************************************

subroutine compute_totChl(this)

use marbl_interior_tendency_mod, only : marbl_interior_tendency_compute_totChl

class(marbl_interface_class), intent(inout) :: this

call marbl_interior_tendency_compute_totChl(this%tracers, this%tracer_indices, this%interior_tendency_output)

end subroutine compute_totChl

!***********************************************************************

subroutine interior_tendency_compute(this)

use marbl_interior_tendency_mod, only : marbl_interior_tendency_compute
Expand Down
36 changes: 26 additions & 10 deletions src/marbl_interior_tendency_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ module marbl_interior_tendency_mod

public :: marbl_interior_tendency_compute
public :: marbl_interior_tendency_adjust_bury_coeff
public :: marbl_interior_tendency_compute_totChl

contains

Expand Down Expand Up @@ -135,7 +136,6 @@ subroutine marbl_interior_tendency_compute( &
use marbl_interface_private_types, only : marbl_internal_timers_type
use marbl_interface_private_types, only : marbl_timer_indexing_type
use marbl_interface_private_types, only : marbl_interior_tendency_saved_state_indexing_type
use marbl_interface_public_types, only : ofg_ind
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
Expand Down Expand Up @@ -183,7 +183,7 @@ subroutine marbl_interior_tendency_compute( &
real(r8), dimension(size(tracers,1), domain%km) :: interior_restore
real(r8), dimension(size(tracers,1), domain%km) :: tracer_local

integer (int_kind) :: auto_ind, k ! indices for loops
integer (int_kind) :: k ! index for loops

real (r8) :: surf_press(domain%km) ! pressure in surface layer
real (r8) :: temperature(domain%km) ! in situ temperature
Expand Down Expand Up @@ -276,14 +276,7 @@ subroutine marbl_interior_tendency_compute( &
! Compute Chlorophyll (if requested by GCM)
!-----------------------------------------------------------------------

if (ofg_ind%total_Chl_id.ne.0) then
interior_tendency_output%outputs_for_GCM(ofg_ind%total_Chl_id)%forcing_field_1d(1,:) = c0
do auto_ind = 1,autotroph_cnt
interior_tendency_output%outputs_for_GCM(ofg_ind%total_Chl_id)%forcing_field_1d(1,:) = &
interior_tendency_output%outputs_for_GCM(ofg_ind%total_Chl_id)%forcing_field_1d(1,:) &
+ tracer_local(marbl_tracer_indices%auto_inds(auto_ind)%Chl_ind,:)
end do
end if
call marbl_interior_tendency_compute_totChl(tracer_local, marbl_tracer_indices, interior_tendency_output)

! Verify forcing is consistent
if (lcheck_forcing) &
Expand Down Expand Up @@ -769,6 +762,29 @@ end subroutine marbl_interior_tendency_adjust_bury_coeff

!***********************************************************************

subroutine marbl_interior_tendency_compute_totChl(tracer_local, marbl_tracer_indices, interior_tendency_output)

use marbl_interface_public_types, only : ofg_ind

real(r8), dimension(:,:), intent(in) :: tracer_local
type(marbl_tracer_index_type), intent(in) :: marbl_tracer_indices
type(marbl_output_for_GCM_type), intent(inout) :: interior_tendency_output

integer (int_kind) :: auto_ind

if (ofg_ind%total_Chl_id.ne.0) then
interior_tendency_output%outputs_for_GCM(ofg_ind%total_Chl_id)%forcing_field_1d(1,:) = c0
do auto_ind = 1,autotroph_cnt
interior_tendency_output%outputs_for_GCM(ofg_ind%total_Chl_id)%forcing_field_1d(1,:) = &
interior_tendency_output%outputs_for_GCM(ofg_ind%total_Chl_id)%forcing_field_1d(1,:) &
+ tracer_local(marbl_tracer_indices%auto_inds(auto_ind)%Chl_ind,:)
end do
end if

end subroutine marbl_interior_tendency_compute_totChl

!***********************************************************************

subroutine setup_local_tracers(column_kmt, marbl_tracer_indices, tracers, &
autotroph_local, tracer_local, zooplankton_local)

Expand Down

0 comments on commit 2c04fb2

Please sign in to comment.