Changeset 5850


Ignore:
Timestamp:
09/16/10 14:46:34 (15 years ago)
Author:
Mathieu Morlighem
Message:

MacAyeal3d is now using ElemMatrix

Location:
issm/trunk/src/c/objects/Elements
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r5849 r5850  
    22122212                        break;
    22132213                case MacAyealPattynApproximationEnum:
    2214                         CreateKMatrixDiagnosticMacAyeal3d( Kgg);
     2214                        Ke=CreateKMatrixDiagnosticMacAyeal3d();
     2215                        if(Ke) Ke->AddToGlobal(Kgg,NULL,NULL);
     2216                        delete Ke;
    22152217                        Ke=CreateKMatrixDiagnosticPattyn();
    22162218                        if(Ke) Ke->AddToGlobal(Kgg,NULL,NULL);
     
    23242326/*}}}*/
    23252327/*FUNCTION Penta::CreateKMatrixDiagnosticMacAyeal3d{{{1*/
    2326 void Penta::CreateKMatrixDiagnosticMacAyeal3d( Mat Kgg){
     2328ElementMatrix* Penta::CreateKMatrixDiagnosticMacAyeal3d(void){
     2329
     2330
     2331        /*compute all stiffness matrices for this element*/
     2332        ElementMatrix* Ke1=CreateKMatrixDiagnosticMacAyeal3dViscous();
     2333        ElementMatrix* Ke2=CreateKMatrixDiagnosticMacAyeal3dFriction();
     2334        ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
     2335
     2336        /*clean-up and return*/
     2337        delete Ke1;
     2338        delete Ke2;
     2339        return Ke;
     2340}
     2341/*}}}*/
     2342/*FUNCTION Penta::CreateKMatrixDiagnosticMacAyeal3dViscous{{{1*/
     2343ElementMatrix* Penta::CreateKMatrixDiagnosticMacAyeal3dViscous(void){
    23272344
    23282345        const int    numdof2d=2*NUMVERTICES2D;
    23292346        int             i,j,ig;
    23302347        double       xyz_list[NUMVERTICES][3];
    2331         int*         doflist=NULL;
    23322348        GaussPenta *gauss=NULL;
    23332349        GaussTria  *gauss_tria=NULL;
     
    23422358        double DL[2][2]={0.0}; //for basal drag
    23432359        double DL_scalar;
    2344         double Ke_gg[numdof2d][numdof2d]={0.0}; //local element stiffness matrix
    23452360        double Ke_gg_gaussian[numdof2d][numdof2d]; //stiffness matrix evaluated at the gaussian point.
    23462361        double Jdet;
     
    23542369        Penta* pentabase=NULL;
    23552370
    2356         /*If on water, skip stiffness: */
    2357         if(IsOnWater())return;
    2358 
    23592371        /*Find penta on bed as this is a macayeal elements: */
    23602372        pentabase=GetBasalElement();
    23612373        tria=pentabase->SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria.
    23622374
    2363         /* Get dof list: */
    2364         tria->GetDofList(&doflist,MacAyealApproximationEnum,GsetEnum);  //Pattyn dof list
     2375        /*Initialize Element matrix and return if necessary*/
     2376        if(IsOnWater()) return NULL;
     2377        ElementMatrix* Ke=tria->NewElementMatrix(MacAyealApproximationEnum);
    23652378
    23662379        /*Retrieve all inputs and parameters*/
     
    23982411                                        &Ke_gg_gaussian[0][0],0);
    23992412
    2400                 for(i=0;i<numdof2d;i++) for(j=0;j<numdof2d;j++) Ke_gg[i][j]+=Ke_gg_gaussian[i][j];
    2401         }
    2402 
    2403         MatSetValues(Kgg,numdof2d,doflist,numdof2d,doflist,(const double*)Ke_gg,ADD_VALUES);
    2404 
    2405         //Deal with 2d friction at the bedrock interface
    2406         if(IsOnBed() && !IsOnShelf()){
    2407                 /*Build a tria element using the 3 grids of the base of the penta. Then use
    2408                  * the tria functionality to build a friction stiffness matrix on these 3
    2409                  * grids: */
    2410 
    2411                 tria->CreateKMatrixDiagnosticMacAyealFriction(Kgg,NULL,NULL);
     2413                for(i=0;i<numdof2d;i++) for(j=0;j<numdof2d;j++) Ke->values[i*numdof2d+j]+=Ke_gg_gaussian[i][j];
    24122414        }
    24132415
     
    24172419        delete gauss_tria;
    24182420        delete gauss;
    2419         xfree((void**)&doflist);
     2421        return Ke;
     2422}
     2423/*}}}*/
     2424/*FUNCTION Penta::CreateKMatrixDiagnosticMacAyeal3dFriction{{{1*/
     2425ElementMatrix* Penta::CreateKMatrixDiagnosticMacAyeal3dFriction(void){
     2426
     2427        /*Initialize Element matrix and return if necessary*/
     2428        if(IsOnWater() || IsOnShelf() || !IsOnBed()) return NULL;
     2429
     2430        /*Build a tria element using the 3 grids of the base of the penta. Then use
     2431         * the tria functionality to build a friction stiffness matrix on these 3
     2432         * grids: */
     2433        Tria* tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria.
     2434        ElementMatrix* Ke=tria->CreateKMatrixDiagnosticMacAyealFriction();
     2435        delete tria->matice; delete tria;
     2436
     2437        /*clean-up and return*/
     2438        return Ke;
    24202439}
    24212440/*}}}*/
  • issm/trunk/src/c/objects/Elements/Penta.h

    r5849 r5850  
    128128                void      CreateKMatrixDiagnosticHutter( Mat Kgg);
    129129                ElementMatrix* CreateKMatrixDiagnosticMacAyeal2d(void);
    130                 void      CreateKMatrixDiagnosticMacAyeal3d(Mat Kgg);
     130                ElementMatrix* CreateKMatrixDiagnosticMacAyeal3d(void);
     131                ElementMatrix* CreateKMatrixDiagnosticMacAyeal3dViscous(void);
     132                ElementMatrix* CreateKMatrixDiagnosticMacAyeal3dFriction(void);
    131133                ElementMatrix* CreateKMatrixDiagnosticPattyn(void);
    132134                ElementMatrix* CreateKMatrixDiagnosticPattynViscous(void);
Note: See TracChangeset for help on using the changeset viewer.