Changeset 18770


Ignore:
Timestamp:
11/10/14 14:32:06 (10 years ago)
Author:
seroussi
Message:

NEW: starting to add new friction law with water layer

Location:
issm/trunk-jpl/src
Files:
1 added
2 edited

Legend:

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

    r18732 r18770  
    5454                case 4:
    5555                        GetAlpha2Temp(palpha2,gauss);
     56                        break;
     57                case 5:
     58                        GetAlpha2WaterLayer(palpha2,gauss);
    5659                        break;
    5760          default:
     
    250253        *palpha2=alpha2;
    251254}/*}}}*/
    252 void Friction::GetAlphaComplement(IssmDouble* palpha_complement, Gauss* gauss){/*{{{*/
    253 
    254         /* FrictionGetAlpha2 computes alpha2= drag^2 * Neff ^r * vel ^s, with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p.
    255          * FrictionGetAlphaComplement is used in control methods on drag, and it computes:
    256          * alpha_complement= Neff ^r * vel ^s*/
    257 
    258         if(this->law!=1)_error_("not supported");
     255void Friction::GetAlpha2WaterLayer(IssmDouble* palpha2, Gauss* gauss){/*{{{*/
     256
     257        /*This routine calculates the basal friction coefficient
     258          alpha2= drag^2 * Neff ^r * | vel | ^(s-1), with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p**/
    259259
    260260        /*diverse: */
    261261        IssmDouble  r,s;
    262         IssmDouble  vx,vy,vz,vmag;
    263         IssmDouble  drag_p,drag_q;
     262        IssmDouble  drag_p, drag_q;
    264263        IssmDouble  Neff;
     264        IssmDouble  thickness,bed;
     265        IssmDouble  vx,vy,vz,vmag;
    265266        IssmDouble  drag_coefficient;
    266         IssmDouble  bed,thickness;
    267         IssmDouble  alpha_complement;
     267        IssmDouble  alpha2;
    268268
    269269        /*Recover parameters: */
     
    285285        if(Neff<0)Neff=0;
    286286
     287        switch(dim){
     288                case 1:
     289                        element->GetInputValue(&vx,gauss,VxEnum);
     290                        vmag=sqrt(vx*vx);
     291                        break;
     292                case 2:
     293                        element->GetInputValue(&vx,gauss,VxEnum);
     294                        element->GetInputValue(&vy,gauss,VyEnum);
     295                        vmag=sqrt(vx*vx+vy*vy);
     296                        break;
     297                case 3:
     298                        element->GetInputValue(&vx,gauss,VxEnum);
     299                        element->GetInputValue(&vy,gauss,VyEnum);
     300                        element->GetInputValue(&vz,gauss,VzEnum);
     301                        vmag=sqrt(vx*vx+vy*vy+vz*vz);
     302                        break;
     303                default:
     304                        _error_("not supported");
     305        }
     306
     307        /*Check to prevent dividing by zero if vmag==0*/
     308        if(vmag==0. && (s-1.)<0.) alpha2=0.;
     309        else alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
     310        _assert_(!xIsNan<IssmDouble>(alpha2));
     311
     312        /*Assign output pointers:*/
     313        *palpha2=alpha2;
     314}/*}}}*/
     315void Friction::GetAlphaComplement(IssmDouble* palpha_complement, Gauss* gauss){/*{{{*/
     316
     317        /* FrictionGetAlpha2 computes alpha2= drag^2 * Neff ^r * vel ^s, with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p.
     318         * FrictionGetAlphaComplement is used in control methods on drag, and it computes:
     319         * alpha_complement= Neff ^r * vel ^s*/
     320
     321        if(this->law!=1)_error_("not supported");
     322
     323        /*diverse: */
     324        IssmDouble  r,s;
     325        IssmDouble  vx,vy,vz,vmag;
     326        IssmDouble  drag_p,drag_q;
     327        IssmDouble  Neff;
     328        IssmDouble  drag_coefficient;
     329        IssmDouble  bed,thickness;
     330        IssmDouble  alpha_complement;
     331
     332        /*Recover parameters: */
     333        element->GetInputValue(&drag_p,FrictionPEnum);
     334        element->GetInputValue(&drag_q,FrictionQEnum);
     335        element->GetInputValue(&thickness, gauss,ThicknessEnum);
     336        element->GetInputValue(&bed, gauss,BaseEnum);
     337        element->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
     338        IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
     339        IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
     340        IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
     341
     342        //compute r and q coefficients: */
     343        r=drag_q/drag_p;
     344        s=1./drag_p;
     345
     346        //From bed and thickness, compute effective pressure when drag is viscous:
     347        Neff=gravity*(rho_ice*thickness+rho_water*bed);
     348        if(Neff<0)Neff=0;
     349
    287350        //We need the velocity magnitude to evaluate the basal stress:
    288351        switch(dim){
  • issm/trunk-jpl/src/c/classes/Loads/Friction.h

    r18732 r18770  
    3434                void  GetAlpha2Hydro(IssmDouble* palpha2,Gauss* gauss);
    3535                void  GetAlpha2Temp(IssmDouble* palpha2,Gauss* gauss);
     36                void  GetAlpha2WaterLayer(IssmDouble* palpha2,Gauss* gauss);
    3637                void  GetAlphaComplement(IssmDouble* alpha_complement,Gauss* gauss);
    3738};
Note: See TracChangeset for help on using the changeset viewer.