Changeset 23841


Ignore:
Timestamp:
04/11/19 15:51:27 (6 years ago)
Author:
Mathieu Morlighem
Message:

BUG: fixing alpha2 <0 in coulomb friction law

Location:
issm/trunk-jpl
Files:
3 edited

Legend:

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

    r23840 r23841  
    241241
    242242        /*Check to prevent dividing by zero if vmag==0*/
    243         if(vmag==0. && (s-1.)<0.) alpha2=0.;
    244         else alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
     243        if(vmag==0. && (s-1.)<0.){
     244                alpha2=0.;
     245        }
     246        else{
     247                alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
     248        }
    245249
    246250        floatation_thickness=0;
    247251        if(base<0) floatation_thickness=-(rho_water/rho_ice)*base;
    248         if(vmag==0.) alpha2_coulomb=0.;
    249         else alpha2_coulomb=drag_coefficient_coulomb*drag_coefficient_coulomb*rho_ice*gravity*(thickness-floatation_thickness)/vmag;
     252        if(vmag==0.){
     253                alpha2_coulomb=0.;
     254        }
     255        else{
     256                alpha2_coulomb=drag_coefficient_coulomb*drag_coefficient_coulomb*rho_ice*gravity*max(0.,thickness-floatation_thickness)/vmag;
     257        }
    250258
    251259        if(alpha2_coulomb<alpha2) alpha2=alpha2_coulomb;
Note: See TracChangeset for help on using the changeset viewer.