Show
Ignore:
Timestamp:
07/04/08 02:43:20 (5 months ago)
Author:
gary
Message:

bugfix for the bugfix - safe_div does not guard against div by 0 - back to using explicit test on magnitude of var

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/c08_branch/source/radius_increment.cpp

    r2152 r2155  
    582582        cmshft(); 
    583583 
     584        relec *= EN1RYD; 
     585 
     586#       if 0 
     587        /* this is all evaluated in pressure_total */ 
     588        /* radiative acceleration; xMassDensity is gm per cc, evaluated when PTOT called */ 
     589        t = 1./SPEEDLIGHT/dense.xMassDensity; 
     590        /* >>chng 03 feb 01, lgLineRadPresOn was missing */ 
     591        wind.AccelLine = (realnum)(RT_line_driving()*t)*pressure.lgLineRadPresOn; 
     592        /* >>chng 01 aug 03, add lgConPress to kill AccelCont here */ 
     593        wind.AccelCont = (realnum)(rforce*EN1RYD*t)*pressure.lgContRadPresOn; 
     594        /* this is numerically unstable */ 
     595        wind.AccelPres = 0.; 
     596        /* total acceleration */ 
     597        wind.AccelTot = wind.AccelCont + wind.AccelLine + wind.AccelPres; 
     598#       endif 
    584599        /* remember the largest value */ 
    585600        wind.AccelMax = (realnum)MAX2(wind.AccelMax,wind.AccelTot); 
     
    587602        /* force multiplier; relec can be zero for very low densities - so use double 
    588603         * form of safe_div - fmul is of order unity - wind.AccelLine and wind.AccelCont  
    589          * are both floats to will underflow long before relec will - fmul is only use 
     604         * are both floats to will underflow long before relec will - fmul is only used 
    590605         * in output, not in any physics */ 
    591606        relec *= (EN1RYD/SPEEDLIGHT/dense.xMassDensity); 
    592         wind.fmul = (realnum)safe_div( (double)(wind.AccelLine + wind.AccelCont) ,  
    593                 relec ); 
     607        if( relec > SMALLFLOAT ) 
     608                wind.fmul = (realnum)( (wind.AccelLine + wind.AccelCont) / relec); 
     609        else 
     610                wind.fmul = 0.; 
    594611 
    595612        /* keep track of average acceleration */