Changeset 16874


Ignore:
Timestamp:
11/21/13 19:01:27 (11 years ago)
Author:
seroussi
Message:

NEW: KMatrix friction SSA

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp

    r16872 r16874  
    975975}/*}}}*/
    976976ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAFriction(Element* element){/*{{{*/
     977
     978        /*Return if element is inactive*/
     979        if(element->IsFloating()) return NULL;
     980
    977981        /*Intermediaries*/
    978982        bool       mainlyfloating;
    979         int        analysis_type,migration_style,point1;
    980         IssmDouble alpha2,Jdet,fraction1,fraction2;
    981         IssmDouble phi=1.0;
    982         IssmDouble D_scalar,gllevelset;
    983         IssmDouble *xyz_list = NULL;
    984         Friction   *friction = NULL;
    985         Gauss*     gauss     = NULL;
    986 
    987         /*Return if element is inactive*/
    988         if(element->IsFloating()) return NULL;
     983        int         migration_style,point1;
     984        IssmDouble  alpha2,Jdet,fraction1,fraction2;
     985        IssmDouble  gllevelset,phi=1.;
     986        IssmDouble *xyz_list  = NULL;
     987        Gauss*      gauss     = NULL;
    989988
    990989        /*Fetch number of nodes and dof for this finite element*/
     
    993992
    994993        /*Initialize Element matrix and vectors*/
    995         ElementMatrix* Ke     = element->NewElementMatrix(SSAApproximationEnum);
    996         IssmDouble*    B      = xNew<IssmDouble>(2*numdof);
    997         IssmDouble*    D      = xNewZeroInit<IssmDouble>(2*2);
     994        ElementMatrix* Ke      = element->NewElementMatrix(SSAApproximationEnum);
     995        IssmDouble*    B       = xNew<IssmDouble>(2*numdof);
     996        IssmDouble     D[2][2] = {0.};
    998997
    999998        /*Retrieve all inputs and parameters*/
    1000999        element->GetVerticesCoordinates(&xyz_list);
    10011000        element->FindParam(&migration_style,GroundinglineMigrationEnum);
    1002         Input* surface_input=element->GetInput(SurfaceEnum); _assert_(surface_input);
    1003         Input* vx_input=element->GetInput(VxEnum);           _assert_(vx_input);
    1004         Input* vy_input=element->GetInput(VyEnum);           _assert_(vy_input);
    1005         Input* gllevelset_input=NULL;
    1006         element->FindParam(&analysis_type,AnalysisTypeEnum);
     1001        Input* surface_input    = element->GetInput(SurfaceEnum); _assert_(surface_input);
     1002        Input* vx_input         = element->GetInput(VxEnum);      _assert_(vx_input);
     1003        Input* vy_input         = element->GetInput(VyEnum);      _assert_(vy_input);
     1004        Input* gllevelset_input = NULL;
    10071005
    10081006        /*build friction object, used later on: */
    1009         //friction=new Friction("2d",inputs,matpar,analysis_type);
     1007        Friction* friction=new Friction(element,2);
    10101008
    10111009        /*Recover portion of element that is grounded*/
     
    10221020        /* Start  looping on the number of gaussian points: */
    10231021        for(int ig=gauss->begin();ig<gauss->end();ig++){
    1024 
    10251022                gauss->GaussPoint(ig);
    10261023
    1027                 //friction->GetAlpha2(&alpha2, gauss,VxEnum,VyEnum,VzEnum);
    1028                 alpha2=1.0;
     1024                friction->GetAlpha2(&alpha2, gauss,vx_input,vy_input,NULL);
    10291025                if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
    10301026                if(migration_style==SubelementMigration2Enum){
    10311027                        gllevelset_input->GetInputValue(&gllevelset, gauss);
    1032                         if(gllevelset<0) alpha2=0;
     1028                        if(gllevelset<0.) alpha2=0.;
    10331029                }
    10341030
    10351031                this->GetBSSAFriction(B, element, xyz_list, gauss);
    10361032                element->JacobianDeterminant(&Jdet, xyz_list,gauss);
    1037                 D_scalar=alpha2*gauss->weight*Jdet;
    1038                 for(int i=0;i<2;i++) D[i*2+i]=D_scalar;
     1033                for(int i=0;i<2;i++) D[i][i]=alpha2*gauss->weight*Jdet;
    10391034
    10401035                TripleMultiply(B,2,numdof,1,
    1041                                         D,2,2,0,
     1036                                        &D[0][0],2,2,0,
    10421037                                        B,2,numdof,0,
    10431038                                        &Ke->values[0],1);
     
    10511046        delete friction;
    10521047        xDelete<IssmDouble>(xyz_list);
    1053         xDelete<IssmDouble>(D);
    10541048        xDelete<IssmDouble>(B);
    10551049        return Ke;
     
    12521246        delete gauss;
    12531247        return pe;
    1254         return NULL;
    12551248}/*}}}*/
    12561249void StressbalanceAnalysis::GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
Note: See TracChangeset for help on using the changeset viewer.