SICOPOLIS V3.3
pdd_m.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Module : p d d _ m
4 !
5 !> @file
6 !!
7 !! Computation of the positive degree days (PDD) with statistical temperature
8 !! fluctuations; based on semi-analytical solution by Calov and Greve (2005).
9 !!
10 !! @section Copyright
11 !!
12 !! Copyright 2009-2017 Reinhard Calov, Ralf Greve
13 !!
14 !! @section License
15 !!
16 !! This file is part of SICOPOLIS.
17 !!
18 !! SICOPOLIS is free software: you can redistribute it and/or modify
19 !! it under the terms of the GNU General Public License as published by
20 !! the Free Software Foundation, either version 3 of the License, or
21 !! (at your option) any later version.
22 !!
23 !! SICOPOLIS is distributed in the hope that it will be useful,
24 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
25 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 !! GNU General Public License for more details.
27 !!
28 !! You should have received a copy of the GNU General Public License
29 !! along with SICOPOLIS. If not, see <http://www.gnu.org/licenses/>.
30 !<
31 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
32 
33 !-------------------------------------------------------------------------------
34 !> Computation of the positive degree days (PDD) with statistical temperature
35 !! fluctuations; based on semi-analytical solution by Calov and Greve (2005).
36 !<------------------------------------------------------------------------------
37 module pdd_m
38 
39  use sico_types_m
40  use sico_variables_m, only : pi
41 
42  implicit none
43 
44  private
45  public :: pdd
46 
47 contains
48 
49 !-------------------------------------------------------------------------------
50 !> Main subroutine of pdd_m:
51 !! Computation of the positive degree days (PDD) with statistical temperature
52 !! fluctuations; based on semi-analytical solution by Calov and Greve (2005).
53 !! Note that this routine uses years as time unit
54 !! (as opposed to the seconds which are usually used by SICOPOLIS).
55 !<------------------------------------------------------------------------------
56  subroutine pdd(temp_mm, s_stat, ET)
57 
58  implicit none
59 
60  real(dp), dimension(12), intent(in) :: temp_mm
61  real(dp), intent(in) :: s_stat
62 
63  real(dp), intent(out) :: ET
64 
65  integer(i4b) :: n
66  real(dp) :: inv_sqrt2pi, inv_s_stat, inv_sqrt2
67  real(dp) :: pdd_sum
68 
69  real(dp), parameter :: time_year = 1.0_dp, & ! period 1 year
70  time_year_inv = 1.0_dp/time_year, &
71  d_time = 1.0_dp/12.0_dp ! time-step 1 month
72 
73  inv_sqrt2pi = 1.0_dp/sqrt(2.0_dp*pi)
74  inv_s_stat = 1.0_dp/s_stat
75  inv_sqrt2 = 1.0_dp/sqrt(2.0_dp)
76 
77  pdd_sum = 0.0_dp
78 
79  do n=1, 12 ! month counter
80  pdd_sum = pdd_sum &
81  + ( s_stat*inv_sqrt2pi*exp(-0.5_dp*(temp_mm(n)*inv_s_stat)**2) &
82  + 0.5_dp*temp_mm(n) &
83  *erfc(-temp_mm(n)*inv_s_stat*inv_sqrt2) ) &
84  *d_time ! positive degree days (a * deg C)
85  end do
86 
87  et = pdd_sum*time_year_inv ! temperature excess (deg C)
88 
89  end subroutine pdd
90 
91 !-------------------------------------------------------------------------------
92 
93 end module pdd_m
94 !
Computation of the positive degree days (PDD) with statistical temperature fluctuations; based on sem...
Definition: pdd_m.F90:37
Declarations of kind types for SICOPOLIS.
real(dp), parameter pi
pi: Constant pi
subroutine, public pdd(temp_mm, s_stat, ET)
Main subroutine of pdd_m: Computation of the positive degree days (PDD) with statistical temperature ...
Definition: pdd_m.F90:57
Declarations of global variables for SICOPOLIS.