Changeset 17938


Ignore:
Timestamp:
05/05/14 16:42:19 (11 years ago)
Author:
cborstad
Message:

CHG: return zero friction if velocity magnitude is calculated as zero instead of raising error, useful for Weertman sliding law

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Loads/Friction.cpp

    r17929 r17938  
    9494        }
    9595
    96         /*Checks that s-1>0 if v=0*/
    97         if(vmag==0. && (s-1.)<0.) _error_("velocity is 0 and (s-1)=" << (s-1.) << "<0, alpha2 is Inf");
    98 
    99         alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
     96        /*Check to prevent dividing by zero if vmag==0*/
     97        if(vmag==0. && (s-1.)<0.) alpha2=0.;
     98        else alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
    10099        _assert_(!xIsNan<IssmDouble>(alpha2));
    101100
     
    159158        }
    160159
    161         /*Checks that s-1>0 if v=0*/
    162         if(vmag==0. && (s-1.)<0.) _error_("velocity is 0 and (s-1)=" << (s-1.) << "<0, alpha2 is Inf");
    163 
    164         alpha_complement=pow(Neff,r)*pow(vmag,(s-1));_assert_(!xIsNan<IssmDouble>(alpha_complement));
     160        /*Check to prevent dividing by zero if vmag==0*/
     161        if(vmag==0. && (s-1.)<0.) alpha_complement=0.;
     162        else alpha_complement=pow(Neff,r)*pow(vmag,(s-1));_assert_(!xIsNan<IssmDouble>(alpha_complement));
    165163
    166164        /*Assign output pointers:*/
Note: See TracChangeset for help on using the changeset viewer.