9 use iso_c_binding,
only : c_short, c_int, c_float, c_double, c_bool
32 integer (c_int) :: number_of_landuses
33 integer (c_int) :: number_of_records
34 integer (c_int) :: indx
35 logical (c_bool) :: list_lengths_are_equal
38 integer (c_int),
allocatable :: landuse_table_codes(:)
39 logical (c_bool),
allocatable :: tempbool(:)
40 character (len=31) :: temp_str
41 integer (c_int) :: status
44 call sllist%append(
"LU_Code" )
45 call sllist%append(
"Landuse_Lookup_Code" )
48 call params%get_parameters( slkeys=sllist, ivalues=landuse_table_codes )
49 number_of_landuses = count( landuse_table_codes >= 0 )
52 sllist =
create_list(
"allow_variable_rooting_depth, variable_rooting_depth")
53 call params%get_parameters( slkeys=sllist, slvalues=sl_variable_rooting_depth, lfatal=
false )
56 number_of_records = sl_variable_rooting_depth%count
57 list_lengths_are_equal = ( number_of_records == number_of_landuses )
59 print *,
"INITIALIZING ROOTING DEPTH data structures:", trim(__file__),
" ", __line__
61 if ( .not. list_lengths_are_equal )
then
63 call warn( smessage=
"The number of landuses does not match the number of values supplied for the " &
64 //
"'allow_variable_rooting_depth' parameter.", &
65 shints=
"By default, all rooting depths will be allowed to vary, using the FAO-56 methodology.", &
66 smodule=__file__, iline=__line__, lfatal=
false )
67 allocate(tempbool(number_of_landuses), stat=status)
74 call assert( status==0,
"Problem allocating memory.", __file__, __line__ )
76 do indx=1, sl_variable_rooting_depth%count
77 temp_str = sl_variable_rooting_depth%get( indx )
78 if ( (temp_str .containssimilar.
"variable") .or. (temp_str .containssimilar.
"varying"))
then
84 print *,
"SETTING 'allow_variable_rooting_depth' for landuse index "//
ascharacter(indx)//
" to "//trim(temp_str)
107 real (c_float),
intent(inout) :: zr_i
108 real (c_float),
intent(in) :: zr_max
109 integer (c_int),
intent(in) :: landuse_index
110 real (c_float),
intent(in) :: kcb
115 real (c_float),
parameter :: zr_min = 0.328
116 real (c_float) :: maxkcb
117 real (c_float) :: minkcb
134 if ( kcb > minkcb )
then
139 zr_i = max(zr_i, zr_min + ( kcb - minkcb ) / ( maxkcb - minkcb ) * ( zr_max - zr_min ))
This module contains physical constants and convenience functions aimed at performing unit conversion...
logical(c_bool), parameter, public true
logical(c_bool), parameter, public false
Update crop coefficients for crop types in simulation.
@ 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(parameters_t), public params
type(dict_t), public params_dict
logical(c_bool), dimension(:), allocatable variable_rooting_depth
elemental subroutine, public update_rooting_depth(zr_i, zr_max, landuse_index, kcb)
Calculate the effective root zone depth.
subroutine, public initialize_rooting_depth()