[FLASH-BUGS] "minor" glitch in flatten.F90 (part 2)

Markus Gross m.s.gross at hw.ac.uk
Wed Jul 16 07:33:44 CDT 2003


Hi again!

Realizing that my fix was not much better than the original for any non 
constructed case, i.e. when rounding error may be present, may I suggest the 
following:

!this is the original:
!!$       if (dp(i) .LT. 0.e0) then
!!$          scrch2(i) = scrch3(i+1)
!!$       else
!!$          scrch2(i) = scrch3(i-1)
!!$       endif

!my "new" suggestion:
       if (dp(i) .LT. -10.e0) THEN
          scrch2(i) = scrch3(i+1)
       ELSE
          if (dp(i) .GT. 10.e0) THEN
             scrch2(i) = scrch3(i-1)
          ELSE
             weight1 = 0.5d0*dabs(derf(dp(i)+2.d0)-1.d0)
             weight2 = 0.5d0*dabs(derf(dp(i)-2.d0)+1.d0)
             scrch2(i) = scrch3(i+1) * weight1 +&
                         scrch3(i-1) * weight2 +&
                         scrch3(i  ) * (1.d0-(weight1+weight2))
          END IF
       END IF

This of course assumes that a -2.d0< dp(i) < 2.d0 is effectively a dp(i)=0 
which for my case is true. Modifications for other "small" values is of course 
straight forward.

Again, what do you think? A weibull may of course be faster than the erf...

Regards,

Markus.






More information about the flash-bugs mailing list