Soil Water Balance (SWB2)
Toggle main menu visibility
Loading...
Searching...
No Matches
rooting_depth__FAO56.F90
Go to the documentation of this file.
1
!> @file
2
!! Contains a single module, \ref rooting_depth__FAO56, which
3
!! provides support for dynamic rooting depth calculation
4
5
!! Calculate the effective root zone depth given the current stage
6
!! of plant growth, the soil type, and the crop type.
7
module
rooting_depth__fao56
8
9
use
iso_c_binding,
only
: c_short, c_int, c_float, c_double, c_bool
10
use
constants_and_conversions
,
only
:
true
,
false
11
use
fstring_list
12
use
fstring
,
only
:
operator
(.containssimilar.),
ascharacter
13
use
logfiles
,
only
:
logs
,
log_all
14
use
parameters
,
only
:
params
15
use
exceptions
,
only
:
assert
,
warn
16
use
crop_coefficients__fao56
,
only
:
kcb_l
,
kcb_min
,
kcb_ini
,
kcb_mid
,
kcb_end
, &
17
kcb_method
,
kcb_method_gdd
,
kcb_method_monthly_values
, &
18
kcb_method_fao56
,
jan
,
dec
19
implicit none
20
21
private
22
23
public
::
initialize_rooting_depth
,
update_rooting_depth
24
25
logical(c_bool)
,
allocatable
::
variable_rooting_depth
(:)
26
27
contains
28
29
subroutine
initialize_rooting_depth
( )
30
31
use
parameters
,
only
:
params
32
33
integer (c_int)
:: number_of_landuses
34
integer (c_int)
:: number_of_records
35
integer (c_int)
:: indx
36
logical (c_bool)
:: list_lengths_are_equal
37
type
(
fstring_list_t
) :: sllist
38
type
(
fstring_list_t
) :: sl_variable_rooting_depth
39
integer (c_int)
,
allocatable
:: landuse_table_codes(:)
40
logical (c_bool)
,
allocatable
:: tempbool(:)
41
character (len=31)
:: temp_str
42
integer (c_int)
:: status
43
44
! create list of possible table headings to look for...
45
call
sllist%append(
"LU_Code"
)
46
call
sllist%append(
"Landuse_Lookup_Code"
)
47
48
!> Determine how many landuse codes are present
49
call
params
%get_parameters( slkeys=sllist, ivalues=landuse_table_codes )
50
number_of_landuses = count( landuse_table_codes >= 0 )
51
call
sllist%clear()
52
53
sllist =
create_list
(
"allow_variable_rooting_depth, variable_rooting_depth"
)
54
call
params
%get_parameters( slkeys=sllist, slvalues=sl_variable_rooting_depth, lfatal=
false
)
55
call
sllist%clear()
56
57
number_of_records = sl_variable_rooting_depth%count
58
list_lengths_are_equal = ( number_of_records == number_of_landuses )
59
60
call
logs
%write(
"INITIALIZING ROOTING DEPTH data structures: "
//trim(__file__))
61
62
if
( .not. list_lengths_are_equal )
then
63
64
call
warn
( smessage=
"The number of landuses does not match the number of values supplied for the "
&
65
//
"'allow_variable_rooting_depth' parameter."
, &
66
shints=
"By default, all rooting depths will be allowed to vary, using the FAO-56 methodology."
, &
67
smodule=__file__, iline=__line__, lfatal=
false
)
68
allocate
(tempbool(number_of_landuses), stat=status)
69
tempbool =
true
70
call
move_alloc(tempbool,
variable_rooting_depth
)
71
72
else
73
74
allocate
(
variable_rooting_depth
( sl_variable_rooting_depth%count ), stat=status )
75
call
assert
( status==0,
"Problem allocating memory."
, __file__, __line__ )
76
77
do
indx=1, sl_variable_rooting_depth%count
78
temp_str = sl_variable_rooting_depth%get( indx )
79
if
( (temp_str .containssimilar.
"variable"
) .or. (temp_str .containssimilar.
"varying"
))
then
80
variable_rooting_depth
(indx) =
true
81
else
82
variable_rooting_depth
(indx) =
false
83
endif
84
85
call
logs
%write(
"SETTING 'allow_variable_rooting_depth' for landuse index "
//
ascharacter
(indx)//
" to "
//trim(temp_str))
86
87
enddo
88
89
endif
90
91
end subroutine
initialize_rooting_depth
92
93
!------------------------------------------------------------------------------
94
95
!> Calculate the effective root zone depth.
96
!!
97
!! Calculate the effective root zone depth given the current stage
98
!! of plant growth, the soil type, and the crop type.
99
!!
100
!! @param[inout] Zr_i Daily rooting depth estimate.
101
!! @param[in] Zr_max The maximum rooting depth for this crop.
102
!! @param[in] landuse_index Index corresponding to the line number of the table
103
!! that holds data for a particular landuse.
104
!! @param[in] Kcb current crop coefficient value for a cell.
105
!! @note Implemented as equation 8-1 (Annex 8), FAO-56, Allen and others.
106
elemental
subroutine
update_rooting_depth
( Zr_i, Zr_max, landuse_index, Kcb )
107
108
real
(c_float),
intent(inout)
:: zr_i
109
real
(c_float),
intent(in)
:: zr_max
110
integer (c_int)
,
intent(in)
:: landuse_index
111
real
(c_float),
intent(in)
:: kcb
112
113
! [ LOCALS ]
114
! 0.328 feet equals 0.1 meters, which is seems to be the standard
115
! initial rooting depth in the FAO-56 methodology
116
real
(c_float),
parameter
:: zr_min = 0.328
117
real
(c_float) :: maxkcb
118
real
(c_float) :: minkcb
119
120
if
(
variable_rooting_depth
(landuse_index))
then
121
122
if
(
kcb_method
( landuse_index ) ==
kcb_method_monthly_values
)
then
123
maxkcb = maxval(
kcb_l
(
jan
:
dec
, landuse_index ) )
124
minkcb = minval(
kcb_l
(
jan
:
dec
, landuse_index ) )
125
else
126
maxkcb = maxval(
kcb_l
(
kcb_ini
:
kcb_min
, landuse_index ) )
127
minkcb = minval(
kcb_l
(
kcb_ini
:
kcb_min
, landuse_index ) )
128
endif
129
130
131
! if ( MinKCB > 0.49_c_float ) then
132
133
! Zr_i = Zr_max
134
135
if
( kcb > minkcb )
then
136
137
! scale the rooting depth in proportion to the progress within the Kcb curve...
138
! update: we are not going to reduce the rooting depth until the Kcb value has been
139
! reset to Kcb_ini
140
zr_i = max(zr_i, zr_min + ( kcb - minkcb ) / ( maxkcb - minkcb ) * ( zr_max - zr_min ))
141
142
else
143
144
zr_i = zr_min
145
146
endif
147
148
else
149
150
! user has specified a constant rooting depth. set value to Zr_max
151
zr_i = zr_max
152
153
endif
154
155
end subroutine
update_rooting_depth
156
157
end module
rooting_depth__fao56
constants_and_conversions
This module contains physical constants and convenience functions aimed at performing unit conversion...
Definition
constants_and_conversions.F90:8
constants_and_conversions::true
logical(c_bool), parameter, public true
Definition
constants_and_conversions.F90:38
constants_and_conversions::false
logical(c_bool), parameter, public false
Definition
constants_and_conversions.F90:39
crop_coefficients__fao56
Update crop coefficients for crop types in simulation.
Definition
crop_coefficients__fao56.F90:8
crop_coefficients__fao56::kcb_mid
@ kcb_mid
Definition
crop_coefficients__fao56.F90:51
crop_coefficients__fao56::kcb_min
@ kcb_min
Definition
crop_coefficients__fao56.F90:51
crop_coefficients__fao56::kcb_ini
@ kcb_ini
Definition
crop_coefficients__fao56.F90:51
crop_coefficients__fao56::kcb_end
@ kcb_end
Definition
crop_coefficients__fao56.F90:51
crop_coefficients__fao56::kcb_method_monthly_values
@ kcb_method_monthly_values
Definition
crop_coefficients__fao56.F90:59
crop_coefficients__fao56::kcb_method_gdd
@ kcb_method_gdd
Definition
crop_coefficients__fao56.F90:59
crop_coefficients__fao56::kcb_method_fao56
@ kcb_method_fao56
Definition
crop_coefficients__fao56.F90:59
crop_coefficients__fao56::dec
@ dec
Definition
crop_coefficients__fao56.F90:55
crop_coefficients__fao56::jan
@ jan
Definition
crop_coefficients__fao56.F90:55
crop_coefficients__fao56::kcb_l
real(c_float), dimension(:,:), allocatable, public kcb_l
Definition
crop_coefficients__fao56.F90:67
crop_coefficients__fao56::kcb_method
integer(c_int), dimension(:), allocatable, public kcb_method
Definition
crop_coefficients__fao56.F90:68
exceptions
Definition
exceptions.F90:1
exceptions::warn
subroutine, public warn(smessage, smodule, iline, shints, lfatal, iloglevel, lecho)
Definition
exceptions.F90:245
fstring
Definition
fstring.F90:1
fstring_list
Definition
fstring_list.F90:1
logfiles
Definition
logfiles.F90:1
logfiles::logs
type(logfile_t), public logs
Definition
logfiles.F90:62
logfiles::log_all
@ log_all
Definition
logfiles.F90:22
parameters
Definition
parameters.F90:1
parameters::params
type(parameters_t), public params
Definition
parameters.F90:68
rooting_depth__fao56
Definition
rooting_depth__FAO56.F90:7
rooting_depth__fao56::variable_rooting_depth
logical(c_bool), dimension(:), allocatable variable_rooting_depth
Definition
rooting_depth__FAO56.F90:25
rooting_depth__fao56::update_rooting_depth
elemental subroutine, public update_rooting_depth(zr_i, zr_max, landuse_index, kcb)
Calculate the effective root zone depth.
Definition
rooting_depth__FAO56.F90:107
rooting_depth__fao56::initialize_rooting_depth
subroutine, public initialize_rooting_depth()
Definition
rooting_depth__FAO56.F90:30
exceptions::assert
Definition
exceptions.F90:15
fstring::ascharacter
Definition
fstring.F90:44
fstring_list::fstring_list_t
Definition
fstring_list.F90:21
fstring_list::create_list
Definition
fstring_list.F90:114
src
rooting_depth__FAO56.F90
Generated on
for Soil Water Balance (SWB2) by
1.17.0