Skip to content

Commit

Permalink
Pass crop_alive to AgSysRunPhenology
Browse files Browse the repository at this point in the history
  • Loading branch information
billsacks committed Nov 15, 2019
1 parent e0655ce commit 6e8933f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/agsys/ctsm_interface/AgSysInterface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ subroutine AgSysDriver(this, num_pcropp, filter_pcropp, &
c = patch%column(p)
cultivar_type = this%agsys_inst%cultivar_patch(p)



if (this%agsys_inst%crop_alive_patch(p)) then
call this%agsys_inst%agsys_environmental_inputs%SetSpatiallyVaryingValues( &
photoperiod = grc%dayl(g), &
Expand All @@ -129,14 +131,15 @@ subroutine AgSysDriver(this, num_pcropp, filter_pcropp, &
soil_cond = this%agsys_inst%agsys_soil_condition)

call AgSysRunPhenology ( &
! Inputs, time-constant
! Inputs, time-constant
crop = this%crops(crop_type)%cultivars(cultivar_type), &

! Inputs, time-varying
! Inputs, time-varying
env = this%agsys_inst%agsys_environmental_inputs, &
soil_cond = this%agsys_inst%agsys_soil_condition, &

! Outputs
! Outputs
crop_alive = this%agsys_inst%crop_alive_patch(p), &
days_after_sowing = this%agsys_inst%days_after_sowing_patch(p), &
current_stage = this%agsys_inst%current_stage_patch(p), &
days_in_phase = this%agsys_inst%days_in_phase_patch(p,:), &
Expand Down
8 changes: 7 additions & 1 deletion src/agsys/science/AgSysPhenology.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ module AgSysPhenology
use AgSysExcepUtils, only : iulog, endrun

implicit none
private

public :: AgSysRunPhenology

contains
!---------------------------------------------------------------
!Some subroutines
!

subroutine AgSysRunPhenology(crop, env, soil_cond, &
days_after_sowing, current_stage, days_in_phase, tt_in_phase, &
crop_alive, days_after_sowing, current_stage, days_in_phase, tt_in_phase, &
days_after_phase, tt_after_phase, phase_target_tt, cumvd)

!!---------------------------------------------------------
Expand All @@ -35,6 +40,7 @@ subroutine AgSysRunPhenology(crop, env, soil_cond, &
type (agsys_soil_condition_type), intent(in) :: soil_cond

!!OUTPUTS: state variables
logical, intent(inout) :: crop_alive !!whether the crop is alive (true between planting and sowing)
integer, intent(inout) :: days_after_sowing !!days after sowing, this is an accumulated number since sowing
real(r8), intent(inout) :: current_stage !!current stage number
real(r8), intent(inout) :: days_in_phase(:) !!days since start of the current phase
Expand Down

0 comments on commit 6e8933f

Please sign in to comment.