From 6e8933fbfdbaa69b7f80c4411d826e92c709cf07 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 15 Nov 2019 13:53:57 -0700 Subject: [PATCH] Pass crop_alive to AgSysRunPhenology --- src/agsys/ctsm_interface/AgSysInterface.F90 | 9 ++++++--- src/agsys/science/AgSysPhenology.F90 | 8 +++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/agsys/ctsm_interface/AgSysInterface.F90 b/src/agsys/ctsm_interface/AgSysInterface.F90 index c6f4f9084c..910027ffed 100644 --- a/src/agsys/ctsm_interface/AgSysInterface.F90 +++ b/src/agsys/ctsm_interface/AgSysInterface.F90 @@ -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), & @@ -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,:), & diff --git a/src/agsys/science/AgSysPhenology.F90 b/src/agsys/science/AgSysPhenology.F90 index 4fea999547..e844c06236 100644 --- a/src/agsys/science/AgSysPhenology.F90 +++ b/src/agsys/science/AgSysPhenology.F90 @@ -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) !!--------------------------------------------------------- @@ -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