Changeset 15312
- Timestamp:
- 06/22/13 07:37:35 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp
r15299 r15312 81 81 * For node i, Bi can be expressed in the actual coordinate system 82 82 * by: 83 * Bi=[ dh/dx 0 ] 84 * [ 0 dh/dy ] 85 * [ 1/2*dh/dy 1/2*dh/dx ] 86 * where h is the interpolation function for node i. 87 * 88 * We assume B has been allocated already, of size: 3x(NDOF2*NUMNODESP1) 89 */ 90 91 int i; 92 IssmDouble dbasis[NDOF2][NUMNODESP1]; 93 94 /*Get dh1dh2dh3 in actual coordinate system: */ 95 GetNodalFunctionsDerivatives(&dbasis[0][0],xyz_list,gauss); 83 * Bi=[ dN/dx 0 ] 84 * [ 0 dN/dy ] 85 * [ 1/2*dN/dy 1/2*dN/dx ] 86 * where N is the interpolation function for node i. 87 * 88 * We assume B has been allocated already, of size: 3x(NDOF2*numnodes) 89 */ 90 91 /*Fetch number of nodes for this finite element*/ 92 int numnodes = this->NumberofNodes(); 93 94 /*Get nodal functions*/ 95 IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes); 96 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss); 96 97 97 98 /*Build B: */ 98 for (i=0;i<NUMNODESP1;i++){ 99 *(B+NDOF2*NUMNODESP1*0+NDOF2*i)=dbasis[0][i]; //B[0][NDOF2*i]=dbasis[0][i]; 100 *(B+NDOF2*NUMNODESP1*0+NDOF2*i+1)=0; 101 *(B+NDOF2*NUMNODESP1*1+NDOF2*i)=0; 102 *(B+NDOF2*NUMNODESP1*1+NDOF2*i+1)=dbasis[1][i]; 103 *(B+NDOF2*NUMNODESP1*2+NDOF2*i)=(float).5*dbasis[1][i]; 104 *(B+NDOF2*NUMNODESP1*2+NDOF2*i+1)=(float).5*dbasis[0][i]; 105 } 99 for(int i=0;i<numnodes;i++){ 100 B[NDOF2*numnodes*0+NDOF2*i+0]=dbasis[0*numnodes+i]; 101 B[NDOF2*numnodes*0+NDOF2*i+1]=0.; 102 B[NDOF2*numnodes*1+NDOF2*i+0]=0.; 103 B[NDOF2*numnodes*1+NDOF2*i+1]=dbasis[1*numnodes+i]; 104 B[NDOF2*numnodes*2+NDOF2*i+0]=.5*dbasis[1*numnodes+i]; 105 B[NDOF2*numnodes*2+NDOF2*i+1]=.5*dbasis[0*numnodes+i]; 106 } 107 108 /*Clean-up*/ 109 xDelete<IssmDouble>(dbasis); 106 110 } 107 111 /*}}}*/ … … 205 209 * For node i, Bi' can be expressed in the actual coordinate system 206 210 * by: 207 * Bi_prime=[ 2*dh/dx dh/dy ] 208 * [ dh/dx 2*dh/dy ] 209 * [ dh/dy dh/dx ] 210 * where h is the interpolation function for node i. 211 * 212 * We assume B' has been allocated already, of size: 3x(NDOF2*NUMNODESP1) 213 */ 214 215 /*Same thing in the actual coordinate system: */ 216 IssmDouble dbasis[NDOF2][NUMNODESP1]; 217 218 /*Get dh1dh2dh3 in actual coordinates system : */ 219 GetNodalFunctionsDerivatives(&dbasis[0][0],xyz_list,gauss); 211 * Bi_prime=[ 2*dN/dx dN/dy ] 212 * [ dN/dx 2*dN/dy ] 213 * [ dN/dy dN/dx ] 214 * where hNis the interpolation function for node i. 215 * 216 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes) 217 */ 218 219 /*Fetch number of nodes for this finite element*/ 220 int numnodes = this->NumberofNodes(); 221 222 /*Get nodal functions*/ 223 IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes); 224 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss); 220 225 221 226 /*Build B': */ 222 227 for (int i=0;i<NUMNODESP1;i++){ 223 *(Bprime+NDOF2*NUMNODESP1*0+NDOF2*i) = 2.*dbasis[0][i]; 224 *(Bprime+NDOF2*NUMNODESP1*0+NDOF2*i+1) = dbasis[1][i]; 225 *(Bprime+NDOF2*NUMNODESP1*1+NDOF2*i) = dbasis[0][i]; 226 *(Bprime+NDOF2*NUMNODESP1*1+NDOF2*i+1) = 2.*dbasis[1][i]; 227 *(Bprime+NDOF2*NUMNODESP1*2+NDOF2*i) = dbasis[1][i]; 228 *(Bprime+NDOF2*NUMNODESP1*2+NDOF2*i+1) = dbasis[0][i]; 229 } 228 Bprime[NDOF2*NUMNODESP1*0+NDOF2*i+0] = 2.*dbasis[0*numnodes+i]; 229 Bprime[NDOF2*NUMNODESP1*0+NDOF2*i+1] = dbasis[1*numnodes+i]; 230 Bprime[NDOF2*NUMNODESP1*1+NDOF2*i+0] = dbasis[0*numnodes+i]; 231 Bprime[NDOF2*NUMNODESP1*1+NDOF2*i+1] = 2.*dbasis[1*numnodes+i]; 232 Bprime[NDOF2*NUMNODESP1*2+NDOF2*i+0] = dbasis[1*numnodes+i]; 233 Bprime[NDOF2*NUMNODESP1*2+NDOF2*i+1] = dbasis[0*numnodes+i]; 234 } 235 236 /*Clean-up*/ 237 xDelete<IssmDouble>(dbasis); 230 238 } 231 239 /*}}}*/ … … 425 433 426 434 /*Get nodal functions*/ 427 IssmDouble* BasisFunctions=xNew<IssmDouble>(numnodes);428 GetNodalFunctions( BasisFunctions,gauss);435 IssmDouble* triabasis=xNew<IssmDouble>(numnodes); 436 GetNodalFunctions(triabasis,gauss); 429 437 430 438 switch(this->element_type){ 431 439 case P1Enum: 432 440 case P1DGEnum: 433 basis[0]= BasisFunctions[index1];434 basis[1]= BasisFunctions[index2];435 xDelete<IssmDouble>( BasisFunctions);441 basis[0]=triabasis[index1]; 442 basis[1]=triabasis[index2]; 443 xDelete<IssmDouble>(triabasis); 436 444 return; 437 445 case P2Enum: 438 446 _assert_(index2<index1); 439 basis[0]= BasisFunctions[index1];440 basis[1]= BasisFunctions[index2];441 basis[2]= BasisFunctions[3+index2-1];442 xDelete<IssmDouble>( BasisFunctions);447 basis[0]=triabasis[index1]; 448 basis[1]=triabasis[index2]; 449 basis[2]=triabasis[3+index2-1]; 450 xDelete<IssmDouble>(triabasis); 443 451 return; 444 452 default: … … 446 454 } 447 455 448 xDelete<IssmDouble>(BasisFunctions); 456 /*Clean up*/ 457 xDelete<IssmDouble>(triabasis); 449 458 } 450 459 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.