Show
Ignore:
Timestamp:
07/04/08 02:38:03 (6 months ago)
Author:
gary
Message:

bugfix, force multiplier - use explicit test for div by zero

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/source/radius_increment.cpp

    r2153 r2154  
    503503        wind.AccelMax = (realnum)MAX2(wind.AccelMax,wind.AccelTot); 
    504504 
    505         /* force multiplier; RELEC*T can be zero for very low densities */ 
    506         if( relec*t > SMALLFLOAT ) 
    507         { 
    508                 wind.fmul = (realnum)((wind.AccelLine + wind.AccelCont)/(relec*t)); 
    509         } 
     505        /* force multiplier; relec can be zero for very low densities - so use double 
     506         * form of safe_div - fmul is of order unity - wind.AccelLine and wind.AccelCont  
     507         * are both floats to will underflow long before relec will - fmul is only used 
     508         * in output, not in any physics */ 
     509        relec *= (EN1RYD/SPEEDLIGHT/dense.xMassDensity); 
     510        if( relec > SMALLFLOAT ) 
     511                wind.fmul = (realnum)( (wind.AccelLine + wind.AccelCont) / relec); 
    510512        else 
    511         { 
    512513                wind.fmul = 0.; 
    513         } 
    514514 
    515515        /* keep track of average acceleration */