diff --git a/src/actual_et__thornthwaite_mather.F90 b/src/actual_et__thornthwaite_mather.F90 index 648c8a15..ca7cea34 100644 --- a/src/actual_et__thornthwaite_mather.F90 +++ b/src/actual_et__thornthwaite_mather.F90 @@ -53,8 +53,9 @@ elemental subroutine calculate_actual_et_thornthwaite_mather( actual_et = soil_storage - soil_storage_temp else + ! open water - limit actual et to the lesser of the reference ET *or* the amount of water 'infiltrated' - actual_et = infiltration + actual_et = min(real(infiltration, c_double), real(crop_etc, c_double)) endif diff --git a/src/constants_and_conversions.F90 b/src/constants_and_conversions.F90 index 45599a04..b4295a49 100644 --- a/src/constants_and_conversions.F90 +++ b/src/constants_and_conversions.F90 @@ -21,9 +21,9 @@ module constants_and_conversions ! [ common mathematical constants ] public :: PI, TWOPI, HALFPI - real (c_double), parameter :: PI = 3.1415926535897932384626433_c_double - real (c_double), parameter :: TWOPI = 3.1415926535897932384626433_c_double * 2.0_c_double - real (c_double), parameter :: HALFPI = 3.1415926535897932384626433_c_double / 2.0_c_double + real (c_double), parameter :: PI = 4.0_c_double*atan(1.0_c_double) + real (c_double), parameter :: TWOPI = PI * 2.0_c_double + real (c_double), parameter :: HALFPI = PI / 2.0_c_double ! [ trig conversion factors ] public :: DEGREES_TO_RADIANS, RADIANS_TO_DEGREES diff --git a/src/et__hargreaves_samani.F90 b/src/et__hargreaves_samani.F90 index a8151868..fb0511be 100644 --- a/src/et__hargreaves_samani.F90 +++ b/src/et__hargreaves_samani.F90 @@ -113,7 +113,7 @@ end subroutine et_hargreaves_initialize !------------------------------------------------------------------------------ -elemental function et_hargreaves_calculate( iDayOfYear, iNumDaysInYear, fLatitude, fTMin, fTMax ) result(fReferenceET0) +impure elemental function et_hargreaves_calculate( iDayOfYear, iNumDaysInYear, fLatitude, fTMin, fTMax ) result(fReferenceET0) !! Computes the potential ET for each cell, based on TMIN and TMAX. !! Stores cell-by-cell PET values in the model grid. @@ -122,7 +122,7 @@ elemental function et_hargreaves_calculate( iDayOfYear, iNumDaysInYear, fLatitud real (c_float), intent(in) :: fLatitude real (c_float), intent(in) :: fTMin real (c_float), intent(in) :: fTMax - real (c_float) :: fReferenceET0 + real (c_double) :: fReferenceET0 ! [ LOCALS ] real (c_double) :: fDelta, fOmega_s, fD_r, fRa @@ -131,7 +131,7 @@ elemental function et_hargreaves_calculate( iDayOfYear, iNumDaysInYear, fLatitud dLatitude_radians = fLatitude * DEGREES_TO_RADIANS fD_r =relative_earth_sun_distance__D_r(iDayOfYear,iNumDaysInYear) - fDelta = solar_declination_simple__delta(iDayOfYear, iNumDaysInYear) + fDelta = solar_declination__delta(iDayOfYear, iNumDaysInYear) fOmega_s = sunrise_sunset_angle__omega_s(dLatitude_radians, fDelta) @@ -141,7 +141,7 @@ elemental function et_hargreaves_calculate( iDayOfYear, iNumDaysInYear, fLatitud fRa = extraterrestrial_radiation__Ra(dLatitude_radians, fDelta, fOmega_s, fD_r) fReferenceET0 = ET0_hargreaves( equivalent_evaporation(fRa), fTMin, fTMax) - + end function et_hargreaves_calculate @@ -153,7 +153,7 @@ elemental function ET0_hargreaves( rRa, rTMinF, rTMaxF ) result(rET_0) real (c_float),intent(in) :: rTMaxF ! [ RETURN VALUE ] - real (c_float) :: rET_0 + real (c_double) :: rET_0 ! [ LOCALS ] real (c_double) :: rTDelta @@ -161,20 +161,12 @@ elemental function ET0_hargreaves( rRa, rTMinF, rTMaxF ) result(rET_0) rTAvg = (rTMinF + rTMaxF) / 2.0_c_double - rTDelta = F_to_K(rTMaxF) - F_to_K(rTMinF) + rTDelta = F_to_K(real(rTMaxF, c_double)) - F_to_K(real(rTMinF, c_double)) rET_0 = MAX(rZERO, & mm_to_in( ET_SLOPE * rRa * (F_to_C(rTavg) + ET_CONSTANT) * (rTDelta**ET_EXPONENT) ) ) ! mm_to_in( 0.0023_c_float * rRa * (F_to_C(rTavg) + 17.8_c_float) * sqrt(rTDelta)) ) - -! rET_0 = MAX(rZERO, & -! ( fET_Slope & -! * rRa & -! * (F_to_C(rTavg) + pConfig%fET_Constant) & -! * (rTDelta**fET_Exponent)) & -! / rMM_PER_INCH) - end function ET0_hargreaves diff --git a/src/et__jensen_haise.F90 b/src/et__jensen_haise.F90 index 1d163ebb..0e3a1041 100644 --- a/src/et__jensen_haise.F90 +++ b/src/et__jensen_haise.F90 @@ -52,7 +52,7 @@ elemental function et_jh_calculate( iDayOfYear, iNumDaysInYear, fLatitude, fTMin real (c_float), intent(in), optional :: fAs real (c_float), intent(in), optional :: fBs real (c_float), intent(in), optional :: fSunPct - real (c_float) :: fReferenceET0 + real (c_double) :: fReferenceET0 ! [ LOCALS ] real (c_double) :: dRa diff --git a/src/solar_calculations.F90 b/src/solar_calculations.F90 index f189fa6d..7e40af43 100644 --- a/src/solar_calculations.F90 +++ b/src/solar_calculations.F90 @@ -218,8 +218,8 @@ elemental function relative_earth_sun_distance__D_r( iDayOfYear, iNumDaysInYear integer (c_int), intent(in) :: iNumDaysInYear real (c_double) :: dDsubR - dDsubR = 1_c_double + 0.033_c_double & - * cos( TWOPI * real( iDayOfYear, c_double ) & + dDsubR = 1.0_c_double + 0.033_c_double & + * cos( TWOPI * real( iDayOfYear, c_double ) & / real( iNumDaysInYear, c_double ) ) end function relative_earth_sun_distance__D_r