forked from ESCOMP/CTSM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'pengbinpeluo/agsys' into agsys
Resolved Conflicts: src/agsys/ctsm_interface/AgSysParamReader.F90 src/agsys/science/AgSysPlaceholder.F90
- Loading branch information
Showing
13 changed files
with
676 additions
and
480 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
module AgSysCropTypeGeneric | ||
use AgSysKinds, only : r8 | ||
use AgSysEnvInputs, only : agsys_env_inputs_type | ||
use AgSysUtils, only : response_curve_type | ||
use AgSysPhases, only : agsys_phase_type | ||
use AgSysExcepUtils, only : iulog, endrun | ||
|
||
implicit none | ||
|
||
!!a container type to store the crop type instances | ||
type, public :: agsys_crop_container_type | ||
private | ||
class(agsys_crop_type_generic), allocatable, public :: crop | ||
end type agsys_crop_container_type | ||
|
||
!!a container type to store all the cultivars of a given crop type | ||
type, public :: agsys_cultivars_of_crop_type | ||
private | ||
class(agsys_crop_type_generic), allocatable, public :: cultivar(:) | ||
end type agsys_cultivars_of_crop_type | ||
|
||
!----------------------------------------------------------------- | ||
!!a generic crop type holding parameters that shared by all crops | ||
type, public :: agsys_crop_type_generic | ||
private | ||
!public data members | ||
integer, public :: croptype | ||
|
||
!phase definition | ||
type(agsys_phase_type), public :: phases | ||
|
||
!parameters related with phenology | ||
integer, allocatable, public :: max_days_from_sowing_to_end_of_phase(:) | ||
real(r8), public :: p_sowing_depth | ||
real(r8), public :: p_shoot_lag | ||
real(r8), public :: p_shoot_rate | ||
real(r8), public :: p_pesw_germ | ||
type(response_curve_type), public :: rc_tair_tt | ||
type(response_curve_type), public :: rc_sw_avail_phenol | ||
type(response_curve_type), public :: rc_sw_emerg_rate | ||
contains | ||
procedure :: init | ||
|
||
procedure :: vernalization | ||
procedure :: vern_days | ||
procedure :: vern_effect | ||
procedure :: photop_eff | ||
procedure :: get_stress_phenol | ||
procedure :: get_stress_phenol_emerging_phase | ||
procedure :: get_stress_phenol_inductive_phase | ||
procedure :: get_target_tt_photosensitive_phase | ||
procedure :: get_target_tt_inductive_phase | ||
end type agsys_crop_type_generic | ||
|
||
contains | ||
subroutine init(this) | ||
type(agsys_crop_type_generic), intent(inout) :: this | ||
this%p_sowing_depth = 0._r8 | ||
this%p_shoot_lag = 0._r8 | ||
this%p_shoot_rate = 0._r8 | ||
this%p_pesw_germ = 0._r8 | ||
this%rc_tair_tt%num_pts = 0 | ||
this%rc_sw_avail_phenol%num_pts = 0 | ||
this%rc_sw_emerg_rate%num_pts = 0 | ||
end subroutine init | ||
|
||
subroutine vernalization(this, env, cumvd) | ||
class(agsys_crop_type_generic), intent(in) :: this | ||
type(agsys_env_inputs_type), intent(in) :: env | ||
real(r8), intent(inout) :: cumvd | ||
!do nothing here | ||
end subroutine vernalization | ||
|
||
function vern_days(this, env) result(dlt_cumvd) | ||
class(agsys_crop_type_generic), intent(in) :: this | ||
type(agsys_env_inputs_type), intent(in) :: env | ||
real(r8) :: dlt_cumvd | ||
!do nothng here | ||
end function vern_days | ||
|
||
function vern_effect(this, cumvd) result(vern_eff) | ||
class(agsys_crop_type_generic), intent(in) :: this | ||
real(r8), intent(in) :: cumvd | ||
real(r8) :: vern_eff | ||
!do nothing here | ||
end function vern_effect | ||
|
||
function photop_effect(this, photoperiod) result(photop_eff) | ||
class(agsys_crop_type_generic), intent(in) :: this | ||
real(r8), intent(in) :: photoperiod | ||
real(r8) :: photop_eff | ||
!do nothing here | ||
end function photop_effect | ||
|
||
function get_stress_phenol(this, swdef_phenol) result(stress_phenol) | ||
class(agsys_crop_type_generic), intent(in) :: this | ||
real(r8), intend(in) :: swdef_phenol | ||
real(r8) stress_phenol | ||
!default stress to crop phenology is water stress | ||
stress_phenol=swdef_phenol | ||
end function get_stress_phenol | ||
|
||
function get_stress_phenol_inductive_phase(this, env, cumvd, swdef_phenol, nfact_phenol, pfact_phenol) result(stress_phenol) | ||
class(agsys_crop_type_wheat), intent(in) :: this | ||
type(agsys_env_inputs_type), intent(in) :: env | ||
real(r8), intent(in) :: cumvd | ||
real(r8), intent(in) :: swdef_phenol | ||
real(r8), intent(in) :: nfact_phenol | ||
real(r8), intent(in) :: pfact_phenol | ||
real(r8) :: stress_phenol | ||
!do nothing here | ||
character(len=*), parameter :: subname = 'get_stress_phenol_inductive_phase' | ||
write(iulog, *) "This call to ", subname, " is illegal" | ||
call endrun(msg="Illegal call!") | ||
end function get_stress_phenol_inductive_phase | ||
|
||
function get_stress_phenol_emerging_phase(this, env, sw_avail_ratio, cumvd) | ||
class(agsys_crop_type_wheat), intent(in) :: this | ||
type(agsys_env_inputs_type), intent(in) :: env | ||
real(r8), intent(in) :: sw_avail_ratio | ||
real(r8), intent(in) :: cumvd | ||
real(r8) :: stress_phenol | ||
|
||
stress_phenol=interpolation(sw_avail_ratio, this%rc_sw_emerg_rate) | ||
end function get_stress_phenol_emerging_phase | ||
|
||
function get_target_tt_photosensitive_phase(this, env) result(target_tt) | ||
class (agsys_crop_type_photosensitive), intent(in) :: this | ||
type (agsys_env_inputs_type), intent(in) :: env | ||
real(r8) :: target_tt | ||
!do nothing here | ||
character(len=*), parameter :: subname = 'get_target_tt_photosensitive_phase' | ||
write(iulog, *) "This call to ", subname, " is illegal" | ||
call endrun(msg="Illegal call!") | ||
end function get_target_tt_photosensitive_phase | ||
|
||
function get_target_tt_inductive_phase(this, cumvd) result(target_tt) | ||
class(agsys_crop_type_vernalization), intent(in) :: this | ||
real(r8), intent(in) :: cumvd | ||
real(r8) :: target_tt | ||
!do nothing here | ||
character(len=*), parameter :: subname = 'get_target_tt_inductive_phase' | ||
write(iulog, *) "This call to ", subname, " is illegal" | ||
call endrun(msg="Illegal call!") | ||
end function get_target_tt_inductive_phase | ||
|
||
end module AgSysCropTypeGeneric |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
module AgSysCropTypeMaize | ||
use AgSysKinds, only : r8 | ||
use AgSysConstants, only : crop_type_maize | ||
use AgSysPhases, only : max_str_len_for_phase_def, & | ||
phase_type_generic, & | ||
phase_type_germinating, phase_type_emerging, phase_type_photo_sensitive | ||
use AgSysEnvInputs, only : agsys_env_inputs_type | ||
use AgSysUtils, only : response_curve_type, interpolation | ||
use AgSysCropTypePhotoSensitive, only : agsys_crop_type_photosensitive | ||
implicit none | ||
|
||
type, extends(agsys_crop_type_photosensitive), public :: agsys_crop_type_maize | ||
private | ||
!public data members | ||
real(r8), public :: tt_emerg_to_endjuv | ||
real(r8), public :: tt_emerg_to_fi | ||
real(r8), public :: tt_flag_to_flower | ||
real(r8), public :: tt_flower_to_start_grain | ||
real(r8), public :: tt_flower_to_maturity | ||
real(r8), public :: tt_maturity_to_ripe | ||
|
||
real(r8), public :: potential_kernel_weight | ||
real(r8), public :: leaf_no_dead_const | ||
real(r8), public :: leaf_no_dead_slope | ||
contains | ||
procedure :: init | ||
|
||
end type agsys_crop_type_maize | ||
contains | ||
subroutine init(this) | ||
type(agsys_crop_type_maize), intent(inout) :: this | ||
|
||
this%croptype = crop_type_maize | ||
|
||
!!!initialize the parameters | ||
!!!TODO(pb, 2019-11-14) now we intialize the variables to 0, | ||
!!!but later can initialize them into nan | ||
this%tt_emerg_to_endjuv = 0._r8 | ||
this%tt_emerg_to_fi = 0._r8 | ||
this%tt_flag_to_flower = 0._r8 | ||
this%tt_flower_to_start_grain = 0._r8 | ||
this%tt_flower_to_maturity = 0._r8 | ||
this%tt_maturity_to_ripe = 0._r8 | ||
this%tt_potential_kernal_weight = 0._r8 | ||
this%tt_leaf_no_dead_const = 0._r8 | ||
this%tt_leaf_no_dead_slope = 0._r8 | ||
|
||
!!!initialize the phases | ||
this%phases%num_phases=11 | ||
this%phases%stage_name=[character(len=max_str_len_for_phase_def) :: & | ||
'sowing', 'germination', 'emergence', 'end_of_juvenile', & | ||
'floral_initiation', 'flag_leaf', 'flowering', & | ||
'start_grain_fill', 'end_grain_fill', 'maturity', 'harvest_ripe', 'end_crop'] | ||
this%phases%phase_name=[character(len=max_str_len_for_phase_def) :: & | ||
'germinating', 'emerging', 'juvenile', & | ||
'photo_sensitive', 'leaf_apperance', 'flag_leaf_to_flowering', & | ||
'flowering_to_grain_filling', 'grain_filling', 'maturing', 'maturity_to_harvest_ripe', 'ready_for_harvesting'] | ||
this%phases%phase_type=[phase_type_germinating, phase_type_emerging, phase_type_generic, & | ||
phase_type_photo_sensitive, phase_type_generic, phase_type_generic, & | ||
phase_type_generic, phase_type_generic, phase_type_generic, phase_type_generic, phase_type_generic] | ||
|
||
end subroutine init | ||
end module AgSysCropTypeMaize |
Oops, something went wrong.