Skip to content

Commit

Permalink
num_*_forcing_fields not needed in marbl_sizes.F90
Browse files Browse the repository at this point in the history
Rather than module variables, these two can be local variables in
complete_config_and_init() and intent(out) variables from the respective
forcing field index constructors.
  • Loading branch information
mnlevy1981 committed Jul 10, 2017
1 parent a0cfb21 commit 5ec676b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 23 deletions.
12 changes: 7 additions & 5 deletions src/marbl_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ module marbl_interface
use marbl_sizes , only : marbl_total_tracer_cnt
use marbl_sizes , only : autotroph_cnt
use marbl_sizes , only : zooplankton_cnt
use marbl_sizes , only : num_surface_forcing_fields
use marbl_sizes , only : num_interior_forcing_fields

use marbl_interface_types , only : marbl_domain_type
use marbl_interface_types , only : marbl_tracer_metadata_type
Expand Down Expand Up @@ -492,6 +490,8 @@ subroutine complete_config_and_init(this)
character(len=*), parameter :: subname = 'marbl_interface:complete_config_and_init'
character(len=char_len) :: log_message

integer :: num_surface_forcing_fields
integer :: num_interior_forcing_fields
integer :: i

call this%timers%start(this%timer_ids%init_timer_id, this%StatusLog)
Expand Down Expand Up @@ -538,9 +538,11 @@ subroutine complete_config_and_init(this)
! Initialize surface and interior forcing (including tracer restoring)
!-----------------------------------------------------------------------

call this%surface_forcing_ind%construct(ciso_on, lflux_gas_o2, lflux_gas_co2, ladjust_bury_coeff)
call this%interior_forcing_ind%construct(this%tracer_metadata%short_name, &
tracer_restore_vars, this%StatusLog)
call this%surface_forcing_ind%construct(ciso_on, lflux_gas_o2, lflux_gas_co2, &
ladjust_bury_coeff, num_surface_forcing_fields)
call this%interior_forcing_ind%construct(this%tracer_metadata%short_name, &
tracer_restore_vars, num_interior_forcing_fields, &
this%StatusLog)
if (this%StatusLog%labort_marbl) then
call this%StatusLog%log_error_trace("interior_forcing_ind%construct", &
subname)
Expand Down
8 changes: 4 additions & 4 deletions src/marbl_internal_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -803,18 +803,17 @@ end subroutine tracer_index_constructor
!*****************************************************************************

subroutine surface_forcing_index_constructor(this, ciso_on, lflux_gas_o2, &
lflux_gas_co2, ladjust_bury_coeff)
lflux_gas_co2, ladjust_bury_coeff, num_surface_forcing_fields)

! This subroutine sets the surface forcing indexes, which are used to
! determine what forcing fields are required from the driver.

use marbl_sizes, only : num_surface_forcing_fields

class(marbl_surface_forcing_indexing_type), intent(inout) :: this
logical, intent(in) :: ciso_on
logical, intent(in) :: lflux_gas_o2
logical, intent(in) :: lflux_gas_co2
logical, intent(in) :: ladjust_bury_coeff
integer, intent(out) :: num_surface_forcing_fields

associate(forcing_cnt => num_surface_forcing_fields)

Expand Down Expand Up @@ -919,18 +918,19 @@ end subroutine surface_forcing_index_constructor
subroutine interior_forcing_index_constructor(this, &
tracer_names, &
tracer_restore_vars, &
num_interior_forcing_fields, &
marbl_status_log)

! This subroutine sets the interior forcing indexes, which are used to
! determine what forcing fields are required from the driver.

use marbl_sizes, only : num_interior_forcing_fields
use marbl_sizes, only : marbl_total_tracer_cnt
use marbl_sizes, only : tracer_restore_cnt

class(marbl_interior_forcing_indexing_type), intent(inout) :: this
character(len=char_len), dimension(:), intent(in) :: tracer_names
character(len=char_len), dimension(:), intent(in) :: tracer_restore_vars
integer, intent(out) :: num_interior_forcing_fields
type(marbl_log_type), intent(inout) :: marbl_status_log

character(len=*), parameter :: subname = 'marbl_internal_types:interior_forcing_index_constructor'
Expand Down
10 changes: 3 additions & 7 deletions src/marbl_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,6 @@ module marbl_mod
subroutine marbl_init_surface_forcing_fields(num_elements, surface_forcing_indices, &
surface_forcings, marbl_status_log)

use marbl_sizes, only : num_surface_forcing_fields

! Initialize the surface forcing_fields datatype with information from the
! namelist read
!
Expand All @@ -305,7 +303,7 @@ subroutine marbl_init_surface_forcing_fields(num_elements, surface_forcing_indic
associate(ind => surface_forcing_indices)

surface_forcings(:)%metadata%varname = ''
do id=1,num_surface_forcing_fields
do id=1,size(surface_forcings)
found = .false.

! Square of 10m wind
Expand Down Expand Up @@ -451,8 +449,6 @@ subroutine marbl_init_interior_forcing_fields(&
interior_forcings, &
marbl_status_log)

use marbl_sizes, only : num_interior_forcing_fields

! Initialize the interior forcing_fields datatype with information from the
! namelist read
!
Expand Down Expand Up @@ -485,7 +481,7 @@ subroutine marbl_init_interior_forcing_fields(&
interior_forcings(:)%metadata%varname = ''

! Surface fluxes that influence interior forcing
do id=1,num_interior_forcing_fields
do id=1,size(interior_forcings)
found = .false.
! Dust Flux
if (id .eq. ind%dustflux_id) then
Expand Down Expand Up @@ -3181,7 +3177,7 @@ subroutine marbl_compute_PAR(domain, interior_forcings, interior_forcing_ind, &

integer(int_kind) , intent(in) :: auto_cnt
type(marbl_domain_type) , intent(in) :: domain
type(marbl_forcing_fields_type) , intent(in) :: interior_forcings(:) ! (num_elements, num_interior_forcing_fields_0d)
type(marbl_forcing_fields_type) , intent(in) :: interior_forcings(:)
type(marbl_interior_forcing_indexing_type), intent(in) :: interior_forcing_ind
real(r8) , intent(in) :: totalChl_local(:)
type(marbl_PAR_type) , intent(inout) :: PAR
Expand Down
7 changes: 0 additions & 7 deletions src/marbl_sizes.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,4 @@ module marbl_sizes

integer (KIND=int_kind), parameter :: max_prey_class_size = 9

!-----------------------------------------------------------------------------
! number of forcing fields
!-----------------------------------------------------------------------------

integer :: num_surface_forcing_fields
integer :: num_interior_forcing_fields

end module marbl_sizes

0 comments on commit 5ec676b

Please sign in to comment.