Changeset 5875


Ignore:
Timestamp:
09/17/10 17:00:10 (15 years ago)
Author:
seroussi
Message:

cleanup in tria

File:
1 edited

Legend:

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

    r5872 r5875  
    28622862ElementMatrix* Tria::CreateKMatrixCouplingMacAyealPattynFriction(void){
    28632863
    2864         const int numdof        = 2 *NUMVERTICES;
    2865         const int numdoftotal   = 4 *NUMVERTICES;
    2866         int       i,j;
    2867         int     ig;
    2868         int       analysis_type;
     2864        /*Constants*/
     2865        const int numdof        = NDOF2 *NUMVERTICES;
     2866        const int numdoftotal   = NDOF4 *NUMVERTICES;
     2867       
     2868        /*Intermediaries */
     2869        int       i,j,ig,analysis_type,drag_type;
     2870        double    Jdet,slope_magnitude,alpha2;
    28692871        double    xyz_list[NUMVERTICES][3];
    2870         int       numberofdofspernode=2;
     2872        double    slope[2]={0.0,0.0};
     2873        double    MAXSLOPE=.06; // 6 %
     2874        double    MOUNTAINKEXPONENT=10;
     2875        double    L[2][numdof];
     2876        double    DL[2][2]                  ={{ 0,0 },{0,0}}; //for basal drag
     2877        double    DL_scalar;
     2878        double    Ke_gg[numdof][numdof]     ={0.0};
     2879        double    Ke_gg_gaussian[numdof][numdof]; //stiffness matrix contribution from drag
     2880        Friction  *friction = NULL;
    28712881        GaussTria *gauss=NULL;
    2872         double L[2][numdof];
    2873         double DL[2][2]={{ 0,0 },{0,0}}; //for basal drag
    2874         double DL_scalar;
    2875         double Ke_gg[numdof][numdof]={0.0};
    2876         double Ke_gg_gaussian[numdof][numdof]; //stiffness matrix contribution from drag
    2877         double Jdet;
    2878         double  slope[2]={0.0,0.0};
    2879         double  slope_magnitude;
    2880         Friction *friction = NULL;
    2881         double    alpha2;
    2882         double MAXSLOPE=.06; // 6 %
    2883         double MOUNTAINKEXPONENT=10;
    2884         int  drag_type;
    28852882
    28862883        /*Initialize Element matrix and return if necessary*/
     
    29262923
    29272924                /*Get L matrix: */
    2928                 GetL(&L[0][0], &xyz_list[0][0], gauss,numberofdofspernode);
     2925                GetL(&L[0][0], &xyz_list[0][0], gauss,NDOF2);
    29292926
    29302927               
     
    29552952ElementMatrix* Tria::CreateKMatrixDiagnosticPattynFriction(void){
    29562953
     2954        /*Constants*/
    29572955        const int numdof   = NDOF2*NUMVERTICES;
    2958         int       i,j;
    2959         int     ig;
    2960         int       analysis_type;
     2956       
     2957        /*Intermediaries */
     2958        int       i,j,ig;
     2959        int       analysis_type,drag_type;
    29612960        double    xyz_list[NUMVERTICES][3];
    2962         int       numberofdofspernode=2;
     2961        double    slope_magnitude,alpha2,Jdet;
     2962        double    slope[2]={0.0,0.0};
     2963        double    MAXSLOPE=.06; // 6 %
     2964        double    MOUNTAINKEXPONENT=10;
     2965        double    L[2][numdof];
     2966        double    DL[2][2]={{ 0,0 },{0,0}}; //for basal drag
     2967        double    DL_scalar;
     2968        double    Ke_gg_gaussian[numdof][numdof]; //stiffness matrix contribution from drag
     2969        Friction  *friction = NULL;
    29632970        GaussTria *gauss=NULL;
    2964         double L[2][numdof];
    2965         double DL[2][2]={{ 0,0 },{0,0}}; //for basal drag
    2966         double DL_scalar;
    2967         double Ke_gg[numdof][numdof]={0.0};
    2968         double Ke_gg_gaussian[numdof][numdof]; //stiffness matrix contribution from drag
    2969         double Jdet;
    2970         double  slope[2]={0.0,0.0};
    2971         double  slope_magnitude;
    2972         Friction *friction = NULL;
    2973         double    alpha2;
    2974         double MAXSLOPE=.06; // 6 %
    2975         double MOUNTAINKEXPONENT=10;
    2976         int  drag_type;
    29772971
    29782972        /*Initialize Element matrix and return if necessary*/
     
    29992993                gauss->GaussPoint(ig);
    30002994
     2995                GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss);
     2996                GetL(&L[0][0], &xyz_list[0][0], gauss,NDOF2);
     2997
     2998                surface_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],gauss);
    30012999                friction->GetAlpha2(&alpha2, gauss,VxEnum,VyEnum,VzEnum); // TO UNCOMMENT
     3000                slope_magnitude=sqrt(pow(slope[0],2)+pow(slope[1],2));
    30023001
    30033002                // If we have a slope > 6% for this element,  it means  we are on a mountain. In this particular case,
    30043003                //velocity should be = 0. To achieve this result, we set alpha2_list to a very high value: */
    3005                 surface_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],gauss);
    3006                 slope_magnitude=sqrt(pow(slope[0],2)+pow(slope[1],2));
    3007 
    30083004                if (slope_magnitude>MAXSLOPE){
    30093005                        alpha2=pow((double)10,MOUNTAINKEXPONENT);
    30103006                }
    3011 
    3012                 GetL(&L[0][0], &xyz_list[0][0], gauss,numberofdofspernode);
    3013                 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss);
    30143007               
    30153008                DL_scalar=alpha2*gauss->weight*Jdet;
     
    30553048void  Tria::CreateKMatrixDiagnosticSurfaceVert(Mat Kgg){
    30563049
    3057         int i,j;
    3058 
    3059         /* node data: */
    3060         const int    numdof=NDOF1*NUMVERTICES;
    3061         double       xyz_list[NUMVERTICES][3];
    3062         int*         doflist=NULL;
    3063 
    3064         /* gaussian points: */
    3065         int     ig;
     3050        /*Constants*/
     3051        const int numdof=NDOF1*NUMVERTICES;
     3052
     3053        /*Intermediaries */
     3054        int       i,j,ig;
     3055        int*      doflist=NULL;
     3056        double    xyz_list[NUMVERTICES][3];
     3057        double    surface_normal[3];
     3058        double    Jdet,DL_scalar;
     3059        double    L[3];
    30663060        GaussTria *gauss=NULL;
    3067 
    3068         /* surface normal: */
    3069         double x4,y4,z4;
    3070         double x5,y5,z5;
    3071         double x6,y6,z6;
    3072         double v46[3];
    3073         double v56[3];
    3074         double normal[3];
    3075         double norm_normal;
    3076         double nz;
    3077 
    3078         /*Matrices: */
    3079         double DL_scalar;
    3080         double L[3];
    3081         double Jdet;
    30823061
    30833062        /* local element matrices: */
     
    30883067        GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
    30893068        GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
    3090 
    3091         /*Build normal vector to the surface:*/
    3092         x4=xyz_list[0][0];
    3093         y4=xyz_list[0][1];
    3094         z4=xyz_list[0][2];
    3095 
    3096         x5=xyz_list[1][0];
    3097         y5=xyz_list[1][1];
    3098         z5=xyz_list[1][2];
    3099 
    3100         x6=xyz_list[2][0];
    3101         y6=xyz_list[2][1];
    3102         z6=xyz_list[2][2];
    3103 
    3104         v46[0]=x4-x6;
    3105         v46[1]=y4-y6;
    3106         v46[2]=z4-z6;
    3107 
    3108         v56[0]=x5-x6;
    3109         v56[1]=y5-y6;
    3110         v56[2]=z5-z6;
    3111 
    3112         normal[0]=(y4-y6)*(z5-z6)-(z4-z6)*(y5-y6);
    3113         normal[1]=(z4-z6)*(x5-x6)-(x4-x6)*(z5-z6);
    3114         normal[2]=(x4-x6)*(y5-y6)-(y4-y6)*(x5-x6);
    3115 
    3116         norm_normal=sqrt(pow(normal[0],(double)2)+pow(normal[1],(double)2)+pow(normal[2],(double)2));
    3117         nz=1.0/norm_normal*normal[2];
     3069        SurfaceNormal(&surface_normal[0],xyz_list);
    31183070
    31193071        /* Start  looping on the number of gaussian points: */
     
    31233075                gauss->GaussPoint(ig);
    31243076
    3125                 /* Get Jacobian determinant: */
    31263077                GetJacobianDeterminant3d(&Jdet, &xyz_list[0][0],gauss);
    3127 
    3128                 //Get L matrix if viscous basal drag present:
    31293078                GetL(&L[0], &xyz_list[0][0], gauss,NDOF1);
    31303079
    31313080                /**********************Do not forget the sign**********************************/
    3132                 DL_scalar=- gauss->weight*Jdet*nz;
     3081                DL_scalar=- gauss->weight*Jdet*surface_normal[2];
    31333082                /******************************************************************************/
    31343083
    3135                 /*  Do the triple producte tL*D*L: */
    31363084                TripleMultiply( L,1,3,1,
    31373085                                        &DL_scalar,1,1,0,
     
    31393087                                        &Ke_gg_gaussian[0][0],0);
    31403088
    3141                 /* Add the Ke_gg_gaussian, onto Ke_gg: */
    31423089                for( i=0; i<numdof; i++) for(j=0;j<numdof;j++) Ke_gg[i][j]+=Ke_gg_gaussian[i][j];
    3143 
    3144 
    3145         }
    3146 
    3147         /*Add Ke_gg to global matrix Kgg: */
     3090        }
     3091
    31483092        MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke_gg,ADD_VALUES);
    31493093
Note: See TracChangeset for help on using the changeset viewer.