Changeset 8416


Ignore:
Timestamp:
05/24/11 13:41:18 (14 years ago)
Author:
seroussi
Message:

moved KMatrix DiagnosticVertSurface from Tria to Penta

Location:
issm/trunk/src/c/objects
Files:
4 edited

Legend:

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

    r8415 r8416  
    16281628        if (!IsOnSurface()) return NULL;
    16291629
    1630         /*Call Tria function*/
    1631         Tria* tria=(Tria*)SpawnTria(3,4,5); //nodes 3,4 and 5 are on the surface
    1632         ElementMatrix* Ke=tria->CreateKMatrixDiagnosticVertSurface();
    1633         delete tria->matice; delete tria;
    1634 
    1635         /*clean up and return*/
     1630        /*Constants*/
     1631        const int numdof=NDOF1*NUMVERTICES;
     1632
     1633        /*Intermediaries */
     1634        int       i,j,ig;
     1635        double    xyz_list[NUMVERTICES][3];
     1636        double    xyz_list_tria[NUMVERTICES2D][3];
     1637        double    surface_normal[3];
     1638        double    Jdet2d,DL_scalar;
     1639        double    l1l6[NUMVERTICES];
     1640        GaussPenta *gauss=NULL;
     1641        double Ke_g[numdof][numdof]; //stiffness matrix evaluated at the gaussian point.
     1642
     1643        /*Initialize Element matrix*/
     1644        ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
     1645
     1646        /*Retrieve all inputs and parameters*/
     1647        GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
     1648        for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i+3][j];
     1649        SurfaceNormal(&surface_normal[0],xyz_list_tria);
     1650
     1651        /* Start  looping on the number of gaussian points: */
     1652        gauss=new GaussPenta(3,4,5,2);
     1653        for (ig=gauss->begin();ig<gauss->end();ig++){
     1654
     1655                gauss->GaussPoint(ig);
     1656
     1657                GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0],gauss);
     1658                GetNodalFunctionsP1(&l1l6[0], gauss);
     1659
     1660                /**********************Do not forget the sign**********************************/
     1661                DL_scalar=- gauss->weight*Jdet2d*surface_normal[2];
     1662                /******************************************************************************/
     1663
     1664                TripleMultiply( l1l6,1,numdof,1,
     1665                                        &DL_scalar,1,1,0,
     1666                                        l1l6,1,numdof,0,
     1667                                        &Ke_g[0][0],0);
     1668
     1669                for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[i*numdof+j]+=Ke_g[i][j];
     1670        }
     1671
     1672        /*Clean up and return*/
     1673        delete gauss;
    16361674        return Ke;
    16371675}
  • TabularUnified issm/trunk/src/c/objects/Elements/Tria.cpp

    r8414 r8416  
    10871087
    10881088        /*Clean up and return*/
    1089         return Ke;
    1090 }
    1091 /*}}}*/
    1092 /*FUNCTION Tria::CreateKMatrixDiagnosticVertSurface {{{1*/
    1093 ElementMatrix* Tria::CreateKMatrixDiagnosticVertSurface(void){
    1094 
    1095         /*Constants*/
    1096         const int numdof=NDOF1*NUMVERTICES;
    1097 
    1098         /*Intermediaries */
    1099         int       i,j,ig;
    1100         double    xyz_list[NUMVERTICES][3];
    1101         double    surface_normal[3];
    1102         double    Jdet,DL_scalar;
    1103         double    L[3];
    1104         GaussTria *gauss=NULL;
    1105         double Ke_g[numdof][numdof]; //stiffness matrix evaluated at the gaussian point.
    1106 
    1107         /*Initialize Element matrix*/
    1108         ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
    1109 
    1110         /*Retrieve all inputs and parameters*/
    1111         GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
    1112         SurfaceNormal(&surface_normal[0],xyz_list);
    1113 
    1114         /* Start  looping on the number of gaussian points: */
    1115         gauss=new GaussTria(2);
    1116         for (ig=gauss->begin();ig<gauss->end();ig++){
    1117 
    1118                 gauss->GaussPoint(ig);
    1119 
    1120                 GetJacobianDeterminant3d(&Jdet, &xyz_list[0][0],gauss);
    1121                 GetL(&L[0], &xyz_list[0][0], gauss,NDOF1);
    1122 
    1123                 /**********************Do not forget the sign**********************************/
    1124                 DL_scalar=- gauss->weight*Jdet*surface_normal[2];
    1125                 /******************************************************************************/
    1126 
    1127                 TripleMultiply( L,1,3,1,
    1128                                         &DL_scalar,1,1,0,
    1129                                         L,1,3,0,
    1130                                         &Ke_g[0][0],0);
    1131 
    1132                 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[i*numdof+j]+=Ke_g[i][j];
    1133         }
    1134 
    1135         /*Clean up and return*/
    1136         delete gauss;
    11371089        return Ke;
    11381090}
  • TabularUnified issm/trunk/src/c/objects/Elements/Tria.h

    r8414 r8416  
    153153                ElementMatrix* CreateKMatrixDiagnosticPattynFriction(void);
    154154                ElementMatrix* CreateKMatrixDiagnosticHutter(void);
    155                 ElementMatrix* CreateKMatrixDiagnosticVertSurface(void);
    156155                ElementMatrix* CreateKMatrixMelting(void);
    157156                ElementMatrix* CreateKMatrixHydrology(void);
  • TabularUnified issm/trunk/src/c/objects/Gauss/GaussPenta.cpp

    r6412 r8416  
    149149                coords4=(double*)xmalloc(numgauss*sizeof(double));
    150150                for(int i=0;i<numgauss;i++) coords4[i]=-1.0;
     151        }
     152        /*Upper surface Tria*/
     153        else if(index1==3 && index2==4 && index3==5){
     154
     155                /*Get GaussTria*/
     156                GaussLegendreTria(&numgauss,&coords1,&coords2,&coords3,&weights,order);
     157
     158                /*compute z coordinate*/
     159                coords4=(double*)xmalloc(numgauss*sizeof(double));
     160                for(int i=0;i<numgauss;i++) coords4[i]=1.0;
    151161        }
    152162        else{
Note: See TracChangeset for help on using the changeset viewer.