Soil Water Balance (SWB2)
Loading...
Searching...
No Matches
et__hargreaves_samani.F90
Go to the documentation of this file.
1!> @file
2!> Contains a single module, et_hargreaves, which
3!> calculates potential evapotranspiration by means of the Hargreaves-Samani (1985) method.
4
5
6!> Calculates potential evapotranspiration by means of the
7!> Hargreaves-Samani (1985) method.
9!!****h* SWB/et_hargreaves
10! NAME
11! et_hargreaves.f95 - Evapotranspiration calculation using the
12! Hargreaves method.
13!
14! SYNOPSIS
15! This module calculates evapotranspiration using the Hargreaves
16! method.
17!
18! NOTES
19!
20! Reference:
21!
22! Allen, R.G., and others, 2006, FAO Irrigation and Drainage Paper No. 56,
23! "Crop Evapotranspiration (Guidelines for computing crop water
24! requirements)", Food and Agriculture Organization, Rome, Italy.
25!
26!!***
27
28 use iso_c_binding, only : c_short, c_int, c_float, c_double
30 use fstring, only : ascharacter
31 use logfiles, only : logs, log_all
33 use parameters, only : params
35
36 implicit none
37
38
39 ! ET parameters -- default values are from Hargreaves and Samani (1985)
40 real (c_double) :: et_slope ! = 0.0023
41 real (c_double) :: et_exponent ! = 0.5
42 real (c_double) :: et_constant ! = 17.8
43
44contains
45
46subroutine et_hargreaves_initialize( ) !pConfig, sRecord )
47 !! Configures the module, using the command line in 'sRecord'
48 ! [ ARGUMENTS ]
49! type (T_MODEL_CONFIGURATION), pointer :: pConfig ! pointer to data structure that contains
50 ! model options, flags, and other settings
51! character (len=*),intent(inout) :: sRecord
52
53 ! [ LOCALS ]
54
55 real (kind=c_float), allocatable :: fet_slope(:)
56 real (kind=c_float), allocatable :: fet_exponent(:)
57 real (kind=c_float), allocatable :: fet_constant(:)
58
59 call params%get_parameters( skey="Hargreaves_ET_slope", fvalues=fet_slope)
60 call params%get_parameters( skey="Hargreaves_ET_exponent", fvalues=fet_exponent)
61 call params%get_parameters( skey="Hargreaves_ET_constant", fvalues=fet_constant)
62
63 if ( fet_slope(1) > ftinyval) then
64 et_slope = real(fet_slope(1), c_double)
65 else
66 et_slope = 0.0023_c_double
67 endif
68
69 if ( fet_exponent(1) > ftinyval) then
70 et_exponent = real(fet_exponent(1), c_double)
71 else
72 et_exponent = 0.5_c_double
73 endif
74
75 if ( fet_constant(1) > ftinyval) then
76 et_constant = real(fet_constant(1), c_double)
77 else
78 et_constant = 17.8_c_double
79 endif
80
81 call logs%write("****************************************************************************")
82 call logs%write("initializing Hargreaves ET parameters")
83 call logs%write("****************************************************************************")
84 call logs%write(" ET_SLOPE = "//ascharacter(real(et_slope, c_float)))
85 call logs%write(" ET_EXPONENT = "//ascharacter(real(et_exponent, c_float)))
86 call logs%write(" ET_CONSTANT = "//ascharacter(real(et_constant, c_float)))
87
88 ! write(UNIT=LU_LOG,FMT=*) "Configuring Hargreaves PET model"
89
90! if (pConfig%rSouthernLatitude <= rNO_DATA_NCDC &
91! .or. pConfig%rNorthernLatitude <= rNO_DATA_NCDC) then
92
93! call Chomp( sRecord,sOption )
94! read ( unit=sOption, fmt=*, iostat=iStat ) rValue
95! call Assert( iStat == 0, "Could not read the southerly latitude" )
96! pConfig%rSouthernLatitude = dpTWOPI * rValue / 360.0_c_float
97
98! call Chomp( sRecord,sOption )
99! read ( unit=sOption, fmt=*, iostat=iStat ) rValue
100! call Assert( iStat == 0, "Could not read the northerly latitude" )
101! pConfig%rNorthernLatitude = dpTWOPI * rValue / 360.0_c_float
102
103! else
104
105! call echolog("Southern and northern latitude values have been determined" &
106! //"~from project grid bounds and projection parameters. The values supplied" &
107! //"~with the Hargreaves PET option will be ignored...")
108
109! endif
110
111end subroutine et_hargreaves_initialize
112
113!------------------------------------------------------------------------------
114
115impure elemental function et_hargreaves_calculate( iDayOfYear, iNumDaysInYear, fLatitude, fTMin, fTMax ) result(fReferenceET0)
116 !! Computes the potential ET for each cell, based on TMIN and TMAX.
117 !! Stores cell-by-cell PET values in the model grid.
118
119 integer (c_int),intent(in) :: idayofyear
120 integer (c_int),intent(in) :: inumdaysinyear
121 real (c_float), intent(in) :: flatitude
122 real (c_float), intent(in) :: ftmin
123 real (c_float), intent(in) :: ftmax
124 real (c_double) :: freferenceet0
125
126 ! [ LOCALS ]
127 real (c_double) :: fdelta, fomega_s, fd_r, fra
128 real (c_double) :: dlatitude_radians
129
130 dlatitude_radians = flatitude * degrees_to_radians
131
132 fd_r =relative_earth_sun_distance__d_r(idayofyear,inumdaysinyear)
133 fdelta = solar_declination__delta(idayofyear, inumdaysinyear)
134
135 fomega_s = sunrise_sunset_angle__omega_s(dlatitude_radians, fdelta)
136
137 ! NOTE that the following equation returns extraterrestrial radiation in
138 ! MJ / m**2 / day. The Hargreaves equation requires extraterrestrial
139 ! radiation to be expressed in units of mm / day.
140 fra = extraterrestrial_radiation__ra(dlatitude_radians, fdelta, fomega_s, fd_r)
141
142 freferenceet0 = et0_hargreaves( equivalent_evaporation(fra), ftmin, ftmax)
143
144end function et_hargreaves_calculate
145
146
147elemental function et0_hargreaves( rRa, rTMinF, rTMaxF ) result(rET_0)
148
149 ! [ ARGUMENTS ]
150 real (c_double),intent(in) :: rra
151 real (c_float),intent(in) :: rtminf
152 real (c_float),intent(in) :: rtmaxf
153
154 ! [ RETURN VALUE ]
155 real (c_double) :: ret_0
156
157 ! [ LOCALS ]
158 real (c_double) :: rtdelta
159 real (c_double) :: rtavg
160
161 rtavg = (rtminf + rtmaxf) / 2.0_c_double
162
163 rtdelta = abs(f_to_k(real(rtmaxf, c_double)) - f_to_k(real(rtminf, c_double)))
164
165 ret_0 = max(dzero, &
166 mm_to_in( et_slope * rra * (f_to_c(rtavg) + et_constant) * (rtdelta**et_exponent) ) )
167! mm_to_in( 0.0023_c_float * rRa * (F_to_C(rTavg) + 17.8_c_float) * sqrt(rTDelta)) )
168
169end function et0_hargreaves
170
171
172end module et__hargreaves_samani
This module contains physical constants and convenience functions aimed at performing unit conversion...
real(c_double), parameter, public degrees_to_radians
Calculates potential evapotranspiration by means of the Hargreaves-Samani (1985) method.
impure elemental real(c_double) function et_hargreaves_calculate(idayofyear, inumdaysinyear, flatitude, ftmin, ftmax)
elemental real(c_double) function et0_hargreaves(rra, rtminf, rtmaxf)
type(logfile_t), public logs
Definition logfiles.F90:62
elemental real(c_double) function equivalent_evaporation(rr)
type(parameters_t), public params
elemental real(c_double) function solar_declination__delta(idayofyear, inumdaysinyear)
Calculate the solar declination for a given day of the year.
elemental real(c_double) function relative_earth_sun_distance__d_r(idayofyear, inumdaysinyear)
Calculate the inverse relative Earth-Sun distance for a given day of the year.
elemental real(c_double) function sunrise_sunset_angle__omega_s(dlatitude, ddelta)
Calculate sunrise/sunset angle, in RADIANS.
elemental real(c_double) function extraterrestrial_radiation__ra(dlatitude, ddelta, domega_s, ddsubr)
Calculate extraterrestrial radiation given latitude and time of year.