10 use iso_c_binding,
only : c_short, c_int, c_float, c_double, c_bool
24 real (c_float),
allocatable ::
rew_l(:,:)
25 real (c_float),
allocatable ::
tew_l(:,:)
49 integer ( c_int),
intent(in) :: landuse_index
50 real (c_double),
intent(in) :: reference_et0
54 * ( 5.0_c_double -
in_to_mm( reference_et0 ) )
56 p = min( p, 0.8_c_double )
57 p = max( p, 0.1_c_double )
67 integer (c_int) :: number_of_landuses
68 integer (c_int) :: number_of_records
69 logical (c_bool) :: list_lengths_are_equal
71 integer (c_int),
allocatable :: landuse_table_codes(:)
72 real (c_float),
allocatable :: tempvals(:)
73 integer (c_int) :: status
76 call sllist%append(
"LU_Code" )
77 call sllist%append(
"Landuse_Lookup_Code" )
80 call params%get_parameters( slkeys=sllist, ivalues=landuse_table_codes )
81 number_of_landuses = count( landuse_table_codes >= 0 )
85 CALL params%get_parameters( fvalues=
rew_l, sprefix=
"REW_", inumrows=number_of_landuses, lfatal=
true )
88 CALL params%get_parameters( fvalues=
tew_l, sprefix=
"TEW_", inumrows=number_of_landuses, lfatal=
true )
92 sllist =
create_list(
"Depletion_fraction, Plant_stress_depletion_fraction")
96 sllist =
create_list(
"Minimum_fraction_vegetative_cover, Min_fraction_covered_soil, Min_vegetative_cover_fraction")
101 list_lengths_are_equal = ( number_of_records == number_of_landuses )
103 if ( .not. list_lengths_are_equal )
then
104 call warn( smessage=
"The number of landuses does not match the number of values supplied for the " &
105 //
"minimum fraction of soil covered by vegetation.", &
106 shints=
"A default value of 0.05 was assigned for the minimum fraction of covered soil.", &
107 smodule=__file__, iline=__line__, lfatal=
false )
108 allocate(tempvals(number_of_landuses), stat=status)
118 infiltration, landuse_index, soil_group)
120 real (c_float),
intent(inout) :: evaporable_water_storage
121 real (c_float),
intent(inout) :: evaporable_water_deficit
122 real (c_float),
intent(in) :: infiltration
123 integer (c_int),
intent(in) :: landuse_index
124 integer (c_int),
intent(in) :: soil_group
126 associate( rew =>
rew_l( landuse_index, soil_group ), &
127 tew =>
tew_l( landuse_index, soil_group ) )
129 evaporable_water_storage =
clip( evaporable_water_storage + infiltration, minval=0.0, maxval=tew)
130 evaporable_water_deficit = max( 0.0, tew - evaporable_water_storage)
140 evaporable_water_deficit )
result( Kr )
143 integer (c_int),
intent(in) :: landuse_index
144 integer (c_int),
intent(in) :: soil_group
145 real (c_float),
intent(in) :: evaporable_water_deficit
148 real (c_double) :: kr
150 associate( rew =>
rew_l( landuse_index, soil_group ), &
151 tew =>
tew_l( landuse_index, soil_group ) )
153 if ( evaporable_water_deficit <= rew )
then
155 elseif ( evaporable_water_deficit < tew )
then
156 kr = ( real(tew, c_double) - evaporable_water_deficit ) &
157 / ( real(tew, c_double) - real(rew, c_double) + 1.0e-8)
174 integer (c_int),
intent(in) :: landuse_index
175 real (c_float),
intent(in) :: kcb
176 real (c_float),
intent(in) :: current_plant_height
179 real (c_float) :: few
183 real (c_double) :: numerator
184 real (c_double) :: denominator
185 real (c_double) :: exponent
187 numerator = max(real(kcb, c_double) - kcb_l( kcb_min, landuse_index), 0.0_c_double)
188 denominator = kcb_l( kcb_mid, landuse_index) - kcb_l( kcb_min, landuse_index)
189 exponent = 1.0_c_double + 0.5_c_double * current_plant_height * m_per_foot
191 if( denominator > 0.0_c_double )
then
192 fc = real(( numerator / denominator ) ** exponent, c_float)
198 few = clip(1.0_c_float - fc, minval=0.05, maxval=1.0)
207 fraction_exposed_and_wetted_soil)
result( Ke )
210 integer (c_int),
intent(in) :: landuse_index
211 real (c_float),
intent(in) :: kcb
212 real (c_float),
intent(in) :: kcb_max
213 real (c_double),
intent(in) :: kr
214 real (c_float),
intent(in) :: fraction_exposed_and_wetted_soil
215 real (c_double) :: ke
217 real (c_double) :: maximum_value
221 maximum_value = min( 1.0_c_double, real(fraction_exposed_and_wetted_soil, c_double) * kcb_max )
223 ke = min( kr * ( real(kcb_max, c_double) - real(kcb, c_double)), maximum_value )
232 adjusted_depletion_fraction_p, &
233 current_rooting_depth, &
236 real (c_double),
intent(inout) :: raw
237 real (c_double),
intent(inout) :: taw
238 real (c_double),
intent(in) :: adjusted_depletion_fraction_p
239 real (c_float),
intent(in) :: current_rooting_depth
240 real (c_float),
intent(in) :: awc
242 taw = real(current_rooting_depth, c_double) * real(awc, c_double)
243 raw = taw * adjusted_depletion_fraction_p
251impure elemental function update_plant_height( landuse_index, it_is_growing_season, Kcb)
result(plant_height)
253 integer (c_int),
intent(in) :: landuse_index
254 logical (c_bool),
intent(in) :: it_is_growing_season
255 real (c_float),
intent(in) :: kcb
256 real (c_float) :: plant_height
259 real (c_float) :: plant_height_minimum_m
260 real (c_double) :: numerator
261 real (c_double) :: denominator
263 plant_height_minimum_m = 0.1
265 numerator = kcb - kcb_l( kcb_min, landuse_index)
266 denominator = kcb_l( kcb_mid, landuse_index) - kcb_l( kcb_min, landuse_index)
268 if (denominator < near_zero)
then
270 plant_height = real(
mean_plant_height( landuse_index ) * m_per_foot, kind=c_float)
272 elseif ( it_is_growing_season )
then
275 plant_height = clip(real( numerator/denominator *
mean_plant_height( landuse_index ) * m_per_foot, kind=c_float), &
276 minval=plant_height_minimum_m, maxval=10.)
279 plant_height = plant_height_minimum_m
290 soil_moisture_deficit)
result( Ks )
292 real (c_double),
intent(in) :: raw
293 real (c_double),
intent(in) :: taw
294 real (c_double),
intent(in) :: soil_moisture_deficit
295 real (c_double) :: ks
297 if ( soil_moisture_deficit < raw )
then
301 elseif ( soil_moisture_deficit < taw )
then
303 ks = ( taw - soil_moisture_deficit ) / ( taw - raw + 1.0e-6)
321 fraction_exposed_and_wetted_soil, &
325 adjusted_depletion_fraction_p, &
326 soil_moisture_deficit, &
327 evaporable_water_storage, &
328 evaporable_water_deficit, &
329 it_is_growing_season, &
334 current_rooting_depth, &
335 current_plant_height, &
341 real (c_double),
intent(inout) :: actual_et
342 real (c_float),
intent(inout) :: crop_etc
343 real (c_float),
intent(inout) :: bare_soil_evap
344 real (c_double),
intent(inout) :: taw
345 real (c_double),
intent(inout) :: raw
346 real (c_float),
intent(inout) :: fraction_exposed_and_wetted_soil
347 real (c_double),
intent(inout) :: kr
348 real (c_double),
intent(inout) :: ke
349 real (c_double),
intent(inout) :: ks
350 real (c_double),
intent(inout) :: adjusted_depletion_fraction_p
351 real (c_double),
intent(inout) :: soil_moisture_deficit
352 real (c_float),
intent(inout) :: current_plant_height
353 real (c_float),
intent(inout) :: evaporable_water_storage
354 real (c_float),
intent(inout) :: evaporable_water_deficit
355 logical (c_bool),
intent(in) :: it_is_growing_season
356 real (c_float),
intent(in) :: kcb
357 integer (c_int),
intent(in) :: landuse_index
358 integer (c_int),
intent(in) :: soil_group
359 real (c_float),
intent(in) :: awc
360 real (c_float),
intent(in) :: current_rooting_depth
361 real (c_double),
intent(in) :: soil_storage
362 real (c_float),
intent(in) :: soil_storage_max
363 real (c_double),
intent(in) :: reference_et0
364 real (c_float),
intent(in) :: infiltration
366 real (c_float) :: interim_soil_storage
367 real (c_float) :: interim_soil_storage2
368 real (c_float) :: kcb_max
374 kcb_max = crop_coefficients_fao56_calculate_kcb_max(wind_speed_meters_per_sec=2., &
375 relative_humidity_min_pct=55., &
377 plant_height_meters=current_plant_height)
383 landuse_index, soil_group )
386 adjusted_depletion_fraction_p, &
387 current_rooting_depth, &
392 evaporable_water_deficit )
398 bare_soil_evap = real(reference_et0 * ke, c_float)
399 evaporable_water_storage = max(0.0, evaporable_water_storage - bare_soil_evap / fraction_exposed_and_wetted_soil)
402 interim_soil_storage = clip(real(soil_storage + infiltration, kind=c_float), minval=0.0, maxval=soil_storage_max)
403 interim_soil_storage2 = clip(real(soil_storage + infiltration - bare_soil_evap, kind=c_float), minval=0.0, maxval=soil_storage_max)
405 bare_soil_evap = clip(interim_soil_storage - interim_soil_storage2, minval=0.0, maxval=soil_storage_max)
407 soil_moisture_deficit = max( 0.0_c_double, real(soil_storage_max, c_double) - interim_soil_storage2)
410 crop_etc = real(min(reference_et0 * kcb * ks, real(interim_soil_storage2, c_double)), c_float)
413 actual_et = crop_etc + bare_soil_evap
Provide support for assessing the effect of irrigation on recharge values by estimating the irrigatio...
real(c_float), dimension(:), allocatable mean_plant_height
impure elemental real(c_float) function update_plant_height(landuse_index, it_is_growing_season, kcb)
This function updates the plant height by scaling values relative to the position of the current Kcb ...
impure elemental real(c_float) function calculate_fraction_exposed_and_wetted_soil_fc(landuse_index, kcb, current_plant_height)
This function estimates the fraction of the ground covered by vegetation during the growing season.
real(c_float), dimension(:), allocatable min_fraction_covered_soil
real(c_float), dimension(:,:), allocatable tew_l
real(c_float), dimension(:,:), allocatable rew_l
elemental subroutine calculate_total_available_water(taw, raw, adjusted_depletion_fraction_p, current_rooting_depth, awc)
This subroutine updates the total available water (TAW) (water within the rootzone) for a gridcell.
elemental real(c_double) function adjust_depletion_fraction_p(landuse_index, reference_et0)
Adjust the depletion fraction based on current reference ET0.
elemental real(c_double) function calculate_water_stress_coefficient_ks(taw, raw, soil_moisture_deficit)
This function estimates Ks, water stress coefficient.
elemental subroutine update_evaporable_water_storage(evaporable_water_storage, evaporable_water_deficit, infiltration, landuse_index, soil_group)
subroutine actual_et_fao56_two_stage_initialize()
elemental real(c_double) function calculate_evaporation_reduction_coefficient_kr(landuse_index, soil_group, evaporable_water_deficit)
elemental real(c_double) function calculate_surface_evap_coefficient_ke(landuse_index, kcb, kcb_max, kr, fraction_exposed_and_wetted_soil)
This function estimates Ke, the bare surface evaporation coefficient.
impure elemental subroutine calculate_actual_et_fao56_two_stage(actual_et, crop_etc, bare_soil_evap, taw, raw, fraction_exposed_and_wetted_soil, kr, ke, ks, adjusted_depletion_fraction_p, soil_moisture_deficit, evaporable_water_storage, evaporable_water_deficit, it_is_growing_season, kcb, landuse_index, soil_group, awc, current_rooting_depth, current_plant_height, soil_storage, soil_storage_max, reference_et0, infiltration)
real(c_float), dimension(:), allocatable depletion_fraction
This module contains physical constants and convenience functions aimed at performing unit conversion...
logical(c_bool), parameter, public true
real(c_float), parameter, public near_zero
logical(c_bool), parameter, public false
real(c_double), parameter, public m_per_foot
Update crop coefficients for crop types in simulation.
pure elemental real(c_float) function, public crop_coefficients_fao56_calculate_kcb_max(wind_speed_meters_per_sec, relative_humidity_min_pct, kcb, plant_height_meters)
@ kcb_method_monthly_values
real(c_float), dimension(:,:), allocatable, public kcb_l
integer(c_int), dimension(:), allocatable, public kcb_method
subroutine, public warn(smessage, smodule, iline, shints, lfatal, iloglevel, lecho)
type(logfile_t), public logs
type(parameters_t), public params