<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-text-html" lang="x-western">hello dart-users, <br>
      <br>
      this note is directed to dart users who redefine R8 (8 byte reals)<br>
      to be R4 (4 byte reals) in the DART/types/common_mod.f90 file,<br>
      and who have data with very small values in their state vector.<br>
      <br>
      it's always possible to find 2 numbers that are individually
      larger than<br>
      zero, but their product is small enough to underflow and be
      exactly 0.<br>
      with 8-byte reals this happens around 1e-308, but with reals
      defined<br>
      as 4-bytes, this happens around 1e-38.&nbsp;&nbsp; we had some code in dart<br>
      where we compute correlations for inflation and sampling error
      correction<br>
      where we test that both operands are &gt; 0 and then divide by
      their<br>
      product, which in rare underflow cases could be 0.<br>
      <br>
      if the denominator is 0 the result is Infinity or NaN (not a
      number)<br>
      depending on the value of the numerator.&nbsp; Infinity would get reset<br>
      to 1.0 by the code lines directly after the divide, but NaN would
      be<br>
      carried along by the code and might eventually result in a NaN
      appearing<br>
      in the output state vector.&nbsp; this generally upsets most models
      when they<br>
      do the next advance.<br>
      <br>
      we have updated the assim_tools/assim_tools_mod.f90 file on both<br>
      the trunk and in the kodiak branch (and the other specialized
      branches<br>
      as well) in the dart subversion repository.&nbsp; the updated code now
      does<br>
      the tests and computations in a different order to avoid this
      possibility. <br>
      the original code was not wrong and was unlikely to cause problems<br>
      with full 8-byte reals and commonly occurring data value ranges.<br>
      <br>
      at this point we believe we have eliminated problems with R4 and
      underflow<br>
      from small values in fields, but there still remains the
      possibility of overflow<br>
      if you are using R4s and working with fields that have very large
      values.<br>
      R4 values overflow around 1e38 and we are computing sums and
      squares<br>
      of the data, so fields with data values greater than ~1e15 should
      not be<br>
      run with an R4 version.&nbsp; (R8 precision goes up to 1e308.)&nbsp; there
      are<br>
      fundamental limitations to numerical accuracy in all cases, but
      running<br>
      with R4 makes it more likely to encounter them.&nbsp;&nbsp; please report
      any<br>
      apparent numerical problems (R4 or R8) to us and we will do our
      best<br>
      to address them.<br>
      <br>
      WRF users in particular often build and run with R4 reals and
      several<br>
      wrf/dart users have recently reported discovering NaNs in their
      output<br>
      state vector.&nbsp; this might show up as a crash immediately after WRF<br>
      starts up from an updated wrfinput file.&nbsp; this patch to
      assim_tools_mod<br>
      has fixed this problem for at least 2 users.&nbsp; there is also a
      possibly-related<br>
      patch available for the WRF code to zero out very small values on
      the<br>
      boundary rows that may have contributed to a higher probability of<br>
      the dart divide-by-zero problem occurring.<br>
      <br>
      i'll be sending around more details about the WRF source code fix
      to<br>
      the wrfdart-users mailing list.&nbsp; click <a moz-do-not-send="true"
        href="http://mailman.ucar.edu/mailman/listinfo/wrfdart-users">here</a>
      if you aren't on that list<br>
      and would like to be.&nbsp; if that link gets stripped out, the
      location to<br>
      sign up for the wrfdart users list is: <br>
      <br>
      <a moz-do-not-send="true" class="moz-txt-link-freetext"
        href="http://mailman.ucar.edu/mailman/listinfo/wrfdart-users">http://mailman.ucar.edu/mailman/listinfo/wrfdart-users</a>
      <br>
      <br>
      if you want to alter any settings or get off this general
      dart-users list<br>
      (or if you want to add someone else), the mailman page for this
      list<br>
      is <a moz-do-not-send="true"
        href="http://mailman.ucar.edu/mailman/listinfo/dart-users">here</a>
      which is a link to: <br>
      <br>
      <a moz-do-not-send="true" class="moz-txt-link-freetext"
        href="http://mailman.ucar.edu/mailman/listinfo/dart-users">http://mailman.ucar.edu/mailman/listinfo/dart-users</a>
      <br>
      <br>
      <br>
      thanks,<br>
      nancy at ucar dot edu<br>
      <br>
      <br>
    </div>
  </body>
</html>