[Dart-dev] [5999] DART/branches/development/adaptive_inflate/adaptive_inflate_mod.f90: test before doing a divide in the inflation standard deviation

nancy at ucar.edu nancy at ucar.edu
Wed Mar 13 14:48:25 MDT 2013


Revision: 5999
Author:   nancy
Date:     2013-03-13 14:48:25 -0600 (Wed, 13 Mar 2013)
Log Message:
-----------
test before doing a divide in the inflation standard deviation
computation if it is allowed to vary.  if you turn on floating
point exceptions to look for numerical errors it was trapping
here with a divide by zero.

Modified Paths:
--------------
    DART/branches/development/adaptive_inflate/adaptive_inflate_mod.f90

-------------- next part --------------
Modified: DART/branches/development/adaptive_inflate/adaptive_inflate_mod.f90
===================================================================
--- DART/branches/development/adaptive_inflate/adaptive_inflate_mod.f90	2013-03-13 19:31:17 UTC (rev 5998)
+++ DART/branches/development/adaptive_inflate/adaptive_inflate_mod.f90	2013-03-13 20:48:25 UTC (rev 5999)
@@ -754,6 +754,15 @@
 ! Find value at a point one OLD sd above new mean value
    new_1_sd = compute_new_density(dist_2, sigma_p_2, sigma_o_2, lambda_mean, lambda_sd, gamma, &
       new_cov_inflate + lambda_sd)
+
+   ! If either the numerator or denominator of the following computation 
+   ! of 'ratio' is going to be zero (or almost so), return the original incoming
+   ! inflation value.  The computation would have resulted in either Inf or NaN.
+   if (abs(new_max) <= TINY(0.0_r8) .or. abs(new_1_sd) <= TINY(0.0_r8)) then
+      new_cov_inflate_sd = lambda_sd
+      return
+   endif
+
    ratio = new_1_sd / new_max 
 
    ! Another error for numerical issues; if ratio is larger than 0.99, bail out


More information about the Dart-dev mailing list