Changeset 5590
- Timestamp:
- 08/26/10 09:46:56 (15 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r5589 r5590 489 489 /*Parameters*/ 490 490 double rho_ice,gravity; 491 double surface_normal[3];492 491 double bed_normal[3]; 493 492 double bed; … … 596 595 597 596 /*Get normal vector to the bed */ 598 SurfaceNormal(&surface_normal[0],xyz_list_tria); 599 bed_normal[0] = - surface_normal[0]; //Program is for surface, so the normal to the bed is the opposite of the result 600 bed_normal[1] = - surface_normal[1]; 601 bed_normal[2] = - surface_normal[2]; 597 BedNormal(&bed_normal[0],xyz_list_tria); 602 598 603 599 /*basalforce*/ … … 2285 2281 2286 2282 /*Penta specific routines: */ 2283 /*FUNCTION Penta::BedNormal {{{1*/ 2284 void Penta::BedNormal(double* bed_normal, double xyz_list[3][3]){ 2285 2286 int i; 2287 double v13[3]; 2288 double v23[3]; 2289 double normal[3]; 2290 double normal_norm; 2291 2292 for (i=0;i<3;i++){ 2293 v13[i]=xyz_list[0][i]-xyz_list[2][i]; 2294 v23[i]=xyz_list[1][i]-xyz_list[2][i]; 2295 } 2296 2297 normal[0]=v13[1]*v23[2]-v13[2]*v23[1]; 2298 normal[1]=v13[2]*v23[0]-v13[0]*v23[2]; 2299 normal[2]=v13[0]*v23[1]-v13[1]*v23[0]; 2300 2301 normal_norm=sqrt( pow(normal[0],2)+pow(normal[1],2)+pow(normal[2],2) ); 2302 2303 /*Bed normal is opposite to surface normal*/ 2304 *(bed_normal)=-normal[0]/normal_norm; 2305 *(bed_normal+1)=-normal[1]/normal_norm; 2306 *(bed_normal+2)=-normal[2]/normal_norm; 2307 2308 } 2309 /*}}}*/ 2287 2310 /*FUNCTION Penta::CreateKMatrixBalancedthickness {{{1*/ 2288 2311 void Penta::CreateKMatrixBalancedthickness(Mat Kgg){ … … 2913 2936 double xyz_list[numgrids][3]; 2914 2937 double xyz_list_tria[numgrids2d][3]; 2915 double surface_normal[3];2916 2938 double bed_normal[3]; 2917 2939 … … 2929 2951 double D[8][8]={0.0}; 2930 2952 double D_scalar; 2931 double tBD[27][8];2932 2953 double DLStokes[14][14]={0.0}; 2933 double tLDStokes[numdof2d][14];2934 2954 2935 2955 /* gaussian points: */ … … 3041 3061 3042 3062 /* Do the triple product tB*D*Bprime: */ 3043 MatrixMultiply(&B[0][0],8,27,1,&D[0][0],8,8,0,&tBD[0][0],0); 3044 MatrixMultiply(&tBD[0][0],27,8,0,&B_prime[0][0],8,27,0,&Ke_gaussian[0][0],0); 3063 TripleMultiply( &B[0][0],8,27,1, 3064 &D[0][0],8,8,0, 3065 &B_prime[0][0],8,27,0, 3066 &Ke_gaussian[0][0],0); 3045 3067 3046 3068 /*Add Ke_gaussian and Ke_gaussian to terms in pKe. Watch out for column orientation from matlab: */ … … 3093 3115 3094 3116 /*Get normal vecyor to the bed */ 3095 SurfaceNormal(&surface_normal[0],xyz_list_tria); 3096 3097 bed_normal[0]=-surface_normal[0]; //Program is for surface, so the normal to the bed is the opposite of the result 3098 bed_normal[1]=-surface_normal[1]; 3099 bed_normal[2]=-surface_normal[2]; 3117 BedNormal(&bed_normal[0],xyz_list_tria); 3100 3118 3101 3119 /*Calculate DL on gauss point */ … … 3118 3136 3119 3137 /* Do the triple product tL*D*L: */ 3120 MatrixMultiply(&LStokes[0][0],14,numdof2d,1,&DLStokes[0][0],14,14,0,&tLDStokes[0][0],0); 3121 MatrixMultiply(&tLDStokes[0][0],numdof2d,14,0,&LprimeStokes[0][0],14,numdof2d,0,&Ke_drag_gaussian[0][0],0); 3138 TripleMultiply( &LStokes[0][0],14,numdof2d,1, 3139 &DLStokes[0][0],14,14,0, 3140 &LprimeStokes[0][0],14,numdof2d,0, 3141 &Ke_drag_gaussian[0][0],0); 3122 3142 3123 3143 for(i=0;i<numdof2d;i++){ … … 4083 4103 double xyz_list_tria[numgrids2d][3]; 4084 4104 double xyz_list[numgrids][3]; 4085 double surface_normal[3];4086 4105 double bed_normal[3]; 4087 4106 double bed; … … 4125 4144 double D_scalar; 4126 4145 double tBD[27][8]; 4127 double P_terms[numdof]={0.0};4128 4146 4129 4147 Tria* tria=NULL; … … 4284 4302 4285 4303 /*Get normal vecyor to the bed */ 4286 SurfaceNormal(&surface_normal[0],xyz_list_tria); 4287 4288 bed_normal[0]=-surface_normal[0]; //Program is for surface, so the normal to the bed is the opposite of the result 4289 bed_normal[1]=-surface_normal[1]; 4290 bed_normal[2]=-surface_normal[2]; 4304 BedNormal(&bed_normal[0],xyz_list_tria); 4291 4305 4292 4306 for(i=0;i<numgrids2d;i++){ … … 4301 4315 ReduceVectorStokes(&Pe_reduced[0], &Ke_temp[0][0], &Pe_temp[0]); 4302 4316 4303 for(i=0;i<numdof;i++){ 4304 P_terms[i]+=Pe_reduced[i]; 4305 } 4306 4307 /*Add P_terms to global vector pg: */ 4308 VecSetValues(pg,numdof,doflist,(const double*)P_terms,ADD_VALUES); 4317 /*Add Pe_reduced to global vector pg: */ 4318 VecSetValues(pg,numdof,doflist,(const double*)Pe_reduced,ADD_VALUES); 4309 4319 4310 4320 /*Free ressources:*/ -
issm/trunk/src/c/objects/Elements/Penta.h
r5578 r5590 123 123 /*}}}*/ 124 124 /*Penta specific routines:{{{1*/ 125 void BedNormal(double* bed_normal, double xyz_list[3][3]); 125 126 void CreateKMatrixBalancedthickness(Mat Kggg); 126 127 void CreateKMatrixBalancedvelocities(Mat Kggg);
Note:
See TracChangeset
for help on using the changeset viewer.