107 integer (c_int) :: inumberoflanduses
108 integer (c_int) :: iindex
109 integer (c_int) :: istat
113 character (len=:),
allocatable :: plantingdate_str
115 real (c_float),
allocatable :: l_ini_l(:)
116 real (c_float),
allocatable :: l_dev_l(:)
117 real (c_float),
allocatable :: l_mid_l(:)
118 real (c_float),
allocatable :: l_late_l(:)
119 real (c_float),
allocatable :: l_fallow_l(:)
121 real (c_float),
allocatable :: gdd_plant_l(:)
122 real (c_float),
allocatable :: gdd_ini_l(:)
123 real (c_float),
allocatable :: gdd_dev_l(:)
124 real (c_float),
allocatable :: gdd_mid_l(:)
125 real (c_float),
allocatable :: gdd_late_l(:)
128 real (c_float),
allocatable :: kcb_ini_l(:)
129 real (c_float),
allocatable :: kcb_mid_l(:)
130 real (c_float),
allocatable :: kcb_end_l(:)
131 real (c_float),
allocatable :: kcb_min_l(:)
133 real (c_float),
allocatable :: kcb_jan(:)
134 real (c_float),
allocatable :: kcb_feb(:)
135 real (c_float),
allocatable :: kcb_mar(:)
136 real (c_float),
allocatable :: kcb_apr(:)
137 real (c_float),
allocatable :: kcb_may(:)
138 real (c_float),
allocatable :: kcb_jun(:)
139 real (c_float),
allocatable :: kcb_jul(:)
140 real (c_float),
allocatable :: kcb_aug(:)
141 real (c_float),
allocatable :: kcb_sep(:)
142 real (c_float),
allocatable :: kcb_oct(:)
143 real (c_float),
allocatable :: kcb_nov(:)
144 real (c_float),
allocatable :: kcb_dec(:)
149 sllist =
create_list(
"LU_Code, Landuse_Code, Landuse_Lookup_Code")
171 call params%get_parameters( skey=
"L_ini", fvalues=l_ini_l)
172 call params%get_parameters( skey=
"L_dev", fvalues=l_dev_l)
173 call params%get_parameters( skey=
"L_mid", fvalues=l_mid_l)
174 call params%get_parameters( skey=
"L_late", fvalues=l_late_l)
175 call params%get_parameters( skey=
"L_fallow", fvalues=l_fallow_l)
177 call params%get_parameters( skey=
"GDD_plant", fvalues=gdd_plant_l)
178 call params%get_parameters( skey=
"GDD_ini", fvalues=gdd_ini_l)
179 call params%get_parameters( skey=
"GDD_dev", fvalues=gdd_dev_l)
180 call params%get_parameters( skey=
"GDD_mid", fvalues=gdd_mid_l)
181 call params%get_parameters( skey=
"GDD_late", fvalues=gdd_late_l)
183 call params%get_parameters( skey=
"Kcb_ini", fvalues=kcb_ini_l)
184 call params%get_parameters( skey=
"Kcb_mid", fvalues=kcb_mid_l)
185 call params%get_parameters( skey=
"Kcb_end", fvalues=kcb_end_l)
186 call params%get_parameters( skey=
"Kcb_min", fvalues=kcb_min_l)
188 call params%get_parameters( skey=
"Kcb_Jan", fvalues=kcb_jan )
189 call params%get_parameters( skey=
"Kcb_Feb", fvalues=kcb_feb )
190 call params%get_parameters( skey=
"Kcb_Mar", fvalues=kcb_mar )
191 call params%get_parameters( skey=
"Kcb_Apr", fvalues=kcb_apr )
192 call params%get_parameters( skey=
"Kcb_May", fvalues=kcb_may )
193 call params%get_parameters( skey=
"Kcb_Jun", fvalues=kcb_jun )
194 call params%get_parameters( skey=
"Kcb_Jul", fvalues=kcb_jul )
195 call params%get_parameters( skey=
"Kcb_Aug", fvalues=kcb_aug )
196 call params%get_parameters( skey=
"Kcb_Sep", fvalues=kcb_sep )
197 call params%get_parameters( skey=
"Kcb_Oct", fvalues=kcb_oct )
198 call params%get_parameters( skey=
"Kcb_Nov", fvalues=kcb_nov )
199 call params%get_parameters( skey=
"Kcb_Dec", fvalues=kcb_dec )
203 call assert( istat==0,
"Failed to allocate memory for GROWTH_STAGE_LENGTH_IN_DAYS array", &
207 call assert( istat==0,
"Failed to allocate memory for GROWTH_STAGE_GDD array", &
211 call assert( istat==0,
"Failed to allocate memory for GROWTH_STAGE_DATE array", &
214 allocate(
kcb_l( 16, inumberoflanduses ), stat=istat )
215 call assert( istat==0,
"Failed to allocate memory for KCB_l array", &
218 allocate(
kcb_method( inumberoflanduses ), stat=istat )
219 call assert( istat==0,
"Failed to allocate memory for KCB_METHOD vector", &
227 if ( ubound(l_ini_l,1) == inumberoflanduses ) &
230 if ( ubound(l_dev_l,1) == inumberoflanduses ) &
233 if ( ubound(l_mid_l,1) == inumberoflanduses ) &
236 if ( ubound(l_late_l,1) == inumberoflanduses ) &
239 if ( ubound(l_fallow_l,1) == inumberoflanduses ) &
242 call logs%write(
" ## Crop Kcb Curve Summary ##", ilinesafter=1)
243 call logs%write(
" _only meaningful for landuses where the Kcb curve is defined " &
244 //
"in terms of days _", ilinesafter=1)
245 call logs%write(
"Landuse Code | Planting Date | End of 'ini' | End of 'dev' " &
246 //
"| End of 'mid' | End of 'late' | End of 'fallow' ")
247 call logs%write(
"-------------|---------------|--------------|--------------" &
248 //
"|--------------|---------------|-----------------")
258 if ( len_trim(plantingdate_str) == 0 ) cycle
321 if (ubound(kcb_ini_l,1) == inumberoflanduses)
kcb_l(
kcb_ini, :) = kcb_ini_l
322 if (ubound(kcb_mid_l,1) == inumberoflanduses)
kcb_l(
kcb_mid, :) = kcb_mid_l
323 if (ubound(kcb_end_l,1) == inumberoflanduses)
kcb_l(
kcb_end, :) = kcb_end_l
324 if (ubound(kcb_min_l,1) == inumberoflanduses)
kcb_l(
kcb_min, :) = kcb_min_l
326 if (ubound(kcb_jan,1) == inumberoflanduses)
kcb_l(
jan, :) = kcb_jan
327 if (ubound(kcb_feb,1) == inumberoflanduses)
kcb_l(
feb, :) = kcb_feb
328 if (ubound(kcb_mar,1) == inumberoflanduses)
kcb_l(
mar, :) = kcb_mar
329 if (ubound(kcb_apr,1) == inumberoflanduses)
kcb_l(
apr, :) = kcb_apr
330 if (ubound(kcb_may,1) == inumberoflanduses)
kcb_l(
may, :) = kcb_may
331 if (ubound(kcb_jun,1) == inumberoflanduses)
kcb_l(
jun, :) = kcb_jun
332 if (ubound(kcb_jul,1) == inumberoflanduses)
kcb_l(
jul, :) = kcb_jul
333 if (ubound(kcb_aug,1) == inumberoflanduses)
kcb_l(
aug, :) = kcb_aug
334 if (ubound(kcb_sep,1) == inumberoflanduses)
kcb_l(
sep, :) = kcb_sep
335 if (ubound(kcb_oct,1) == inumberoflanduses)
kcb_l(
oct, :) = kcb_oct
336 if (ubound(kcb_nov,1) == inumberoflanduses)
kcb_l(
nov, :) = kcb_nov
337 if (ubound(kcb_dec,1) == inumberoflanduses)
kcb_l(
dec, :) = kcb_dec
343 if ( all(
kcb_l(
jan:
dec, iindex ) > 0.0_c_float ) )
then
358 call warn(
"There are missing day-of-year (L_ini, L_dev, L_mid, L_late, L_fallow), " &
359 //
"growing degree-day ~(GDD_plant, GDD_ini, GDD_dev, GDD_mid, GDD_late)," &
360 //
" or monthly crop ~coefficients (Kcb_jan...Kcb_dec) for" &
466 relative_humidity_min_pct, &
468 plant_height_meters)
result(kcb_max)
470 real (c_float),
intent(in) :: wind_speed_meters_per_sec
471 real (c_float),
intent(in) :: relative_humidity_min_pct
472 real (c_float),
intent(in) :: kcb
473 real (c_float),
intent(in) :: plant_height_meters
475 real (c_float) :: kcb_max
476 real (c_double) :: u2
477 real (c_double) :: rhmin
478 real (c_double) :: plant_height
482 rhmin = clip( relative_humidity_min_pct, minval=20., maxval=80. )
483 u2 = clip(wind_speed_meters_per_sec, minval=1., maxval=6.)
484 plant_height = clip(plant_height_meters, minval=1., maxval=10.)
487 kcb_max = real(max( 1.2_c_double + ( (0.04_c_double * (u2 - 2._c_double) &
488 - 0.004_c_double * (rhmin - 45._c_double) ) ) &
489 * (plant_height_meters/3._c_double)**0.3_c_double, &
490 kcb + 0.05_c_double ), c_float)
571 integer (c_int) :: iindex
598 iyear=sim_dt%curr%iYear + 1)
605 iyear=sim_dt%curr%iYear )
621 call logs%write(
"## Updated Crop Kcb Curve Summary ##", ilinesafter=1, lecho=false )
622 call logs%write(
"Landuse Code | Planting Date | End of 'ini' | End of 'dev' " &
623 //
"| End of 'mid' | End of 'late' | End of 'fallow' ", lecho=false )
624 call logs%write(
"-------------|---------------|--------------|--------------" &
625 //
"|--------------|---------------|-----------------", lecho=false )
637 call logs%write(
"| "//ascharacter(
landuse_code( iindex ))//
" | " &
650 lecho=false, iloglevel=log_all)