Soil Water Balance (SWB2)
Loading...
Searching...
No Matches
snowmelt__original.F90
Go to the documentation of this file.
2
3 use iso_c_binding, only : c_int, c_float, c_double, c_bool
4 implicit none
5
6 private
7
9
10 real (c_double), parameter :: freezing_f = 32.0_c_double
11 real (c_double), parameter :: freezing_c = 0.0_c_double
12 real (c_double), parameter :: melt_index = 1.5_c_double
13 real (c_double), parameter :: degc_per_degf = 0.55555555555555555555556_c_double
14 real (c_double), parameter :: mm_per_inch = 25.4_c_double
15
16contains
17
18 elemental subroutine snowmelt_original_calculate( potential_snowmelt, tmin, tmax, imperial_units )
19
20 real (c_float), intent(inout) :: potential_snowmelt
21 real (c_float), intent(in) :: tmin
22 real (c_float), intent(in) :: tmax
23 logical ( c_bool), intent(in) :: imperial_units
24
25 if ( imperial_units ) then
26
27 !> temperatures in degrees Fahrenheit, snowmelt in inches
28
29 ! Vic's port of Wes's code simply tests to see whether the
30
31 ! from Vic's earliest port of Wes's code: (TMax in Fahrenheit)
32 ! 1.5 * (5_T_INT * ( cel%rTMax - rFREEZING) / 228.6)
33
34 if ( ( ( tmin + tmax ) / 2.0_c_double ) > freezing_f ) then
35
36 potential_snowmelt = melt_index * ( tmax - freezing_f ) * degc_per_degf / mm_per_inch
37
38 else
39
40 potential_snowmelt = 0.0_c_float
41
42 end if
43
44 else
45
46 !> temperatures in degrees Celcius, snowmelt in mm
47
48 if ( ( ( tmin + tmax ) / 2.0_c_double ) > freezing_c ) then
49
50 potential_snowmelt = melt_index * tmax
51
52 else
53
54 potential_snowmelt = 0.0_c_float
55
56 end if
57
58 endif
59
60 end subroutine snowmelt_original_calculate
61
62end module snowmelt__original
elemental subroutine, public snowmelt_original_calculate(potential_snowmelt, tmin, tmax, imperial_units)
real(c_double), parameter degc_per_degf
real(c_double), parameter melt_index
real(c_double), parameter freezing_c
real(c_double), parameter freezing_f
real(c_double), parameter mm_per_inch