Changeset 5875
- Timestamp:
- 09/17/10 17:00:10 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk/src/c/objects/Elements/Tria.cpp ¶
r5872 r5875 2862 2862 ElementMatrix* Tria::CreateKMatrixCouplingMacAyealPattynFriction(void){ 2863 2863 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; 2869 2871 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; 2871 2881 GaussTria *gauss=NULL; 2872 double L[2][numdof];2873 double DL[2][2]={{ 0,0 },{0,0}}; //for basal drag2874 double DL_scalar;2875 double Ke_gg[numdof][numdof]={0.0};2876 double Ke_gg_gaussian[numdof][numdof]; //stiffness matrix contribution from drag2877 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;2885 2882 2886 2883 /*Initialize Element matrix and return if necessary*/ … … 2926 2923 2927 2924 /*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); 2929 2926 2930 2927 … … 2955 2952 ElementMatrix* Tria::CreateKMatrixDiagnosticPattynFriction(void){ 2956 2953 2954 /*Constants*/ 2957 2955 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; 2961 2960 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; 2963 2970 GaussTria *gauss=NULL; 2964 double L[2][numdof];2965 double DL[2][2]={{ 0,0 },{0,0}}; //for basal drag2966 double DL_scalar;2967 double Ke_gg[numdof][numdof]={0.0};2968 double Ke_gg_gaussian[numdof][numdof]; //stiffness matrix contribution from drag2969 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;2977 2971 2978 2972 /*Initialize Element matrix and return if necessary*/ … … 2999 2993 gauss->GaussPoint(ig); 3000 2994 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); 3001 2999 friction->GetAlpha2(&alpha2, gauss,VxEnum,VyEnum,VzEnum); // TO UNCOMMENT 3000 slope_magnitude=sqrt(pow(slope[0],2)+pow(slope[1],2)); 3002 3001 3003 3002 // If we have a slope > 6% for this element, it means we are on a mountain. In this particular case, 3004 3003 //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 3008 3004 if (slope_magnitude>MAXSLOPE){ 3009 3005 alpha2=pow((double)10,MOUNTAINKEXPONENT); 3010 3006 } 3011 3012 GetL(&L[0][0], &xyz_list[0][0], gauss,numberofdofspernode);3013 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss);3014 3007 3015 3008 DL_scalar=alpha2*gauss->weight*Jdet; … … 3055 3048 void Tria::CreateKMatrixDiagnosticSurfaceVert(Mat Kgg){ 3056 3049 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]; 3066 3060 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;3082 3061 3083 3062 /* local element matrices: */ … … 3088 3067 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 3089 3068 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); 3118 3070 3119 3071 /* Start looping on the number of gaussian points: */ … … 3123 3075 gauss->GaussPoint(ig); 3124 3076 3125 /* Get Jacobian determinant: */3126 3077 GetJacobianDeterminant3d(&Jdet, &xyz_list[0][0],gauss); 3127 3128 //Get L matrix if viscous basal drag present:3129 3078 GetL(&L[0], &xyz_list[0][0], gauss,NDOF1); 3130 3079 3131 3080 /**********************Do not forget the sign**********************************/ 3132 DL_scalar=- gauss->weight*Jdet* nz;3081 DL_scalar=- gauss->weight*Jdet*surface_normal[2]; 3133 3082 /******************************************************************************/ 3134 3083 3135 /* Do the triple producte tL*D*L: */3136 3084 TripleMultiply( L,1,3,1, 3137 3085 &DL_scalar,1,1,0, … … 3139 3087 &Ke_gg_gaussian[0][0],0); 3140 3088 3141 /* Add the Ke_gg_gaussian, onto Ke_gg: */3142 3089 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 3148 3092 MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke_gg,ADD_VALUES); 3149 3093
Note:
See TracChangeset
for help on using the changeset viewer.